@@ -72,7 +72,7 @@ |
||
| 72 | 72 | { |
| 73 | 73 | $ret = false; |
| 74 | 74 | |
| 75 | - $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; |
|
| 75 | + $class = '\\XoopsModules\\'.ucfirst(mb_strtolower(basename(dirname(__DIR__)))).'\\'.$name.'Handler'; |
|
| 76 | 76 | if (!class_exists($class)) { |
| 77 | 77 | throw new \RuntimeException("Class '$class' not found"); |
| 78 | 78 | } |
@@ -31,94 +31,94 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class TestfieldsHandler extends \XoopsPersistableObjectHandler |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * Constructor |
|
| 36 | - * |
|
| 37 | - * @param null|XoopsDatabase $db |
|
| 38 | - */ |
|
| 39 | - public function __construct(\XoopsDatabase $db) |
|
| 40 | - { |
|
| 41 | - parent::__construct($db, 'mymodule2_testfields', Testfields::class, 'tf_id', 'tf_text'); |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor |
|
| 36 | + * |
|
| 37 | + * @param null|XoopsDatabase $db |
|
| 38 | + */ |
|
| 39 | + public function __construct(\XoopsDatabase $db) |
|
| 40 | + { |
|
| 41 | + parent::__construct($db, 'mymodule2_testfields', Testfields::class, 'tf_id', 'tf_text'); |
|
| 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 integer 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 integer reference to the {@link Get} object |
|
| 71 | + */ |
|
| 72 | + public function getInsertId() |
|
| 73 | + { |
|
| 74 | + return $this->db->getInsertId(); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Get Count Testfields 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 getCountTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') |
|
| 86 | - { |
|
| 87 | - $crCountTestfields = new \CriteriaCompo(); |
|
| 88 | - $crCountTestfields = $this->getTestfieldsCriteria($crCountTestfields, $start, $limit, $sort, $order); |
|
| 89 | - return parent::getCount($crCountTestfields); |
|
| 90 | - } |
|
| 77 | + /** |
|
| 78 | + * Get Count Testfields 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 getCountTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') |
|
| 86 | + { |
|
| 87 | + $crCountTestfields = new \CriteriaCompo(); |
|
| 88 | + $crCountTestfields = $this->getTestfieldsCriteria($crCountTestfields, $start, $limit, $sort, $order); |
|
| 89 | + return parent::getCount($crCountTestfields); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Get All Testfields 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 getAllTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') |
|
| 101 | - { |
|
| 102 | - $crAllTestfields = new \CriteriaCompo(); |
|
| 103 | - $crAllTestfields = $this->getTestfieldsCriteria($crAllTestfields, $start, $limit, $sort, $order); |
|
| 104 | - return parent::getAll($crAllTestfields); |
|
| 105 | - } |
|
| 92 | + /** |
|
| 93 | + * Get All Testfields 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 getAllTestfields($start = 0, $limit = 0, $sort = 'tf_id ASC, tf_text', $order = 'ASC') |
|
| 101 | + { |
|
| 102 | + $crAllTestfields = new \CriteriaCompo(); |
|
| 103 | + $crAllTestfields = $this->getTestfieldsCriteria($crAllTestfields, $start, $limit, $sort, $order); |
|
| 104 | + return parent::getAll($crAllTestfields); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get Criteria Testfields |
|
| 109 | - * @param $crTestfields |
|
| 110 | - * @param int $start |
|
| 111 | - * @param int $limit |
|
| 112 | - * @param string $sort |
|
| 113 | - * @param string $order |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - private function getTestfieldsCriteria($crTestfields, $start, $limit, $sort, $order) |
|
| 117 | - { |
|
| 118 | - $crTestfields->setStart( $start ); |
|
| 119 | - $crTestfields->setLimit( $limit ); |
|
| 120 | - $crTestfields->setSort( $sort ); |
|
| 121 | - $crTestfields->setOrder( $order ); |
|
| 122 | - return $crTestfields; |
|
| 123 | - } |
|
| 107 | + /** |
|
| 108 | + * Get Criteria Testfields |
|
| 109 | + * @param $crTestfields |
|
| 110 | + * @param int $start |
|
| 111 | + * @param int $limit |
|
| 112 | + * @param string $sort |
|
| 113 | + * @param string $order |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + private function getTestfieldsCriteria($crTestfields, $start, $limit, $sort, $order) |
|
| 117 | + { |
|
| 118 | + $crTestfields->setStart( $start ); |
|
| 119 | + $crTestfields->setLimit( $limit ); |
|
| 120 | + $crTestfields->setSort( $sort ); |
|
| 121 | + $crTestfields->setOrder( $order ); |
|
| 122 | + return $crTestfields; |
|
| 123 | + } |
|
| 124 | 124 | } |
@@ -115,10 +115,10 @@ |
||
| 115 | 115 | */ |
| 116 | 116 | private function getTestfieldsCriteria($crTestfields, $start, $limit, $sort, $order) |
| 117 | 117 | { |
| 118 | - $crTestfields->setStart( $start ); |
|
| 119 | - $crTestfields->setLimit( $limit ); |
|
| 120 | - $crTestfields->setSort( $sort ); |
|
| 121 | - $crTestfields->setOrder( $order ); |
|
| 118 | + $crTestfields->setStart($start); |
|
| 119 | + $crTestfields->setLimit($limit); |
|
| 120 | + $crTestfields->setSort($sort); |
|
| 121 | + $crTestfields->setOrder($order); |
|
| 122 | 122 | return $crTestfields; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -189,14 +189,14 @@ |
||
| 189 | 189 | $donationform = [ |
| 190 | 190 | 0 => '<form name="donation" id="donation" action="http://www.txmodxoops.org/modules/xdonations/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
| 191 | 191 | 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
| 192 | - . _AM_MYMODULE2_ABOUT_MAKE_DONATION |
|
| 193 | - . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
| 194 | - . _AM_MYMODULE2_DONATION_AMOUNT |
|
| 195 | - . '</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="' |
|
| 196 | - . _SUBMIT |
|
| 197 | - . '" title="' |
|
| 198 | - . _SUBMIT |
|
| 199 | - . '" type="submit"></td></tr></tbody></table>', |
|
| 192 | + . _AM_MYMODULE2_ABOUT_MAKE_DONATION |
|
| 193 | + . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">' |
|
| 194 | + . _AM_MYMODULE2_DONATION_AMOUNT |
|
| 195 | + . '</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="' |
|
| 196 | + . _SUBMIT |
|
| 197 | + . '" title="' |
|
| 198 | + . _SUBMIT |
|
| 199 | + . '" type="submit"></td></tr></tbody></table>', |
|
| 200 | 200 | 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>', |
| 201 | 201 | 'D' => '', |
| 202 | 202 | 3 => '', |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | if ($considerHtml) { |
| 58 | 58 | // if the plain text is shorter than the maximum length, return the whole text |
| 59 | - if (mb_strlen(preg_replace('/<.*?' . '>/', '', $text)) <= $length) { |
|
| 59 | + if (mb_strlen(preg_replace('/<.*?'.'>/', '', $text)) <= $length) { |
|
| 60 | 60 | return $text; |
| 61 | 61 | } |
| 62 | 62 | // splits all html-tags to scanable lines |
| 63 | - preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); |
|
| 63 | + preg_match_all('/(<.+?'.'>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); |
|
| 64 | 64 | $total_length = mb_strlen($ending); |
| 65 | 65 | $open_tags = []; |
| 66 | 66 | $truncate = ''; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | unset($open_tags[$pos]); |
| 79 | 79 | } |
| 80 | 80 | // if tag is an opening tag |
| 81 | - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { |
|
| 81 | + } elseif (preg_match('/^<\s*([^\s>!]+).*?'.'>$/s', $line_matchings[1], $tag_matchings)) { |
|
| 82 | 82 | // add tag to the beginning of $open_tags list |
| 83 | 83 | array_unshift($open_tags, mb_strtolower($tag_matchings[1])); |
| 84 | 84 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ($considerHtml) { |
| 137 | 137 | // close all unclosed html-tags |
| 138 | 138 | foreach ($open_tags as $tag) { |
| 139 | - $truncate .= '</' . $tag . '>'; |
|
| 139 | + $truncate .= '</'.$tag.'>'; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | //--></script> |
| 210 | 210 | <!-- End Form Validation JavaScript //-->', |
| 211 | 211 | ]; |
| 212 | - $paypalform = [ |
|
| 212 | + $paypalform = [ |
|
| 213 | 213 | 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
| 214 | 214 | 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
| 215 | 215 | 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | case 2: |
| 223 | 223 | $donationform[$key] = sprintf( |
| 224 | 224 | $donationform[$key], |
| 225 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . ('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
| 225 | + $GLOBALS['xoopsConfig']['sitename'].' - '.('' != $GLOBALS['xoopsUser']->getVar('name') ? $GLOBALS['xoopsUser']->getVar('name').' ['.$GLOBALS['xoopsUser']->getVar('uname').']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
| 226 | 226 | $GLOBALS['xoopsUser']->getVar('email'), |
| 227 | 227 | XOOPS_LICENSE_KEY, |
| 228 | 228 | mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')), |
| 229 | - mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')) . ' ' . $GLOBALS['xoopsModule']->getVar('name') |
|
| 229 | + mb_strtoupper($GLOBALS['xoopsModule']->getVar('dirname')).' '.$GLOBALS['xoopsModule']->getVar('name') |
|
| 230 | 230 | ); |
| 231 | 231 | break; |
| 232 | 232 | } |
@@ -29,16 +29,16 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Constants |
| 31 | 31 | { |
| 32 | - // Constants for status |
|
| 33 | - const STATUS_NONE = 0; |
|
| 34 | - const STATUS_OFFLINE = 1; |
|
| 35 | - const STATUS_SUBMITTED = 2; |
|
| 36 | - const STATUS_APPROVED = 3; |
|
| 32 | + // Constants for status |
|
| 33 | + const STATUS_NONE = 0; |
|
| 34 | + const STATUS_OFFLINE = 1; |
|
| 35 | + const STATUS_SUBMITTED = 2; |
|
| 36 | + const STATUS_APPROVED = 3; |
|
| 37 | 37 | |
| 38 | - // Constants for permissions |
|
| 39 | - const PERM_GLOBAL_NONE = 0; |
|
| 40 | - const PERM_GLOBAL_VIEW = 1; |
|
| 41 | - const PERM_GLOBAL_SUBMIT = 2; |
|
| 42 | - const PERM_GLOBAL_APPROVE = 3; |
|
| 38 | + // Constants for permissions |
|
| 39 | + const PERM_GLOBAL_NONE = 0; |
|
| 40 | + const PERM_GLOBAL_VIEW = 1; |
|
| 41 | + const PERM_GLOBAL_SUBMIT = 2; |
|
| 42 | + const PERM_GLOBAL_APPROVE = 3; |
|
| 43 | 43 | |
| 44 | 44 | } |
@@ -31,94 +31,94 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class CategoriesHandler extends \XoopsPersistableObjectHandler |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * Constructor |
|
| 36 | - * |
|
| 37 | - * @param null|XoopsDatabase $db |
|
| 38 | - */ |
|
| 39 | - public function __construct(\XoopsDatabase $db) |
|
| 40 | - { |
|
| 41 | - parent::__construct($db, 'mymodule2_categories', Categories::class, 'cat_id', 'cat_name'); |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor |
|
| 36 | + * |
|
| 37 | + * @param null|XoopsDatabase $db |
|
| 38 | + */ |
|
| 39 | + public function __construct(\XoopsDatabase $db) |
|
| 40 | + { |
|
| 41 | + parent::__construct($db, 'mymodule2_categories', Categories::class, 'cat_id', 'cat_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 integer 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 integer reference to the {@link Get} object |
|
| 71 | + */ |
|
| 72 | + public function getInsertId() |
|
| 73 | + { |
|
| 74 | + return $this->db->getInsertId(); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Get Count Categories 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 getCountCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') |
|
| 86 | - { |
|
| 87 | - $crCountCategories = new \CriteriaCompo(); |
|
| 88 | - $crCountCategories = $this->getCategoriesCriteria($crCountCategories, $start, $limit, $sort, $order); |
|
| 89 | - return parent::getCount($crCountCategories); |
|
| 90 | - } |
|
| 77 | + /** |
|
| 78 | + * Get Count Categories 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 getCountCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') |
|
| 86 | + { |
|
| 87 | + $crCountCategories = new \CriteriaCompo(); |
|
| 88 | + $crCountCategories = $this->getCategoriesCriteria($crCountCategories, $start, $limit, $sort, $order); |
|
| 89 | + return parent::getCount($crCountCategories); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Get All Categories 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 getAllCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') |
|
| 101 | - { |
|
| 102 | - $crAllCategories = new \CriteriaCompo(); |
|
| 103 | - $crAllCategories = $this->getCategoriesCriteria($crAllCategories, $start, $limit, $sort, $order); |
|
| 104 | - return parent::getAll($crAllCategories); |
|
| 105 | - } |
|
| 92 | + /** |
|
| 93 | + * Get All Categories 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 getAllCategories($start = 0, $limit = 0, $sort = 'cat_id ASC, cat_name', $order = 'ASC') |
|
| 101 | + { |
|
| 102 | + $crAllCategories = new \CriteriaCompo(); |
|
| 103 | + $crAllCategories = $this->getCategoriesCriteria($crAllCategories, $start, $limit, $sort, $order); |
|
| 104 | + return parent::getAll($crAllCategories); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get Criteria Categories |
|
| 109 | - * @param $crCategories |
|
| 110 | - * @param int $start |
|
| 111 | - * @param int $limit |
|
| 112 | - * @param string $sort |
|
| 113 | - * @param string $order |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - private function getCategoriesCriteria($crCategories, $start, $limit, $sort, $order) |
|
| 117 | - { |
|
| 118 | - $crCategories->setStart( $start ); |
|
| 119 | - $crCategories->setLimit( $limit ); |
|
| 120 | - $crCategories->setSort( $sort ); |
|
| 121 | - $crCategories->setOrder( $order ); |
|
| 122 | - return $crCategories; |
|
| 123 | - } |
|
| 107 | + /** |
|
| 108 | + * Get Criteria Categories |
|
| 109 | + * @param $crCategories |
|
| 110 | + * @param int $start |
|
| 111 | + * @param int $limit |
|
| 112 | + * @param string $sort |
|
| 113 | + * @param string $order |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + private function getCategoriesCriteria($crCategories, $start, $limit, $sort, $order) |
|
| 117 | + { |
|
| 118 | + $crCategories->setStart( $start ); |
|
| 119 | + $crCategories->setLimit( $limit ); |
|
| 120 | + $crCategories->setSort( $sort ); |
|
| 121 | + $crCategories->setOrder( $order ); |
|
| 122 | + return $crCategories; |
|
| 123 | + } |
|
| 124 | 124 | } |
@@ -115,10 +115,10 @@ |
||
| 115 | 115 | */ |
| 116 | 116 | private function getCategoriesCriteria($crCategories, $start, $limit, $sort, $order) |
| 117 | 117 | { |
| 118 | - $crCategories->setStart( $start ); |
|
| 119 | - $crCategories->setLimit( $limit ); |
|
| 120 | - $crCategories->setSort( $sort ); |
|
| 121 | - $crCategories->setOrder( $order ); |
|
| 118 | + $crCategories->setStart($start); |
|
| 119 | + $crCategories->setLimit($limit); |
|
| 120 | + $crCategories->setSort($sort); |
|
| 121 | + $crCategories->setOrder($order); |
|
| 122 | 122 | return $crCategories; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -32,224 +32,224 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class Articles extends \XoopsObject |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Constructor |
|
| 37 | - * |
|
| 38 | - * @param null |
|
| 39 | - */ |
|
| 40 | - public function __construct() |
|
| 41 | - { |
|
| 42 | - $this->initVar('art_id', XOBJ_DTYPE_INT); |
|
| 43 | - $this->initVar('art_cat', XOBJ_DTYPE_INT); |
|
| 44 | - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX); |
|
| 45 | - $this->initVar('art_descr', XOBJ_DTYPE_TXTAREA); |
|
| 46 | - $this->initVar('art_img', XOBJ_DTYPE_TXTBOX); |
|
| 47 | - $this->initVar('art_status', XOBJ_DTYPE_INT); |
|
| 48 | - $this->initVar('art_file', XOBJ_DTYPE_TXTBOX); |
|
| 49 | - $this->initVar('art_created', XOBJ_DTYPE_INT); |
|
| 50 | - $this->initVar('art_submitter', XOBJ_DTYPE_INT); |
|
| 51 | - } |
|
| 35 | + /** |
|
| 36 | + * Constructor |
|
| 37 | + * |
|
| 38 | + * @param null |
|
| 39 | + */ |
|
| 40 | + public function __construct() |
|
| 41 | + { |
|
| 42 | + $this->initVar('art_id', XOBJ_DTYPE_INT); |
|
| 43 | + $this->initVar('art_cat', XOBJ_DTYPE_INT); |
|
| 44 | + $this->initVar('art_title', XOBJ_DTYPE_TXTBOX); |
|
| 45 | + $this->initVar('art_descr', XOBJ_DTYPE_TXTAREA); |
|
| 46 | + $this->initVar('art_img', XOBJ_DTYPE_TXTBOX); |
|
| 47 | + $this->initVar('art_status', XOBJ_DTYPE_INT); |
|
| 48 | + $this->initVar('art_file', XOBJ_DTYPE_TXTBOX); |
|
| 49 | + $this->initVar('art_created', XOBJ_DTYPE_INT); |
|
| 50 | + $this->initVar('art_submitter', XOBJ_DTYPE_INT); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @static function &getInstance |
|
| 55 | - * |
|
| 56 | - * @param null |
|
| 57 | - */ |
|
| 58 | - public static function getInstance() |
|
| 59 | - { |
|
| 60 | - static $instance = false; |
|
| 61 | - if (!$instance) { |
|
| 62 | - $instance = new self(); |
|
| 63 | - } |
|
| 64 | - } |
|
| 53 | + /** |
|
| 54 | + * @static function &getInstance |
|
| 55 | + * |
|
| 56 | + * @param null |
|
| 57 | + */ |
|
| 58 | + public static function getInstance() |
|
| 59 | + { |
|
| 60 | + static $instance = false; |
|
| 61 | + if (!$instance) { |
|
| 62 | + $instance = new self(); |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * The new inserted $Id |
|
| 68 | - * @return inserted id |
|
| 69 | - */ |
|
| 70 | - public function getNewInsertedIdArticles() |
|
| 71 | - { |
|
| 72 | - $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
| 73 | - return $newInsertedId; |
|
| 74 | - } |
|
| 66 | + /** |
|
| 67 | + * The new inserted $Id |
|
| 68 | + * @return inserted id |
|
| 69 | + */ |
|
| 70 | + public function getNewInsertedIdArticles() |
|
| 71 | + { |
|
| 72 | + $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
|
| 73 | + return $newInsertedId; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * @public function getForm |
|
| 78 | - * @param bool $action |
|
| 79 | - * @return XoopsThemeForm |
|
| 80 | - */ |
|
| 81 | - public function getFormArticles($action = false) |
|
| 82 | - { |
|
| 83 | - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); |
|
| 84 | - if (false === $action) { |
|
| 85 | - $action = $_SERVER['REQUEST_URI']; |
|
| 86 | - } |
|
| 87 | - // Permissions for uploader |
|
| 88 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 89 | - $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 90 | - if ($GLOBALS['xoopsUser']) { |
|
| 91 | - if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { |
|
| 92 | - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
|
| 93 | - } else { |
|
| 94 | - $permissionUpload = true; |
|
| 95 | - } |
|
| 96 | - } else { |
|
| 97 | - $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
|
| 98 | - } |
|
| 99 | - // Title |
|
| 100 | - $title = $this->isNew() ? sprintf(_AM_MYMODULE2_ARTICLE_ADD) : sprintf(_AM_MYMODULE2_ARTICLE_EDIT); |
|
| 101 | - // Get Theme Form |
|
| 102 | - xoops_load('XoopsFormLoader'); |
|
| 103 | - $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
| 104 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 105 | - // Use tag module |
|
| 106 | - $dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false; |
|
| 107 | - if (($helper->getConfig('usetag') == 1) && $dirTag) { |
|
| 108 | - $tagId = $this->isNew() ? 0 : $this->getVar('art_id'); |
|
| 109 | - include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
| 110 | - $form->addElement(new \XoopsFormTag( 'tag', 60, 255, $tagId, 0 ), true); |
|
| 111 | - } |
|
| 112 | - // Form Table categories |
|
| 113 | - $categoriesHandler = $helper->getHandler('categories'); |
|
| 114 | - $artCatSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); |
|
| 115 | - $artCatSelect->addOptionArray($categoriesHandler->getList()); |
|
| 116 | - $form->addElement($artCatSelect, true); |
|
| 117 | - // Form Text ArtTitle |
|
| 118 | - $form->addElement(new \XoopsFormText( _AM_MYMODULE2_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title') ), true); |
|
| 119 | - // Form editor ArtDescr |
|
| 120 | - $editorConfigs = []; |
|
| 121 | - $editorConfigs['name'] = 'art_descr'; |
|
| 122 | - $editorConfigs['value'] = $this->getVar('art_descr', 'e'); |
|
| 123 | - $editorConfigs['rows'] = 5; |
|
| 124 | - $editorConfigs['cols'] = 40; |
|
| 125 | - $editorConfigs['width'] = '100%'; |
|
| 126 | - $editorConfigs['height'] = '400px'; |
|
| 127 | - $editorConfigs['editor'] = $helper->getConfig('editor_descr'); |
|
| 128 | - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE2_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); |
|
| 129 | - // Form Image ArtImg |
|
| 130 | - // Form Image ArtImg: Select Uploaded Image |
|
| 131 | - $getArtImg = $this->getVar('art_img'); |
|
| 132 | - $artImg = $getArtImg ? $getArtImg : 'blank.gif'; |
|
| 133 | - $imageDirectory = '/uploads/mymodule2/images/articles'; |
|
| 134 | - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_IMG, '<br>' ); |
|
| 135 | - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_ARTICLE_IMG_UPLOADS, ".{$imageDirectory}/"), 'art_img', $artImg, 5); |
|
| 136 | - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); |
|
| 137 | - foreach($imageArray as $image1) { |
|
| 138 | - $imageSelect->addOption("{$image1}", $image1); |
|
| 139 | - } |
|
| 140 | - $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_art_img\", \"art_img\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); |
|
| 141 | - $imageTray->addElement($imageSelect, false); |
|
| 142 | - $imageTray->addElement(new \XoopsFormLabel('', "<br><img src='".XOOPS_URL."/".$imageDirectory."/".$artImg."' name='imglabel_art_img' id='imglabel_art_img' alt='' style='max-width:100px' />")); |
|
| 143 | - // Form Image ArtImg: Upload new image |
|
| 144 | - if ($permissionUpload) { |
|
| 145 | - $maxsize = $helper->getConfig('maxsize_image'); |
|
| 146 | - $imageTray->addElement(new \XoopsFormFile( '<br>' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'art_img', $maxsize )); |
|
| 147 | - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 148 | - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
|
| 149 | - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
|
| 150 | - } else { |
|
| 151 | - $imageTray->addElement(new \XoopsFormHidden( 'art_img', $artImg )); |
|
| 152 | - } |
|
| 153 | - $form->addElement($imageTray, ); |
|
| 154 | - // Form Select Articles |
|
| 155 | - $artStatusSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_STATUS, 'art_status', $this->getVar('art_status')); |
|
| 156 | - $artStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE2_STATUS_NONE); |
|
| 157 | - $artStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE2_STATUS_OFFLINE); |
|
| 158 | - $artStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE2_STATUS_SUBMITTED); |
|
| 159 | - $artStatusSelect->addOption(Constants::STATUS_APPROVED, _AM_MYMODULE2_STATUS_APPROVED); |
|
| 160 | - $form->addElement($artStatusSelect, true); |
|
| 161 | - // Form File ArtFile |
|
| 162 | - $artFile = $this->isNew() ? '' : $this->getVar('art_file'); |
|
| 163 | - if ($permissionUpload) { |
|
| 164 | - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_FILE, '<br>' ); |
|
| 165 | - $fileDirectory = '/uploads/mymodule2/files/articles'; |
|
| 166 | - if (!$this->isNew()) { |
|
| 167 | - $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE2_ARTICLE_FILE_UPLOADS, ".{$fileDirectory}/"), $artFile)); |
|
| 168 | - } |
|
| 169 | - $maxsize = $helper->getConfig('maxsize_file'); |
|
| 170 | - $fileUploadTray->addElement(new \XoopsFormFile( '', 'art_file', $maxsize )); |
|
| 171 | - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 172 | - $form->addElement($fileUploadTray, ); |
|
| 173 | - } else { |
|
| 174 | - $form->addElement(new \XoopsFormHidden( 'art_file', $artFile )); |
|
| 175 | - } |
|
| 176 | - // Form Text Date Select ArtCreated |
|
| 177 | - $artCreated = $this->isNew() ? 0 : $this->getVar('art_created'); |
|
| 178 | - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_ARTICLE_CREATED, 'art_created', '', $artCreated )); |
|
| 179 | - // Form Select User ArtSubmitter |
|
| 180 | - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE2_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter') )); |
|
| 181 | - // Permissions |
|
| 182 | - $memberHandler = xoops_getHandler('member'); |
|
| 183 | - $groupList = $memberHandler->getGroupList(); |
|
| 184 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 185 | - $fullList[] = array_keys($groupList); |
|
| 186 | - if (!$this->isNew()) { |
|
| 187 | - $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule2_approve_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
| 188 | - $groupsIdsApprove[] = array_values($groupsIdsApprove); |
|
| 189 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $groupsIdsApprove); |
|
| 190 | - $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule2_submit_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
| 191 | - $groupsIdsSubmit[] = array_values($groupsIdsSubmit); |
|
| 192 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $groupsIdsSubmit); |
|
| 193 | - $groupsIdsView = $grouppermHandler->getGroupIds('mymodule2_view_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
| 194 | - $groupsIdsView[] = array_values($groupsIdsView); |
|
| 195 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $groupsIdsView); |
|
| 196 | - } else { |
|
| 197 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $fullList); |
|
| 198 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $fullList); |
|
| 199 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $fullList); |
|
| 200 | - } |
|
| 201 | - // To Approve |
|
| 202 | - $groupsCanApproveCheckbox->addOptionArray($groupList); |
|
| 203 | - $form->addElement($groupsCanApproveCheckbox); |
|
| 204 | - // To Submit |
|
| 205 | - $groupsCanSubmitCheckbox->addOptionArray($groupList); |
|
| 206 | - $form->addElement($groupsCanSubmitCheckbox); |
|
| 207 | - // To View |
|
| 208 | - $groupsCanViewCheckbox->addOptionArray($groupList); |
|
| 209 | - $form->addElement($groupsCanViewCheckbox); |
|
| 210 | - // To Save |
|
| 211 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 212 | - $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
| 213 | - return $form; |
|
| 214 | - } |
|
| 76 | + /** |
|
| 77 | + * @public function getForm |
|
| 78 | + * @param bool $action |
|
| 79 | + * @return XoopsThemeForm |
|
| 80 | + */ |
|
| 81 | + public function getFormArticles($action = false) |
|
| 82 | + { |
|
| 83 | + $helper = \XoopsModules\Mymodule2\Helper::getInstance(); |
|
| 84 | + if (false === $action) { |
|
| 85 | + $action = $_SERVER['REQUEST_URI']; |
|
| 86 | + } |
|
| 87 | + // Permissions for uploader |
|
| 88 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 89 | + $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 90 | + if ($GLOBALS['xoopsUser']) { |
|
| 91 | + if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { |
|
| 92 | + $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
|
| 93 | + } else { |
|
| 94 | + $permissionUpload = true; |
|
| 95 | + } |
|
| 96 | + } else { |
|
| 97 | + $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
|
| 98 | + } |
|
| 99 | + // Title |
|
| 100 | + $title = $this->isNew() ? sprintf(_AM_MYMODULE2_ARTICLE_ADD) : sprintf(_AM_MYMODULE2_ARTICLE_EDIT); |
|
| 101 | + // Get Theme Form |
|
| 102 | + xoops_load('XoopsFormLoader'); |
|
| 103 | + $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
|
| 104 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 105 | + // Use tag module |
|
| 106 | + $dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false; |
|
| 107 | + if (($helper->getConfig('usetag') == 1) && $dirTag) { |
|
| 108 | + $tagId = $this->isNew() ? 0 : $this->getVar('art_id'); |
|
| 109 | + include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
| 110 | + $form->addElement(new \XoopsFormTag( 'tag', 60, 255, $tagId, 0 ), true); |
|
| 111 | + } |
|
| 112 | + // Form Table categories |
|
| 113 | + $categoriesHandler = $helper->getHandler('categories'); |
|
| 114 | + $artCatSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); |
|
| 115 | + $artCatSelect->addOptionArray($categoriesHandler->getList()); |
|
| 116 | + $form->addElement($artCatSelect, true); |
|
| 117 | + // Form Text ArtTitle |
|
| 118 | + $form->addElement(new \XoopsFormText( _AM_MYMODULE2_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title') ), true); |
|
| 119 | + // Form editor ArtDescr |
|
| 120 | + $editorConfigs = []; |
|
| 121 | + $editorConfigs['name'] = 'art_descr'; |
|
| 122 | + $editorConfigs['value'] = $this->getVar('art_descr', 'e'); |
|
| 123 | + $editorConfigs['rows'] = 5; |
|
| 124 | + $editorConfigs['cols'] = 40; |
|
| 125 | + $editorConfigs['width'] = '100%'; |
|
| 126 | + $editorConfigs['height'] = '400px'; |
|
| 127 | + $editorConfigs['editor'] = $helper->getConfig('editor_descr'); |
|
| 128 | + $form->addElement(new \XoopsFormEditor( _AM_MYMODULE2_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); |
|
| 129 | + // Form Image ArtImg |
|
| 130 | + // Form Image ArtImg: Select Uploaded Image |
|
| 131 | + $getArtImg = $this->getVar('art_img'); |
|
| 132 | + $artImg = $getArtImg ? $getArtImg : 'blank.gif'; |
|
| 133 | + $imageDirectory = '/uploads/mymodule2/images/articles'; |
|
| 134 | + $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_IMG, '<br>' ); |
|
| 135 | + $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_ARTICLE_IMG_UPLOADS, ".{$imageDirectory}/"), 'art_img', $artImg, 5); |
|
| 136 | + $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); |
|
| 137 | + foreach($imageArray as $image1) { |
|
| 138 | + $imageSelect->addOption("{$image1}", $image1); |
|
| 139 | + } |
|
| 140 | + $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_art_img\", \"art_img\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); |
|
| 141 | + $imageTray->addElement($imageSelect, false); |
|
| 142 | + $imageTray->addElement(new \XoopsFormLabel('', "<br><img src='".XOOPS_URL."/".$imageDirectory."/".$artImg."' name='imglabel_art_img' id='imglabel_art_img' alt='' style='max-width:100px' />")); |
|
| 143 | + // Form Image ArtImg: Upload new image |
|
| 144 | + if ($permissionUpload) { |
|
| 145 | + $maxsize = $helper->getConfig('maxsize_image'); |
|
| 146 | + $imageTray->addElement(new \XoopsFormFile( '<br>' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'art_img', $maxsize )); |
|
| 147 | + $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 148 | + $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
|
| 149 | + $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
|
| 150 | + } else { |
|
| 151 | + $imageTray->addElement(new \XoopsFormHidden( 'art_img', $artImg )); |
|
| 152 | + } |
|
| 153 | + $form->addElement($imageTray, ); |
|
| 154 | + // Form Select Articles |
|
| 155 | + $artStatusSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_STATUS, 'art_status', $this->getVar('art_status')); |
|
| 156 | + $artStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE2_STATUS_NONE); |
|
| 157 | + $artStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE2_STATUS_OFFLINE); |
|
| 158 | + $artStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE2_STATUS_SUBMITTED); |
|
| 159 | + $artStatusSelect->addOption(Constants::STATUS_APPROVED, _AM_MYMODULE2_STATUS_APPROVED); |
|
| 160 | + $form->addElement($artStatusSelect, true); |
|
| 161 | + // Form File ArtFile |
|
| 162 | + $artFile = $this->isNew() ? '' : $this->getVar('art_file'); |
|
| 163 | + if ($permissionUpload) { |
|
| 164 | + $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_FILE, '<br>' ); |
|
| 165 | + $fileDirectory = '/uploads/mymodule2/files/articles'; |
|
| 166 | + if (!$this->isNew()) { |
|
| 167 | + $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE2_ARTICLE_FILE_UPLOADS, ".{$fileDirectory}/"), $artFile)); |
|
| 168 | + } |
|
| 169 | + $maxsize = $helper->getConfig('maxsize_file'); |
|
| 170 | + $fileUploadTray->addElement(new \XoopsFormFile( '', 'art_file', $maxsize )); |
|
| 171 | + $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 172 | + $form->addElement($fileUploadTray, ); |
|
| 173 | + } else { |
|
| 174 | + $form->addElement(new \XoopsFormHidden( 'art_file', $artFile )); |
|
| 175 | + } |
|
| 176 | + // Form Text Date Select ArtCreated |
|
| 177 | + $artCreated = $this->isNew() ? 0 : $this->getVar('art_created'); |
|
| 178 | + $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_ARTICLE_CREATED, 'art_created', '', $artCreated )); |
|
| 179 | + // Form Select User ArtSubmitter |
|
| 180 | + $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE2_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter') )); |
|
| 181 | + // Permissions |
|
| 182 | + $memberHandler = xoops_getHandler('member'); |
|
| 183 | + $groupList = $memberHandler->getGroupList(); |
|
| 184 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 185 | + $fullList[] = array_keys($groupList); |
|
| 186 | + if (!$this->isNew()) { |
|
| 187 | + $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule2_approve_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
| 188 | + $groupsIdsApprove[] = array_values($groupsIdsApprove); |
|
| 189 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $groupsIdsApprove); |
|
| 190 | + $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule2_submit_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
| 191 | + $groupsIdsSubmit[] = array_values($groupsIdsSubmit); |
|
| 192 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $groupsIdsSubmit); |
|
| 193 | + $groupsIdsView = $grouppermHandler->getGroupIds('mymodule2_view_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
|
| 194 | + $groupsIdsView[] = array_values($groupsIdsView); |
|
| 195 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $groupsIdsView); |
|
| 196 | + } else { |
|
| 197 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $fullList); |
|
| 198 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $fullList); |
|
| 199 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $fullList); |
|
| 200 | + } |
|
| 201 | + // To Approve |
|
| 202 | + $groupsCanApproveCheckbox->addOptionArray($groupList); |
|
| 203 | + $form->addElement($groupsCanApproveCheckbox); |
|
| 204 | + // To Submit |
|
| 205 | + $groupsCanSubmitCheckbox->addOptionArray($groupList); |
|
| 206 | + $form->addElement($groupsCanSubmitCheckbox); |
|
| 207 | + // To View |
|
| 208 | + $groupsCanViewCheckbox->addOptionArray($groupList); |
|
| 209 | + $form->addElement($groupsCanViewCheckbox); |
|
| 210 | + // To Save |
|
| 211 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
| 212 | + $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
|
| 213 | + return $form; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * Get Values |
|
| 218 | - * @param null $keys |
|
| 219 | - * @param null $format |
|
| 220 | - * @param null$maxDepth |
|
| 221 | - * @return array |
|
| 222 | - */ |
|
| 223 | - public function getValuesArticles($keys = null, $format = null, $maxDepth = null) |
|
| 224 | - { |
|
| 225 | - $helper = \XoopsModules\Mymodule2\Helper::getInstance(); |
|
| 226 | - $ret = $this->getValues($keys, $format, $maxDepth); |
|
| 227 | - $ret['id'] = $this->getVar('art_id'); |
|
| 228 | - $categories = $helper->getHandler('categories'); |
|
| 229 | - $categoriesObj = $categories->get($this->getVar('art_cat')); |
|
| 230 | - $ret['cat'] = $categoriesObj->getVar('cat_name'); |
|
| 231 | - $ret['title'] = $this->getVar('art_title'); |
|
| 232 | - $ret['descr'] = strip_tags($this->getVar('art_descr')); |
|
| 233 | - $ret['img'] = $this->getVar('art_img'); |
|
| 234 | - $ret['status'] = $this->getVar('art_status'); |
|
| 235 | - $ret['file'] = $this->getVar('art_file'); |
|
| 236 | - $ret['created'] = formatTimeStamp($this->getVar('art_created'), 's'); |
|
| 237 | - $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('art_submitter')); |
|
| 238 | - return $ret; |
|
| 239 | - } |
|
| 216 | + /** |
|
| 217 | + * Get Values |
|
| 218 | + * @param null $keys |
|
| 219 | + * @param null $format |
|
| 220 | + * @param null$maxDepth |
|
| 221 | + * @return array |
|
| 222 | + */ |
|
| 223 | + public function getValuesArticles($keys = null, $format = null, $maxDepth = null) |
|
| 224 | + { |
|
| 225 | + $helper = \XoopsModules\Mymodule2\Helper::getInstance(); |
|
| 226 | + $ret = $this->getValues($keys, $format, $maxDepth); |
|
| 227 | + $ret['id'] = $this->getVar('art_id'); |
|
| 228 | + $categories = $helper->getHandler('categories'); |
|
| 229 | + $categoriesObj = $categories->get($this->getVar('art_cat')); |
|
| 230 | + $ret['cat'] = $categoriesObj->getVar('cat_name'); |
|
| 231 | + $ret['title'] = $this->getVar('art_title'); |
|
| 232 | + $ret['descr'] = strip_tags($this->getVar('art_descr')); |
|
| 233 | + $ret['img'] = $this->getVar('art_img'); |
|
| 234 | + $ret['status'] = $this->getVar('art_status'); |
|
| 235 | + $ret['file'] = $this->getVar('art_file'); |
|
| 236 | + $ret['created'] = formatTimeStamp($this->getVar('art_created'), 's'); |
|
| 237 | + $ret['submitter'] = \XoopsUser::getUnameFromId($this->getVar('art_submitter')); |
|
| 238 | + return $ret; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns an array representation of the object |
|
| 243 | - * |
|
| 244 | - * @return array |
|
| 245 | - */ |
|
| 246 | - public function toArrayArticles() |
|
| 247 | - { |
|
| 248 | - $ret = []; |
|
| 249 | - $vars = $this->getVars(); |
|
| 250 | - foreach(array_keys($vars) as $var) { |
|
| 251 | - $ret[$var] = $this->getVar('"{$var}"'); |
|
| 252 | - } |
|
| 253 | - return $ret; |
|
| 254 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns an array representation of the object |
|
| 243 | + * |
|
| 244 | + * @return array |
|
| 245 | + */ |
|
| 246 | + public function toArrayArticles() |
|
| 247 | + { |
|
| 248 | + $ret = []; |
|
| 249 | + $vars = $this->getVars(); |
|
| 250 | + foreach(array_keys($vars) as $var) { |
|
| 251 | + $ret[$var] = $this->getVar('"{$var}"'); |
|
| 252 | + } |
|
| 253 | + return $ret; |
|
| 254 | + } |
|
| 255 | 255 | } |
@@ -103,19 +103,19 @@ discard block |
||
| 103 | 103 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
| 104 | 104 | $form->setExtra('enctype="multipart/form-data"'); |
| 105 | 105 | // Use tag module |
| 106 | - $dirTag = is_dir(XOOPS_ROOT_PATH . '/modules/tag') ? true : false; |
|
| 106 | + $dirTag = is_dir(XOOPS_ROOT_PATH.'/modules/tag') ? true : false; |
|
| 107 | 107 | if (($helper->getConfig('usetag') == 1) && $dirTag) { |
| 108 | 108 | $tagId = $this->isNew() ? 0 : $this->getVar('art_id'); |
| 109 | - include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
| 110 | - $form->addElement(new \XoopsFormTag( 'tag', 60, 255, $tagId, 0 ), true); |
|
| 109 | + include_once XOOPS_ROOT_PATH.'/modules/tag/include/formtag.php'; |
|
| 110 | + $form->addElement(new \XoopsFormTag('tag', 60, 255, $tagId, 0), true); |
|
| 111 | 111 | } |
| 112 | 112 | // Form Table categories |
| 113 | 113 | $categoriesHandler = $helper->getHandler('categories'); |
| 114 | - $artCatSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); |
|
| 114 | + $artCatSelect = new \XoopsFormSelect(_AM_MYMODULE2_ARTICLE_CAT, 'art_cat', $this->getVar('art_cat')); |
|
| 115 | 115 | $artCatSelect->addOptionArray($categoriesHandler->getList()); |
| 116 | 116 | $form->addElement($artCatSelect, true); |
| 117 | 117 | // Form Text ArtTitle |
| 118 | - $form->addElement(new \XoopsFormText( _AM_MYMODULE2_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title') ), true); |
|
| 118 | + $form->addElement(new \XoopsFormText(_AM_MYMODULE2_ARTICLE_TITLE, 'art_title', 50, 255, $this->getVar('art_title')), true); |
|
| 119 | 119 | // Form editor ArtDescr |
| 120 | 120 | $editorConfigs = []; |
| 121 | 121 | $editorConfigs['name'] = 'art_descr'; |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | $editorConfigs['width'] = '100%'; |
| 126 | 126 | $editorConfigs['height'] = '400px'; |
| 127 | 127 | $editorConfigs['editor'] = $helper->getConfig('editor_descr'); |
| 128 | - $form->addElement(new \XoopsFormEditor( _AM_MYMODULE2_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); |
|
| 128 | + $form->addElement(new \XoopsFormEditor(_AM_MYMODULE2_ARTICLE_DESCR, 'art_descr', $editorConfigs), true); |
|
| 129 | 129 | // Form Image ArtImg |
| 130 | 130 | // Form Image ArtImg: Select Uploaded Image |
| 131 | 131 | $getArtImg = $this->getVar('art_img'); |
| 132 | 132 | $artImg = $getArtImg ? $getArtImg : 'blank.gif'; |
| 133 | 133 | $imageDirectory = '/uploads/mymodule2/images/articles'; |
| 134 | - $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_IMG, '<br>' ); |
|
| 135 | - $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_ARTICLE_IMG_UPLOADS, ".{$imageDirectory}/"), 'art_img', $artImg, 5); |
|
| 136 | - $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); |
|
| 137 | - foreach($imageArray as $image1) { |
|
| 134 | + $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_IMG, '<br>'); |
|
| 135 | + $imageSelect = new \XoopsFormSelect(sprintf(_AM_MYMODULE2_ARTICLE_IMG_UPLOADS, ".{$imageDirectory}/"), 'art_img', $artImg, 5); |
|
| 136 | + $imageArray = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH.$imageDirectory); |
|
| 137 | + foreach ($imageArray as $image1) { |
|
| 138 | 138 | $imageSelect->addOption("{$image1}", $image1); |
| 139 | 139 | } |
| 140 | 140 | $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_art_img\", \"art_img\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | // Form Image ArtImg: Upload new image |
| 144 | 144 | if ($permissionUpload) { |
| 145 | 145 | $maxsize = $helper->getConfig('maxsize_image'); |
| 146 | - $imageTray->addElement(new \XoopsFormFile( '<br>' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'art_img', $maxsize )); |
|
| 147 | - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 148 | - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
|
| 149 | - $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
|
| 146 | + $imageTray->addElement(new \XoopsFormFile('<br>'._AM_MYMODULE2_FORM_UPLOAD_NEW, 'art_img', $maxsize)); |
|
| 147 | + $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576).' '._AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 148 | + $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image').' px')); |
|
| 149 | + $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image').' px')); |
|
| 150 | 150 | } else { |
| 151 | - $imageTray->addElement(new \XoopsFormHidden( 'art_img', $artImg )); |
|
| 151 | + $imageTray->addElement(new \XoopsFormHidden('art_img', $artImg)); |
|
| 152 | 152 | } |
| 153 | - $form->addElement($imageTray, ); |
|
| 153 | + $form->addElement($imageTray,); |
|
| 154 | 154 | // Form Select Articles |
| 155 | - $artStatusSelect = new \XoopsFormSelect( _AM_MYMODULE2_ARTICLE_STATUS, 'art_status', $this->getVar('art_status')); |
|
| 155 | + $artStatusSelect = new \XoopsFormSelect(_AM_MYMODULE2_ARTICLE_STATUS, 'art_status', $this->getVar('art_status')); |
|
| 156 | 156 | $artStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE2_STATUS_NONE); |
| 157 | 157 | $artStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE2_STATUS_OFFLINE); |
| 158 | 158 | $artStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE2_STATUS_SUBMITTED); |
@@ -161,23 +161,23 @@ discard block |
||
| 161 | 161 | // Form File ArtFile |
| 162 | 162 | $artFile = $this->isNew() ? '' : $this->getVar('art_file'); |
| 163 | 163 | if ($permissionUpload) { |
| 164 | - $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_FILE, '<br>' ); |
|
| 164 | + $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_ARTICLE_FILE, '<br>'); |
|
| 165 | 165 | $fileDirectory = '/uploads/mymodule2/files/articles'; |
| 166 | 166 | if (!$this->isNew()) { |
| 167 | 167 | $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE2_ARTICLE_FILE_UPLOADS, ".{$fileDirectory}/"), $artFile)); |
| 168 | 168 | } |
| 169 | 169 | $maxsize = $helper->getConfig('maxsize_file'); |
| 170 | - $fileUploadTray->addElement(new \XoopsFormFile( '', 'art_file', $maxsize )); |
|
| 171 | - $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 172 | - $form->addElement($fileUploadTray, ); |
|
| 170 | + $fileUploadTray->addElement(new \XoopsFormFile('', 'art_file', $maxsize)); |
|
| 171 | + $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576).' '._AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
|
| 172 | + $form->addElement($fileUploadTray,); |
|
| 173 | 173 | } else { |
| 174 | - $form->addElement(new \XoopsFormHidden( 'art_file', $artFile )); |
|
| 174 | + $form->addElement(new \XoopsFormHidden('art_file', $artFile)); |
|
| 175 | 175 | } |
| 176 | 176 | // Form Text Date Select ArtCreated |
| 177 | 177 | $artCreated = $this->isNew() ? 0 : $this->getVar('art_created'); |
| 178 | - $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_ARTICLE_CREATED, 'art_created', '', $artCreated )); |
|
| 178 | + $form->addElement(new \XoopsFormTextDateSelect(_AM_MYMODULE2_ARTICLE_CREATED, 'art_created', '', $artCreated)); |
|
| 179 | 179 | // Form Select User ArtSubmitter |
| 180 | - $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE2_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter') )); |
|
| 180 | + $form->addElement(new \XoopsFormSelectUser(_AM_MYMODULE2_ARTICLE_SUBMITTER, 'art_submitter', false, $this->getVar('art_submitter'))); |
|
| 181 | 181 | // Permissions |
| 182 | 182 | $memberHandler = xoops_getHandler('member'); |
| 183 | 183 | $groupList = $memberHandler->getGroupList(); |
@@ -186,17 +186,17 @@ discard block |
||
| 186 | 186 | if (!$this->isNew()) { |
| 187 | 187 | $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule2_approve_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
| 188 | 188 | $groupsIdsApprove[] = array_values($groupsIdsApprove); |
| 189 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $groupsIdsApprove); |
|
| 189 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox(_AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $groupsIdsApprove); |
|
| 190 | 190 | $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule2_submit_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
| 191 | 191 | $groupsIdsSubmit[] = array_values($groupsIdsSubmit); |
| 192 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $groupsIdsSubmit); |
|
| 192 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(_AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $groupsIdsSubmit); |
|
| 193 | 193 | $groupsIdsView = $grouppermHandler->getGroupIds('mymodule2_view_articles', $this->getVar('art_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
| 194 | 194 | $groupsIdsView[] = array_values($groupsIdsView); |
| 195 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $groupsIdsView); |
|
| 195 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox(_AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $groupsIdsView); |
|
| 196 | 196 | } else { |
| 197 | - $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $fullList); |
|
| 198 | - $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $fullList); |
|
| 199 | - $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $fullList); |
|
| 197 | + $groupsCanApproveCheckbox = new \XoopsFormCheckBox(_AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_articles[]', $fullList); |
|
| 198 | + $groupsCanSubmitCheckbox = new \XoopsFormCheckBox(_AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_articles[]', $fullList); |
|
| 199 | + $groupsCanViewCheckbox = new \XoopsFormCheckBox(_AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_articles[]', $fullList); |
|
| 200 | 200 | } |
| 201 | 201 | // To Approve |
| 202 | 202 | $groupsCanApproveCheckbox->addOptionArray($groupList); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | { |
| 248 | 248 | $ret = []; |
| 249 | 249 | $vars = $this->getVars(); |
| 250 | - foreach(array_keys($vars) as $var) { |
|
| 250 | + foreach (array_keys($vars) as $var) { |
|
| 251 | 251 | $ret[$var] = $this->getVar('"{$var}"'); |
| 252 | 252 | } |
| 253 | 253 | return $ret; |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | // require dirname(dirname(__DIR__)) . '/config/config.php'; |
| 52 | 52 | // $config = getConfig(); |
| 53 | 53 | |
| 54 | - $config = include dirname(dirname(__DIR__)) . '/config/config.php'; |
|
| 54 | + $config = include dirname(dirname(__DIR__)).'/config/config.php'; |
|
| 55 | 55 | |
| 56 | 56 | $this->name = $config->name; |
| 57 | 57 | $this->paths = $config->paths; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
| 38 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
| 39 | 39 | } |
| 40 | 40 | } catch (\Exception $e) { |
| 41 | 41 | echo 'Caught exception: ', $e->getMessage(), '<br>'; |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | $dir = opendir($src); |
| 62 | 62 | // @mkdir($dst); |
| 63 | 63 | if (!@mkdir($dst) && !is_dir($dst)) { |
| 64 | - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); |
|
| 64 | + throw new \RuntimeException('The directory '.$dst.' could not be created.'); |
|
| 65 | 65 | } |
| 66 | 66 | while (false !== ($file = readdir($dir))) { |
| 67 | 67 | if (('.' !== $file) && ('..' !== $file)) { |
| 68 | - if (is_dir($src . '/' . $file)) { |
|
| 69 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
| 68 | + if (is_dir($src.'/'.$file)) { |
|
| 69 | + self::recurseCopy($src.'/'.$file, $dst.'/'.$file); |
|
| 70 | 70 | } else { |
| 71 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
| 71 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | self::rrmdir($fObj->getPathname()); |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | - $iterator = null; // clear iterator Obj to close file/directory |
|
| 210 | + $iterator = null; // clear iterator Obj to close file/directory |
|
| 211 | 211 | return rmdir($src); // remove the directory & return results |
| 212 | 212 | } |
| 213 | 213 | |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | $iterator = new \DirectoryIterator($src); |
| 241 | 241 | foreach ($iterator as $fObj) { |
| 242 | 242 | if ($fObj->isFile()) { |
| 243 | - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 243 | + rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 244 | 244 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
| 245 | 245 | // Try recursively on directory |
| 246 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 246 | + self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 247 | 247 | // rmdir($fObj->getPath()); // now delete the directory |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - $iterator = null; // clear iterator Obj to close file/directory |
|
| 250 | + $iterator = null; // clear iterator Obj to close file/directory |
|
| 251 | 251 | return rmdir($src); // remove the directory & return results |
| 252 | 252 | } |
| 253 | 253 | |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | $iterator = new \DirectoryIterator($src); |
| 284 | 284 | foreach ($iterator as $fObj) { |
| 285 | 285 | if ($fObj->isFile()) { |
| 286 | - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 286 | + copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 287 | 287 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
| 288 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
| 288 | + self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -36,19 +36,19 @@ discard block |
||
| 36 | 36 | // $query = $GLOBALS['xoopsDB']->query($sql); |
| 37 | 37 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
| 38 | 38 | $html .= '<fieldset>'; |
| 39 | - $html .= "<legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>'; |
|
| 39 | + $html .= "<legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO').'</legend>'; |
|
| 40 | 40 | $html .= "<div style='padding: 8px;'>"; |
| 41 | 41 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>"; |
| 42 | 42 | // $html .= "<br>"; |
| 43 | 43 | // $html .= "<br>"; |
| 44 | - $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>'; |
|
| 44 | + $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI').'</div>'; |
|
| 45 | 45 | $html .= '<ul>'; |
| 46 | 46 | |
| 47 | - $gdlib = function_exists('gd_info') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
| 48 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
| 47 | + $gdlib = function_exists('gd_info') ? '<span style="color: #008000;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: #ff0000;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>'; |
|
| 48 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib; |
|
| 49 | 49 | if (function_exists('gd_info')) { |
| 50 | 50 | if (true === ($gdlib = gd_info())) { |
| 51 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
| 51 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>'; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -58,18 +58,18 @@ discard block |
||
| 58 | 58 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: #008000;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: #ff0000;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
| 59 | 59 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
| 60 | 60 | |
| 61 | - $downloads = ini_get('file_uploads') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
| 62 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
| 61 | + $downloads = ini_get('file_uploads') ? '<span style="color: #008000;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: #ff0000;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>'; |
|
| 62 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads; |
|
| 63 | 63 | |
| 64 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . ini_get('upload_max_filesize') . '</span></b>'; |
|
| 65 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . ini_get('post_max_size') . '</span></b>'; |
|
| 66 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . ini_get('memory_limit') . '</span></b>'; |
|
| 64 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: #0000ff;">'.ini_get('upload_max_filesize').'</span></b>'; |
|
| 65 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: #0000ff;">'.ini_get('post_max_size').'</span></b>'; |
|
| 66 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: #0000ff;">'.ini_get('memory_limit').'</span></b>'; |
|
| 67 | 67 | $html .= '</ul>'; |
| 68 | 68 | $html .= '<ul>'; |
| 69 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>'; |
|
| 69 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH.'</b>'; |
|
| 70 | 70 | $html .= '</ul>'; |
| 71 | 71 | $html .= '<br>'; |
| 72 | - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; |
|
| 72 | + $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC').''; |
|
| 73 | 73 | $html .= '</div>'; |
| 74 | 74 | $html .= '</fieldset><br>'; |
| 75 | 75 | |