@@ -32,119 +32,119 @@ |
||
32 | 32 | */ |
33 | 33 | class Settings extends \XoopsObject |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor |
|
37 | - * |
|
38 | - * @param null |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->initVar('set_id', XOBJ_DTYPE_INT); |
|
43 | - $this->initVar('set_username', XOBJ_DTYPE_TXTBOX); |
|
44 | - $this->initVar('set_token', XOBJ_DTYPE_TXTBOX); |
|
45 | - $this->initVar('set_options', XOBJ_DTYPE_TXTAREA); |
|
46 | - $this->initVar('set_primary', XOBJ_DTYPE_INT); |
|
47 | - $this->initVar('set_date', XOBJ_DTYPE_INT); |
|
48 | - $this->initVar('set_submitter', XOBJ_DTYPE_INT); |
|
49 | - } |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @param null |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->initVar('set_id', XOBJ_DTYPE_INT); |
|
43 | + $this->initVar('set_username', XOBJ_DTYPE_TXTBOX); |
|
44 | + $this->initVar('set_token', XOBJ_DTYPE_TXTBOX); |
|
45 | + $this->initVar('set_options', XOBJ_DTYPE_TXTAREA); |
|
46 | + $this->initVar('set_primary', XOBJ_DTYPE_INT); |
|
47 | + $this->initVar('set_date', XOBJ_DTYPE_INT); |
|
48 | + $this->initVar('set_submitter', XOBJ_DTYPE_INT); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @static function &getInstance |
|
53 | - * |
|
54 | - * @param null |
|
55 | - */ |
|
56 | - public static function getInstance() |
|
57 | - { |
|
58 | - static $instance = false; |
|
59 | - if (!$instance) { |
|
60 | - $instance = new self(); |
|
61 | - } |
|
62 | - } |
|
51 | + /** |
|
52 | + * @static function &getInstance |
|
53 | + * |
|
54 | + * @param null |
|
55 | + */ |
|
56 | + public static function getInstance() |
|
57 | + { |
|
58 | + static $instance = false; |
|
59 | + if (!$instance) { |
|
60 | + $instance = new self(); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * The new inserted $Id |
|
66 | - * @return inserted id |
|
67 | - */ |
|
68 | - public function getNewInsertedIdSettings() |
|
69 | - { |
|
70 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
71 | - return $newInsertedId; |
|
72 | - } |
|
64 | + /** |
|
65 | + * The new inserted $Id |
|
66 | + * @return inserted id |
|
67 | + */ |
|
68 | + public function getNewInsertedIdSettings() |
|
69 | + { |
|
70 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
71 | + return $newInsertedId; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @public function getForm |
|
76 | - * @param bool $action |
|
77 | - * @return \XoopsThemeForm |
|
78 | - */ |
|
79 | - public function getFormSettings($action = false) |
|
80 | - { |
|
81 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
82 | - if (!$action) { |
|
83 | - $action = $_SERVER['REQUEST_URI']; |
|
84 | - } |
|
85 | - $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
86 | - // Title |
|
87 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_SETTING_ADD) : \sprintf(_AM_WGGITHUB_SETTING_EDIT); |
|
88 | - // Get Theme Form |
|
89 | - \xoops_load('XoopsFormLoader'); |
|
90 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
91 | - $form->setExtra('enctype="multipart/form-data"'); |
|
92 | - // Form Text setUsername |
|
93 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_USERNAME, 'set_username', 50, 255, $this->getVar('set_username')), true); |
|
94 | - // Form Text setToken |
|
95 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_TOKEN, 'set_token', 50, 255, $this->getVar('set_token')), true); |
|
96 | - // Form Editor TextArea setOptions |
|
97 | - $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_SETTING_OPTIONS, 'set_options', $this->getVar('set_options', 'e'), 4, 47)); |
|
98 | - // Form Radio Yes/No setPrimary |
|
99 | - $setPrimary = $this->isNew() ?: $this->getVar('set_primary'); |
|
100 | - $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_SETTING_PRIMARY, 'set_primary', $setPrimary)); |
|
101 | - // Form Text Date Select setDate |
|
102 | - $setDate = $this->isNew() ?: $this->getVar('set_date'); |
|
103 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_SETTING_DATE, 'set_date', '', $setDate)); |
|
104 | - // Form Select User setSubmitter |
|
105 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_SETTING_SUBMITTER, 'set_submitter', false, $this->getVar('set_submitter'))); |
|
106 | - // To Save |
|
107 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
108 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
109 | - return $form; |
|
110 | - } |
|
74 | + /** |
|
75 | + * @public function getForm |
|
76 | + * @param bool $action |
|
77 | + * @return \XoopsThemeForm |
|
78 | + */ |
|
79 | + public function getFormSettings($action = false) |
|
80 | + { |
|
81 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
82 | + if (!$action) { |
|
83 | + $action = $_SERVER['REQUEST_URI']; |
|
84 | + } |
|
85 | + $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
|
86 | + // Title |
|
87 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_SETTING_ADD) : \sprintf(_AM_WGGITHUB_SETTING_EDIT); |
|
88 | + // Get Theme Form |
|
89 | + \xoops_load('XoopsFormLoader'); |
|
90 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
91 | + $form->setExtra('enctype="multipart/form-data"'); |
|
92 | + // Form Text setUsername |
|
93 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_USERNAME, 'set_username', 50, 255, $this->getVar('set_username')), true); |
|
94 | + // Form Text setToken |
|
95 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_SETTING_TOKEN, 'set_token', 50, 255, $this->getVar('set_token')), true); |
|
96 | + // Form Editor TextArea setOptions |
|
97 | + $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_SETTING_OPTIONS, 'set_options', $this->getVar('set_options', 'e'), 4, 47)); |
|
98 | + // Form Radio Yes/No setPrimary |
|
99 | + $setPrimary = $this->isNew() ?: $this->getVar('set_primary'); |
|
100 | + $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_SETTING_PRIMARY, 'set_primary', $setPrimary)); |
|
101 | + // Form Text Date Select setDate |
|
102 | + $setDate = $this->isNew() ?: $this->getVar('set_date'); |
|
103 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_SETTING_DATE, 'set_date', '', $setDate)); |
|
104 | + // Form Select User setSubmitter |
|
105 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_SETTING_SUBMITTER, 'set_submitter', false, $this->getVar('set_submitter'))); |
|
106 | + // To Save |
|
107 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
108 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
109 | + return $form; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * Get Values |
|
114 | - * @param null $keys |
|
115 | - * @param null $format |
|
116 | - * @param null $maxDepth |
|
117 | - * @return array |
|
118 | - */ |
|
119 | - public function getValuesSettings($keys = null, $format = null, $maxDepth = null) |
|
120 | - { |
|
121 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
122 | - $utility = new \XoopsModules\Wggithub\Utility(); |
|
123 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
124 | - $ret['id'] = $this->getVar('set_id'); |
|
125 | - $ret['username'] = $this->getVar('set_username'); |
|
126 | - $ret['token'] = $this->getVar('set_token'); |
|
127 | - $ret['options'] = \strip_tags($this->getVar('set_options', 'e')); |
|
128 | - $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
129 | - $ret['options_short'] = $utility::truncateHtml($ret['options'], $editorMaxchar); |
|
130 | - $ret['primary'] = (int)$this->getVar('set_primary') > 0 ? _YES : _NO; |
|
131 | - $ret['date'] = \formatTimestamp($this->getVar('set_date'), 's'); |
|
132 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('set_submitter')); |
|
133 | - return $ret; |
|
134 | - } |
|
112 | + /** |
|
113 | + * Get Values |
|
114 | + * @param null $keys |
|
115 | + * @param null $format |
|
116 | + * @param null $maxDepth |
|
117 | + * @return array |
|
118 | + */ |
|
119 | + public function getValuesSettings($keys = null, $format = null, $maxDepth = null) |
|
120 | + { |
|
121 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
122 | + $utility = new \XoopsModules\Wggithub\Utility(); |
|
123 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
124 | + $ret['id'] = $this->getVar('set_id'); |
|
125 | + $ret['username'] = $this->getVar('set_username'); |
|
126 | + $ret['token'] = $this->getVar('set_token'); |
|
127 | + $ret['options'] = \strip_tags($this->getVar('set_options', 'e')); |
|
128 | + $editorMaxchar = $helper->getConfig('editor_maxchar'); |
|
129 | + $ret['options_short'] = $utility::truncateHtml($ret['options'], $editorMaxchar); |
|
130 | + $ret['primary'] = (int)$this->getVar('set_primary') > 0 ? _YES : _NO; |
|
131 | + $ret['date'] = \formatTimestamp($this->getVar('set_date'), 's'); |
|
132 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('set_submitter')); |
|
133 | + return $ret; |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Returns an array representation of the object |
|
138 | - * |
|
139 | - * @return array |
|
140 | - */ |
|
141 | - public function toArraySettings() |
|
142 | - { |
|
143 | - $ret = []; |
|
144 | - $vars = $this->getVars(); |
|
145 | - foreach (\array_keys($vars) as $var) { |
|
146 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
147 | - } |
|
148 | - return $ret; |
|
149 | - } |
|
136 | + /** |
|
137 | + * Returns an array representation of the object |
|
138 | + * |
|
139 | + * @return array |
|
140 | + */ |
|
141 | + public function toArraySettings() |
|
142 | + { |
|
143 | + $ret = []; |
|
144 | + $vars = $this->getVars(); |
|
145 | + foreach (\array_keys($vars) as $var) { |
|
146 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
147 | + } |
|
148 | + return $ret; |
|
149 | + } |
|
150 | 150 | } |
@@ -65,8 +65,8 @@ |
||
65 | 65 | |
66 | 66 | if ($width > $this->maxWidth || $height > $this->maxHeight) { |
67 | 67 | // recalc image size based on this->maxWidth/this->maxHeight |
68 | - $new_width = 0; |
|
69 | - $new_height = 0; |
|
68 | + $new_width = 0; |
|
69 | + $new_height = 0; |
|
70 | 70 | if ($width > $height) { |
71 | 71 | if ($width < $this->maxWidth) { |
72 | 72 | $new_width = $width; |
@@ -31,96 +31,96 @@ |
||
31 | 31 | */ |
32 | 32 | class RequestsHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_requests', Requests::class, 'req_id', 'req_request'); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Get Count Requests in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountRequests = new \CriteriaCompo(); |
|
88 | - $crCountRequests = $this->getRequestsCriteria($crCountRequests, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountRequests); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Get All Requests in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllRequests = new \CriteriaCompo(); |
|
103 | - $crAllRequests = $this->getRequestsCriteria($crAllRequests, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllRequests); |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Get Criteria Requests |
|
109 | - * @param $crRequests |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getRequestsCriteria($crRequests, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crRequests->setStart($start); |
|
119 | - $crRequests->setLimit($limit); |
|
120 | - $crRequests->setSort($sort); |
|
121 | - $crRequests->setOrder($order); |
|
122 | - return $crRequests; |
|
123 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_requests', Requests::class, 'req_id', 'req_request'); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Get Count Requests in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountRequests = new \CriteriaCompo(); |
|
88 | + $crCountRequests = $this->getRequestsCriteria($crCountRequests, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountRequests); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Get All Requests in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllRequests($start = 0, $limit = 0, $sort = 'req_id ASC, req_request', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllRequests = new \CriteriaCompo(); |
|
103 | + $crAllRequests = $this->getRequestsCriteria($crAllRequests, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllRequests); |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Get Criteria Requests |
|
109 | + * @param $crRequests |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getRequestsCriteria($crRequests, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crRequests->setStart($start); |
|
119 | + $crRequests->setLimit($limit); |
|
120 | + $crRequests->setSort($sort); |
|
121 | + $crRequests->setOrder($order); |
|
122 | + return $crRequests; |
|
123 | + } |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Update table requests |
@@ -32,110 +32,110 @@ |
||
32 | 32 | */ |
33 | 33 | class Requests extends \XoopsObject |
34 | 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_TXTAREA); |
|
45 | - $this->initVar('req_datecreated', XOBJ_DTYPE_INT); |
|
46 | - $this->initVar('req_submitter', XOBJ_DTYPE_INT); |
|
47 | - } |
|
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_TXTAREA); |
|
45 | + $this->initVar('req_datecreated', XOBJ_DTYPE_INT); |
|
46 | + $this->initVar('req_submitter', XOBJ_DTYPE_INT); |
|
47 | + } |
|
48 | 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 | - } |
|
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 | 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 | - } |
|
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 | 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 |
|
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 | 93 | $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_REQUEST_RESULT, 'req_result', $this->getVar('req_result', 'e'), 4, 47)); |
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 | - } |
|
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 | 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 | - { |
|
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 | 114 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
115 | 115 | $utility = new \XoopsModules\Wggithub\Utility(); |
116 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
117 | - $ret['id'] = $this->getVar('req_id'); |
|
118 | - $ret['request'] = $this->getVar('req_request'); |
|
116 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
117 | + $ret['id'] = $this->getVar('req_id'); |
|
118 | + $ret['request'] = $this->getVar('req_request'); |
|
119 | 119 | $ret['result'] = \strip_tags($this->getVar('req_result', 'e')); |
120 | 120 | $editorMaxchar = $helper->getConfig('editor_maxchar'); |
121 | 121 | $ret['result_short'] = $utility::truncateHtml($ret['result'], $editorMaxchar); |
122 | - $ret['datecreated'] = \formatTimestamp($this->getVar('req_datecreated'), 'm'); |
|
123 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('req_submitter')); |
|
124 | - return $ret; |
|
125 | - } |
|
122 | + $ret['datecreated'] = \formatTimestamp($this->getVar('req_datecreated'), 'm'); |
|
123 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('req_submitter')); |
|
124 | + return $ret; |
|
125 | + } |
|
126 | 126 | |
127 | - /** |
|
128 | - * Returns an array representation of the object |
|
129 | - * |
|
130 | - * @return array |
|
131 | - */ |
|
132 | - public function toArrayRequests() |
|
133 | - { |
|
134 | - $ret = []; |
|
135 | - $vars = $this->getVars(); |
|
136 | - foreach (\array_keys($vars) as $var) { |
|
137 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
138 | - } |
|
139 | - return $ret; |
|
140 | - } |
|
127 | + /** |
|
128 | + * Returns an array representation of the object |
|
129 | + * |
|
130 | + * @return array |
|
131 | + */ |
|
132 | + public function toArrayRequests() |
|
133 | + { |
|
134 | + $ret = []; |
|
135 | + $vars = $this->getVars(); |
|
136 | + foreach (\array_keys($vars) as $var) { |
|
137 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
138 | + } |
|
139 | + return $ret; |
|
140 | + } |
|
141 | 141 | } |
@@ -1991,8 +1991,8 @@ |
||
1991 | 1991 | 'q', 'rt', 'ins', 'font', 'strong', |
1992 | 1992 | 's', 'tt', 'kbd', 'mark', |
1993 | 1993 | 'u', 'xm', 'sub', 'nobr', |
1994 | - 'sup', 'ruby', |
|
1995 | - 'var', 'span', |
|
1996 | - 'wbr', 'time', |
|
1994 | + 'sup', 'ruby', |
|
1995 | + 'var', 'span', |
|
1996 | + 'wbr', 'time', |
|
1997 | 1997 | ); |
1998 | 1998 | } |
@@ -31,96 +31,96 @@ |
||
31 | 31 | */ |
32 | 32 | class ReleasesHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_releases', Releases::class, 'rel_id', 'rel_name'); |
|
42 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_releases', Releases::class, 'rel_id', 'rel_name'); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get Count Releases in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountReleases = new \CriteriaCompo(); |
|
88 | - $crCountReleases = $this->getReleasesCriteria($crCountReleases, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountReleases); |
|
90 | - } |
|
77 | + /** |
|
78 | + * Get Count Releases in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountReleases = new \CriteriaCompo(); |
|
88 | + $crCountReleases = $this->getReleasesCriteria($crCountReleases, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountReleases); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get All Releases in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllReleases = new \CriteriaCompo(); |
|
103 | - $crAllReleases = $this->getReleasesCriteria($crAllReleases, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllReleases); |
|
105 | - } |
|
92 | + /** |
|
93 | + * Get All Releases in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllReleases($start = 0, $limit = 0, $sort = 'rel_id ASC, rel_name', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllReleases = new \CriteriaCompo(); |
|
103 | + $crAllReleases = $this->getReleasesCriteria($crAllReleases, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllReleases); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get Criteria Releases |
|
109 | - * @param $crReleases |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getReleasesCriteria($crReleases, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crReleases->setStart($start); |
|
119 | - $crReleases->setLimit($limit); |
|
120 | - $crReleases->setSort($sort); |
|
121 | - $crReleases->setOrder($order); |
|
122 | - return $crReleases; |
|
123 | - } |
|
107 | + /** |
|
108 | + * Get Criteria Releases |
|
109 | + * @param $crReleases |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getReleasesCriteria($crReleases, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crReleases->setStart($start); |
|
119 | + $crReleases->setLimit($limit); |
|
120 | + $crReleases->setSort($sort); |
|
121 | + $crReleases->setOrder($order); |
|
122 | + return $crReleases; |
|
123 | + } |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Update table requests |
@@ -31,94 +31,94 @@ |
||
31 | 31 | */ |
32 | 32 | class RepositoriesHandler extends \XoopsPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor |
|
36 | - * |
|
37 | - * @param \XoopsDatabase $db |
|
38 | - */ |
|
39 | - public function __construct(\XoopsDatabase $db) |
|
40 | - { |
|
41 | - parent::__construct($db, 'wggithub_repositories', Repositories::class, 'repo_id', 'repo_name'); |
|
42 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + * |
|
37 | + * @param \XoopsDatabase $db |
|
38 | + */ |
|
39 | + public function __construct(\XoopsDatabase $db) |
|
40 | + { |
|
41 | + parent::__construct($db, 'wggithub_repositories', Repositories::class, 'repo_id', 'repo_name'); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param bool $isNew |
|
46 | - * |
|
47 | - * @return object |
|
48 | - */ |
|
49 | - public function create($isNew = true) |
|
50 | - { |
|
51 | - return parent::create($isNew); |
|
52 | - } |
|
44 | + /** |
|
45 | + * @param bool $isNew |
|
46 | + * |
|
47 | + * @return object |
|
48 | + */ |
|
49 | + public function create($isNew = true) |
|
50 | + { |
|
51 | + return parent::create($isNew); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * retrieve a field |
|
56 | - * |
|
57 | - * @param int $i field id |
|
58 | - * @param null fields |
|
59 | - * @return mixed reference to the {@link Get} object |
|
60 | - */ |
|
61 | - public function get($i = null, $fields = null) |
|
62 | - { |
|
63 | - return parent::get($i, $fields); |
|
64 | - } |
|
54 | + /** |
|
55 | + * retrieve a field |
|
56 | + * |
|
57 | + * @param int $i field id |
|
58 | + * @param null fields |
|
59 | + * @return mixed reference to the {@link Get} object |
|
60 | + */ |
|
61 | + public function get($i = null, $fields = null) |
|
62 | + { |
|
63 | + return parent::get($i, $fields); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * get inserted id |
|
68 | - * |
|
69 | - * @param null |
|
70 | - * @return int reference to the {@link Get} object |
|
71 | - */ |
|
72 | - public function getInsertId() |
|
73 | - { |
|
74 | - return $this->db->getInsertId(); |
|
75 | - } |
|
66 | + /** |
|
67 | + * get inserted id |
|
68 | + * |
|
69 | + * @param null |
|
70 | + * @return int reference to the {@link Get} object |
|
71 | + */ |
|
72 | + public function getInsertId() |
|
73 | + { |
|
74 | + return $this->db->getInsertId(); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Get Count Repositories in the database |
|
79 | - * @param int $start |
|
80 | - * @param int $limit |
|
81 | - * @param string $sort |
|
82 | - * @param string $order |
|
83 | - * @return int |
|
84 | - */ |
|
85 | - public function getCountRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
86 | - { |
|
87 | - $crCountRepositories = new \CriteriaCompo(); |
|
88 | - $crCountRepositories = $this->getRepositoriesCriteria($crCountRepositories, $start, $limit, $sort, $order); |
|
89 | - return $this->getCount($crCountRepositories); |
|
90 | - } |
|
77 | + /** |
|
78 | + * Get Count Repositories in the database |
|
79 | + * @param int $start |
|
80 | + * @param int $limit |
|
81 | + * @param string $sort |
|
82 | + * @param string $order |
|
83 | + * @return int |
|
84 | + */ |
|
85 | + public function getCountRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
86 | + { |
|
87 | + $crCountRepositories = new \CriteriaCompo(); |
|
88 | + $crCountRepositories = $this->getRepositoriesCriteria($crCountRepositories, $start, $limit, $sort, $order); |
|
89 | + return $this->getCount($crCountRepositories); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get All Repositories in the database |
|
94 | - * @param int $start |
|
95 | - * @param int $limit |
|
96 | - * @param string $sort |
|
97 | - * @param string $order |
|
98 | - * @return array |
|
99 | - */ |
|
100 | - public function getAllRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
101 | - { |
|
102 | - $crAllRepositories = new \CriteriaCompo(); |
|
103 | - $crAllRepositories = $this->getRepositoriesCriteria($crAllRepositories, $start, $limit, $sort, $order); |
|
104 | - return $this->getAll($crAllRepositories); |
|
105 | - } |
|
92 | + /** |
|
93 | + * Get All Repositories in the database |
|
94 | + * @param int $start |
|
95 | + * @param int $limit |
|
96 | + * @param string $sort |
|
97 | + * @param string $order |
|
98 | + * @return array |
|
99 | + */ |
|
100 | + public function getAllRepositories($start = 0, $limit = 0, $sort = 'repo_id ASC, repo_name', $order = 'ASC') |
|
101 | + { |
|
102 | + $crAllRepositories = new \CriteriaCompo(); |
|
103 | + $crAllRepositories = $this->getRepositoriesCriteria($crAllRepositories, $start, $limit, $sort, $order); |
|
104 | + return $this->getAll($crAllRepositories); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get Criteria Repositories |
|
109 | - * @param $crRepositories |
|
110 | - * @param int $start |
|
111 | - * @param int $limit |
|
112 | - * @param string $sort |
|
113 | - * @param string $order |
|
114 | - * @return int |
|
115 | - */ |
|
116 | - private function getRepositoriesCriteria($crRepositories, $start, $limit, $sort, $order) |
|
117 | - { |
|
118 | - $crRepositories->setStart($start); |
|
119 | - $crRepositories->setLimit($limit); |
|
120 | - $crRepositories->setSort($sort); |
|
121 | - $crRepositories->setOrder($order); |
|
122 | - return $crRepositories; |
|
123 | - } |
|
107 | + /** |
|
108 | + * Get Criteria Repositories |
|
109 | + * @param $crRepositories |
|
110 | + * @param int $start |
|
111 | + * @param int $limit |
|
112 | + * @param string $sort |
|
113 | + * @param string $order |
|
114 | + * @return int |
|
115 | + */ |
|
116 | + private function getRepositoriesCriteria($crRepositories, $start, $limit, $sort, $order) |
|
117 | + { |
|
118 | + $crRepositories->setStart($start); |
|
119 | + $crRepositories->setLimit($limit); |
|
120 | + $crRepositories->setSort($sort); |
|
121 | + $crRepositories->setOrder($order); |
|
122 | + return $crRepositories; |
|
123 | + } |
|
124 | 124 | } |
@@ -32,135 +32,135 @@ |
||
32 | 32 | */ |
33 | 33 | class Releases extends \XoopsObject |
34 | 34 | { |
35 | - /** |
|
36 | - * Constructor |
|
37 | - * |
|
38 | - * @param null |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->initVar('rel_id', XOBJ_DTYPE_INT); |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @param null |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->initVar('rel_id', XOBJ_DTYPE_INT); |
|
43 | 43 | $this->initVar('rel_repoid', XOBJ_DTYPE_INT); |
44 | - $this->initVar('rel_type', XOBJ_DTYPE_INT); |
|
45 | - $this->initVar('rel_name', XOBJ_DTYPE_TXTBOX); |
|
46 | - $this->initVar('rel_prerelease', XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('rel_type', XOBJ_DTYPE_INT); |
|
45 | + $this->initVar('rel_name', XOBJ_DTYPE_TXTBOX); |
|
46 | + $this->initVar('rel_prerelease', XOBJ_DTYPE_INT); |
|
47 | 47 | $this->initVar('rel_publishedat', XOBJ_DTYPE_INT); |
48 | - $this->initVar('rel_tarballurl', XOBJ_DTYPE_TXTBOX); |
|
49 | - $this->initVar('rel_zipballurl', XOBJ_DTYPE_TXTBOX); |
|
50 | - $this->initVar('rel_datecreated', XOBJ_DTYPE_INT); |
|
51 | - $this->initVar('rel_submitter', XOBJ_DTYPE_INT); |
|
52 | - } |
|
48 | + $this->initVar('rel_tarballurl', XOBJ_DTYPE_TXTBOX); |
|
49 | + $this->initVar('rel_zipballurl', XOBJ_DTYPE_TXTBOX); |
|
50 | + $this->initVar('rel_datecreated', XOBJ_DTYPE_INT); |
|
51 | + $this->initVar('rel_submitter', XOBJ_DTYPE_INT); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @static function &getInstance |
|
56 | - * |
|
57 | - * @param null |
|
58 | - */ |
|
59 | - public static function getInstance() |
|
60 | - { |
|
61 | - static $instance = false; |
|
62 | - if (!$instance) { |
|
63 | - $instance = new self(); |
|
64 | - } |
|
65 | - } |
|
54 | + /** |
|
55 | + * @static function &getInstance |
|
56 | + * |
|
57 | + * @param null |
|
58 | + */ |
|
59 | + public static function getInstance() |
|
60 | + { |
|
61 | + static $instance = false; |
|
62 | + if (!$instance) { |
|
63 | + $instance = new self(); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * The new inserted $Id |
|
69 | - * @return inserted id |
|
70 | - */ |
|
71 | - public function getNewInsertedIdReleases() |
|
72 | - { |
|
73 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | - return $newInsertedId; |
|
75 | - } |
|
67 | + /** |
|
68 | + * The new inserted $Id |
|
69 | + * @return inserted id |
|
70 | + */ |
|
71 | + public function getNewInsertedIdReleases() |
|
72 | + { |
|
73 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
74 | + return $newInsertedId; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @public function getForm |
|
79 | - * @param bool $action |
|
80 | - * @return \XoopsThemeForm |
|
81 | - */ |
|
82 | - public function getFormReleases($action = false) |
|
83 | - { |
|
84 | - $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | - if (!$action) { |
|
86 | - $action = $_SERVER['REQUEST_URI']; |
|
87 | - } |
|
88 | - // Title |
|
89 | - $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_RELEASE_ADD) : \sprintf(_AM_WGGITHUB_RELEASE_EDIT); |
|
90 | - // Get Theme Form |
|
91 | - \xoops_load('XoopsFormLoader'); |
|
92 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
93 | - $form->setExtra('enctype="multipart/form-data"'); |
|
77 | + /** |
|
78 | + * @public function getForm |
|
79 | + * @param bool $action |
|
80 | + * @return \XoopsThemeForm |
|
81 | + */ |
|
82 | + public function getFormReleases($action = false) |
|
83 | + { |
|
84 | + $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
|
85 | + if (!$action) { |
|
86 | + $action = $_SERVER['REQUEST_URI']; |
|
87 | + } |
|
88 | + // Title |
|
89 | + $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_RELEASE_ADD) : \sprintf(_AM_WGGITHUB_RELEASE_EDIT); |
|
90 | + // Get Theme Form |
|
91 | + \xoops_load('XoopsFormLoader'); |
|
92 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
93 | + $form->setExtra('enctype="multipart/form-data"'); |
|
94 | 94 | // Form Table repositories |
95 | 95 | $repositoriesHandler = $helper->getHandler('Repositories'); |
96 | 96 | $rmRepoidSelect = new \XoopsFormSelect(_AM_WGGITHUB_README_REPOID, 'rel_repoid', $this->getVar('rel_repoid')); |
97 | 97 | $rmRepoidSelect->addOptionArray($repositoriesHandler->getList()); |
98 | 98 | $form->addElement($rmRepoidSelect); |
99 | - // Form Select relType |
|
100 | - $relTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_RELEASE_TYPE, 'rel_type', $this->getVar('rel_type')); |
|
101 | - $relTypeSelect->addOption('file'); |
|
102 | - $form->addElement($relTypeSelect); |
|
103 | - // Form Text relName |
|
104 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_NAME, 'rel_name', 50, 255, $this->getVar('rel_name')), true); |
|
99 | + // Form Select relType |
|
100 | + $relTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_RELEASE_TYPE, 'rel_type', $this->getVar('rel_type')); |
|
101 | + $relTypeSelect->addOption('file'); |
|
102 | + $form->addElement($relTypeSelect); |
|
103 | + // Form Text relName |
|
104 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_NAME, 'rel_name', 50, 255, $this->getVar('rel_name')), true); |
|
105 | 105 | // Form Radio Yes/No relPrerelease |
106 | 106 | $relPrerelease = $this->isNew() ?: $this->getVar('rel_prerelease'); |
107 | 107 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_RELEASE_PRERELEASE, 'rel_prerelease', $relPrerelease)); |
108 | - // Form Text Date Select relPublishedat |
|
109 | - $relPublishedat = $this->isNew() ?: $this->getVar('rel_publishedat'); |
|
110 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_PUBLISHEDAT, 'rel_publishedat', '', $relPublishedat)); |
|
111 | - // Form Text relTarballurl |
|
112 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_TARBALLURL, 'rel_tarballurl', 50, 255, $this->getVar('rel_tarballurl'))); |
|
113 | - // Form Text relZipballurl |
|
114 | - $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_ZIPBALLURL, 'rel_zipballurl', 50, 255, $this->getVar('rel_zipballurl'))); |
|
115 | - // Form Text Date Select relDatecreated |
|
116 | - $relDatecreated = $this->isNew() ?: $this->getVar('rel_datecreated'); |
|
117 | - $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_DATECREATED, 'rel_datecreated', '', $relDatecreated)); |
|
118 | - // Form Select User relSubmitter |
|
119 | - $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_RELEASE_SUBMITTER, 'rel_submitter', false, $this->getVar('rel_submitter'))); |
|
120 | - // To Save |
|
121 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
122 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
123 | - return $form; |
|
124 | - } |
|
108 | + // Form Text Date Select relPublishedat |
|
109 | + $relPublishedat = $this->isNew() ?: $this->getVar('rel_publishedat'); |
|
110 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_PUBLISHEDAT, 'rel_publishedat', '', $relPublishedat)); |
|
111 | + // Form Text relTarballurl |
|
112 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_TARBALLURL, 'rel_tarballurl', 50, 255, $this->getVar('rel_tarballurl'))); |
|
113 | + // Form Text relZipballurl |
|
114 | + $form->addElement(new \XoopsFormText(_AM_WGGITHUB_RELEASE_ZIPBALLURL, 'rel_zipballurl', 50, 255, $this->getVar('rel_zipballurl'))); |
|
115 | + // Form Text Date Select relDatecreated |
|
116 | + $relDatecreated = $this->isNew() ?: $this->getVar('rel_datecreated'); |
|
117 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_RELEASE_DATECREATED, 'rel_datecreated', '', $relDatecreated)); |
|
118 | + // Form Select User relSubmitter |
|
119 | + $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_RELEASE_SUBMITTER, 'rel_submitter', false, $this->getVar('rel_submitter'))); |
|
120 | + // To Save |
|
121 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
122 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
123 | + return $form; |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * Get Values |
|
128 | - * @param null $keys |
|
129 | - * @param null $format |
|
130 | - * @param null $maxDepth |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
|
134 | - { |
|
126 | + /** |
|
127 | + * Get Values |
|
128 | + * @param null $keys |
|
129 | + * @param null $format |
|
130 | + * @param null $maxDepth |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + public function getValuesReleases($keys = null, $format = null, $maxDepth = null) |
|
134 | + { |
|
135 | 135 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
136 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
137 | - $ret['id'] = $this->getVar('rel_id'); |
|
136 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
137 | + $ret['id'] = $this->getVar('rel_id'); |
|
138 | 138 | $repositoriesHandler = $helper->getHandler('Repositories'); |
139 | 139 | $repositoriesObj = $repositoriesHandler->get($this->getVar('rel_repoid')); |
140 | 140 | $ret['repoid'] = $repositoriesObj->getVar('repo_name'); |
141 | - $ret['type'] = $this->getVar('rel_type'); |
|
142 | - $ret['name'] = $this->getVar('rel_name'); |
|
141 | + $ret['type'] = $this->getVar('rel_type'); |
|
142 | + $ret['name'] = $this->getVar('rel_name'); |
|
143 | 143 | $ret['prerelease'] = (int)$this->getVar('rel_prerelease') > 0 ? _YES : _NO; |
144 | - $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
|
145 | - $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
|
146 | - $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
|
147 | - $ret['datecreated'] = \formatTimestamp($this->getVar('rel_datecreated'), 'm'); |
|
148 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rel_submitter')); |
|
149 | - return $ret; |
|
150 | - } |
|
144 | + $ret['publishedat'] = \formatTimestamp($this->getVar('rel_publishedat'), 'm'); |
|
145 | + $ret['tarballurl'] = $this->getVar('rel_tarballurl'); |
|
146 | + $ret['zipballurl'] = $this->getVar('rel_zipballurl'); |
|
147 | + $ret['datecreated'] = \formatTimestamp($this->getVar('rel_datecreated'), 'm'); |
|
148 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('rel_submitter')); |
|
149 | + return $ret; |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
153 | - * Returns an array representation of the object |
|
154 | - * |
|
155 | - * @return array |
|
156 | - */ |
|
157 | - public function toArrayReleases() |
|
158 | - { |
|
159 | - $ret = []; |
|
160 | - $vars = $this->getVars(); |
|
161 | - foreach (\array_keys($vars) as $var) { |
|
162 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
163 | - } |
|
164 | - return $ret; |
|
165 | - } |
|
152 | + /** |
|
153 | + * Returns an array representation of the object |
|
154 | + * |
|
155 | + * @return array |
|
156 | + */ |
|
157 | + public function toArrayReleases() |
|
158 | + { |
|
159 | + $ret = []; |
|
160 | + $vars = $this->getVars(); |
|
161 | + foreach (\array_keys($vars) as $var) { |
|
162 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
163 | + } |
|
164 | + return $ret; |
|
165 | + } |
|
166 | 166 | } |
@@ -191,14 +191,14 @@ |
||
191 | 191 | $donationform = [ |
192 | 192 | 0 => '<form name="donation" id="donation" action="http://www.txmodxoops.org/modules/xdonations/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
193 | 193 | 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
194 | - . _AM_WGGITHUB_ABOUT_MAKE_DONATION |
|
195 | - . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
196 | - . _AM_WGGITHUB_DONATION_AMOUNT |
|
197 | - . '</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 EUR</option><option value="10">10.00 EUR</option><option value="20">20.00 EUR</option><option value="40">40.00 EUR</option><option value="60">60.00 EUR</option><option value="80">80.00 EUR</option><option value="90">90.00 EUR</option><option value="100">100.00 EUR</option><option value="200">200.00 EUR</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
198 | - . _SUBMIT |
|
199 | - . '" title="' |
|
200 | - . _SUBMIT |
|
201 | - . '" type="submit"></td></tr></tbody></table>', |
|
194 | + . _AM_WGGITHUB_ABOUT_MAKE_DONATION |
|
195 | + . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
196 | + . _AM_WGGITHUB_DONATION_AMOUNT |
|
197 | + . '</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 EUR</option><option value="10">10.00 EUR</option><option value="20">20.00 EUR</option><option value="40">40.00 EUR</option><option value="60">60.00 EUR</option><option value="80">80.00 EUR</option><option value="90">90.00 EUR</option><option value="100">100.00 EUR</option><option value="200">200.00 EUR</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
198 | + . _SUBMIT |
|
199 | + . '" title="' |
|
200 | + . _SUBMIT |
|
201 | + . '" type="submit"></td></tr></tbody></table>', |
|
202 | 202 | 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="EUR" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="http://www.txmodxoops.org/modules/xdonations/success.php" type="hidden"><input name="cancel" id="cancel" value="http://www.txmodxoops.org/modules/xdonations/success.php" type="hidden"></form>', |
203 | 203 | 'D' => '', |
204 | 204 | 3 => '', |