@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
| 21 | 21 | */ |
| 22 | 22 | if (\count($xoBreadcrumbs) > 1) { |
| 23 | - $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); |
|
| 23 | + $GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs); |
|
| 24 | 24 | } |
| 25 | 25 | $GLOBALS['xoopsTpl']->assign('adv', $helper->getConfig('advertise')); |
| 26 | 26 | // |
@@ -47,38 +47,38 @@ |
||
| 47 | 47 | $GLOBALS['xoopsTpl']->assign('showItem', $repoId > 0); |
| 48 | 48 | |
| 49 | 49 | switch ($op) { |
| 50 | - case 'show': |
|
| 51 | - case 'list': |
|
| 52 | - default: |
|
| 53 | - $crRepositories = new \CriteriaCompo(); |
|
| 54 | - if ($repoId > 0) { |
|
| 55 | - $crRepositories->add(new \Criteria('repo_id', $repoId)); |
|
| 56 | - } |
|
| 57 | - $repositoriesCount = $repositoriesHandler->getCount($crRepositories); |
|
| 58 | - $GLOBALS['xoopsTpl']->assign('repositoriesCount', $repositoriesCount); |
|
| 59 | - $crRepositories->setStart($start); |
|
| 60 | - $crRepositories->setLimit($limit); |
|
| 61 | - $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
| 62 | - if ($repositoriesCount > 0) { |
|
| 63 | - $repositories = []; |
|
| 64 | - // Get All Repositories |
|
| 65 | - foreach (\array_keys($repositoriesAll) as $i) { |
|
| 66 | - $repositories[$i] = $repositoriesAll[$i]->getValuesRepositories(); |
|
| 67 | - $keywords[$i] = $repositoriesAll[$i]->getVar('repo_name'); |
|
| 68 | - } |
|
| 69 | - $GLOBALS['xoopsTpl']->assign('repositories', $repositories); |
|
| 70 | - unset($repositories); |
|
| 71 | - // Display Navigation |
|
| 72 | - if ($repositoriesCount > $limit) { |
|
| 73 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 74 | - $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 75 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 76 | - } |
|
| 77 | - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
| 78 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 79 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 80 | - } |
|
| 81 | - break; |
|
| 50 | + case 'show': |
|
| 51 | + case 'list': |
|
| 52 | + default: |
|
| 53 | + $crRepositories = new \CriteriaCompo(); |
|
| 54 | + if ($repoId > 0) { |
|
| 55 | + $crRepositories->add(new \Criteria('repo_id', $repoId)); |
|
| 56 | + } |
|
| 57 | + $repositoriesCount = $repositoriesHandler->getCount($crRepositories); |
|
| 58 | + $GLOBALS['xoopsTpl']->assign('repositoriesCount', $repositoriesCount); |
|
| 59 | + $crRepositories->setStart($start); |
|
| 60 | + $crRepositories->setLimit($limit); |
|
| 61 | + $repositoriesAll = $repositoriesHandler->getAll($crRepositories); |
|
| 62 | + if ($repositoriesCount > 0) { |
|
| 63 | + $repositories = []; |
|
| 64 | + // Get All Repositories |
|
| 65 | + foreach (\array_keys($repositoriesAll) as $i) { |
|
| 66 | + $repositories[$i] = $repositoriesAll[$i]->getValuesRepositories(); |
|
| 67 | + $keywords[$i] = $repositoriesAll[$i]->getVar('repo_name'); |
|
| 68 | + } |
|
| 69 | + $GLOBALS['xoopsTpl']->assign('repositories', $repositories); |
|
| 70 | + unset($repositories); |
|
| 71 | + // Display Navigation |
|
| 72 | + if ($repositoriesCount > $limit) { |
|
| 73 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 74 | + $pagenav = new \XoopsPageNav($repositoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 75 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 76 | + } |
|
| 77 | + $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
| 78 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 79 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 80 | + } |
|
| 81 | + break; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Breadcrumbs |
@@ -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 SettingsHandler 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_settings', Settings::class, 'set_id', 'set_token'); |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor |
|
| 36 | + * |
|
| 37 | + * @param \XoopsDatabase $db |
|
| 38 | + */ |
|
| 39 | + public function __construct(\XoopsDatabase $db) |
|
| 40 | + { |
|
| 41 | + parent::__construct($db, 'wggithub_settings', Settings::class, 'set_id', 'set_token'); |
|
| 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 Settings 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 getCountSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
| 86 | - { |
|
| 87 | - $crCountSettings = new \CriteriaCompo(); |
|
| 88 | - $crCountSettings = $this->getSettingsCriteria($crCountSettings, $start, $limit, $sort, $order); |
|
| 89 | - return $this->getCount($crCountSettings); |
|
| 90 | - } |
|
| 77 | + /** |
|
| 78 | + * Get Count Settings 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 getCountSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
| 86 | + { |
|
| 87 | + $crCountSettings = new \CriteriaCompo(); |
|
| 88 | + $crCountSettings = $this->getSettingsCriteria($crCountSettings, $start, $limit, $sort, $order); |
|
| 89 | + return $this->getCount($crCountSettings); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Get All Settings 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 getAllSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
| 101 | - { |
|
| 102 | - $crAllSettings = new \CriteriaCompo(); |
|
| 103 | - $crAllSettings = $this->getSettingsCriteria($crAllSettings, $start, $limit, $sort, $order); |
|
| 104 | - return $this->getAll($crAllSettings); |
|
| 105 | - } |
|
| 92 | + /** |
|
| 93 | + * Get All Settings 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 getAllSettings($start = 0, $limit = 0, $sort = 'set_id ASC, set_token', $order = 'ASC') |
|
| 101 | + { |
|
| 102 | + $crAllSettings = new \CriteriaCompo(); |
|
| 103 | + $crAllSettings = $this->getSettingsCriteria($crAllSettings, $start, $limit, $sort, $order); |
|
| 104 | + return $this->getAll($crAllSettings); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get Criteria Settings |
|
| 109 | - * @param $crSettings |
|
| 110 | - * @param int $start |
|
| 111 | - * @param int $limit |
|
| 112 | - * @param string $sort |
|
| 113 | - * @param string $order |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - private function getSettingsCriteria($crSettings, $start, $limit, $sort, $order) |
|
| 117 | - { |
|
| 118 | - $crSettings->setStart($start); |
|
| 119 | - $crSettings->setLimit($limit); |
|
| 120 | - $crSettings->setSort($sort); |
|
| 121 | - $crSettings->setOrder($order); |
|
| 122 | - return $crSettings; |
|
| 123 | - } |
|
| 107 | + /** |
|
| 108 | + * Get Criteria Settings |
|
| 109 | + * @param $crSettings |
|
| 110 | + * @param int $start |
|
| 111 | + * @param int $limit |
|
| 112 | + * @param string $sort |
|
| 113 | + * @param string $order |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + private function getSettingsCriteria($crSettings, $start, $limit, $sort, $order) |
|
| 117 | + { |
|
| 118 | + $crSettings->setStart($start); |
|
| 119 | + $crSettings->setLimit($limit); |
|
| 120 | + $crSettings->setSort($sort); |
|
| 121 | + $crSettings->setOrder($order); |
|
| 122 | + return $crSettings; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * Get Primary Setting |
@@ -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 |