@@ -11,13 +11,13 @@ |
||
11 | 11 | */ |
12 | 12 | class SmartFormYesnoElement extends XoopsFormRadioYN |
13 | 13 | { |
14 | - /** |
|
15 | - * SmartFormYesnoElement constructor. |
|
16 | - * @param string $object |
|
17 | - * @param string $key |
|
18 | - */ |
|
19 | - public function __construct($object, $key) |
|
20 | - { |
|
21 | - parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e')); |
|
22 | - } |
|
14 | + /** |
|
15 | + * SmartFormYesnoElement constructor. |
|
16 | + * @param string $object |
|
17 | + * @param string $key |
|
18 | + */ |
|
19 | + public function __construct($object, $key) |
|
20 | + { |
|
21 | + parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e')); |
|
22 | + } |
|
23 | 23 | } |
@@ -11,38 +11,38 @@ |
||
11 | 11 | */ |
12 | 12 | class SmartAutocompleteElement extends XoopsFormText |
13 | 13 | { |
14 | - public $_include_file; |
|
14 | + public $_include_file; |
|
15 | 15 | |
16 | - /** |
|
17 | - * SmartAutocompleteElement constructor. |
|
18 | - * @param string $caption |
|
19 | - * @param string $name |
|
20 | - * @param int $include_file |
|
21 | - * @param int $size |
|
22 | - * @param string $maxlength |
|
23 | - * @param string $value |
|
24 | - */ |
|
25 | - public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '') |
|
26 | - { |
|
27 | - $this->_include_file = $include_file; |
|
28 | - parent::__construct($caption, $name, $size, $maxlength, $value); |
|
29 | - } |
|
16 | + /** |
|
17 | + * SmartAutocompleteElement constructor. |
|
18 | + * @param string $caption |
|
19 | + * @param string $name |
|
20 | + * @param int $include_file |
|
21 | + * @param int $size |
|
22 | + * @param string $maxlength |
|
23 | + * @param string $value |
|
24 | + */ |
|
25 | + public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '') |
|
26 | + { |
|
27 | + $this->_include_file = $include_file; |
|
28 | + parent::__construct($caption, $name, $size, $maxlength, $value); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Prepare HTML for output |
|
33 | - * |
|
34 | - * @return string HTML |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . ' />'; |
|
31 | + /** |
|
32 | + * Prepare HTML for output |
|
33 | + * |
|
34 | + * @return string HTML |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
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 | 43 | new Ajax.Autocompleter("' . $this->getName() . '","smartobject_autocomplete_hint' . $this->getName() . '","' . $this->_include_file . '?key=' . $this->getName() . '"); |
44 | 44 | </script>'; |
45 | 45 | |
46 | - return $ret; |
|
47 | - } |
|
46 | + return $ret; |
|
47 | + } |
|
48 | 48 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | // ------------------------------------------------------------------------- // |
31 | 31 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
32 | 32 | /** |
33 | - * Class for users |
|
34 | - * @author Kazumi Ono <[email protected]> |
|
35 | - * @copyright copyright (c) 2000-2003 XOOPS.org |
|
36 | - * @package kernel |
|
37 | - */ |
|
33 | + * Class for users |
|
34 | + * @author Kazumi Ono <[email protected]> |
|
35 | + * @copyright copyright (c) 2000-2003 XOOPS.org |
|
36 | + * @package kernel |
|
37 | + */ |
|
38 | 38 | class SmartobjectUser extends XoopsUser |
39 | 39 | { |
40 | 40 | } |
@@ -36,29 +36,29 @@ |
||
36 | 36 | */ |
37 | 37 | class SmartobjectBasedUrl extends SmartObject |
38 | 38 | { |
39 | - /** |
|
40 | - * SmartobjectBasedUrl constructor. |
|
41 | - */ |
|
42 | - public function __construct() |
|
43 | - { |
|
44 | - $this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false); |
|
45 | - $this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false); |
|
46 | - $this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false); |
|
47 | - } |
|
39 | + /** |
|
40 | + * SmartobjectBasedUrl constructor. |
|
41 | + */ |
|
42 | + public function __construct() |
|
43 | + { |
|
44 | + $this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false); |
|
45 | + $this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false); |
|
46 | + $this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param string $key |
|
51 | - * @param string $format |
|
52 | - * @return mixed |
|
53 | - */ |
|
54 | - public function getVar($key, $format = 'e') |
|
55 | - { |
|
56 | - if (0 === strpos($key, 'url_')) { |
|
57 | - return parent::getVar('url', $format); |
|
58 | - } elseif (0 === strpos($key, 'caption_')) { |
|
59 | - return parent::getVar('caption', $format); |
|
60 | - } else { |
|
61 | - return parent::getVar($key, $format); |
|
62 | - } |
|
63 | - } |
|
49 | + /** |
|
50 | + * @param string $key |
|
51 | + * @param string $format |
|
52 | + * @return mixed |
|
53 | + */ |
|
54 | + public function getVar($key, $format = 'e') |
|
55 | + { |
|
56 | + if (0 === strpos($key, 'url_')) { |
|
57 | + return parent::getVar('url', $format); |
|
58 | + } elseif (0 === strpos($key, 'caption_')) { |
|
59 | + return parent::getVar('caption', $format); |
|
60 | + } else { |
|
61 | + return parent::getVar($key, $format); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
@@ -37,115 +37,115 @@ discard block |
||
37 | 37 | */ |
38 | 38 | class SmartobjectCurrency extends SmartObject |
39 | 39 | { |
40 | - public $_modulePlugin = false; |
|
41 | - |
|
42 | - /** |
|
43 | - * SmartobjectCurrency constructor. |
|
44 | - */ |
|
45 | - public function __construct() |
|
46 | - { |
|
47 | - $this->quickInitVar('currencyid', XOBJ_DTYPE_INT, true); |
|
48 | - $this->quickInitVar('iso4217', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_ISO4217, _CO_SOBJECT_CURRENCY_ISO4217_DSC); |
|
49 | - $this->quickInitVar('name', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_NAME); |
|
50 | - $this->quickInitVar('symbol', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_SYMBOL); |
|
51 | - $this->quickInitVar('rate', XOBJ_DTYPE_FLOAT, true, _CO_SOBJECT_CURRENCY_RATE, '', '1.0'); |
|
52 | - $this->quickInitVar('default_currency', XOBJ_DTYPE_INT, false, _CO_SOBJECT_CURRENCY_DEFAULT, '', false); |
|
53 | - |
|
54 | - $this->setControl('symbol', array( |
|
55 | - 'name' => 'text', |
|
56 | - 'size' => '15', |
|
57 | - 'maxlength' => '15' |
|
58 | - )); |
|
59 | - |
|
60 | - $this->setControl('iso4217', array( |
|
61 | - 'name' => 'text', |
|
62 | - 'size' => '5', |
|
63 | - 'maxlength' => '5' |
|
64 | - )); |
|
65 | - |
|
66 | - $this->setControl('rate', array( |
|
67 | - 'name' => 'text', |
|
68 | - 'size' => '5', |
|
69 | - 'maxlength' => '5' |
|
70 | - )); |
|
71 | - |
|
72 | - $this->setControl('rate', array( |
|
73 | - 'name' => 'text', |
|
74 | - 'size' => '5', |
|
75 | - 'maxlength' => '5' |
|
76 | - )); |
|
77 | - |
|
78 | - $this->hideFieldFromForm('default_currency'); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * @param string $key |
|
83 | - * @param string $format |
|
84 | - * @return mixed |
|
85 | - */ |
|
86 | - public function getVar($key, $format = 's') |
|
87 | - { |
|
88 | - if ($format === 's' && in_array($key, array('rate', 'default_currency'))) { |
|
89 | - // return call_user_func(array($this, $key)); |
|
90 | - return $this->{$key}(); |
|
91 | - } |
|
92 | - |
|
93 | - return parent::getVar($key, $format); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * @return mixed |
|
98 | - */ |
|
99 | - public function getCurrencyLink() |
|
100 | - { |
|
101 | - $ret = $this->getVar('name', 'e'); |
|
102 | - |
|
103 | - return $ret; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @return mixed |
|
108 | - */ |
|
109 | - public function getCode() |
|
110 | - { |
|
111 | - $ret = $this->getVar('iso4217', 'e'); |
|
112 | - |
|
113 | - return $ret; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @return float|int|mixed|string |
|
118 | - */ |
|
119 | - public function rate() |
|
120 | - { |
|
121 | - return smart_currency($this->getVar('rate', 'e')); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - public function defaultCurrency() |
|
128 | - { |
|
129 | - if ($this->getVar('default_currency', 'e') == true) { |
|
130 | - return _YES; |
|
131 | - } else { |
|
132 | - return _NO; |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @return string |
|
138 | - */ |
|
139 | - public function getDefaultCurrencyControl() |
|
140 | - { |
|
141 | - $radio_box = '<input name="default_currency" value="' . $this->getVar('currencyid') . '" type="radio"'; |
|
142 | - if ($this->getVar('default_currency', 'e')) { |
|
143 | - $radio_box .= 'checked="checked"'; |
|
144 | - } |
|
145 | - $radio_box .= '>'; |
|
146 | - |
|
147 | - return $radio_box; |
|
148 | - } |
|
40 | + public $_modulePlugin = false; |
|
41 | + |
|
42 | + /** |
|
43 | + * SmartobjectCurrency constructor. |
|
44 | + */ |
|
45 | + public function __construct() |
|
46 | + { |
|
47 | + $this->quickInitVar('currencyid', XOBJ_DTYPE_INT, true); |
|
48 | + $this->quickInitVar('iso4217', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_ISO4217, _CO_SOBJECT_CURRENCY_ISO4217_DSC); |
|
49 | + $this->quickInitVar('name', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_NAME); |
|
50 | + $this->quickInitVar('symbol', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_SYMBOL); |
|
51 | + $this->quickInitVar('rate', XOBJ_DTYPE_FLOAT, true, _CO_SOBJECT_CURRENCY_RATE, '', '1.0'); |
|
52 | + $this->quickInitVar('default_currency', XOBJ_DTYPE_INT, false, _CO_SOBJECT_CURRENCY_DEFAULT, '', false); |
|
53 | + |
|
54 | + $this->setControl('symbol', array( |
|
55 | + 'name' => 'text', |
|
56 | + 'size' => '15', |
|
57 | + 'maxlength' => '15' |
|
58 | + )); |
|
59 | + |
|
60 | + $this->setControl('iso4217', array( |
|
61 | + 'name' => 'text', |
|
62 | + 'size' => '5', |
|
63 | + 'maxlength' => '5' |
|
64 | + )); |
|
65 | + |
|
66 | + $this->setControl('rate', array( |
|
67 | + 'name' => 'text', |
|
68 | + 'size' => '5', |
|
69 | + 'maxlength' => '5' |
|
70 | + )); |
|
71 | + |
|
72 | + $this->setControl('rate', array( |
|
73 | + 'name' => 'text', |
|
74 | + 'size' => '5', |
|
75 | + 'maxlength' => '5' |
|
76 | + )); |
|
77 | + |
|
78 | + $this->hideFieldFromForm('default_currency'); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * @param string $key |
|
83 | + * @param string $format |
|
84 | + * @return mixed |
|
85 | + */ |
|
86 | + public function getVar($key, $format = 's') |
|
87 | + { |
|
88 | + if ($format === 's' && in_array($key, array('rate', 'default_currency'))) { |
|
89 | + // return call_user_func(array($this, $key)); |
|
90 | + return $this->{$key}(); |
|
91 | + } |
|
92 | + |
|
93 | + return parent::getVar($key, $format); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * @return mixed |
|
98 | + */ |
|
99 | + public function getCurrencyLink() |
|
100 | + { |
|
101 | + $ret = $this->getVar('name', 'e'); |
|
102 | + |
|
103 | + return $ret; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @return mixed |
|
108 | + */ |
|
109 | + public function getCode() |
|
110 | + { |
|
111 | + $ret = $this->getVar('iso4217', 'e'); |
|
112 | + |
|
113 | + return $ret; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @return float|int|mixed|string |
|
118 | + */ |
|
119 | + public function rate() |
|
120 | + { |
|
121 | + return smart_currency($this->getVar('rate', 'e')); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + public function defaultCurrency() |
|
128 | + { |
|
129 | + if ($this->getVar('default_currency', 'e') == true) { |
|
130 | + return _YES; |
|
131 | + } else { |
|
132 | + return _NO; |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @return string |
|
138 | + */ |
|
139 | + public function getDefaultCurrencyControl() |
|
140 | + { |
|
141 | + $radio_box = '<input name="default_currency" value="' . $this->getVar('currencyid') . '" type="radio"'; |
|
142 | + if ($this->getVar('default_currency', 'e')) { |
|
143 | + $radio_box .= 'checked="checked"'; |
|
144 | + } |
|
145 | + $radio_box .= '>'; |
|
146 | + |
|
147 | + return $radio_box; |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -153,22 +153,22 @@ discard block |
||
153 | 153 | */ |
154 | 154 | class SmartObjectCurrencyHandler extends SmartPersistableObjectHandler |
155 | 155 | { |
156 | - /** |
|
157 | - * SmartObjectCurrencyHandler constructor. |
|
158 | - * @param object|XoopsDatabase $db |
|
159 | - */ |
|
160 | - public function __construct($db) |
|
161 | - { |
|
162 | - parent::__construct($db, 'currency', 'currencyid', 'name', '', 'smartobject'); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @return array |
|
167 | - */ |
|
168 | - public function getCurrencies() |
|
169 | - { |
|
170 | - $currenciesObj = $this->getObjects(null, true); |
|
171 | - |
|
172 | - return $currenciesObj; |
|
173 | - } |
|
156 | + /** |
|
157 | + * SmartObjectCurrencyHandler constructor. |
|
158 | + * @param object|XoopsDatabase $db |
|
159 | + */ |
|
160 | + public function __construct($db) |
|
161 | + { |
|
162 | + parent::__construct($db, 'currency', 'currencyid', 'name', '', 'smartobject'); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @return array |
|
167 | + */ |
|
168 | + public function getCurrencies() |
|
169 | + { |
|
170 | + $currenciesObj = $this->getObjects(null, true); |
|
171 | + |
|
172 | + return $currenciesObj; |
|
173 | + } |
|
174 | 174 | } |
@@ -8,22 +8,22 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class SmartobjectUrlLink extends SmartobjectBasedUrl |
10 | 10 | { |
11 | - /** |
|
12 | - * SmartobjectUrlLink constructor. |
|
13 | - */ |
|
14 | - public function __construct() |
|
15 | - { |
|
16 | - parent::__construct(); |
|
17 | - $this->quickInitVar('urllinkid', XOBJ_DTYPE_TXTBOX, true); |
|
18 | - $this->quickInitVar('target', XOBJ_DTYPE_TXTBOX, true); |
|
11 | + /** |
|
12 | + * SmartobjectUrlLink constructor. |
|
13 | + */ |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + parent::__construct(); |
|
17 | + $this->quickInitVar('urllinkid', XOBJ_DTYPE_TXTBOX, true); |
|
18 | + $this->quickInitVar('target', XOBJ_DTYPE_TXTBOX, true); |
|
19 | 19 | |
20 | - $this->setControl('target', array( |
|
21 | - 'options' => array( |
|
22 | - '_self' => _CO_SOBJECT_URLLINK_SELF, |
|
23 | - '_blank' => _CO_SOBJECT_URLLINK_BLANK |
|
24 | - ) |
|
25 | - )); |
|
26 | - } |
|
20 | + $this->setControl('target', array( |
|
21 | + 'options' => array( |
|
22 | + '_self' => _CO_SOBJECT_URLLINK_SELF, |
|
23 | + '_blank' => _CO_SOBJECT_URLLINK_BLANK |
|
24 | + ) |
|
25 | + )); |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class SmartobjectUrlLinkHandler extends SmartPersistableObjectHandler |
33 | 33 | { |
34 | - /** |
|
35 | - * SmartobjectUrlLinkHandler constructor. |
|
36 | - * @param object|XoopsDatabase $db |
|
37 | - */ |
|
38 | - public function __construct($db) |
|
39 | - { |
|
40 | - parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject'); |
|
41 | - } |
|
34 | + /** |
|
35 | + * SmartobjectUrlLinkHandler constructor. |
|
36 | + * @param object|XoopsDatabase $db |
|
37 | + */ |
|
38 | + public function __construct($db) |
|
39 | + { |
|
40 | + parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject'); |
|
41 | + } |
|
42 | 42 | } |
@@ -15,65 +15,65 @@ |
||
15 | 15 | */ |
16 | 16 | class SmartPrinterFriendly |
17 | 17 | { |
18 | - public $_title; |
|
19 | - public $_dsc; |
|
20 | - public $_content; |
|
21 | - public $_tpl; |
|
22 | - public $_pageTitle = false; |
|
23 | - public $_width = 680; |
|
18 | + public $_title; |
|
19 | + public $_dsc; |
|
20 | + public $_content; |
|
21 | + public $_tpl; |
|
22 | + public $_pageTitle = false; |
|
23 | + public $_width = 680; |
|
24 | 24 | |
25 | - /** |
|
26 | - * SmartPrinterFriendly constructor. |
|
27 | - * @param $content |
|
28 | - * @param bool $title |
|
29 | - * @param bool $dsc |
|
30 | - */ |
|
31 | - public function __construct($content, $title = false, $dsc = false) |
|
32 | - { |
|
33 | - $this->_title = $title; |
|
34 | - $this->_dsc = $dsc; |
|
35 | - $this->_content = $content; |
|
36 | - } |
|
25 | + /** |
|
26 | + * SmartPrinterFriendly constructor. |
|
27 | + * @param $content |
|
28 | + * @param bool $title |
|
29 | + * @param bool $dsc |
|
30 | + */ |
|
31 | + public function __construct($content, $title = false, $dsc = false) |
|
32 | + { |
|
33 | + $this->_title = $title; |
|
34 | + $this->_dsc = $dsc; |
|
35 | + $this->_content = $content; |
|
36 | + } |
|
37 | 37 | |
38 | - public function render() |
|
39 | - { |
|
40 | - /** |
|
41 | - * @todo move the output to a template |
|
42 | - * @todo make the output XHTML compliant |
|
43 | - */ |
|
38 | + public function render() |
|
39 | + { |
|
40 | + /** |
|
41 | + * @todo move the output to a template |
|
42 | + * @todo make the output XHTML compliant |
|
43 | + */ |
|
44 | 44 | |
45 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
45 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
46 | 46 | |
47 | - $this->_tpl = new XoopsTpl(); |
|
47 | + $this->_tpl = new XoopsTpl(); |
|
48 | 48 | |
49 | - $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title); |
|
50 | - $this->_tpl->assign('smartobject_print_title', $this->_title); |
|
51 | - $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); |
|
52 | - $this->_tpl->assign('smartobject_print_content', $this->_content); |
|
53 | - $this->_tpl->assign('smartobject_print_width', $this->_width); |
|
49 | + $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title); |
|
50 | + $this->_tpl->assign('smartobject_print_title', $this->_title); |
|
51 | + $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); |
|
52 | + $this->_tpl->assign('smartobject_print_content', $this->_content); |
|
53 | + $this->_tpl->assign('smartobject_print_width', $this->_width); |
|
54 | 54 | |
55 | - $current_urls = smart_getCurrentUrls(); |
|
56 | - $current_url = $current_urls['full']; |
|
55 | + $current_urls = smart_getCurrentUrls(); |
|
56 | + $current_url = $current_urls['full']; |
|
57 | 57 | |
58 | - $this->_tpl->assign('smartobject_print_currenturl', $current_url); |
|
59 | - $this->_tpl->assign('smartobject_print_url', $this->url); |
|
58 | + $this->_tpl->assign('smartobject_print_currenturl', $current_url); |
|
59 | + $this->_tpl->assign('smartobject_print_url', $this->url); |
|
60 | 60 | |
61 | - $this->_tpl->display('db:smartobject_print.tpl'); |
|
62 | - } |
|
61 | + $this->_tpl->display('db:smartobject_print.tpl'); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param $text |
|
66 | - */ |
|
67 | - public function setPageTitle($text) |
|
68 | - { |
|
69 | - $this->_pageTitle = $text; |
|
70 | - } |
|
64 | + /** |
|
65 | + * @param $text |
|
66 | + */ |
|
67 | + public function setPageTitle($text) |
|
68 | + { |
|
69 | + $this->_pageTitle = $text; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @param $width |
|
74 | - */ |
|
75 | - public function setWidth($width) |
|
76 | - { |
|
77 | - $this->_width = $width; |
|
78 | - } |
|
72 | + /** |
|
73 | + * @param $width |
|
74 | + */ |
|
75 | + public function setWidth($width) |
|
76 | + { |
|
77 | + $this->_width = $width; |
|
78 | + } |
|
79 | 79 | } |
@@ -18,123 +18,123 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class SmartobjectCategory extends SmartSeoObject |
20 | 20 | { |
21 | - public $_categoryPath; |
|
22 | - |
|
23 | - /** |
|
24 | - * SmartobjectCategory constructor. |
|
25 | - */ |
|
26 | - public function __construct() |
|
27 | - { |
|
28 | - $this->initVar('categoryid', XOBJ_DTYPE_INT, '', true); |
|
29 | - $this->initVar('parentid', XOBJ_DTYPE_INT, '', false, null, '', false, _CO_SOBJECT_CATEGORY_PARENTID, _CO_SOBJECT_CATEGORY_PARENTID_DSC); |
|
30 | - $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_NAME, _CO_SOBJECT_CATEGORY_NAME_DSC); |
|
31 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false, null, '', false, _CO_SOBJECT_CATEGORY_DESCRIPTION, _CO_SOBJECT_CATEGORY_DESCRIPTION_DSC); |
|
32 | - $this->initVar('image', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_IMAGE, _CO_SOBJECT_CATEGORY_IMAGE_DSC); |
|
33 | - |
|
34 | - $this->initCommonVar('doxcode'); |
|
35 | - |
|
36 | - $this->setControl('image', array('name' => 'image')); |
|
37 | - $this->setControl('parentid', array('name' => 'parentcategory')); |
|
38 | - $this->setControl('description', array( |
|
39 | - 'name' => 'textarea', |
|
40 | - 'itemHandler' => false, |
|
41 | - 'method' => false, |
|
42 | - 'module' => false, |
|
43 | - 'form_editor' => 'default' |
|
44 | - )); |
|
45 | - |
|
46 | - // call parent constructor to get SEO fields initiated |
|
47 | - parent::__construct; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * returns a specific variable for the object in a proper format |
|
52 | - * |
|
53 | - * @access public |
|
54 | - * @param string $key key of the object's variable to be returned |
|
55 | - * @param string $format format to use for the output |
|
56 | - * @return mixed formatted value of the variable |
|
57 | - */ |
|
58 | - public function getVar($key, $format = 's') |
|
59 | - { |
|
60 | - if ($format === 's' && in_array($key, array('description', 'image'))) { |
|
61 | - // return call_user_func(array($this, $key)); |
|
62 | - return $this->{$key}(); |
|
63 | - } |
|
64 | - |
|
65 | - return parent::getVar($key, $format); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @return string |
|
70 | - */ |
|
71 | - public function description() |
|
72 | - { |
|
73 | - return $this->getValueFor('description', false); |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * @return bool|mixed |
|
78 | - */ |
|
79 | - public function image() |
|
80 | - { |
|
81 | - $ret = $this->getVar('image', 'e'); |
|
82 | - if ($ret == '-1') { |
|
83 | - return false; |
|
84 | - } else { |
|
85 | - return $ret; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - public function toArray() |
|
93 | - { |
|
94 | - $this->setVar('doxcode', true); |
|
95 | - global $myts; |
|
96 | - $objectArray = parent::toArray(); |
|
97 | - if ($objectArray['image']) { |
|
98 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
99 | - } |
|
100 | - |
|
101 | - return $objectArray; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Create the complete path of a category |
|
106 | - * |
|
107 | - * @todo this could be improved as it uses multiple queries |
|
108 | - * @param bool $withAllLink make all name clickable |
|
109 | - * @param bool $currentCategory |
|
110 | - * @return string complete path (breadcrumb) |
|
111 | - */ |
|
112 | - public function getCategoryPath($withAllLink = true, $currentCategory = false) |
|
113 | - { |
|
114 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
115 | - $controller = new SmartObjectController($this->handler); |
|
116 | - |
|
117 | - if (!$this->_categoryPath) { |
|
118 | - if ($withAllLink && !$currentCategory) { |
|
119 | - $ret = $controller->getItemLink($this); |
|
120 | - } else { |
|
121 | - $currentCategory = false; |
|
122 | - $ret = $this->getVar('name'); |
|
123 | - } |
|
124 | - $parentid = $this->getVar('parentid'); |
|
125 | - if ($parentid != 0) { |
|
126 | - $parentObj = $this->handler->get($parentid); |
|
127 | - if ($parentObj->isNew()) { |
|
128 | - exit; |
|
129 | - } |
|
130 | - $parentid = $parentObj->getVar('parentid'); |
|
131 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
132 | - } |
|
133 | - $this->_categoryPath = $ret; |
|
134 | - } |
|
135 | - |
|
136 | - return $this->_categoryPath; |
|
137 | - } |
|
21 | + public $_categoryPath; |
|
22 | + |
|
23 | + /** |
|
24 | + * SmartobjectCategory constructor. |
|
25 | + */ |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + $this->initVar('categoryid', XOBJ_DTYPE_INT, '', true); |
|
29 | + $this->initVar('parentid', XOBJ_DTYPE_INT, '', false, null, '', false, _CO_SOBJECT_CATEGORY_PARENTID, _CO_SOBJECT_CATEGORY_PARENTID_DSC); |
|
30 | + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_NAME, _CO_SOBJECT_CATEGORY_NAME_DSC); |
|
31 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false, null, '', false, _CO_SOBJECT_CATEGORY_DESCRIPTION, _CO_SOBJECT_CATEGORY_DESCRIPTION_DSC); |
|
32 | + $this->initVar('image', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_IMAGE, _CO_SOBJECT_CATEGORY_IMAGE_DSC); |
|
33 | + |
|
34 | + $this->initCommonVar('doxcode'); |
|
35 | + |
|
36 | + $this->setControl('image', array('name' => 'image')); |
|
37 | + $this->setControl('parentid', array('name' => 'parentcategory')); |
|
38 | + $this->setControl('description', array( |
|
39 | + 'name' => 'textarea', |
|
40 | + 'itemHandler' => false, |
|
41 | + 'method' => false, |
|
42 | + 'module' => false, |
|
43 | + 'form_editor' => 'default' |
|
44 | + )); |
|
45 | + |
|
46 | + // call parent constructor to get SEO fields initiated |
|
47 | + parent::__construct; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * returns a specific variable for the object in a proper format |
|
52 | + * |
|
53 | + * @access public |
|
54 | + * @param string $key key of the object's variable to be returned |
|
55 | + * @param string $format format to use for the output |
|
56 | + * @return mixed formatted value of the variable |
|
57 | + */ |
|
58 | + public function getVar($key, $format = 's') |
|
59 | + { |
|
60 | + if ($format === 's' && in_array($key, array('description', 'image'))) { |
|
61 | + // return call_user_func(array($this, $key)); |
|
62 | + return $this->{$key}(); |
|
63 | + } |
|
64 | + |
|
65 | + return parent::getVar($key, $format); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @return string |
|
70 | + */ |
|
71 | + public function description() |
|
72 | + { |
|
73 | + return $this->getValueFor('description', false); |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * @return bool|mixed |
|
78 | + */ |
|
79 | + public function image() |
|
80 | + { |
|
81 | + $ret = $this->getVar('image', 'e'); |
|
82 | + if ($ret == '-1') { |
|
83 | + return false; |
|
84 | + } else { |
|
85 | + return $ret; |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + public function toArray() |
|
93 | + { |
|
94 | + $this->setVar('doxcode', true); |
|
95 | + global $myts; |
|
96 | + $objectArray = parent::toArray(); |
|
97 | + if ($objectArray['image']) { |
|
98 | + $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
99 | + } |
|
100 | + |
|
101 | + return $objectArray; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * Create the complete path of a category |
|
106 | + * |
|
107 | + * @todo this could be improved as it uses multiple queries |
|
108 | + * @param bool $withAllLink make all name clickable |
|
109 | + * @param bool $currentCategory |
|
110 | + * @return string complete path (breadcrumb) |
|
111 | + */ |
|
112 | + public function getCategoryPath($withAllLink = true, $currentCategory = false) |
|
113 | + { |
|
114 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
115 | + $controller = new SmartObjectController($this->handler); |
|
116 | + |
|
117 | + if (!$this->_categoryPath) { |
|
118 | + if ($withAllLink && !$currentCategory) { |
|
119 | + $ret = $controller->getItemLink($this); |
|
120 | + } else { |
|
121 | + $currentCategory = false; |
|
122 | + $ret = $this->getVar('name'); |
|
123 | + } |
|
124 | + $parentid = $this->getVar('parentid'); |
|
125 | + if ($parentid != 0) { |
|
126 | + $parentObj = $this->handler->get($parentid); |
|
127 | + if ($parentObj->isNew()) { |
|
128 | + exit; |
|
129 | + } |
|
130 | + $parentid = $parentObj->getVar('parentid'); |
|
131 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
132 | + } |
|
133 | + $this->_categoryPath = $ret; |
|
134 | + } |
|
135 | + |
|
136 | + return $this->_categoryPath; |
|
137 | + } |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -142,91 +142,91 @@ discard block |
||
142 | 142 | */ |
143 | 143 | class SmartobjectCategoryHandler extends SmartPersistableObjectHandler |
144 | 144 | { |
145 | - public $allCategoriesObj = false; |
|
146 | - public $_allCategoriesId = false; |
|
147 | - |
|
148 | - /** |
|
149 | - * SmartobjectCategoryHandler constructor. |
|
150 | - * @param object|XoopsDatabase $db |
|
151 | - * @param $modulename |
|
152 | - */ |
|
153 | - public function __construct($db, $modulename) |
|
154 | - { |
|
155 | - parent::__construct($db, 'category', 'categoryid', 'name', 'description', $modulename); |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @param int $parentid |
|
160 | - * @param bool $perm_name |
|
161 | - * @param string $sort |
|
162 | - * @param string $order |
|
163 | - * @return array|bool |
|
164 | - */ |
|
165 | - public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC') |
|
166 | - { |
|
167 | - if (!$this->allCategoriesObj) { |
|
168 | - $criteria = new CriteriaCompo(); |
|
169 | - $criteria->setSort($sort); |
|
170 | - $criteria->setOrder($order); |
|
171 | - global $xoopsUser; |
|
172 | - $userIsAdmin = is_object($xoopsUser) && $xoopsUser->isAdmin(); |
|
173 | - |
|
174 | - if ($perm_name && !$userIsAdmin) { |
|
175 | - if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) { |
|
176 | - return false; |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - $this->allCategoriesObj = $this->getObjects($criteria, 'parentid'); |
|
181 | - } |
|
182 | - |
|
183 | - $ret = array(); |
|
184 | - if (isset($this->allCategoriesObj[$parentid])) { |
|
185 | - foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) { |
|
186 | - $ret[$categoryid]['self'] = $categoryObj->toArray(); |
|
187 | - if (isset($this->allCategoriesObj[$categoryid])) { |
|
188 | - $ret[$categoryid]['sub'] = $this->getAllCategoriesArray($categoryid); |
|
189 | - $ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']); |
|
190 | - } |
|
191 | - } |
|
192 | - } |
|
193 | - |
|
194 | - return $ret; |
|
195 | - } |
|
196 | - |
|
197 | - /** |
|
198 | - * @param $parentid |
|
199 | - * @param bool $asString |
|
200 | - * @return array|string |
|
201 | - */ |
|
202 | - public function getParentIds($parentid, $asString = true) |
|
203 | - { |
|
204 | - if (!$this->allCategoriesId) { |
|
205 | - $ret = array(); |
|
206 | - $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
207 | - |
|
208 | - $result = $this->db->query($sql); |
|
209 | - |
|
210 | - if (!$result) { |
|
211 | - return $ret; |
|
212 | - } |
|
213 | - |
|
214 | - while ($myrow = $this->db->fetchArray($result)) { |
|
215 | - $this->allCategoriesId[$myrow['categoryid']] = $myrow['parentid']; |
|
216 | - } |
|
217 | - } |
|
218 | - |
|
219 | - $retArray = array($parentid); |
|
220 | - while ($parentid != 0) { |
|
221 | - $parentid = $this->allCategoriesId[$parentid]; |
|
222 | - if ($parentid != 0) { |
|
223 | - $retArray[] = $parentid; |
|
224 | - } |
|
225 | - } |
|
226 | - if ($asString) { |
|
227 | - return implode(', ', $retArray); |
|
228 | - } else { |
|
229 | - return $retArray; |
|
230 | - } |
|
231 | - } |
|
145 | + public $allCategoriesObj = false; |
|
146 | + public $_allCategoriesId = false; |
|
147 | + |
|
148 | + /** |
|
149 | + * SmartobjectCategoryHandler constructor. |
|
150 | + * @param object|XoopsDatabase $db |
|
151 | + * @param $modulename |
|
152 | + */ |
|
153 | + public function __construct($db, $modulename) |
|
154 | + { |
|
155 | + parent::__construct($db, 'category', 'categoryid', 'name', 'description', $modulename); |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @param int $parentid |
|
160 | + * @param bool $perm_name |
|
161 | + * @param string $sort |
|
162 | + * @param string $order |
|
163 | + * @return array|bool |
|
164 | + */ |
|
165 | + public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC') |
|
166 | + { |
|
167 | + if (!$this->allCategoriesObj) { |
|
168 | + $criteria = new CriteriaCompo(); |
|
169 | + $criteria->setSort($sort); |
|
170 | + $criteria->setOrder($order); |
|
171 | + global $xoopsUser; |
|
172 | + $userIsAdmin = is_object($xoopsUser) && $xoopsUser->isAdmin(); |
|
173 | + |
|
174 | + if ($perm_name && !$userIsAdmin) { |
|
175 | + if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) { |
|
176 | + return false; |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + $this->allCategoriesObj = $this->getObjects($criteria, 'parentid'); |
|
181 | + } |
|
182 | + |
|
183 | + $ret = array(); |
|
184 | + if (isset($this->allCategoriesObj[$parentid])) { |
|
185 | + foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) { |
|
186 | + $ret[$categoryid]['self'] = $categoryObj->toArray(); |
|
187 | + if (isset($this->allCategoriesObj[$categoryid])) { |
|
188 | + $ret[$categoryid]['sub'] = $this->getAllCategoriesArray($categoryid); |
|
189 | + $ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']); |
|
190 | + } |
|
191 | + } |
|
192 | + } |
|
193 | + |
|
194 | + return $ret; |
|
195 | + } |
|
196 | + |
|
197 | + /** |
|
198 | + * @param $parentid |
|
199 | + * @param bool $asString |
|
200 | + * @return array|string |
|
201 | + */ |
|
202 | + public function getParentIds($parentid, $asString = true) |
|
203 | + { |
|
204 | + if (!$this->allCategoriesId) { |
|
205 | + $ret = array(); |
|
206 | + $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
207 | + |
|
208 | + $result = $this->db->query($sql); |
|
209 | + |
|
210 | + if (!$result) { |
|
211 | + return $ret; |
|
212 | + } |
|
213 | + |
|
214 | + while ($myrow = $this->db->fetchArray($result)) { |
|
215 | + $this->allCategoriesId[$myrow['categoryid']] = $myrow['parentid']; |
|
216 | + } |
|
217 | + } |
|
218 | + |
|
219 | + $retArray = array($parentid); |
|
220 | + while ($parentid != 0) { |
|
221 | + $parentid = $this->allCategoriesId[$parentid]; |
|
222 | + if ($parentid != 0) { |
|
223 | + $retArray[] = $parentid; |
|
224 | + } |
|
225 | + } |
|
226 | + if ($asString) { |
|
227 | + return implode(', ', $retArray); |
|
228 | + } else { |
|
229 | + return $retArray; |
|
230 | + } |
|
231 | + } |
|
232 | 232 | } |
@@ -6,44 +6,44 @@ |
||
6 | 6 | */ |
7 | 7 | class SmartHookHandler |
8 | 8 | { |
9 | - /** |
|
10 | - * SmartHookHandler constructor. |
|
11 | - */ |
|
12 | - public function __construct() |
|
13 | - { |
|
14 | - } |
|
9 | + /** |
|
10 | + * SmartHookHandler constructor. |
|
11 | + */ |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + } |
|
15 | 15 | |
16 | - /** |
|
17 | - * Access the only instance of this class |
|
18 | - * |
|
19 | - * @return object |
|
20 | - * |
|
21 | - * @static |
|
22 | - * @staticvar object |
|
23 | - */ |
|
24 | - public static function getInstance() |
|
25 | - { |
|
26 | - static $instance; |
|
27 | - if (!isset($instance)) { |
|
28 | - $instance = new SmartHookHandler(); |
|
29 | - } |
|
16 | + /** |
|
17 | + * Access the only instance of this class |
|
18 | + * |
|
19 | + * @return object |
|
20 | + * |
|
21 | + * @static |
|
22 | + * @staticvar object |
|
23 | + */ |
|
24 | + public static function getInstance() |
|
25 | + { |
|
26 | + static $instance; |
|
27 | + if (!isset($instance)) { |
|
28 | + $instance = new SmartHookHandler(); |
|
29 | + } |
|
30 | 30 | |
31 | - return $instance; |
|
32 | - } |
|
31 | + return $instance; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param $hook_name |
|
36 | - */ |
|
37 | - public function executeHook($hook_name) |
|
38 | - { |
|
39 | - $lower_hook_name = strtolower($hook_name); |
|
40 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
41 | - if (file_exists($filename)) { |
|
42 | - include_once($filename); |
|
43 | - $function = 'smarthook_' . $lower_hook_name; |
|
44 | - if (function_exists($function)) { |
|
45 | - $function(); |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
34 | + /** |
|
35 | + * @param $hook_name |
|
36 | + */ |
|
37 | + public function executeHook($hook_name) |
|
38 | + { |
|
39 | + $lower_hook_name = strtolower($hook_name); |
|
40 | + $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
41 | + if (file_exists($filename)) { |
|
42 | + include_once($filename); |
|
43 | + $function = 'smarthook_' . $lower_hook_name; |
|
44 | + if (function_exists($function)) { |
|
45 | + $function(); |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |