1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Wggithub; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits
|
7
|
|
|
of supporting developers from this source code or any supporting source code
|
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors.
|
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful,
|
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* wgGitHub module for xoops |
17
|
|
|
* |
18
|
|
|
* @copyright 2020 XOOPS Project (https://xooops.org) |
19
|
|
|
* @license GPL 2.0 or later |
20
|
|
|
* @package wggithub |
21
|
|
|
* @since 1.0 |
22
|
|
|
* @min_xoops 2.5.10 |
23
|
|
|
* @author TDM XOOPS - Email:<[email protected]> - Website:<https://wedega.com> |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
use XoopsModules\Wggithub; |
27
|
|
|
|
28
|
|
|
\defined('\XOOPS_ROOT_PATH') || die('Restricted access'); |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Object Requests |
32
|
|
|
*/ |
33
|
|
|
class Requests extends \XoopsObject |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* Constructor |
37
|
|
|
* |
38
|
|
|
* @param null |
39
|
|
|
*/ |
40
|
|
|
public function __construct() |
41
|
|
|
{ |
42
|
|
|
$this->initVar('req_id', \XOBJ_DTYPE_INT); |
|
|
|
|
43
|
|
|
$this->initVar('req_request', \XOBJ_DTYPE_TXTBOX); |
|
|
|
|
44
|
|
|
$this->initVar('req_result', \XOBJ_DTYPE_TXTBOX); |
45
|
|
|
$this->initVar('req_datecreated', \XOBJ_DTYPE_INT); |
46
|
|
|
$this->initVar('req_submitter', \XOBJ_DTYPE_INT); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @static function &getInstance |
51
|
|
|
* |
52
|
|
|
* @param null |
53
|
|
|
*/ |
54
|
|
|
public static function getInstance() |
55
|
|
|
{ |
56
|
|
|
static $instance = false; |
57
|
|
|
if (!$instance) { |
58
|
|
|
$instance = new self(); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* The new inserted $Id |
64
|
|
|
* @return inserted id |
|
|
|
|
65
|
|
|
*/ |
66
|
|
|
public function getNewInsertedIdRequests() |
67
|
|
|
{ |
68
|
|
|
$newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
69
|
|
|
return $newInsertedId; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @public function getForm |
74
|
|
|
* @param bool $action |
75
|
|
|
* @return \XoopsThemeForm |
76
|
|
|
*/ |
77
|
|
|
public function getFormRequests($action = false) |
78
|
|
|
{ |
79
|
|
|
$helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
|
|
|
80
|
|
|
if (!$action) { |
81
|
|
|
$action = $_SERVER['REQUEST_URI']; |
82
|
|
|
} |
83
|
|
|
$isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
|
|
|
84
|
|
|
// Title |
85
|
|
|
$title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_REQUEST_ADD) : \sprintf(\_AM_WGGITHUB_REQUEST_EDIT); |
|
|
|
|
86
|
|
|
// Get Theme Form |
87
|
|
|
\xoops_load('XoopsFormLoader'); |
|
|
|
|
88
|
|
|
$form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
|
|
|
89
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
90
|
|
|
// Form Text reqRequest |
91
|
|
|
$form->addElement(new \XoopsFormText(\_AM_WGGITHUB_REQUEST_REQUEST, 'req_request', 50, 255, $this->getVar('req_request')), true); |
|
|
|
|
92
|
|
|
// Form Text reqResult |
93
|
|
|
$form->addElement(new \XoopsFormText(\_AM_WGGITHUB_REQUEST_RESULT, 'req_result', 50, 255, $this->getVar('req_result'))); |
|
|
|
|
94
|
|
|
// Form Text Date Select reqDatecreated |
95
|
|
|
$reqDatecreated = $this->isNew() ?: $this->getVar('req_datecreated'); |
96
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_REQUEST_DATECREATED, 'req_datecreated', '', $reqDatecreated)); |
|
|
|
|
97
|
|
|
// Form Select User reqSubmitter |
98
|
|
|
$form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_REQUEST_SUBMITTER, 'req_submitter', false, $this->getVar('req_submitter'))); |
|
|
|
|
99
|
|
|
// To Save |
100
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'save')); |
|
|
|
|
101
|
|
|
$form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
|
|
|
102
|
|
|
return $form; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Get Values |
107
|
|
|
* @param null $keys |
|
|
|
|
108
|
|
|
* @param null $format |
|
|
|
|
109
|
|
|
* @param null $maxDepth |
|
|
|
|
110
|
|
|
* @return array |
111
|
|
|
*/ |
112
|
|
|
public function getValuesRequests($keys = null, $format = null, $maxDepth = null) |
113
|
|
|
{ |
114
|
|
|
$ret = $this->getValues($keys, $format, $maxDepth); |
115
|
|
|
$ret['id'] = $this->getVar('req_id'); |
116
|
|
|
$ret['request'] = $this->getVar('req_request'); |
117
|
|
|
$ret['result'] = $this->getVar('req_result'); |
118
|
|
|
$ret['datecreated'] = \formatTimestamp($this->getVar('req_datecreated'), 's'); |
|
|
|
|
119
|
|
|
$ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('req_submitter')); |
|
|
|
|
120
|
|
|
return $ret; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Returns an array representation of the object |
125
|
|
|
* |
126
|
|
|
* @return array |
127
|
|
|
*/ |
128
|
|
|
public function toArrayRequests() |
129
|
|
|
{ |
130
|
|
|
$ret = []; |
131
|
|
|
$vars = $this->getVars(); |
132
|
|
|
foreach (\array_keys($vars) as $var) { |
133
|
|
|
$ret[$var] = $this->getVar('"{$var}"'); |
134
|
|
|
} |
135
|
|
|
return $ret; |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths