@@ -25,157 +25,157 @@ |
||
25 | 25 | */ |
26 | 26 | class TreeTable extends Smartobject\BaseSmartObjectTable |
27 | 27 | { |
28 | - /** |
|
29 | - * SmartObjectTreeTable constructor. |
|
30 | - * @param PersistableObjectHandler $objectHandler |
|
31 | - * @param bool $criteria |
|
32 | - * @param array $actions |
|
33 | - * @param bool $userSide |
|
34 | - */ |
|
35 | - public function __construct( |
|
36 | - PersistableObjectHandler $objectHandler, |
|
37 | - $criteria = false, |
|
38 | - $actions = ['edit', 'delete'], |
|
39 | - $userSide = false |
|
40 | - ) { |
|
41 | - $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide); |
|
42 | - $this->_isTree = true; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Get children objects given a specific parentid |
|
47 | - * |
|
48 | - * @var int $parentid id of the parent which children we want to retreive |
|
49 | - * @return array of SmartObject |
|
50 | - */ |
|
51 | - public function getChildrenOf($parentid = 0) |
|
52 | - { |
|
53 | - return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @param $object |
|
58 | - * @param int $level |
|
59 | - */ |
|
60 | - public function createTableRow($object, $level = 0) |
|
61 | - { |
|
62 | - $aObject = []; |
|
63 | - |
|
64 | - $i = 0; |
|
65 | - |
|
66 | - $aColumns = []; |
|
67 | - $doWeHaveActions = false; |
|
68 | - |
|
69 | - foreach ($this->_columns as $column) { |
|
70 | - $aColumn = []; |
|
71 | - |
|
72 | - if (0 == $i) { |
|
73 | - $class = 'head'; |
|
74 | - } elseif (0 == $i % 2) { |
|
75 | - $class = 'even'; |
|
76 | - } else { |
|
77 | - $class = 'odd'; |
|
78 | - } |
|
79 | - |
|
80 | - if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
|
81 | - $method = $column->_customMethodForValue; |
|
82 | - $value = $object->$method(); |
|
83 | - } else { |
|
84 | - /** |
|
85 | - * If the column is the identifier, then put a link on it |
|
86 | - */ |
|
87 | - if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
88 | - $value = $object->getItemLink(); |
|
89 | - } else { |
|
90 | - $value = $object->getVar($column->getKeyName()); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - $space = ''; |
|
95 | - if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
96 | - for ($i = 0; $i < $level; ++$i) { |
|
97 | - $space .= '--'; |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - if ('' !== $space) { |
|
102 | - $space .= ' '; |
|
103 | - } |
|
104 | - |
|
105 | - $aColumn['value'] = $space . $value; |
|
106 | - $aColumn['class'] = $class; |
|
107 | - $aColumn['width'] = $column->getWidth(); |
|
108 | - $aColumn['align'] = $column->getAlign(); |
|
109 | - $aColumn['key'] = $column->getKeyName(); |
|
110 | - |
|
111 | - $aColumns[] = $aColumn; |
|
112 | - ++$i; |
|
113 | - } |
|
114 | - |
|
115 | - $aObject['columns'] = $aColumns; |
|
116 | - |
|
117 | - $class = 'even' === $class ? 'odd' : 'even'; |
|
118 | - $aObject['class'] = $class; |
|
119 | - |
|
120 | - $actions = []; |
|
121 | - |
|
122 | - // Adding the custom actions if any |
|
123 | - foreach ($this->_custom_actions as $action) { |
|
124 | - if (method_exists($object, $action)) { |
|
125 | - $actions[] = $object->$action(); |
|
126 | - } |
|
127 | - } |
|
28 | + /** |
|
29 | + * SmartObjectTreeTable constructor. |
|
30 | + * @param PersistableObjectHandler $objectHandler |
|
31 | + * @param bool $criteria |
|
32 | + * @param array $actions |
|
33 | + * @param bool $userSide |
|
34 | + */ |
|
35 | + public function __construct( |
|
36 | + PersistableObjectHandler $objectHandler, |
|
37 | + $criteria = false, |
|
38 | + $actions = ['edit', 'delete'], |
|
39 | + $userSide = false |
|
40 | + ) { |
|
41 | + $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide); |
|
42 | + $this->_isTree = true; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Get children objects given a specific parentid |
|
47 | + * |
|
48 | + * @var int $parentid id of the parent which children we want to retreive |
|
49 | + * @return array of SmartObject |
|
50 | + */ |
|
51 | + public function getChildrenOf($parentid = 0) |
|
52 | + { |
|
53 | + return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @param $object |
|
58 | + * @param int $level |
|
59 | + */ |
|
60 | + public function createTableRow($object, $level = 0) |
|
61 | + { |
|
62 | + $aObject = []; |
|
63 | + |
|
64 | + $i = 0; |
|
65 | + |
|
66 | + $aColumns = []; |
|
67 | + $doWeHaveActions = false; |
|
68 | + |
|
69 | + foreach ($this->_columns as $column) { |
|
70 | + $aColumn = []; |
|
71 | + |
|
72 | + if (0 == $i) { |
|
73 | + $class = 'head'; |
|
74 | + } elseif (0 == $i % 2) { |
|
75 | + $class = 'even'; |
|
76 | + } else { |
|
77 | + $class = 'odd'; |
|
78 | + } |
|
79 | + |
|
80 | + if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
|
81 | + $method = $column->_customMethodForValue; |
|
82 | + $value = $object->$method(); |
|
83 | + } else { |
|
84 | + /** |
|
85 | + * If the column is the identifier, then put a link on it |
|
86 | + */ |
|
87 | + if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
88 | + $value = $object->getItemLink(); |
|
89 | + } else { |
|
90 | + $value = $object->getVar($column->getKeyName()); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + $space = ''; |
|
95 | + if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
96 | + for ($i = 0; $i < $level; ++$i) { |
|
97 | + $space .= '--'; |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + if ('' !== $space) { |
|
102 | + $space .= ' '; |
|
103 | + } |
|
104 | + |
|
105 | + $aColumn['value'] = $space . $value; |
|
106 | + $aColumn['class'] = $class; |
|
107 | + $aColumn['width'] = $column->getWidth(); |
|
108 | + $aColumn['align'] = $column->getAlign(); |
|
109 | + $aColumn['key'] = $column->getKeyName(); |
|
110 | + |
|
111 | + $aColumns[] = $aColumn; |
|
112 | + ++$i; |
|
113 | + } |
|
114 | + |
|
115 | + $aObject['columns'] = $aColumns; |
|
116 | + |
|
117 | + $class = 'even' === $class ? 'odd' : 'even'; |
|
118 | + $aObject['class'] = $class; |
|
119 | + |
|
120 | + $actions = []; |
|
121 | + |
|
122 | + // Adding the custom actions if any |
|
123 | + foreach ($this->_custom_actions as $action) { |
|
124 | + if (method_exists($object, $action)) { |
|
125 | + $actions[] = $object->$action(); |
|
126 | + } |
|
127 | + } |
|
128 | 128 | |
129 | 129 | // require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
130 | - $controller = new ObjectController($this->_objectHandler); |
|
131 | - |
|
132 | - if (in_array('edit', $this->_actions)) { |
|
133 | - $actions[] = $controller->getEditItemLink($object, false, true); |
|
134 | - } |
|
135 | - if (in_array('delete', $this->_actions)) { |
|
136 | - $actions[] = $controller->getDeleteItemLink($object, false, true); |
|
137 | - } |
|
138 | - $aObject['actions'] = $actions; |
|
139 | - |
|
140 | - $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); |
|
141 | - $aObject['id'] = $object->id(); |
|
142 | - $this->_aObjects[] = $aObject; |
|
143 | - |
|
144 | - $childrenObjects = $this->getChildrenOf($object->id()); |
|
145 | - |
|
146 | - $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; |
|
147 | - |
|
148 | - if ($childrenObjects) { |
|
149 | - ++$level; |
|
150 | - foreach ($childrenObjects as $subObject) { |
|
151 | - $this->createTableRow($subObject, $level); |
|
152 | - } |
|
153 | - } |
|
154 | - } |
|
155 | - |
|
156 | - public function createTableRows() |
|
157 | - { |
|
158 | - $this->_aObjects = []; |
|
159 | - |
|
160 | - if (count($this->_objects) > 0) { |
|
161 | - foreach ($this->getChildrenOf() as $object) { |
|
162 | - $this->createTableRow($object); |
|
163 | - } |
|
164 | - |
|
165 | - $this->_tpl->assign('smartobject_objects', $this->_aObjects); |
|
166 | - } else { |
|
167 | - $colspan = count($this->_columns) + 1; |
|
168 | - $this->_tpl->assign('smartobject_colspan', $colspan); |
|
169 | - } |
|
170 | - } |
|
171 | - |
|
172 | - /** |
|
173 | - * @return mixed |
|
174 | - */ |
|
175 | - public function fetchObjects() |
|
176 | - { |
|
177 | - $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid'); |
|
178 | - |
|
179 | - return $ret; |
|
180 | - } |
|
130 | + $controller = new ObjectController($this->_objectHandler); |
|
131 | + |
|
132 | + if (in_array('edit', $this->_actions)) { |
|
133 | + $actions[] = $controller->getEditItemLink($object, false, true); |
|
134 | + } |
|
135 | + if (in_array('delete', $this->_actions)) { |
|
136 | + $actions[] = $controller->getDeleteItemLink($object, false, true); |
|
137 | + } |
|
138 | + $aObject['actions'] = $actions; |
|
139 | + |
|
140 | + $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); |
|
141 | + $aObject['id'] = $object->id(); |
|
142 | + $this->_aObjects[] = $aObject; |
|
143 | + |
|
144 | + $childrenObjects = $this->getChildrenOf($object->id()); |
|
145 | + |
|
146 | + $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; |
|
147 | + |
|
148 | + if ($childrenObjects) { |
|
149 | + ++$level; |
|
150 | + foreach ($childrenObjects as $subObject) { |
|
151 | + $this->createTableRow($subObject, $level); |
|
152 | + } |
|
153 | + } |
|
154 | + } |
|
155 | + |
|
156 | + public function createTableRows() |
|
157 | + { |
|
158 | + $this->_aObjects = []; |
|
159 | + |
|
160 | + if (count($this->_objects) > 0) { |
|
161 | + foreach ($this->getChildrenOf() as $object) { |
|
162 | + $this->createTableRow($object); |
|
163 | + } |
|
164 | + |
|
165 | + $this->_tpl->assign('smartobject_objects', $this->_aObjects); |
|
166 | + } else { |
|
167 | + $colspan = count($this->_columns) + 1; |
|
168 | + $this->_tpl->assign('smartobject_colspan', $colspan); |
|
169 | + } |
|
170 | + } |
|
171 | + |
|
172 | + /** |
|
173 | + * @return mixed |
|
174 | + */ |
|
175 | + public function fetchObjects() |
|
176 | + { |
|
177 | + $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid'); |
|
178 | + |
|
179 | + return $ret; |
|
180 | + } |
|
181 | 181 | } |
@@ -102,7 +102,7 @@ |
||
102 | 102 | $space .= ' '; |
103 | 103 | } |
104 | 104 | |
105 | - $aColumn['value'] = $space . $value; |
|
105 | + $aColumn['value'] = $space.$value; |
|
106 | 106 | $aColumn['class'] = $class; |
107 | 107 | $aColumn['width'] = $column->getWidth(); |
108 | 108 | $aColumn['align'] = $column->getAlign(); |
@@ -30,113 +30,113 @@ |
||
30 | 30 | */ |
31 | 31 | class Currency extends Smartobject\BaseSmartObject |
32 | 32 | { |
33 | - public $_modulePlugin = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * SmartobjectCurrency constructor. |
|
37 | - */ |
|
38 | - public function __construct() |
|
39 | - { |
|
40 | - $this->quickInitVar('currencyid', XOBJ_DTYPE_INT, true); |
|
41 | - $this->quickInitVar('iso4217', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_ISO4217, _CO_SOBJECT_CURRENCY_ISO4217_DSC); |
|
42 | - $this->quickInitVar('name', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_NAME); |
|
43 | - $this->quickInitVar('symbol', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_SYMBOL); |
|
44 | - $this->quickInitVar('rate', XOBJ_DTYPE_FLOAT, true, _CO_SOBJECT_CURRENCY_RATE, '', '1.0'); |
|
45 | - $this->quickInitVar('default_currency', XOBJ_DTYPE_INT, false, _CO_SOBJECT_CURRENCY_DEFAULT, '', false); |
|
46 | - |
|
47 | - $this->setControl('symbol', [ |
|
48 | - 'name' => 'text', |
|
49 | - 'size' => '15', |
|
50 | - 'maxlength' => '15' |
|
51 | - ]); |
|
52 | - |
|
53 | - $this->setControl('iso4217', [ |
|
54 | - 'name' => 'text', |
|
55 | - 'size' => '5', |
|
56 | - 'maxlength' => '5' |
|
57 | - ]); |
|
58 | - |
|
59 | - $this->setControl('rate', [ |
|
60 | - 'name' => 'text', |
|
61 | - 'size' => '5', |
|
62 | - 'maxlength' => '5' |
|
63 | - ]); |
|
64 | - |
|
65 | - $this->setControl('rate', [ |
|
66 | - 'name' => 'text', |
|
67 | - 'size' => '5', |
|
68 | - 'maxlength' => '5' |
|
69 | - ]); |
|
70 | - |
|
71 | - $this->hideFieldFromForm('default_currency'); |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * @param string $key |
|
76 | - * @param string $format |
|
77 | - * @return mixed |
|
78 | - */ |
|
79 | - public function getVar($key, $format = 's') |
|
80 | - { |
|
81 | - if ('s' === $format && in_array($key, ['rate', 'default_currency'])) { |
|
82 | - // return call_user_func(array($this, $key)); |
|
83 | - return $this->{$key}(); |
|
84 | - } |
|
85 | - |
|
86 | - return parent::getVar($key, $format); |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @return mixed |
|
91 | - */ |
|
92 | - public function getCurrencyLink() |
|
93 | - { |
|
94 | - $ret = $this->getVar('name', 'e'); |
|
95 | - |
|
96 | - return $ret; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @return mixed |
|
101 | - */ |
|
102 | - public function getCode() |
|
103 | - { |
|
104 | - $ret = $this->getVar('iso4217', 'e'); |
|
105 | - |
|
106 | - return $ret; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @return float|int|mixed|string |
|
111 | - */ |
|
112 | - public function rate() |
|
113 | - { |
|
114 | - return Smartobject\Utility::getCurrency($this->getVar('rate', 'e')); |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - public function defaultCurrency() |
|
121 | - { |
|
122 | - if (true === $this->getVar('default_currency', 'e')) { |
|
123 | - return _YES; |
|
124 | - } else { |
|
125 | - return _NO; |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - public function getDefaultCurrencyControl() |
|
133 | - { |
|
134 | - $radio_box = '<input name="default_currency" value="' . $this->getVar('currencyid') . '" type="radio"'; |
|
135 | - if ($this->getVar('default_currency', 'e')) { |
|
136 | - $radio_box .= 'checked'; |
|
137 | - } |
|
138 | - $radio_box .= '>'; |
|
139 | - |
|
140 | - return $radio_box; |
|
141 | - } |
|
33 | + public $_modulePlugin = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * SmartobjectCurrency constructor. |
|
37 | + */ |
|
38 | + public function __construct() |
|
39 | + { |
|
40 | + $this->quickInitVar('currencyid', XOBJ_DTYPE_INT, true); |
|
41 | + $this->quickInitVar('iso4217', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_ISO4217, _CO_SOBJECT_CURRENCY_ISO4217_DSC); |
|
42 | + $this->quickInitVar('name', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_NAME); |
|
43 | + $this->quickInitVar('symbol', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_CURRENCY_SYMBOL); |
|
44 | + $this->quickInitVar('rate', XOBJ_DTYPE_FLOAT, true, _CO_SOBJECT_CURRENCY_RATE, '', '1.0'); |
|
45 | + $this->quickInitVar('default_currency', XOBJ_DTYPE_INT, false, _CO_SOBJECT_CURRENCY_DEFAULT, '', false); |
|
46 | + |
|
47 | + $this->setControl('symbol', [ |
|
48 | + 'name' => 'text', |
|
49 | + 'size' => '15', |
|
50 | + 'maxlength' => '15' |
|
51 | + ]); |
|
52 | + |
|
53 | + $this->setControl('iso4217', [ |
|
54 | + 'name' => 'text', |
|
55 | + 'size' => '5', |
|
56 | + 'maxlength' => '5' |
|
57 | + ]); |
|
58 | + |
|
59 | + $this->setControl('rate', [ |
|
60 | + 'name' => 'text', |
|
61 | + 'size' => '5', |
|
62 | + 'maxlength' => '5' |
|
63 | + ]); |
|
64 | + |
|
65 | + $this->setControl('rate', [ |
|
66 | + 'name' => 'text', |
|
67 | + 'size' => '5', |
|
68 | + 'maxlength' => '5' |
|
69 | + ]); |
|
70 | + |
|
71 | + $this->hideFieldFromForm('default_currency'); |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * @param string $key |
|
76 | + * @param string $format |
|
77 | + * @return mixed |
|
78 | + */ |
|
79 | + public function getVar($key, $format = 's') |
|
80 | + { |
|
81 | + if ('s' === $format && in_array($key, ['rate', 'default_currency'])) { |
|
82 | + // return call_user_func(array($this, $key)); |
|
83 | + return $this->{$key}(); |
|
84 | + } |
|
85 | + |
|
86 | + return parent::getVar($key, $format); |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @return mixed |
|
91 | + */ |
|
92 | + public function getCurrencyLink() |
|
93 | + { |
|
94 | + $ret = $this->getVar('name', 'e'); |
|
95 | + |
|
96 | + return $ret; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @return mixed |
|
101 | + */ |
|
102 | + public function getCode() |
|
103 | + { |
|
104 | + $ret = $this->getVar('iso4217', 'e'); |
|
105 | + |
|
106 | + return $ret; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @return float|int|mixed|string |
|
111 | + */ |
|
112 | + public function rate() |
|
113 | + { |
|
114 | + return Smartobject\Utility::getCurrency($this->getVar('rate', 'e')); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + public function defaultCurrency() |
|
121 | + { |
|
122 | + if (true === $this->getVar('default_currency', 'e')) { |
|
123 | + return _YES; |
|
124 | + } else { |
|
125 | + return _NO; |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + public function getDefaultCurrencyControl() |
|
133 | + { |
|
134 | + $radio_box = '<input name="default_currency" value="' . $this->getVar('currencyid') . '" type="radio"'; |
|
135 | + if ($this->getVar('default_currency', 'e')) { |
|
136 | + $radio_box .= 'checked'; |
|
137 | + } |
|
138 | + $radio_box .= '>'; |
|
139 | + |
|
140 | + return $radio_box; |
|
141 | + } |
|
142 | 142 | } |
@@ -21,60 +21,60 @@ |
||
21 | 21 | */ |
22 | 22 | class PersistableMlObjectHandler extends Smartobject\PersistableObjectHandler |
23 | 23 | { |
24 | - /** |
|
25 | - * @param null|\CriteriaElement $criteria |
|
26 | - * @param bool $id_as_key |
|
27 | - * @param bool $as_object |
|
28 | - * @param bool $debug |
|
29 | - * @param bool $language |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - public function getObjects( |
|
33 | - \CriteriaElement $criteria = null, |
|
34 | - $id_as_key = false, |
|
35 | - $as_object = true, |
|
36 | - $debug = false, |
|
37 | - $language = false |
|
38 | - ) { |
|
39 | - // Create the first part of the SQL query to join the "_text" table |
|
40 | - $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName; |
|
24 | + /** |
|
25 | + * @param null|\CriteriaElement $criteria |
|
26 | + * @param bool $id_as_key |
|
27 | + * @param bool $as_object |
|
28 | + * @param bool $debug |
|
29 | + * @param bool $language |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + public function getObjects( |
|
33 | + \CriteriaElement $criteria = null, |
|
34 | + $id_as_key = false, |
|
35 | + $as_object = true, |
|
36 | + $debug = false, |
|
37 | + $language = false |
|
38 | + ) { |
|
39 | + // Create the first part of the SQL query to join the "_text" table |
|
40 | + $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName; |
|
41 | 41 | |
42 | - if ($language) { |
|
43 | - // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
42 | + if ($language) { |
|
43 | + // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
44 | 44 | |
45 | - // if no criteria was previously created, let's create it |
|
46 | - if (!$criteria) { |
|
47 | - $criteria = new \CriteriaCompo(); |
|
48 | - } |
|
49 | - $criteria->add(new \Criteria('language', $language)); |
|
45 | + // if no criteria was previously created, let's create it |
|
46 | + if (!$criteria) { |
|
47 | + $criteria = new \CriteriaCompo(); |
|
48 | + } |
|
49 | + $criteria->add(new \Criteria('language', $language)); |
|
50 | 50 | |
51 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
52 | - } |
|
51 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
52 | + } |
|
53 | 53 | |
54 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
55 | - } |
|
54 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @param mixed $id |
|
59 | - * @param bool $language |
|
60 | - * @param bool $as_object |
|
61 | - * @param bool $debug |
|
62 | - * @return mixed |
|
63 | - */ |
|
64 | - public function &get($id, $language = false, $as_object = true, $debug = false) |
|
65 | - { |
|
66 | - if (!$language) { |
|
67 | - return parent::get($id, $as_object, $debug); |
|
68 | - } else { |
|
69 | - $criteria = new \CriteriaCompo(); |
|
70 | - $criteria->add(new \Criteria('language', $language)); |
|
57 | + /** |
|
58 | + * @param mixed $id |
|
59 | + * @param bool $language |
|
60 | + * @param bool $as_object |
|
61 | + * @param bool $debug |
|
62 | + * @return mixed |
|
63 | + */ |
|
64 | + public function &get($id, $language = false, $as_object = true, $debug = false) |
|
65 | + { |
|
66 | + if (!$language) { |
|
67 | + return parent::get($id, $as_object, $debug); |
|
68 | + } else { |
|
69 | + $criteria = new \CriteriaCompo(); |
|
70 | + $criteria->add(new \Criteria('language', $language)); |
|
71 | 71 | |
72 | - return parent::get($id, $as_object, $debug, $criteria); |
|
73 | - } |
|
74 | - } |
|
72 | + return parent::get($id, $as_object, $debug, $criteria); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - public function changeTableNameForML() |
|
77 | - { |
|
78 | - $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
79 | - } |
|
76 | + public function changeTableNameForML() |
|
77 | + { |
|
78 | + $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
79 | + } |
|
80 | 80 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -include __DIR__ . '/../../mainfile.php'; |
|
10 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
9 | +include __DIR__.'/../../mainfile.php'; |
|
10 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
11 | 11 | |
12 | 12 | Smartobject\Utility::loadCommonLanguageFile(); |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function smartobject_addto_show($options) |
10 | 10 | { |
11 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
11 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
12 | 12 | // require_once SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php'; |
13 | - $smartaddto = new XoopsModules\Smartobject\AddTo($options[0]); |
|
14 | - $block = $smartaddto->renderForBlock(); |
|
13 | + $smartaddto = new XoopsModules\Smartobject\AddTo($options[0]); |
|
14 | + $block = $smartaddto->renderForBlock(); |
|
15 | 15 | |
16 | - return $block; |
|
16 | + return $block; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function smartobject_addto_edit($options) |
24 | 24 | { |
25 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
25 | + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
26 | 26 | |
27 | - $form = ''; |
|
27 | + $form = ''; |
|
28 | 28 | |
29 | - $layout_select = new \XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]); |
|
30 | - $layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0); |
|
31 | - $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1); |
|
32 | - $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2); |
|
33 | - $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3); |
|
34 | - $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>'; |
|
29 | + $layout_select = new \XoopsFormSelect(_MB_SOBJECT_BLOCKS_ADDTO_LAYOUT, 'options[]', $options[0]); |
|
30 | + $layout_select->addOption(0, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION0); |
|
31 | + $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1); |
|
32 | + $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2); |
|
33 | + $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3); |
|
34 | + $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>'; |
|
35 | 35 | |
36 | - return $form; |
|
36 | + return $form; |
|
37 | 37 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function smartobject_addto_show($options) |
10 | 10 | { |
11 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
11 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
12 | 12 | // require_once SMARTOBJECT_ROOT_PATH . 'class/smartaddto.php'; |
13 | 13 | $smartaddto = new XoopsModules\Smartobject\AddTo($options[0]); |
14 | 14 | $block = $smartaddto->renderForBlock(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function smartobject_addto_edit($options) |
24 | 24 | { |
25 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
25 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
26 | 26 | |
27 | 27 | $form = ''; |
28 | 28 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $layout_select->addOption(1, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION1); |
32 | 32 | $layout_select->addOption(2, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2); |
33 | 33 | $layout_select->addOption(3, _MB_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3); |
34 | - $form .= $layout_select->getCaption() . ' ' . $layout_select->render() . '<br>'; |
|
34 | + $form .= $layout_select->getCaption().' '.$layout_select->render().'<br>'; |
|
35 | 35 | |
36 | 36 | return $form; |
37 | 37 | } |
@@ -17,30 +17,30 @@ discard block |
||
17 | 17 | * SmartObject library path |
18 | 18 | */ |
19 | 19 | if (!defined('SMARTOBJECT_URL')) { |
20 | - define('SMARTOBJECT_URL', XOOPS_URL . '/modules/smartobject/'); |
|
20 | + define('SMARTOBJECT_URL', XOOPS_URL.'/modules/smartobject/'); |
|
21 | 21 | } |
22 | 22 | if (!defined('SMARTOBJECT_ROOT_PATH')) { |
23 | - define('SMARTOBJECT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/smartobject/'); |
|
23 | + define('SMARTOBJECT_ROOT_PATH', XOOPS_ROOT_PATH.'/modules/smartobject/'); |
|
24 | 24 | } |
25 | 25 | if (!defined('SMARTOBJECT_IMAGES_URL')) { |
26 | - define('SMARTOBJECT_IMAGES_URL', SMARTOBJECT_URL . 'assets/images/'); |
|
26 | + define('SMARTOBJECT_IMAGES_URL', SMARTOBJECT_URL.'assets/images/'); |
|
27 | 27 | } |
28 | 28 | if (!defined('SMARTOBJECT_IMAGES_ROOT_PATH')) { |
29 | - define('SMARTOBJECT_IMAGES_ROOT_PATH', SMARTOBJECT_ROOT_PATH . 'assets/images/'); |
|
29 | + define('SMARTOBJECT_IMAGES_ROOT_PATH', SMARTOBJECT_ROOT_PATH.'assets/images/'); |
|
30 | 30 | } |
31 | 31 | if (!defined('SMARTOBJECT_IMAGES_ACTIONS_URL')) { |
32 | - define('SMARTOBJECT_IMAGES_ACTIONS_URL', SMARTOBJECT_URL . 'assets/images/actions/'); |
|
32 | + define('SMARTOBJECT_IMAGES_ACTIONS_URL', SMARTOBJECT_URL.'assets/images/actions/'); |
|
33 | 33 | } |
34 | 34 | if (!defined('SMARTOBJECT_IMAGES_ACTIONS_ROOT_PATH')) { |
35 | - define('SMARTOBJECT_IMAGES_ACTIONS_ROOT_PATH', SMARTOBJECT_ROOT_PATH . 'assets/images/actions/'); |
|
35 | + define('SMARTOBJECT_IMAGES_ACTIONS_ROOT_PATH', SMARTOBJECT_ROOT_PATH.'assets/images/actions/'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Version of the SmartObject Framework |
40 | 40 | */ |
41 | -require_once SMARTOBJECT_ROOT_PATH . 'include/version.php'; |
|
41 | +require_once SMARTOBJECT_ROOT_PATH.'include/version.php'; |
|
42 | 42 | //require_once SMARTOBJECT_ROOT_PATH . 'include/functions.php'; |
43 | -require_once SMARTOBJECT_ROOT_PATH . 'include/xoops_core_common_functions.php'; |
|
43 | +require_once SMARTOBJECT_ROOT_PATH.'include/xoops_core_common_functions.php'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Some constants used by the SmartObjects |
@@ -69,4 +69,4 @@ discard block |
||
69 | 69 | // get previous page |
70 | 70 | $smart_previous_page = Smartobject\Utility::getEnv('HTTP_REFERER'); |
71 | 71 | |
72 | -require_once SMARTOBJECT_ROOT_PATH . 'class/smartloader.php'; |
|
72 | +require_once SMARTOBJECT_ROOT_PATH.'class/smartloader.php'; |
@@ -28,26 +28,26 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function xoops_module_update_smartobject(\XoopsModule $module) |
30 | 30 | { |
31 | - ob_start(); |
|
31 | + ob_start(); |
|
32 | 32 | |
33 | - $dbVersion = Smartobject\Utility::getMeta('version', 'smartobject'); |
|
34 | - if (!$dbVersion) { |
|
35 | - $dbVersion = 0; |
|
36 | - } |
|
33 | + $dbVersion = Smartobject\Utility::getMeta('version', 'smartobject'); |
|
34 | + if (!$dbVersion) { |
|
35 | + $dbVersion = 0; |
|
36 | + } |
|
37 | 37 | |
38 | - $dbupdater = new XoopsModules\Smartobject\Dbupdater(); |
|
38 | + $dbupdater = new XoopsModules\Smartobject\Dbupdater(); |
|
39 | 39 | |
40 | - echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
40 | + echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
41 | 41 | |
42 | - // db migrate version = 1 |
|
43 | - $newDbVersion = 1; |
|
44 | - if ($dbVersion < $newDbVersion) { |
|
45 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
42 | + // db migrate version = 1 |
|
43 | + $newDbVersion = 1; |
|
44 | + if ($dbVersion < $newDbVersion) { |
|
45 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
46 | 46 | |
47 | - // Create table smartobject_link |
|
48 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_link'); |
|
49 | - if (!$table->exists()) { |
|
50 | - $table->setStructure("CREATE TABLE `%s` ( |
|
47 | + // Create table smartobject_link |
|
48 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_link'); |
|
49 | + if (!$table->exists()) { |
|
50 | + $table->setStructure("CREATE TABLE `%s` ( |
|
51 | 51 | `linkid` int(11) NOT NULL auto_increment, |
52 | 52 | `from_uid` int(11) NOT NULL default '0', |
53 | 53 | `from_email` varchar(255) NOT NULL default '', |
@@ -64,63 +64,63 @@ discard block |
||
64 | 64 | PRIMARY KEY (`linkid`) |
65 | 65 | ) ENGINE=MyISAM COMMENT='SmartObject by The SmartFactory <www.smartfactory.ca>' AUTO_INCREMENT=1 ;"); |
66 | 66 | |
67 | - if (!$dbupdater->updateTable($table)) { |
|
68 | - /** |
|
69 | - * @todo trap the errors |
|
70 | - */ |
|
71 | - } |
|
72 | - } |
|
73 | - unset($table); |
|
74 | - // Create table smartobject_link |
|
75 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_link'); |
|
76 | - if (!$table->fieldExists('date')) { |
|
77 | - $table->addNewField('date', "int(11) NOT NULL default '0'"); |
|
78 | - if (!$dbupdater->updateTable($table)) { |
|
79 | - /** |
|
80 | - * @todo trap the errors |
|
81 | - */ |
|
82 | - } |
|
83 | - } |
|
84 | - unset($table); |
|
85 | - |
|
86 | - // Create table smartobject_tag |
|
87 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_tag'); |
|
88 | - if (!$table->exists()) { |
|
89 | - $table->setStructure("CREATE TABLE %s ( |
|
67 | + if (!$dbupdater->updateTable($table)) { |
|
68 | + /** |
|
69 | + * @todo trap the errors |
|
70 | + */ |
|
71 | + } |
|
72 | + } |
|
73 | + unset($table); |
|
74 | + // Create table smartobject_link |
|
75 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_link'); |
|
76 | + if (!$table->fieldExists('date')) { |
|
77 | + $table->addNewField('date', "int(11) NOT NULL default '0'"); |
|
78 | + if (!$dbupdater->updateTable($table)) { |
|
79 | + /** |
|
80 | + * @todo trap the errors |
|
81 | + */ |
|
82 | + } |
|
83 | + } |
|
84 | + unset($table); |
|
85 | + |
|
86 | + // Create table smartobject_tag |
|
87 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_tag'); |
|
88 | + if (!$table->exists()) { |
|
89 | + $table->setStructure("CREATE TABLE %s ( |
|
90 | 90 | `tagid` int(11) NOT NULL auto_increment, |
91 | 91 | `name` varchar(255) NOT NULL default '', |
92 | 92 | `description` TEXT NOT NULL, |
93 | 93 | PRIMARY KEY (`id`) |
94 | 94 | ) ENGINE=MyISAM COMMENT='SmartObject by The SmartFactory <www.smartfactory.ca>' AUTO_INCREMENT=1 ;"); |
95 | 95 | |
96 | - if (!$dbupdater->updateTable($table)) { |
|
97 | - /** |
|
98 | - * @todo trap the errors |
|
99 | - */ |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - // Create table smartobject_tag_text |
|
104 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_tag_text'); |
|
105 | - if (!$table->exists()) { |
|
106 | - $table->setStructure("CREATE TABLE %s ( |
|
96 | + if (!$dbupdater->updateTable($table)) { |
|
97 | + /** |
|
98 | + * @todo trap the errors |
|
99 | + */ |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + // Create table smartobject_tag_text |
|
104 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_tag_text'); |
|
105 | + if (!$table->exists()) { |
|
106 | + $table->setStructure("CREATE TABLE %s ( |
|
107 | 107 | `tagid` int(11) NOT NULL default 0, |
108 | 108 | `language` varchar(255) NOT NULL default '', |
109 | 109 | `value` TEXT NOT NULL, |
110 | 110 | PRIMARY KEY (`id`, `language`) |
111 | 111 | ) ENGINE=MyISAM COMMENT='SmartObject by The SmartFactory <www.smartfactory.ca>' AUTO_INCREMENT=1 ;"); |
112 | 112 | |
113 | - if (!$dbupdater->updateTable($table)) { |
|
114 | - /** |
|
115 | - * @todo trap the errors |
|
116 | - */ |
|
117 | - } |
|
118 | - } |
|
119 | - |
|
120 | - // Create table smartobject_adsense |
|
121 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_adsense'); |
|
122 | - if (!$table->exists()) { |
|
123 | - $table->setStructure(" |
|
113 | + if (!$dbupdater->updateTable($table)) { |
|
114 | + /** |
|
115 | + * @todo trap the errors |
|
116 | + */ |
|
117 | + } |
|
118 | + } |
|
119 | + |
|
120 | + // Create table smartobject_adsense |
|
121 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_adsense'); |
|
122 | + if (!$table->exists()) { |
|
123 | + $table->setStructure(" |
|
124 | 124 | `adsenseid` int(11) NOT NULL auto_increment, |
125 | 125 | `format` VARCHAR(100) NOT NULL, |
126 | 126 | `description` TEXT NOT NULL, |
@@ -134,23 +134,23 @@ discard block |
||
134 | 134 | `tag` varchar(50) NOT NULL default '', |
135 | 135 | PRIMARY KEY (`adsenseid`) |
136 | 136 | "); |
137 | - } |
|
138 | - |
|
139 | - if (!$dbupdater->updateTable($table)) { |
|
140 | - /** |
|
141 | - * @todo trap the errors |
|
142 | - */ |
|
143 | - } |
|
144 | - } |
|
145 | - // db migrate version = 2 |
|
146 | - $newDbVersion = 2; |
|
147 | - if ($dbVersion < $newDbVersion) { |
|
148 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
149 | - |
|
150 | - // Create table smartobject_rating |
|
151 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_rating'); |
|
152 | - if (!$table->exists()) { |
|
153 | - $table->setStructure(' |
|
137 | + } |
|
138 | + |
|
139 | + if (!$dbupdater->updateTable($table)) { |
|
140 | + /** |
|
141 | + * @todo trap the errors |
|
142 | + */ |
|
143 | + } |
|
144 | + } |
|
145 | + // db migrate version = 2 |
|
146 | + $newDbVersion = 2; |
|
147 | + if ($dbVersion < $newDbVersion) { |
|
148 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
149 | + |
|
150 | + // Create table smartobject_rating |
|
151 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_rating'); |
|
152 | + if (!$table->exists()) { |
|
153 | + $table->setStructure(' |
|
154 | 154 | `ratingid` int(11) NOT NULL auto_increment, |
155 | 155 | `dirname` VARCHAR(255) NOT NULL, |
156 | 156 | `item` VARCHAR(255) NOT NULL, |
@@ -161,36 +161,36 @@ discard block |
||
161 | 161 | PRIMARY KEY (`ratingid`), |
162 | 162 | UNIQUE (`dirname`, `item`, `itemid`, `uid`) |
163 | 163 | '); |
164 | - } |
|
165 | - |
|
166 | - if (!$dbupdater->updateTable($table)) { |
|
167 | - /** |
|
168 | - * @todo trap the errors |
|
169 | - */ |
|
170 | - } |
|
171 | - |
|
172 | - // Create table smartobject_currency |
|
173 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_currency'); |
|
174 | - $table->setData("2, 'EUR', 'Euro', '�', 0.65, 0"); |
|
175 | - $table->setData("3, 'USD', 'American dollar', '$', 0.9, 0"); |
|
176 | - $table->setData("1, 'CAD', 'Canadian dollar', '$', 1, 1"); |
|
177 | - |
|
178 | - if (!$dbupdater->updateTable($table)) { |
|
179 | - /** |
|
180 | - * @todo trap the errors |
|
181 | - */ |
|
182 | - } |
|
183 | - } |
|
184 | - |
|
185 | - // db migrate version = 3 |
|
186 | - $newDbVersion = 3; |
|
187 | - if ($dbVersion < $newDbVersion) { |
|
188 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
189 | - |
|
190 | - // Create table smartobject_customtag |
|
191 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_customtag'); |
|
192 | - if (!$table->exists()) { |
|
193 | - $table->setStructure(' |
|
164 | + } |
|
165 | + |
|
166 | + if (!$dbupdater->updateTable($table)) { |
|
167 | + /** |
|
168 | + * @todo trap the errors |
|
169 | + */ |
|
170 | + } |
|
171 | + |
|
172 | + // Create table smartobject_currency |
|
173 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_currency'); |
|
174 | + $table->setData("2, 'EUR', 'Euro', '�', 0.65, 0"); |
|
175 | + $table->setData("3, 'USD', 'American dollar', '$', 0.9, 0"); |
|
176 | + $table->setData("1, 'CAD', 'Canadian dollar', '$', 1, 1"); |
|
177 | + |
|
178 | + if (!$dbupdater->updateTable($table)) { |
|
179 | + /** |
|
180 | + * @todo trap the errors |
|
181 | + */ |
|
182 | + } |
|
183 | + } |
|
184 | + |
|
185 | + // db migrate version = 3 |
|
186 | + $newDbVersion = 3; |
|
187 | + if ($dbVersion < $newDbVersion) { |
|
188 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
189 | + |
|
190 | + // Create table smartobject_customtag |
|
191 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_customtag'); |
|
192 | + if (!$table->exists()) { |
|
193 | + $table->setStructure(' |
|
194 | 194 | `customtagid` int(11) NOT NULL auto_increment, |
195 | 195 | `name` VARCHAR(255) NOT NULL, |
196 | 196 | `description` TEXT NOT NULL, |
@@ -198,24 +198,24 @@ discard block |
||
198 | 198 | `language` TEXT NOT NULL, |
199 | 199 | PRIMARY KEY (`customtagid`) |
200 | 200 | '); |
201 | - } |
|
202 | - |
|
203 | - if (!$dbupdater->updateTable($table)) { |
|
204 | - /** |
|
205 | - * @todo trap the errors |
|
206 | - */ |
|
207 | - } |
|
208 | - } |
|
209 | - |
|
210 | - // db migrate version = 4 |
|
211 | - $newDbVersion = 4; |
|
212 | - if ($dbVersion < $newDbVersion) { |
|
213 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
214 | - |
|
215 | - // Create table smartobject_currency |
|
216 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_currency'); |
|
217 | - if (!$table->exists()) { |
|
218 | - $table->setStructure(' |
|
201 | + } |
|
202 | + |
|
203 | + if (!$dbupdater->updateTable($table)) { |
|
204 | + /** |
|
205 | + * @todo trap the errors |
|
206 | + */ |
|
207 | + } |
|
208 | + } |
|
209 | + |
|
210 | + // db migrate version = 4 |
|
211 | + $newDbVersion = 4; |
|
212 | + if ($dbVersion < $newDbVersion) { |
|
213 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
214 | + |
|
215 | + // Create table smartobject_currency |
|
216 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_currency'); |
|
217 | + if (!$table->exists()) { |
|
218 | + $table->setStructure(' |
|
219 | 219 | `currencyid` int(11) NOT NULL auto_increment, |
220 | 220 | `iso4217` VARCHAR(5) NOT NULL, |
221 | 221 | `name` VARCHAR(255) NOT NULL, |
@@ -224,46 +224,46 @@ discard block |
||
224 | 224 | `default_currency` int(1) NOT NULL, |
225 | 225 | PRIMARY KEY (`currencyid`) |
226 | 226 | '); |
227 | - } |
|
228 | - |
|
229 | - if (!$dbupdater->updateTable($table)) { |
|
230 | - /** |
|
231 | - * @todo trap the errors |
|
232 | - */ |
|
233 | - } |
|
234 | - } |
|
235 | - |
|
236 | - // db migrate version = 6 |
|
237 | - $newDbVersion = 6; |
|
238 | - if ($dbVersion < $newDbVersion) { |
|
239 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
240 | - } |
|
241 | - |
|
242 | - $newDbVersion = 7; |
|
243 | - if ($dbVersion < $newDbVersion) { |
|
244 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
245 | - |
|
246 | - // Create table smartobject_file |
|
247 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_file'); |
|
248 | - if (!$table->exists()) { |
|
249 | - $table->setStructure(' |
|
227 | + } |
|
228 | + |
|
229 | + if (!$dbupdater->updateTable($table)) { |
|
230 | + /** |
|
231 | + * @todo trap the errors |
|
232 | + */ |
|
233 | + } |
|
234 | + } |
|
235 | + |
|
236 | + // db migrate version = 6 |
|
237 | + $newDbVersion = 6; |
|
238 | + if ($dbVersion < $newDbVersion) { |
|
239 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
240 | + } |
|
241 | + |
|
242 | + $newDbVersion = 7; |
|
243 | + if ($dbVersion < $newDbVersion) { |
|
244 | + echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
245 | + |
|
246 | + // Create table smartobject_file |
|
247 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_file'); |
|
248 | + if (!$table->exists()) { |
|
249 | + $table->setStructure(' |
|
250 | 250 | `fileid` int(11) NOT NULL auto_increment, |
251 | 251 | `caption` varchar(255) collate latin1_general_ci NOT NULL, |
252 | 252 | `url` varchar(255) collate latin1_general_ci NOT NULL, |
253 | 253 | `description` text collate latin1_general_ci NOT NULL, |
254 | 254 | PRIMARY KEY (`fileid`) |
255 | 255 | '); |
256 | - if (!$dbupdater->updateTable($table)) { |
|
257 | - /** |
|
258 | - * @todo trap the errors |
|
259 | - */ |
|
260 | - } |
|
261 | - } |
|
262 | - unset($table); |
|
263 | - // Create table smartobject_urllink |
|
264 | - $table = new XoopsModules\Smartobject\DbTable('smartobject_urllink'); |
|
265 | - if (!$table->exists()) { |
|
266 | - $table->setStructure(' |
|
256 | + if (!$dbupdater->updateTable($table)) { |
|
257 | + /** |
|
258 | + * @todo trap the errors |
|
259 | + */ |
|
260 | + } |
|
261 | + } |
|
262 | + unset($table); |
|
263 | + // Create table smartobject_urllink |
|
264 | + $table = new XoopsModules\Smartobject\DbTable('smartobject_urllink'); |
|
265 | + if (!$table->exists()) { |
|
266 | + $table->setStructure(' |
|
267 | 267 | `urllinkid` int(11) NOT NULL auto_increment, |
268 | 268 | `caption` varchar(255) collate latin1_general_ci NOT NULL, |
269 | 269 | `url` varchar(255) collate latin1_general_ci NOT NULL, |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | `target` varchar(10) collate latin1_general_ci NOT NULL, |
272 | 272 | PRIMARY KEY (`urllinkid`) |
273 | 273 | '); |
274 | - if (!$dbupdater->updateTable($table)) { |
|
275 | - /** |
|
276 | - * @todo trap the errors |
|
277 | - */ |
|
278 | - } |
|
279 | - } |
|
280 | - unset($table); |
|
281 | - } |
|
282 | - echo '</code>'; |
|
283 | - |
|
284 | - $feedback = ob_get_clean(); |
|
285 | - if (method_exists($module, 'setMessage')) { |
|
286 | - $module->setMessage($feedback); |
|
287 | - } else { |
|
288 | - echo $feedback; |
|
289 | - } |
|
290 | - Smartobject\Utility::setMeta('version', $newDbVersion, 'smartobject'); //Set meta version to current |
|
291 | - |
|
292 | - return true; |
|
274 | + if (!$dbupdater->updateTable($table)) { |
|
275 | + /** |
|
276 | + * @todo trap the errors |
|
277 | + */ |
|
278 | + } |
|
279 | + } |
|
280 | + unset($table); |
|
281 | + } |
|
282 | + echo '</code>'; |
|
283 | + |
|
284 | + $feedback = ob_get_clean(); |
|
285 | + if (method_exists($module, 'setMessage')) { |
|
286 | + $module->setMessage($feedback); |
|
287 | + } else { |
|
288 | + echo $feedback; |
|
289 | + } |
|
290 | + Smartobject\Utility::setMeta('version', $newDbVersion, 'smartobject'); //Set meta version to current |
|
291 | + |
|
292 | + return true; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function xoops_module_install_smartobject(\XoopsModule $module) |
300 | 300 | { |
301 | - ob_start(); |
|
301 | + ob_start(); |
|
302 | 302 | |
303 | - echo 'Using the ImpressCMS onInstall event'; |
|
304 | - $feedback = ob_get_clean(); |
|
303 | + echo 'Using the ImpressCMS onInstall event'; |
|
304 | + $feedback = ob_get_clean(); |
|
305 | 305 | |
306 | - return $feedback; |
|
306 | + return $feedback; |
|
307 | 307 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
21 | 21 | |
22 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
23 | 23 | //require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartdbupdater.php'; |
24 | 24 | |
25 | 25 | /** |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | |
38 | 38 | $dbupdater = new XoopsModules\Smartobject\Dbupdater(); |
39 | 39 | |
40 | - echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
40 | + echo '<code>'._SDU_UPDATE_UPDATING_DATABASE.'<br>'; |
|
41 | 41 | |
42 | 42 | // db migrate version = 1 |
43 | 43 | $newDbVersion = 1; |
44 | 44 | if ($dbVersion < $newDbVersion) { |
45 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
45 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
46 | 46 | |
47 | 47 | // Create table smartobject_link |
48 | 48 | $table = new XoopsModules\Smartobject\DbTable('smartobject_link'); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | // db migrate version = 2 |
146 | 146 | $newDbVersion = 2; |
147 | 147 | if ($dbVersion < $newDbVersion) { |
148 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
148 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
149 | 149 | |
150 | 150 | // Create table smartobject_rating |
151 | 151 | $table = new XoopsModules\Smartobject\DbTable('smartobject_rating'); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // db migrate version = 3 |
186 | 186 | $newDbVersion = 3; |
187 | 187 | if ($dbVersion < $newDbVersion) { |
188 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
188 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
189 | 189 | |
190 | 190 | // Create table smartobject_customtag |
191 | 191 | $table = new XoopsModules\Smartobject\DbTable('smartobject_customtag'); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // db migrate version = 4 |
211 | 211 | $newDbVersion = 4; |
212 | 212 | if ($dbVersion < $newDbVersion) { |
213 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
213 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
214 | 214 | |
215 | 215 | // Create table smartobject_currency |
216 | 216 | $table = new XoopsModules\Smartobject\DbTable('smartobject_currency'); |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | // db migrate version = 6 |
237 | 237 | $newDbVersion = 6; |
238 | 238 | if ($dbVersion < $newDbVersion) { |
239 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
239 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $newDbVersion = 7; |
243 | 243 | if ($dbVersion < $newDbVersion) { |
244 | - echo 'Database migrate to version ' . $newDbVersion . '<br>'; |
|
244 | + echo 'Database migrate to version '.$newDbVersion.'<br>'; |
|
245 | 245 | |
246 | 246 | // Create table smartobject_file |
247 | 247 | $table = new XoopsModules\Smartobject\DbTable('smartobject_file'); |
@@ -13,16 +13,16 @@ |
||
13 | 13 | |
14 | 14 | function smart_adsense_initiate_smartytags() |
15 | 15 | { |
16 | - global $xoopsTpl, $smartobjectAdsenseHandler; |
|
17 | - if (is_object($xoopsTpl)) { |
|
18 | - foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
19 | - $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
20 | - } |
|
21 | - } |
|
16 | + global $xoopsTpl, $smartobjectAdsenseHandler; |
|
17 | + if (is_object($xoopsTpl)) { |
|
18 | + foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
19 | + $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
20 | + } |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if (!defined('SMARTOBJECT_URL')) { |
25 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
25 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | //require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
@@ -16,13 +16,13 @@ |
||
16 | 16 | global $xoopsTpl, $smartobjectAdsenseHandler; |
17 | 17 | if (is_object($xoopsTpl)) { |
18 | 18 | foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
19 | - $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
19 | + $xoopsTpl->assign('adsense_'.$k, $v->render()); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | 24 | if (!defined('SMARTOBJECT_URL')) { |
25 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
25 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | //require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use XoopsModules\Smartobject\PluginHandler; |
13 | 13 | |
14 | 14 | if (!defined('SMARTOBJECT_URL')) { |
15 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
15 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
16 | 16 | } |
17 | 17 | //require_once SMARTOBJECT_ROOT_PATH . 'class/rating.php'; |
18 | 18 | //require_once SMARTOBJECT_ROOT_PATH . 'include/functions.php'; |
@@ -26,52 +26,52 @@ discard block |
||
26 | 26 | $smartobjectPluginHandler = new XoopsModules\Smartobject\PluginHandler(); |
27 | 27 | $pluginObj = $smartobjectPluginHandler->getPlugin($module_dirname); |
28 | 28 | if ($pluginObj) { |
29 | - $rating_item = $pluginObj->getItem(); |
|
30 | - if ($rating_item) { |
|
31 | - $rating_itemid = $pluginObj->getItemIdForItem($rating_item); |
|
32 | - $stats = $smartobjectRatingHandler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); |
|
33 | - $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); |
|
34 | - $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); |
|
35 | - $xoopsTpl->assign('smartobject_rating_item', $rating_item); |
|
36 | - if (is_object($xoopsUser)) { |
|
37 | - $ratingObj = $smartobjectRatingHandler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); |
|
38 | - $xoopsTpl->assign('smartobject_user_can_rate', true); |
|
39 | - } |
|
40 | - if (isset($ratingObj) && is_object($ratingObj)) { |
|
41 | - $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); |
|
42 | - $xoopsTpl->assign('smartobject_rated', true); |
|
43 | - } else { |
|
44 | - $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); |
|
45 | - $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); |
|
46 | - $urls = Smartobject\Utility::getCurrentUrls(); |
|
47 | - $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
|
48 | - if (isset($xoTheme) && is_object($xoTheme)) { |
|
49 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
50 | - } else { |
|
51 | - //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
|
52 | - //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
|
53 | - } |
|
54 | - } |
|
55 | - } |
|
29 | + $rating_item = $pluginObj->getItem(); |
|
30 | + if ($rating_item) { |
|
31 | + $rating_itemid = $pluginObj->getItemIdForItem($rating_item); |
|
32 | + $stats = $smartobjectRatingHandler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); |
|
33 | + $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); |
|
34 | + $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); |
|
35 | + $xoopsTpl->assign('smartobject_rating_item', $rating_item); |
|
36 | + if (is_object($xoopsUser)) { |
|
37 | + $ratingObj = $smartobjectRatingHandler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); |
|
38 | + $xoopsTpl->assign('smartobject_user_can_rate', true); |
|
39 | + } |
|
40 | + if (isset($ratingObj) && is_object($ratingObj)) { |
|
41 | + $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); |
|
42 | + $xoopsTpl->assign('smartobject_rated', true); |
|
43 | + } else { |
|
44 | + $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); |
|
45 | + $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); |
|
46 | + $urls = Smartobject\Utility::getCurrentUrls(); |
|
47 | + $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
|
48 | + if (isset($xoTheme) && is_object($xoTheme)) { |
|
49 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
50 | + } else { |
|
51 | + //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
|
52 | + //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
|
53 | + } |
|
54 | + } |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if (isset($_POST['smartobject_rating_submit'])) { |
59 | - // The rating form has just been posted. Let's save the info |
|
60 | - $ratingObj = $smartobjectRatingHandler->create(); |
|
61 | - $ratingObj->setVar('dirname', $module_dirname); |
|
62 | - $ratingObj->setVar('item', $rating_item); |
|
63 | - $ratingObj->setVar('itemid', $rating_itemid); |
|
64 | - $ratingObj->setVar('uid', $xoopsUser->getVar('uid')); |
|
65 | - $ratingObj->setVar('date', time()); |
|
66 | - $ratingObj->setVar('rate', $_POST['smartobject_rating_value']); |
|
67 | - if (!$smartobjectRatingHandler->insert($ratingObj)) { |
|
68 | - if (1062 == $xoopsDB->errno()) { |
|
69 | - $message = _SOBJECT_RATING_DUPLICATE_ENTRY; |
|
70 | - } else { |
|
71 | - $message = _SOBJECT_RATING_ERROR; |
|
72 | - } |
|
73 | - } else { |
|
74 | - $message = _SOBJECT_RATING_SUCCESS; |
|
75 | - } |
|
76 | - redirect_header('', 3, $message); |
|
59 | + // The rating form has just been posted. Let's save the info |
|
60 | + $ratingObj = $smartobjectRatingHandler->create(); |
|
61 | + $ratingObj->setVar('dirname', $module_dirname); |
|
62 | + $ratingObj->setVar('item', $rating_item); |
|
63 | + $ratingObj->setVar('itemid', $rating_itemid); |
|
64 | + $ratingObj->setVar('uid', $xoopsUser->getVar('uid')); |
|
65 | + $ratingObj->setVar('date', time()); |
|
66 | + $ratingObj->setVar('rate', $_POST['smartobject_rating_value']); |
|
67 | + if (!$smartobjectRatingHandler->insert($ratingObj)) { |
|
68 | + if (1062 == $xoopsDB->errno()) { |
|
69 | + $message = _SOBJECT_RATING_DUPLICATE_ENTRY; |
|
70 | + } else { |
|
71 | + $message = _SOBJECT_RATING_ERROR; |
|
72 | + } |
|
73 | + } else { |
|
74 | + $message = _SOBJECT_RATING_SUCCESS; |
|
75 | + } |
|
76 | + redirect_header('', 3, $message); |
|
77 | 77 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use XoopsModules\Smartobject\PluginHandler; |
13 | 13 | |
14 | 14 | if (!defined('SMARTOBJECT_URL')) { |
15 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
15 | + require_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
16 | 16 | } |
17 | 17 | //require_once SMARTOBJECT_ROOT_PATH . 'class/rating.php'; |
18 | 18 | //require_once SMARTOBJECT_ROOT_PATH . 'include/functions.php'; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $urls = Smartobject\Utility::getCurrentUrls(); |
47 | 47 | $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
48 | 48 | if (isset($xoTheme) && is_object($xoTheme)) { |
49 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
49 | + $xoTheme->addStylesheet(SMARTOBJECT_URL.'assets/css/module.css'); |
|
50 | 50 | } else { |
51 | 51 | //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
52 | 52 | //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |