@@ -11,13 +11,13 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormDateElement extends XoopsFormTextDateSelect |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormDateElement constructor. |
|
| 16 | - * @param $object |
|
| 17 | - * @param $key |
|
| 18 | - */ |
|
| 19 | - public function __construct($object, $key) |
|
| 20 | - { |
|
| 21 | - parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e')); |
|
| 22 | - } |
|
| 14 | + /** |
|
| 15 | + * SmartFormDateElement constructor. |
|
| 16 | + * @param $object |
|
| 17 | + * @param $key |
|
| 18 | + */ |
|
| 19 | + public function __construct($object, $key) |
|
| 20 | + { |
|
| 21 | + parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e')); |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -1,61 +1,61 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Contains the set password tray class |
|
| 4 | - * |
|
| 5 | - * @license GNU |
|
| 6 | - * @author marcan <[email protected]> |
|
| 7 | - * @link http://smartfactory.ca The SmartFactory |
|
| 8 | - * @package SmartObject |
|
| 9 | - * @subpackage SmartObjectForm |
|
| 10 | - */ |
|
| 3 | + * Contains the set password tray class |
|
| 4 | + * |
|
| 5 | + * @license GNU |
|
| 6 | + * @author marcan <[email protected]> |
|
| 7 | + * @link http://smartfactory.ca The SmartFactory |
|
| 8 | + * @package SmartObject |
|
| 9 | + * @subpackage SmartObjectForm |
|
| 10 | + */ |
|
| 11 | 11 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 12 | 12 | |
| 13 | 13 | class SmartFormSet_passwordElement extends XoopsFormElementTray |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Size of the field. |
|
| 17 | - * @var int |
|
| 18 | - * @access private |
|
| 19 | - */ |
|
| 20 | - public $_size; |
|
| 15 | + /** |
|
| 16 | + * Size of the field. |
|
| 17 | + * @var int |
|
| 18 | + * @access private |
|
| 19 | + */ |
|
| 20 | + public $_size; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Maximum length of the text |
|
| 24 | - * @var int |
|
| 25 | - * @access private |
|
| 26 | - */ |
|
| 27 | - public $_maxlength; |
|
| 22 | + /** |
|
| 23 | + * Maximum length of the text |
|
| 24 | + * @var int |
|
| 25 | + * @access private |
|
| 26 | + */ |
|
| 27 | + public $_maxlength; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Initial content of the field. |
|
| 31 | - * @var string |
|
| 32 | - * @access private |
|
| 33 | - */ |
|
| 34 | - public $_value; |
|
| 29 | + /** |
|
| 30 | + * Initial content of the field. |
|
| 31 | + * @var string |
|
| 32 | + * @access private |
|
| 33 | + */ |
|
| 34 | + public $_value; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Constructor |
|
| 38 | - * |
|
| 39 | - * @param string $object |
|
| 40 | - * @param string $key |
|
| 41 | - * @internal param string $caption Caption |
|
| 42 | - * @internal param string $name "name" attribute |
|
| 43 | - * @internal param int $size Size of the field |
|
| 44 | - * @internal param int $maxlength Maximum length of the text |
|
| 45 | - * @internal param int $value Initial value of the field. |
|
| 46 | - * <b>Warning:</b> this is readable in cleartext in the page's source! |
|
| 47 | - */ |
|
| 48 | - public function __construct($object, $key) |
|
| 49 | - { |
|
| 50 | - $var = $object->vars[$key]; |
|
| 51 | - $control = $object->controls[$key]; |
|
| 36 | + /** |
|
| 37 | + * Constructor |
|
| 38 | + * |
|
| 39 | + * @param string $object |
|
| 40 | + * @param string $key |
|
| 41 | + * @internal param string $caption Caption |
|
| 42 | + * @internal param string $name "name" attribute |
|
| 43 | + * @internal param int $size Size of the field |
|
| 44 | + * @internal param int $maxlength Maximum length of the text |
|
| 45 | + * @internal param int $value Initial value of the field. |
|
| 46 | + * <b>Warning:</b> this is readable in cleartext in the page's source! |
|
| 47 | + */ |
|
| 48 | + public function __construct($object, $key) |
|
| 49 | + { |
|
| 50 | + $var = $object->vars[$key]; |
|
| 51 | + $control = $object->controls[$key]; |
|
| 52 | 52 | |
| 53 | - parent::__construct($var['form_caption'] . '<br />' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
| 53 | + parent::__construct($var['form_caption'] . '<br />' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
| 54 | 54 | |
| 55 | - $password_box1 = new XoopsFormPassword('', $key . '1', 10, 32); |
|
| 56 | - $this->addElement($password_box1); |
|
| 55 | + $password_box1 = new XoopsFormPassword('', $key . '1', 10, 32); |
|
| 56 | + $this->addElement($password_box1); |
|
| 57 | 57 | |
| 58 | - $password_box2 = new XoopsFormPassword('', $key . '2', 10, 32); |
|
| 59 | - $this->addElement($password_box2); |
|
| 60 | - } |
|
| 58 | + $password_box2 = new XoopsFormPassword('', $key . '2', 10, 32); |
|
| 59 | + $this->addElement($password_box2); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -16,27 +16,27 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class SmartFormFileUploadElement extends SmartFormUploadElement |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * SmartFormFileUploadElement constructor. |
|
| 21 | - * @param string $object |
|
| 22 | - * @param string $key |
|
| 23 | - */ |
|
| 24 | - public function __construct($object, $key) |
|
| 25 | - { |
|
| 26 | - $this->SmartFormFileElement($object, $key); |
|
| 27 | - // Override name for upload purposes |
|
| 28 | - $this->setName('upload_' . $key); |
|
| 29 | - } |
|
| 19 | + /** |
|
| 20 | + * SmartFormFileUploadElement constructor. |
|
| 21 | + * @param string $object |
|
| 22 | + * @param string $key |
|
| 23 | + */ |
|
| 24 | + public function __construct($object, $key) |
|
| 25 | + { |
|
| 26 | + $this->SmartFormFileElement($object, $key); |
|
| 27 | + // Override name for upload purposes |
|
| 28 | + $this->setName('upload_' . $key); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * prepare HTML for output |
|
| 33 | - * |
|
| 34 | - * @return string HTML |
|
| 35 | - */ |
|
| 36 | - public function render() |
|
| 37 | - { |
|
| 38 | - return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "' /> |
|
| 31 | + /** |
|
| 32 | + * prepare HTML for output |
|
| 33 | + * |
|
| 34 | + * @return string HTML |
|
| 35 | + */ |
|
| 36 | + public function render() |
|
| 37 | + { |
|
| 38 | + return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "' /> |
|
| 39 | 39 | <input type='file' name='upload_" . $this->getName() . "' id='upload_" . $this->getName() . "'" . $this->getExtra() . " /> |
| 40 | 40 | <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "' />"; |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -11,20 +11,20 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormLanguageElement extends XoopsFormSelectLang |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormLanguageElement constructor. |
|
| 16 | - * @param string $object |
|
| 17 | - * @param string $key |
|
| 18 | - */ |
|
| 19 | - public function __construct($object, $key) |
|
| 20 | - { |
|
| 21 | - $var = $object->vars[$key]; |
|
| 22 | - $control = $object->controls[$key]; |
|
| 23 | - $all = isset($control['all']) ? true : false; |
|
| 14 | + /** |
|
| 15 | + * SmartFormLanguageElement constructor. |
|
| 16 | + * @param string $object |
|
| 17 | + * @param string $key |
|
| 18 | + */ |
|
| 19 | + public function __construct($object, $key) |
|
| 20 | + { |
|
| 21 | + $var = $object->vars[$key]; |
|
| 22 | + $control = $object->controls[$key]; |
|
| 23 | + $all = isset($control['all']) ? true : false; |
|
| 24 | 24 | |
| 25 | - parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 26 | - if ($all) { |
|
| 27 | - $this->addOption('all', _ALL); |
|
| 28 | - } |
|
| 29 | - } |
|
| 25 | + parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 26 | + if ($all) { |
|
| 27 | + $this->addOption('all', _ALL); |
|
| 28 | + } |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -11,39 +11,39 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormRichFileElement extends XoopsFormElementTray |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormRichFileElement constructor. |
|
| 16 | - * @param string $form_caption |
|
| 17 | - * @param string $key |
|
| 18 | - * @param string $object |
|
| 19 | - */ |
|
| 20 | - public function __construct($form_caption, $key, $object) |
|
| 21 | - { |
|
| 22 | - parent::__construct($form_caption, ' '); |
|
| 23 | - if ($object->getVar('url') != '') { |
|
| 24 | - $caption = $object->getVar('caption') != '' ? $object->getVar('caption') : $object->getVar('url'); |
|
| 25 | - $this->addElement(new XoopsFormLabel('', _CO_SOBJECT_CURRENT_FILE . "<a href='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar('url')) . "' target='_blank' >" . $caption . '</a><br/><br/>')); |
|
| 26 | - //$this->addElement( new XoopsFormLabel( '', "<br/><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>")); |
|
| 27 | - } |
|
| 14 | + /** |
|
| 15 | + * SmartFormRichFileElement constructor. |
|
| 16 | + * @param string $form_caption |
|
| 17 | + * @param string $key |
|
| 18 | + * @param string $object |
|
| 19 | + */ |
|
| 20 | + public function __construct($form_caption, $key, $object) |
|
| 21 | + { |
|
| 22 | + parent::__construct($form_caption, ' '); |
|
| 23 | + if ($object->getVar('url') != '') { |
|
| 24 | + $caption = $object->getVar('caption') != '' ? $object->getVar('caption') : $object->getVar('url'); |
|
| 25 | + $this->addElement(new XoopsFormLabel('', _CO_SOBJECT_CURRENT_FILE . "<a href='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar('url')) . "' target='_blank' >" . $caption . '</a><br/><br/>')); |
|
| 26 | + //$this->addElement( new XoopsFormLabel( '', "<br/><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>")); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - include_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php'; |
|
| 30 | - if ($object->isNew()) { |
|
| 31 | - $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 32 | - $this->addElement(new XoopsFormLabel('', '<br/><br/><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 33 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URL_FILE)); |
|
| 34 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 35 | - } |
|
| 36 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION)); |
|
| 37 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 38 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>')); |
|
| 39 | - $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 29 | + include_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php'; |
|
| 30 | + if ($object->isNew()) { |
|
| 31 | + $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 32 | + $this->addElement(new XoopsFormLabel('', '<br/><br/><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 33 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URL_FILE)); |
|
| 34 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 35 | + } |
|
| 36 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION)); |
|
| 37 | + $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 38 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>')); |
|
| 39 | + $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 40 | 40 | |
| 41 | - if (!$object->isNew()) { |
|
| 42 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CHANGE_FILE)); |
|
| 43 | - $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 44 | - $this->addElement(new XoopsFormLabel('', '<br/><br/><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 45 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URL_FILE)); |
|
| 46 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 47 | - } |
|
| 48 | - } |
|
| 41 | + if (!$object->isNew()) { |
|
| 42 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CHANGE_FILE)); |
|
| 43 | + $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 44 | + $this->addElement(new XoopsFormLabel('', '<br/><br/><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 45 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URL_FILE)); |
|
| 46 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -11,23 +11,23 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormTimeElement extends XoopsFormSelect |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormTimeElement constructor. |
|
| 16 | - * @param string $object |
|
| 17 | - * @param string $key |
|
| 18 | - */ |
|
| 19 | - public function __construct($object, $key) |
|
| 20 | - { |
|
| 21 | - $var = $object->vars[$key]; |
|
| 22 | - $timearray = array(); |
|
| 23 | - for ($i = 0; $i < 24; ++$i) { |
|
| 24 | - for ($j = 0; $j < 60; $j = $j + 10) { |
|
| 25 | - $key_t = ($i * 3600) + ($j * 60); |
|
| 26 | - $timearray[$key_t] = ($j != 0) ? $i . ':' . $j : $i . ':0' . $j; |
|
| 27 | - } |
|
| 28 | - } |
|
| 29 | - ksort($timearray); |
|
| 30 | - parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 31 | - $this->addOptionArray($timearray); |
|
| 32 | - } |
|
| 14 | + /** |
|
| 15 | + * SmartFormTimeElement constructor. |
|
| 16 | + * @param string $object |
|
| 17 | + * @param string $key |
|
| 18 | + */ |
|
| 19 | + public function __construct($object, $key) |
|
| 20 | + { |
|
| 21 | + $var = $object->vars[$key]; |
|
| 22 | + $timearray = array(); |
|
| 23 | + for ($i = 0; $i < 24; ++$i) { |
|
| 24 | + for ($j = 0; $j < 60; $j = $j + 10) { |
|
| 25 | + $key_t = ($i * 3600) + ($j * 60); |
|
| 26 | + $timearray[$key_t] = ($j != 0) ? $i . ':' . $j : $i . ':0' . $j; |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | + ksort($timearray); |
|
| 30 | + parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 31 | + $this->addOptionArray($timearray); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -1,34 +1,34 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Contains the set password tray class |
|
| 4 | - * |
|
| 5 | - * @license GNU |
|
| 6 | - * @author marcan <[email protected]> |
|
| 7 | - * @link http://smartfactory.ca The SmartFactory |
|
| 8 | - * @package SmartObject |
|
| 9 | - * @subpackage SmartObjectForm |
|
| 10 | - */ |
|
| 3 | + * Contains the set password tray class |
|
| 4 | + * |
|
| 5 | + * @license GNU |
|
| 6 | + * @author marcan <[email protected]> |
|
| 7 | + * @link http://smartfactory.ca The SmartFactory |
|
| 8 | + * @package SmartObject |
|
| 9 | + * @subpackage SmartObjectForm |
|
| 10 | + */ |
|
| 11 | 11 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 12 | 12 | |
| 13 | 13 | class SmartFormUser_sigElement extends XoopsFormElementTray |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * SmartFormUser_sigElement constructor. |
|
| 17 | - * @param string $object |
|
| 18 | - * @param string $key |
|
| 19 | - */ |
|
| 20 | - public function __construct($object, $key) |
|
| 21 | - { |
|
| 22 | - $var = $object->vars[$key]; |
|
| 23 | - $control = $object->controls[$key]; |
|
| 15 | + /** |
|
| 16 | + * SmartFormUser_sigElement constructor. |
|
| 17 | + * @param string $object |
|
| 18 | + * @param string $key |
|
| 19 | + */ |
|
| 20 | + public function __construct($object, $key) |
|
| 21 | + { |
|
| 22 | + $var = $object->vars[$key]; |
|
| 23 | + $control = $object->controls[$key]; |
|
| 24 | 24 | |
| 25 | - parent::__construct($var['form_caption'], '<br /><br />', $key . '_signature_tray'); |
|
| 25 | + parent::__construct($var['form_caption'], '<br /><br />', $key . '_signature_tray'); |
|
| 26 | 26 | |
| 27 | - $signature_textarea = new XoopsFormDhtmlTextArea('', $key, $object->getVar($key, 'e')); |
|
| 28 | - $this->addElement($signature_textarea); |
|
| 27 | + $signature_textarea = new XoopsFormDhtmlTextArea('', $key, $object->getVar($key, 'e')); |
|
| 28 | + $this->addElement($signature_textarea); |
|
| 29 | 29 | |
| 30 | - $attach_checkbox = new XoopsFormCheckBox('', 'attachsig', $object->getVar('attachsig', 'e')); |
|
| 31 | - $attach_checkbox->addOption(1, _US_SHOWSIG); |
|
| 32 | - $this->addElement($attach_checkbox); |
|
| 33 | - } |
|
| 30 | + $attach_checkbox = new XoopsFormCheckBox('', 'attachsig', $object->getVar('attachsig', 'e')); |
|
| 31 | + $attach_checkbox->addOption(1, _US_SHOWSIG); |
|
| 32 | + $this->addElement($attach_checkbox); |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -11,59 +11,59 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormSelectElement extends XoopsFormSelect |
| 13 | 13 | { |
| 14 | - public $multiple = false; |
|
| 14 | + public $multiple = false; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * SmartFormSelectElement constructor. |
|
| 18 | - * @param string $object |
|
| 19 | - * @param string $key |
|
| 20 | - */ |
|
| 21 | - public function __construct($object, $key) |
|
| 22 | - { |
|
| 23 | - $var = $object->vars[$key]; |
|
| 24 | - $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1); |
|
| 16 | + /** |
|
| 17 | + * SmartFormSelectElement constructor. |
|
| 18 | + * @param string $object |
|
| 19 | + * @param string $key |
|
| 20 | + */ |
|
| 21 | + public function __construct($object, $key) |
|
| 22 | + { |
|
| 23 | + $var = $object->vars[$key]; |
|
| 24 | + $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1); |
|
| 25 | 25 | |
| 26 | - // Adding the options inside this SelectBox |
|
| 27 | - // If the custom method is not from a module, than it's from the core |
|
| 28 | - $control = $object->getControl($key); |
|
| 26 | + // Adding the options inside this SelectBox |
|
| 27 | + // If the custom method is not from a module, than it's from the core |
|
| 28 | + $control = $object->getControl($key); |
|
| 29 | 29 | |
| 30 | - $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e'); |
|
| 30 | + $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e'); |
|
| 31 | 31 | |
| 32 | - parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple); |
|
| 32 | + parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple); |
|
| 33 | 33 | |
| 34 | - if (isset($control['options'])) { |
|
| 35 | - $this->addOptionArray($control['options']); |
|
| 36 | - } else { |
|
| 37 | - // let's find if the method we need to call comes from an already defined object |
|
| 38 | - if (isset($control['object'])) { |
|
| 39 | - if (method_exists($control['object'], $control['method'])) { |
|
| 40 | - if ($option_array = $control['object']->{$control['method']}()) { |
|
| 41 | - // Adding the options array to the XoopsFormSelect |
|
| 42 | - $this->addOptionArray($option_array); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - } else { |
|
| 46 | - // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 47 | - if (isset($control['itemHandler'])) { |
|
| 48 | - if (!$control['module']) { |
|
| 49 | - // Creating the specified core object handler |
|
| 50 | - $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 51 | - } else { |
|
| 52 | - $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $controlHandler =& $object->handler; |
|
| 56 | - } |
|
| 34 | + if (isset($control['options'])) { |
|
| 35 | + $this->addOptionArray($control['options']); |
|
| 36 | + } else { |
|
| 37 | + // let's find if the method we need to call comes from an already defined object |
|
| 38 | + if (isset($control['object'])) { |
|
| 39 | + if (method_exists($control['object'], $control['method'])) { |
|
| 40 | + if ($option_array = $control['object']->{$control['method']}()) { |
|
| 41 | + // Adding the options array to the XoopsFormSelect |
|
| 42 | + $this->addOptionArray($option_array); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + } else { |
|
| 46 | + // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 47 | + if (isset($control['itemHandler'])) { |
|
| 48 | + if (!$control['module']) { |
|
| 49 | + // Creating the specified core object handler |
|
| 50 | + $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 51 | + } else { |
|
| 52 | + $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $controlHandler =& $object->handler; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - // Checking if the specified method exists |
|
| 59 | - if (method_exists($controlHandler, $control['method'])) { |
|
| 60 | - // TODO: How could I pass the parameters in the following call ... |
|
| 61 | - if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 62 | - // Adding the options array to the XoopsFormSelect |
|
| 63 | - $this->addOptionArray($option_array); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - } |
|
| 58 | + // Checking if the specified method exists |
|
| 59 | + if (method_exists($controlHandler, $control['method'])) { |
|
| 60 | + // TODO: How could I pass the parameters in the following call ... |
|
| 61 | + if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 62 | + // Adding the options array to the XoopsFormSelect |
|
| 63 | + $this->addOptionArray($option_array); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | - $controlHandler =& $object->handler; |
|
| 55 | + $controlHandler = & $object->handler; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Checking if the specified method exists |
@@ -11,36 +11,36 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormUserElement extends XoopsFormSelect |
| 13 | 13 | { |
| 14 | - public $multiple = false; |
|
| 14 | + public $multiple = false; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * SmartFormUserElement constructor. |
|
| 18 | - * @param string $object |
|
| 19 | - * @param string $key |
|
| 20 | - */ |
|
| 21 | - public function __construct($object, $key) |
|
| 22 | - { |
|
| 23 | - $var = $object->vars[$key]; |
|
| 24 | - $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1); |
|
| 16 | + /** |
|
| 17 | + * SmartFormUserElement constructor. |
|
| 18 | + * @param string $object |
|
| 19 | + * @param string $key |
|
| 20 | + */ |
|
| 21 | + public function __construct($object, $key) |
|
| 22 | + { |
|
| 23 | + $var = $object->vars[$key]; |
|
| 24 | + $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1); |
|
| 25 | 25 | |
| 26 | - parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $size, $this->multiple); |
|
| 26 | + parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $size, $this->multiple); |
|
| 27 | 27 | |
| 28 | - // Adding the options inside this SelectBox |
|
| 29 | - // If the custom method is not from a module, than it's from the core |
|
| 30 | - $control = $object->getControl($key); |
|
| 28 | + // Adding the options inside this SelectBox |
|
| 29 | + // If the custom method is not from a module, than it's from the core |
|
| 30 | + $control = $object->getControl($key); |
|
| 31 | 31 | |
| 32 | - global $xoopsDB; |
|
| 33 | - $ret = array(); |
|
| 34 | - $limit = $start = 0; |
|
| 35 | - $sql = 'SELECT uid, uname FROM ' . $xoopsDB->prefix('users'); |
|
| 36 | - $sql .= ' ORDER BY uname ASC'; |
|
| 32 | + global $xoopsDB; |
|
| 33 | + $ret = array(); |
|
| 34 | + $limit = $start = 0; |
|
| 35 | + $sql = 'SELECT uid, uname FROM ' . $xoopsDB->prefix('users'); |
|
| 36 | + $sql .= ' ORDER BY uname ASC'; |
|
| 37 | 37 | |
| 38 | - $result = $xoopsDB->query($sql); |
|
| 39 | - if ($result) { |
|
| 40 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 41 | - $uArray[$myrow['uid']] = $myrow['uname']; |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - $this->addOptionArray($uArray); |
|
| 45 | - } |
|
| 38 | + $result = $xoopsDB->query($sql); |
|
| 39 | + if ($result) { |
|
| 40 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 41 | + $uArray[$myrow['uid']] = $myrow['uname']; |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + $this->addOptionArray($uArray); |
|
| 45 | + } |
|
| 46 | 46 | } |