@@ -7,38 +7,38 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class SmartFormFileElement extends \XoopsFormFile |
| 9 | 9 | { |
| 10 | - public $object; |
|
| 11 | - public $key; |
|
| 10 | + public $object; |
|
| 11 | + public $key; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * SmartFormFileElement constructor. |
|
| 15 | - * @param string $object |
|
| 16 | - * @param string $key |
|
| 17 | - */ |
|
| 18 | - public function __construct($object, $key) |
|
| 19 | - { |
|
| 20 | - $this->object = $object; |
|
| 21 | - $this->key = $key; |
|
| 22 | - parent::__construct($object->vars[$key]['form_caption'], $key, isset($object->vars[$key]['form_maxfilesize']) ? $object->vars[$key]['form_maxfilesize'] : 0); |
|
| 23 | - $this->setExtra(' size=50'); |
|
| 24 | - } |
|
| 13 | + /** |
|
| 14 | + * SmartFormFileElement constructor. |
|
| 15 | + * @param string $object |
|
| 16 | + * @param string $key |
|
| 17 | + */ |
|
| 18 | + public function __construct($object, $key) |
|
| 19 | + { |
|
| 20 | + $this->object = $object; |
|
| 21 | + $this->key = $key; |
|
| 22 | + parent::__construct($object->vars[$key]['form_caption'], $key, isset($object->vars[$key]['form_maxfilesize']) ? $object->vars[$key]['form_maxfilesize'] : 0); |
|
| 23 | + $this->setExtra(' size=50'); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * prepare HTML for output |
|
| 28 | - * |
|
| 29 | - * @return string HTML |
|
| 30 | - */ |
|
| 31 | - public function render() |
|
| 32 | - { |
|
| 33 | - $ret = ''; |
|
| 34 | - if ('' !== $this->object->getVar($this->key)) { |
|
| 35 | - $ret .= '<div>' . _CO_SOBJECT_CURRENT_FILE . $this->object->getVar($this->key) . '</div>'; |
|
| 36 | - } |
|
| 26 | + /** |
|
| 27 | + * prepare HTML for output |
|
| 28 | + * |
|
| 29 | + * @return string HTML |
|
| 30 | + */ |
|
| 31 | + public function render() |
|
| 32 | + { |
|
| 33 | + $ret = ''; |
|
| 34 | + if ('' !== $this->object->getVar($this->key)) { |
|
| 35 | + $ret .= '<div>' . _CO_SOBJECT_CURRENT_FILE . $this->object->getVar($this->key) . '</div>'; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $ret .= "<div><input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'> |
|
| 38 | + $ret .= "<div><input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'> |
|
| 39 | 39 | <input type='file' name='" . $this->getName() . "' id='" . $this->getName() . "'" . $this->getExtra() . "> |
| 40 | 40 | <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "'></div>"; |
| 41 | 41 | |
| 42 | - return $ret; |
|
| 43 | - } |
|
| 42 | + return $ret; |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -19,27 +19,27 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class SmartFormFileUploadElement extends Smartobject\Form\Elements\SmartFormUploadElement |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * SmartFormFileUploadElement constructor. |
|
| 24 | - * @param string $object |
|
| 25 | - * @param string $key |
|
| 26 | - */ |
|
| 27 | - public function __construct($object, $key) |
|
| 28 | - { |
|
| 29 | - $this->SmartFormFileElement($object, $key); |
|
| 30 | - // Override name for upload purposes |
|
| 31 | - $this->setName('upload_' . $key); |
|
| 32 | - } |
|
| 22 | + /** |
|
| 23 | + * SmartFormFileUploadElement constructor. |
|
| 24 | + * @param string $object |
|
| 25 | + * @param string $key |
|
| 26 | + */ |
|
| 27 | + public function __construct($object, $key) |
|
| 28 | + { |
|
| 29 | + $this->SmartFormFileElement($object, $key); |
|
| 30 | + // Override name for upload purposes |
|
| 31 | + $this->setName('upload_' . $key); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * prepare HTML for output |
|
| 36 | - * |
|
| 37 | - * @return string HTML |
|
| 38 | - */ |
|
| 39 | - public function render() |
|
| 40 | - { |
|
| 41 | - return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'> |
|
| 34 | + /** |
|
| 35 | + * prepare HTML for output |
|
| 36 | + * |
|
| 37 | + * @return string HTML |
|
| 38 | + */ |
|
| 39 | + public function render() |
|
| 40 | + { |
|
| 41 | + return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'> |
|
| 42 | 42 | <input type='file' name='upload_" . $this->getName() . "' id='upload_" . $this->getName() . "'" . $this->getExtra() . "> |
| 43 | 43 | <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "'>"; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $this->SmartFormFileElement($object, $key); |
| 30 | 30 | // Override name for upload purposes |
| 31 | - $this->setName('upload_' . $key); |
|
| 31 | + $this->setName('upload_'.$key); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function render() |
| 40 | 40 | { |
| 41 | - return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'> |
|
| 42 | - <input type='file' name='upload_" . $this->getName() . "' id='upload_" . $this->getName() . "'" . $this->getExtra() . "> |
|
| 43 | - <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "'>"; |
|
| 41 | + return "<input type='hidden' name='MAX_FILE_SIZE' value='".$this->getMaxFileSize()."'> |
|
| 42 | + <input type='file' name='upload_" . $this->getName()."' id='upload_".$this->getName()."'".$this->getExtra()."> |
|
| 43 | + <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName()."'>"; |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -19,50 +19,50 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class SmartFormSetPasswordElement extends \XoopsFormElementTray |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Size of the field. |
|
| 24 | - * @var int |
|
| 25 | - * @access private |
|
| 26 | - */ |
|
| 27 | - public $_size; |
|
| 22 | + /** |
|
| 23 | + * Size of the field. |
|
| 24 | + * @var int |
|
| 25 | + * @access private |
|
| 26 | + */ |
|
| 27 | + public $_size; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Maximum length of the text |
|
| 31 | - * @var int |
|
| 32 | - * @access private |
|
| 33 | - */ |
|
| 34 | - public $_maxlength; |
|
| 29 | + /** |
|
| 30 | + * Maximum length of the text |
|
| 31 | + * @var int |
|
| 32 | + * @access private |
|
| 33 | + */ |
|
| 34 | + public $_maxlength; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Initial content of the field. |
|
| 38 | - * @var string |
|
| 39 | - * @access private |
|
| 40 | - */ |
|
| 41 | - public $_value; |
|
| 36 | + /** |
|
| 37 | + * Initial content of the field. |
|
| 38 | + * @var string |
|
| 39 | + * @access private |
|
| 40 | + */ |
|
| 41 | + public $_value; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Constructor |
|
| 45 | - * |
|
| 46 | - * @param string $object |
|
| 47 | - * @param string $key |
|
| 48 | - * @internal param string $caption Caption |
|
| 49 | - * @internal param string $name "name" attribute |
|
| 50 | - * @internal param int $size Size of the field |
|
| 51 | - * @internal param int $maxlength Maximum length of the text |
|
| 52 | - * @internal param int $value Initial value of the field. |
|
| 53 | - * <b>Warning:</b> this is readable in cleartext in the page's source! |
|
| 54 | - */ |
|
| 55 | - public function __construct($object, $key) |
|
| 56 | - { |
|
| 57 | - $var = $object->vars[$key]; |
|
| 58 | - $control = $object->controls[$key]; |
|
| 43 | + /** |
|
| 44 | + * Constructor |
|
| 45 | + * |
|
| 46 | + * @param string $object |
|
| 47 | + * @param string $key |
|
| 48 | + * @internal param string $caption Caption |
|
| 49 | + * @internal param string $name "name" attribute |
|
| 50 | + * @internal param int $size Size of the field |
|
| 51 | + * @internal param int $maxlength Maximum length of the text |
|
| 52 | + * @internal param int $value Initial value of the field. |
|
| 53 | + * <b>Warning:</b> this is readable in cleartext in the page's source! |
|
| 54 | + */ |
|
| 55 | + public function __construct($object, $key) |
|
| 56 | + { |
|
| 57 | + $var = $object->vars[$key]; |
|
| 58 | + $control = $object->controls[$key]; |
|
| 59 | 59 | |
| 60 | - parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
| 60 | + parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
| 61 | 61 | |
| 62 | - $password_box1 = new \XoopsFormPassword('', $key . '1', 10, 32); |
|
| 63 | - $this->addElement($password_box1); |
|
| 62 | + $password_box1 = new \XoopsFormPassword('', $key . '1', 10, 32); |
|
| 63 | + $this->addElement($password_box1); |
|
| 64 | 64 | |
| 65 | - $password_box2 = new \XoopsFormPassword('', $key . '2', 10, 32); |
|
| 66 | - $this->addElement($password_box2); |
|
| 67 | - } |
|
| 65 | + $password_box2 = new \XoopsFormPassword('', $key . '2', 10, 32); |
|
| 66 | + $this->addElement($password_box2); |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -57,12 +57,12 @@ |
||
| 57 | 57 | $var = $object->vars[$key]; |
| 58 | 58 | $control = $object->controls[$key]; |
| 59 | 59 | |
| 60 | - parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
| 60 | + parent::__construct($var['form_caption'].'<br>'._US_TYPEPASSTWICE, ' ', $key.'_password_tray'); |
|
| 61 | 61 | |
| 62 | - $password_box1 = new \XoopsFormPassword('', $key . '1', 10, 32); |
|
| 62 | + $password_box1 = new \XoopsFormPassword('', $key.'1', 10, 32); |
|
| 63 | 63 | $this->addElement($password_box1); |
| 64 | 64 | |
| 65 | - $password_box2 = new \XoopsFormPassword('', $key . '2', 10, 32); |
|
| 65 | + $password_box2 = new \XoopsFormPassword('', $key.'2', 10, 32); |
|
| 66 | 66 | $this->addElement($password_box2); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -26,41 +26,41 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class SmartFormSection extends \XoopsFormElement |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * Text |
|
| 31 | - * @var string |
|
| 32 | - * @access private |
|
| 33 | - */ |
|
| 34 | - public $_value; |
|
| 29 | + /** |
|
| 30 | + * Text |
|
| 31 | + * @var string |
|
| 32 | + * @access private |
|
| 33 | + */ |
|
| 34 | + public $_value; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * SmartFormSection constructor. |
|
| 38 | - * @param $sectionname |
|
| 39 | - * @param bool $value |
|
| 40 | - */ |
|
| 41 | - public function __construct($sectionname, $value = false) |
|
| 42 | - { |
|
| 43 | - $this->setName($sectionname); |
|
| 44 | - $this->_value = $value; |
|
| 45 | - } |
|
| 36 | + /** |
|
| 37 | + * SmartFormSection constructor. |
|
| 38 | + * @param $sectionname |
|
| 39 | + * @param bool $value |
|
| 40 | + */ |
|
| 41 | + public function __construct($sectionname, $value = false) |
|
| 42 | + { |
|
| 43 | + $this->setName($sectionname); |
|
| 44 | + $this->_value = $value; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get the text |
|
| 49 | - * |
|
| 50 | - * @return string |
|
| 51 | - */ |
|
| 52 | - public function getValue() |
|
| 53 | - { |
|
| 54 | - return $this->_value; |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * Get the text |
|
| 49 | + * |
|
| 50 | + * @return string |
|
| 51 | + */ |
|
| 52 | + public function getValue() |
|
| 53 | + { |
|
| 54 | + return $this->_value; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Prepare HTML for output |
|
| 59 | - * |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - public function render() |
|
| 63 | - { |
|
| 64 | - return $this->getValue(); |
|
| 65 | - } |
|
| 57 | + /** |
|
| 58 | + * Prepare HTML for output |
|
| 59 | + * |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + public function render() |
|
| 63 | + { |
|
| 64 | + return $this->getValue(); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -26,41 +26,41 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class SmartFormSectionClose extends \XoopsFormElement |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * Text |
|
| 31 | - * @var string |
|
| 32 | - * @access private |
|
| 33 | - */ |
|
| 34 | - public $_value; |
|
| 29 | + /** |
|
| 30 | + * Text |
|
| 31 | + * @var string |
|
| 32 | + * @access private |
|
| 33 | + */ |
|
| 34 | + public $_value; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * SmartFormSectionClose constructor. |
|
| 38 | - * @param $sectionname |
|
| 39 | - * @param bool $value |
|
| 40 | - */ |
|
| 41 | - public function __construct($sectionname, $value = false) |
|
| 42 | - { |
|
| 43 | - $this->setName($sectionname); |
|
| 44 | - $this->_value = $value; |
|
| 45 | - } |
|
| 36 | + /** |
|
| 37 | + * SmartFormSectionClose constructor. |
|
| 38 | + * @param $sectionname |
|
| 39 | + * @param bool $value |
|
| 40 | + */ |
|
| 41 | + public function __construct($sectionname, $value = false) |
|
| 42 | + { |
|
| 43 | + $this->setName($sectionname); |
|
| 44 | + $this->_value = $value; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get the text |
|
| 49 | - * |
|
| 50 | - * @return string |
|
| 51 | - */ |
|
| 52 | - public function getValue() |
|
| 53 | - { |
|
| 54 | - return $this->_value; |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * Get the text |
|
| 49 | + * |
|
| 50 | + * @return string |
|
| 51 | + */ |
|
| 52 | + public function getValue() |
|
| 53 | + { |
|
| 54 | + return $this->_value; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Prepare HTML for output |
|
| 59 | - * |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - public function render() |
|
| 63 | - { |
|
| 64 | - return $this->getValue(); |
|
| 65 | - } |
|
| 57 | + /** |
|
| 58 | + * Prepare HTML for output |
|
| 59 | + * |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + public function render() |
|
| 63 | + { |
|
| 64 | + return $this->getValue(); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class SmartFormEmailElement extends \XoopsFormElement |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @param bool $withtags |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 33 | - public function renderValidationJS($withtags = true) |
|
| 34 | - { |
|
| 35 | - $js = ''; |
|
| 29 | + /** |
|
| 30 | + * @param bool $withtags |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | + public function renderValidationJS($withtags = true) |
|
| 34 | + { |
|
| 35 | + $js = ''; |
|
| 36 | 36 | |
| 37 | - return $js; |
|
| 38 | - } |
|
| 37 | + return $js; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -17,13 +17,13 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class SmartFormDateTimeElement extends \XoopsFormDateTime |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * SmartFormDateTimeElement constructor. |
|
| 22 | - * @param mixed $object |
|
| 23 | - * @param mixed $key |
|
| 24 | - */ |
|
| 25 | - public function __construct($object, $key) |
|
| 26 | - { |
|
| 27 | - parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e')); |
|
| 28 | - } |
|
| 20 | + /** |
|
| 21 | + * SmartFormDateTimeElement constructor. |
|
| 22 | + * @param mixed $object |
|
| 23 | + * @param mixed $key |
|
| 24 | + */ |
|
| 25 | + public function __construct($object, $key) |
|
| 26 | + { |
|
| 27 | + parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e')); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -18,39 +18,39 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class SmartFormRichFileElement extends \XoopsFormElementTray |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * SmartFormRichFileElement constructor. |
|
| 23 | - * @param string $form_caption |
|
| 24 | - * @param string $key |
|
| 25 | - * @param string $object |
|
| 26 | - */ |
|
| 27 | - public function __construct($form_caption, $key, $object) |
|
| 28 | - { |
|
| 29 | - parent::__construct($form_caption, ' '); |
|
| 30 | - if ('' !== $object->getVar('url')) { |
|
| 31 | - $caption = '' !== $object->getVar('caption') ? $object->getVar('caption') : $object->getVar('url'); |
|
| 32 | - $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>')); |
|
| 33 | - //$this->addElement( new \XoopsFormLabel( '', "<br><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>")); |
|
| 34 | - } |
|
| 21 | + /** |
|
| 22 | + * SmartFormRichFileElement constructor. |
|
| 23 | + * @param string $form_caption |
|
| 24 | + * @param string $key |
|
| 25 | + * @param string $object |
|
| 26 | + */ |
|
| 27 | + public function __construct($form_caption, $key, $object) |
|
| 28 | + { |
|
| 29 | + parent::__construct($form_caption, ' '); |
|
| 30 | + if ('' !== $object->getVar('url')) { |
|
| 31 | + $caption = '' !== $object->getVar('caption') ? $object->getVar('caption') : $object->getVar('url'); |
|
| 32 | + $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>')); |
|
| 33 | + //$this->addElement( new \XoopsFormLabel( '', "<br><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>")); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php'; |
| 37 | - if ($object->isNew()) { |
|
| 38 | - $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 39 | - $this->addElement(new \XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 40 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 41 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 42 | - } |
|
| 43 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION)); |
|
| 44 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 45 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>')); |
|
| 46 | - $this->addElement(new \XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 37 | + if ($object->isNew()) { |
|
| 38 | + $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 39 | + $this->addElement(new \XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 40 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 41 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 42 | + } |
|
| 43 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION)); |
|
| 44 | + $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 45 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>')); |
|
| 46 | + $this->addElement(new \XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 47 | 47 | |
| 48 | - if (!$object->isNew()) { |
|
| 49 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CHANGE_FILE)); |
|
| 50 | - $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 51 | - $this->addElement(new \XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 52 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 53 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 54 | - } |
|
| 55 | - } |
|
| 48 | + if (!$object->isNew()) { |
|
| 49 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CHANGE_FILE)); |
|
| 50 | + $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 51 | + $this->addElement(new \XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 52 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 53 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -29,28 +29,28 @@ |
||
| 29 | 29 | parent::__construct($form_caption, ' '); |
| 30 | 30 | if ('' !== $object->getVar('url')) { |
| 31 | 31 | $caption = '' !== $object->getVar('caption') ? $object->getVar('caption') : $object->getVar('url'); |
| 32 | - $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>')); |
|
| 32 | + $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>')); |
|
| 33 | 33 | //$this->addElement( new \XoopsFormLabel( '', "<br><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>")); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php'; |
| 37 | 37 | if ($object->isNew()) { |
| 38 | 38 | $this->addElement(new SmartFormFileUploadElement($object, $key)); |
| 39 | - $this->addElement(new \XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 40 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 41 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 39 | + $this->addElement(new \XoopsFormLabel('', '<br><br><small>'._CO_SOBJECT_URL_FILE_DSC.'</small>')); |
|
| 40 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_URL_FILE)); |
|
| 41 | + $this->addElement(new SmartFormTextElement($object, 'url_'.$key)); |
|
| 42 | 42 | } |
| 43 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION)); |
|
| 44 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 45 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>')); |
|
| 46 | - $this->addElement(new \XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 43 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_CAPTION)); |
|
| 44 | + $this->addElement(new SmartFormTextElement($object, 'caption_'.$key)); |
|
| 45 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_DESC.'<br>')); |
|
| 46 | + $this->addElement(new \XoopsFormTextArea('', 'desc_'.$key, $object->getVar('description'))); |
|
| 47 | 47 | |
| 48 | 48 | if (!$object->isNew()) { |
| 49 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CHANGE_FILE)); |
|
| 49 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_CHANGE_FILE)); |
|
| 50 | 50 | $this->addElement(new SmartFormFileUploadElement($object, $key)); |
| 51 | - $this->addElement(new \XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>')); |
|
| 52 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 53 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 51 | + $this->addElement(new \XoopsFormLabel('', '<br><br><small>'._CO_SOBJECT_URL_FILE_DSC.'</small>')); |
|
| 52 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_URL_FILE)); |
|
| 53 | + $this->addElement(new SmartFormTextElement($object, 'url_'.$key)); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -18,54 +18,54 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class SmartFormRadioElement extends \XoopsFormRadio |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * SmartFormRadioElement constructor. |
|
| 23 | - * @param string $object |
|
| 24 | - * @param string $key |
|
| 25 | - */ |
|
| 26 | - public function __construct($object, $key) |
|
| 27 | - { |
|
| 28 | - $var = $object->vars[$key]; |
|
| 21 | + /** |
|
| 22 | + * SmartFormRadioElement constructor. |
|
| 23 | + * @param string $object |
|
| 24 | + * @param string $key |
|
| 25 | + */ |
|
| 26 | + public function __construct($object, $key) |
|
| 27 | + { |
|
| 28 | + $var = $object->vars[$key]; |
|
| 29 | 29 | |
| 30 | - parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 30 | + parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 31 | 31 | |
| 32 | - // Adding the options inside this SelectBox |
|
| 33 | - // If the custom method is not from a module, than it's from the core |
|
| 34 | - $control = $object->getControl($key); |
|
| 32 | + // Adding the options inside this SelectBox |
|
| 33 | + // If the custom method is not from a module, than it's from the core |
|
| 34 | + $control = $object->getControl($key); |
|
| 35 | 35 | |
| 36 | - if (isset($control['options'])) { |
|
| 37 | - $this->addOptionArray($control['options']); |
|
| 38 | - } else { |
|
| 39 | - // let's find if the method we need to call comes from an already defined object |
|
| 40 | - if (isset($control['object'])) { |
|
| 41 | - if (method_exists($control['object'], $control['method'])) { |
|
| 42 | - if ($option_array = $control['object']->{$control['method']}()) { |
|
| 43 | - // Adding the options array to the XoopsFormSelect |
|
| 44 | - $this->addOptionArray($option_array); |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } else { |
|
| 48 | - // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 49 | - if (isset($control['itemHandler'])) { |
|
| 50 | - if (!$control['module']) { |
|
| 51 | - // Creating the specified core object handler |
|
| 52 | - $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 53 | - } else { |
|
| 54 | - $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 55 | - } |
|
| 56 | - } else { |
|
| 57 | - $controlHandler = $object->handler; |
|
| 58 | - } |
|
| 36 | + if (isset($control['options'])) { |
|
| 37 | + $this->addOptionArray($control['options']); |
|
| 38 | + } else { |
|
| 39 | + // let's find if the method we need to call comes from an already defined object |
|
| 40 | + if (isset($control['object'])) { |
|
| 41 | + if (method_exists($control['object'], $control['method'])) { |
|
| 42 | + if ($option_array = $control['object']->{$control['method']}()) { |
|
| 43 | + // Adding the options array to the XoopsFormSelect |
|
| 44 | + $this->addOptionArray($option_array); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } else { |
|
| 48 | + // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 49 | + if (isset($control['itemHandler'])) { |
|
| 50 | + if (!$control['module']) { |
|
| 51 | + // Creating the specified core object handler |
|
| 52 | + $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 53 | + } else { |
|
| 54 | + $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 55 | + } |
|
| 56 | + } else { |
|
| 57 | + $controlHandler = $object->handler; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // Checking if the specified method exists |
|
| 61 | - if (method_exists($controlHandler, $control['method'])) { |
|
| 62 | - // TODO: How could I pass the parameters in the following call ... |
|
| 63 | - if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 64 | - // Adding the options array to the XoopsFormSelect |
|
| 65 | - $this->addOptionArray($option_array); |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - } |
|
| 60 | + // Checking if the specified method exists |
|
| 61 | + if (method_exists($controlHandler, $control['method'])) { |
|
| 62 | + // TODO: How could I pass the parameters in the following call ... |
|
| 63 | + if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 64 | + // Adding the options array to the XoopsFormSelect |
|
| 65 | + $this->addOptionArray($option_array); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | } |