@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
17 | 17 | |
18 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
18 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Include other classes used by the SmartObject |
@@ -24,38 +24,38 @@ |
||
24 | 24 | */ |
25 | 25 | class Constants |
26 | 26 | { |
27 | - /**#@+ |
|
27 | + /**#@+ |
|
28 | 28 | * Constant definition |
29 | 29 | */ |
30 | 30 | |
31 | - const DISALLOW = 0; |
|
31 | + const DISALLOW = 0; |
|
32 | 32 | |
33 | - // CONFIG displayicons |
|
34 | - const DISPLAYICONS_ICON = 1; |
|
35 | - const DISPLAYICONS_TEXT = 2; |
|
36 | - const DISPLAYICONS_NO = 3; |
|
33 | + // CONFIG displayicons |
|
34 | + const DISPLAYICONS_ICON = 1; |
|
35 | + const DISPLAYICONS_TEXT = 2; |
|
36 | + const DISPLAYICONS_NO = 3; |
|
37 | 37 | |
38 | - // CONFIG submissions |
|
39 | - const SUBMISSIONS_NONE = 1; |
|
40 | - const SUBMISSIONS_DOWNLOAD = 2; |
|
41 | - const SUBMISSIONS_MIRROR = 3; |
|
42 | - const SUBMISSIONS_BOTH = 4; |
|
38 | + // CONFIG submissions |
|
39 | + const SUBMISSIONS_NONE = 1; |
|
40 | + const SUBMISSIONS_DOWNLOAD = 2; |
|
41 | + const SUBMISSIONS_MIRROR = 3; |
|
42 | + const SUBMISSIONS_BOTH = 4; |
|
43 | 43 | |
44 | - // CONFIG anonpost |
|
45 | - const ANONPOST_NONE = 1; |
|
46 | - const ANONPOST_DOWNLOAD = 2; |
|
47 | - const ANONPOST_MIRROR = 3; |
|
48 | - const ANONPOST_BOTH = 4; |
|
44 | + // CONFIG anonpost |
|
45 | + const ANONPOST_NONE = 1; |
|
46 | + const ANONPOST_DOWNLOAD = 2; |
|
47 | + const ANONPOST_MIRROR = 3; |
|
48 | + const ANONPOST_BOTH = 4; |
|
49 | 49 | |
50 | - // CONFIG autoapprove |
|
51 | - const AUTOAPPROVE_NONE = 1; |
|
52 | - const AUTOAPPROVE_DOWNLOAD = 2; |
|
53 | - const AUTOAPPROVE_MIRROR = 3; |
|
54 | - const AUTOAPPROVE_BOTH = 4; |
|
50 | + // CONFIG autoapprove |
|
51 | + const AUTOAPPROVE_NONE = 1; |
|
52 | + const AUTOAPPROVE_DOWNLOAD = 2; |
|
53 | + const AUTOAPPROVE_MIRROR = 3; |
|
54 | + const AUTOAPPROVE_BOTH = 4; |
|
55 | 55 | |
56 | - const DEFAULT_ELEMENT_SIZE = 1; |
|
56 | + const DEFAULT_ELEMENT_SIZE = 1; |
|
57 | 57 | |
58 | 58 | |
59 | - /**#@-*/ |
|
59 | + /**#@-*/ |
|
60 | 60 | } |
61 | 61 |
@@ -9,41 +9,41 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class SmartFormCheckElement extends \XoopsFormCheckBox |
11 | 11 | { |
12 | - /** |
|
13 | - * |
|
14 | - * /** |
|
15 | - * prepare HTML for output |
|
16 | - * |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function render() |
|
20 | - { |
|
21 | - $ret = ''; |
|
22 | - if (count($this->getOptions()) > 1 && '[]' !== substr($this->getName(), -2, 2)) { |
|
23 | - $newname = $this->getName() . '[]'; |
|
24 | - $this->setName($newname); |
|
25 | - } |
|
26 | - foreach ($this->getOptions() as $value => $name) { |
|
27 | - $ret .= "<input type='checkbox' name='" . $this->getName() . "' value='" . $value . "'"; |
|
28 | - if (count($this->getValue()) > 0 && in_array($value, $this->getValue())) { |
|
29 | - $ret .= ' checked'; |
|
30 | - } |
|
31 | - $ret .= $this->getExtra() . '>' . $name . '<br>'; |
|
32 | - } |
|
12 | + /** |
|
13 | + * |
|
14 | + * /** |
|
15 | + * prepare HTML for output |
|
16 | + * |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function render() |
|
20 | + { |
|
21 | + $ret = ''; |
|
22 | + if (count($this->getOptions()) > 1 && '[]' !== substr($this->getName(), -2, 2)) { |
|
23 | + $newname = $this->getName() . '[]'; |
|
24 | + $this->setName($newname); |
|
25 | + } |
|
26 | + foreach ($this->getOptions() as $value => $name) { |
|
27 | + $ret .= "<input type='checkbox' name='" . $this->getName() . "' value='" . $value . "'"; |
|
28 | + if (count($this->getValue()) > 0 && in_array($value, $this->getValue())) { |
|
29 | + $ret .= ' checked'; |
|
30 | + } |
|
31 | + $ret .= $this->getExtra() . '>' . $name . '<br>'; |
|
32 | + } |
|
33 | 33 | |
34 | - return $ret; |
|
35 | - } |
|
34 | + return $ret; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function renderValidationJS() |
|
41 | - { |
|
42 | - $js .= 'var hasSelections = false;'; |
|
43 | - //sometimes, there is an implicit '[]', sometimes not |
|
44 | - $eltname = $this->getName(); |
|
45 | - if (false === strpos($eltname, '[')) { |
|
46 | - $js .= "for (var i = 0; i < myform['{$eltname}[]'].length; i++) { |
|
37 | + /** |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function renderValidationJS() |
|
41 | + { |
|
42 | + $js .= 'var hasSelections = false;'; |
|
43 | + //sometimes, there is an implicit '[]', sometimes not |
|
44 | + $eltname = $this->getName(); |
|
45 | + if (false === strpos($eltname, '[')) { |
|
46 | + $js .= "for (var i = 0; i < myform['{$eltname}[]'].length; i++) { |
|
47 | 47 | if (myform['{$eltname}[]'][i].checked) { |
48 | 48 | hasSelections = true; |
49 | 49 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | } |
52 | 52 | if (hasSelections === false) { |
53 | 53 | window.alert(\"{$eltmsg}\"); myform['{$eltname}[]'][0].focus(); return false; }\n"; |
54 | - } else { |
|
55 | - $js .= "for (var i = 0; i < myform['" . $eltname . "'].length; i++) { |
|
54 | + } else { |
|
55 | + $js .= "for (var i = 0; i < myform['" . $eltname . "'].length; i++) { |
|
56 | 56 | if (myform['{$eltname}'][i].checked) { |
57 | 57 | hasSelections = true; |
58 | 58 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | if (hasSelections === false) { |
62 | 62 | window.alert(\"{$eltmsg}\"); myform['{$eltname}'][0].focus(); return false; }\n"; |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - return $js; |
|
66 | - } |
|
65 | + return $js; |
|
66 | + } |
|
67 | 67 | } |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | { |
19 | 19 | $ret = ''; |
20 | 20 | if (count($this->getOptions()) > 1 && '[]' !== substr($this->getName(), -2, 2)) { |
21 | - $newname = $this->getName() . '[]'; |
|
21 | + $newname = $this->getName().'[]'; |
|
22 | 22 | $this->setName($newname); |
23 | 23 | } |
24 | 24 | foreach ($this->getOptions() as $value => $name) { |
25 | - $ret .= "<input type='checkbox' name='" . $this->getName() . "' value='" . $value . "'"; |
|
25 | + $ret .= "<input type='checkbox' name='".$this->getName()."' value='".$value."'"; |
|
26 | 26 | if (count($this->getValue()) > 0 && in_array($value, $this->getValue())) { |
27 | 27 | $ret .= ' checked'; |
28 | 28 | } |
29 | - $ret .= $this->getExtra() . '>' . $name . '<br>'; |
|
29 | + $ret .= $this->getExtra().'>'.$name.'<br>'; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | return $ret; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if (hasSelections === false) { |
51 | 51 | window.alert(\"{$eltmsg}\"); myform['{$eltname}[]'][0].focus(); return false; }\n"; |
52 | 52 | } else { |
53 | - $js .= "for (var i = 0; i < myform['" . $eltname . "'].length; i++) { |
|
53 | + $js .= "for (var i = 0; i < myform['".$eltname."'].length; i++) { |
|
54 | 54 | if (myform['{$eltname}'][i].checked) { |
55 | 55 | hasSelections = true; |
56 | 56 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | class SmartFormYesnoElement extends \XoopsFormRadioYN |
20 | 20 | { |
21 | - /** |
|
22 | - * SmartFormYesnoElement constructor. |
|
23 | - * @param string $object |
|
24 | - * @param string $key |
|
25 | - */ |
|
26 | - public function __construct($object, $key) |
|
27 | - { |
|
28 | - parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e')); |
|
29 | - } |
|
21 | + /** |
|
22 | + * SmartFormYesnoElement constructor. |
|
23 | + * @param string $object |
|
24 | + * @param string $key |
|
25 | + */ |
|
26 | + public function __construct($object, $key) |
|
27 | + { |
|
28 | + parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e')); |
|
29 | + } |
|
30 | 30 | } |
@@ -18,38 +18,38 @@ |
||
18 | 18 | */ |
19 | 19 | class SmartAutocompleteElement extends \XoopsFormText |
20 | 20 | { |
21 | - public $_include_file; |
|
22 | - |
|
23 | - /** |
|
24 | - * SmartAutocompleteElement constructor. |
|
25 | - * @param string $caption |
|
26 | - * @param string $name |
|
27 | - * @param int $include_file |
|
28 | - * @param int $size |
|
29 | - * @param string $maxlength |
|
30 | - * @param string $value |
|
31 | - */ |
|
32 | - public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '') |
|
33 | - { |
|
34 | - $this->_include_file = $include_file; |
|
35 | - parent::__construct($caption, $name, $size, $maxlength, $value); |
|
36 | - } |
|
37 | - |
|
38 | - /** |
|
39 | - * Prepare HTML for output |
|
40 | - * |
|
41 | - * @return string HTML |
|
42 | - */ |
|
43 | - public function render() |
|
44 | - { |
|
45 | - $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>'; |
|
46 | - |
|
47 | - $ret .= ' <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div> |
|
21 | + public $_include_file; |
|
22 | + |
|
23 | + /** |
|
24 | + * SmartAutocompleteElement constructor. |
|
25 | + * @param string $caption |
|
26 | + * @param string $name |
|
27 | + * @param int $include_file |
|
28 | + * @param int $size |
|
29 | + * @param string $maxlength |
|
30 | + * @param string $value |
|
31 | + */ |
|
32 | + public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '') |
|
33 | + { |
|
34 | + $this->_include_file = $include_file; |
|
35 | + parent::__construct($caption, $name, $size, $maxlength, $value); |
|
36 | + } |
|
37 | + |
|
38 | + /** |
|
39 | + * Prepare HTML for output |
|
40 | + * |
|
41 | + * @return string HTML |
|
42 | + */ |
|
43 | + public function render() |
|
44 | + { |
|
45 | + $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>'; |
|
46 | + |
|
47 | + $ret .= ' <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div> |
|
48 | 48 | |
49 | 49 | <script type="text/javascript"> |
50 | 50 | new Ajax.Autocompleter("' . $this->getName() . '","smartobject_autocomplete_hint' . $this->getName() . '","' . $this->_include_file . '?key=' . $this->getName() . '"); |
51 | 51 | </script>'; |
52 | 52 | |
53 | - return $ret; |
|
54 | - } |
|
53 | + return $ret; |
|
54 | + } |
|
55 | 55 | } |
@@ -35,12 +35,12 @@ |
||
35 | 35 | */ |
36 | 36 | public function render() |
37 | 37 | { |
38 | - $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>'; |
|
38 | + $ret = "<input type='text' name='".$this->getName()."' id='".$this->getName()."' size='".$this->getSize()."' maxlength='".$this->getMaxlength()."' value='".$this->getValue()."'".$this->getExtra().'>'; |
|
39 | 39 | |
40 | - $ret .= ' <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div> |
|
40 | + $ret .= ' <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint'.$this->getName().'"></div> |
|
41 | 41 | |
42 | 42 | <script type="text/javascript"> |
43 | - new Ajax.Autocompleter("' . $this->getName() . '","smartobject_autocomplete_hint' . $this->getName() . '","' . $this->_include_file . '?key=' . $this->getName() . '"); |
|
43 | + new Ajax.Autocompleter("' . $this->getName().'","smartobject_autocomplete_hint'.$this->getName().'","'.$this->_include_file.'?key='.$this->getName().'"); |
|
44 | 44 | </script>'; |
45 | 45 | |
46 | 46 | return $ret; |
@@ -18,18 +18,18 @@ |
||
18 | 18 | */ |
19 | 19 | class SmartFormAutocompleteElement extends Smartobject\Form\Elements\SmartAutocompleteElement |
20 | 20 | { |
21 | - /** |
|
22 | - * SmartFormAutocompleteElement constructor. |
|
23 | - * @param string $object |
|
24 | - * @param string $key |
|
25 | - */ |
|
26 | - public function __construct($object, $key) |
|
27 | - { |
|
28 | - $var = $object->vars[$key]; |
|
29 | - $control = $object->controls[$key]; |
|
30 | - $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
21 | + /** |
|
22 | + * SmartFormAutocompleteElement constructor. |
|
23 | + * @param string $object |
|
24 | + * @param string $key |
|
25 | + */ |
|
26 | + public function __construct($object, $key) |
|
27 | + { |
|
28 | + $var = $object->vars[$key]; |
|
29 | + $control = $object->controls[$key]; |
|
30 | + $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
31 | 31 | |
32 | - $form_size = isset($control['size']) ? $control['size'] : 50; |
|
33 | - parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
34 | - } |
|
32 | + $form_size = isset($control['size']) ? $control['size'] : 50; |
|
33 | + parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
34 | + } |
|
35 | 35 | } |
@@ -19,14 +19,14 @@ |
||
19 | 19 | */ |
20 | 20 | class SmartFormSelectMultiElement extends Smartobject\Form\Elements\SmartFormSelectElement |
21 | 21 | { |
22 | - /** |
|
23 | - * SmartFormSelectMultiElement constructor. |
|
24 | - * @param string $object |
|
25 | - * @param string $key |
|
26 | - */ |
|
27 | - public function __construct($object, $key) |
|
28 | - { |
|
29 | - $this->multiple = true; |
|
30 | - parent::__construct($object, $key); |
|
31 | - } |
|
22 | + /** |
|
23 | + * SmartFormSelectMultiElement constructor. |
|
24 | + * @param string $object |
|
25 | + * @param string $key |
|
26 | + */ |
|
27 | + public function __construct($object, $key) |
|
28 | + { |
|
29 | + $this->multiple = true; |
|
30 | + parent::__construct($object, $key); |
|
31 | + } |
|
32 | 32 | } |
@@ -18,23 +18,23 @@ |
||
18 | 18 | */ |
19 | 19 | class SmartFormTimeElement extends \XoopsFormSelect |
20 | 20 | { |
21 | - /** |
|
22 | - * SmartFormTimeElement constructor. |
|
23 | - * @param string $object |
|
24 | - * @param string $key |
|
25 | - */ |
|
26 | - public function __construct($object, $key) |
|
27 | - { |
|
28 | - $var = $object->vars[$key]; |
|
29 | - $timearray = []; |
|
30 | - for ($i = 0; $i < 24; ++$i) { |
|
31 | - for ($j = 0; $j < 60; $j += 10) { |
|
32 | - $key_t = ($i * 3600) + ($j * 60); |
|
33 | - $timearray[$key_t] = (0 != $j) ? $i . ':' . $j : $i . ':0' . $j; |
|
34 | - } |
|
35 | - } |
|
36 | - ksort($timearray); |
|
37 | - parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
38 | - $this->addOptionArray($timearray); |
|
39 | - } |
|
21 | + /** |
|
22 | + * SmartFormTimeElement constructor. |
|
23 | + * @param string $object |
|
24 | + * @param string $key |
|
25 | + */ |
|
26 | + public function __construct($object, $key) |
|
27 | + { |
|
28 | + $var = $object->vars[$key]; |
|
29 | + $timearray = []; |
|
30 | + for ($i = 0; $i < 24; ++$i) { |
|
31 | + for ($j = 0; $j < 60; $j += 10) { |
|
32 | + $key_t = ($i * 3600) + ($j * 60); |
|
33 | + $timearray[$key_t] = (0 != $j) ? $i . ':' . $j : $i . ':0' . $j; |
|
34 | + } |
|
35 | + } |
|
36 | + ksort($timearray); |
|
37 | + parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
38 | + $this->addOptionArray($timearray); |
|
39 | + } |
|
40 | 40 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | for ($i = 0; $i < 24; ++$i) { |
24 | 24 | for ($j = 0; $j < 60; $j += 10) { |
25 | 25 | $key_t = ($i * 3600) + ($j * 60); |
26 | - $timearray[$key_t] = (0 != $j) ? $i . ':' . $j : $i . ':0' . $j; |
|
26 | + $timearray[$key_t] = (0 != $j) ? $i.':'.$j : $i.':0'.$j; |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | ksort($timearray); |
@@ -17,13 +17,13 @@ |
||
17 | 17 | */ |
18 | 18 | class SmartFormDateElement extends \XoopsFormTextDateSelect |
19 | 19 | { |
20 | - /** |
|
21 | - * SmartFormDateElement constructor. |
|
22 | - * @param $object |
|
23 | - * @param $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 | + * SmartFormDateElement constructor. |
|
22 | + * @param $object |
|
23 | + * @param $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 | } |