@@ -24,20 +24,20 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class SmartFormHidden extends XoopsFormHidden |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @return string |
|
| 29 | - */ |
|
| 30 | - public function render() |
|
| 31 | - { |
|
| 32 | - if (is_array($this->getValue())) { |
|
| 33 | - $ret = ''; |
|
| 34 | - foreach ($this->getValue() as $value) { |
|
| 35 | - $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n"; |
|
| 36 | - } |
|
| 37 | - } else { |
|
| 38 | - $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>"; |
|
| 39 | - } |
|
| 27 | + /** |
|
| 28 | + * @return string |
|
| 29 | + */ |
|
| 30 | + public function render() |
|
| 31 | + { |
|
| 32 | + if (is_array($this->getValue())) { |
|
| 33 | + $ret = ''; |
|
| 34 | + foreach ($this->getValue() as $value) { |
|
| 35 | + $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n"; |
|
| 36 | + } |
|
| 37 | + } else { |
|
| 38 | + $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>"; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - return $ret; |
|
| 42 | - } |
|
| 41 | + return $ret; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -32,10 +32,10 @@ |
||
| 32 | 32 | if (is_array($this->getValue())) { |
| 33 | 33 | $ret = ''; |
| 34 | 34 | foreach ($this->getValue() as $value) { |
| 35 | - $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n"; |
|
| 35 | + $ret .= "<input type='hidden' name='".$this->getName()."[]' id='".$this->getName()."' value='".$value."'>\n"; |
|
| 36 | 36 | } |
| 37 | 37 | } else { |
| 38 | - $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>"; |
|
| 38 | + $ret = "<input type='hidden' name='".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."'>"; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | return $ret; |
@@ -11,54 +11,54 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class SmartFormRadioElement extends XoopsFormRadio |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * SmartFormRadioElement constructor. |
|
| 16 | - * @param string $object |
|
| 17 | - * @param string $key |
|
| 18 | - */ |
|
| 19 | - public function __construct($object, $key) |
|
| 20 | - { |
|
| 21 | - $var = $object->vars[$key]; |
|
| 14 | + /** |
|
| 15 | + * SmartFormRadioElement constructor. |
|
| 16 | + * @param string $object |
|
| 17 | + * @param string $key |
|
| 18 | + */ |
|
| 19 | + public function __construct($object, $key) |
|
| 20 | + { |
|
| 21 | + $var = $object->vars[$key]; |
|
| 22 | 22 | |
| 23 | - parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 23 | + parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e')); |
|
| 24 | 24 | |
| 25 | - // Adding the options inside this SelectBox |
|
| 26 | - // If the custom method is not from a module, than it's from the core |
|
| 27 | - $control = $object->getControl($key); |
|
| 25 | + // Adding the options inside this SelectBox |
|
| 26 | + // If the custom method is not from a module, than it's from the core |
|
| 27 | + $control = $object->getControl($key); |
|
| 28 | 28 | |
| 29 | - if (isset($control['options'])) { |
|
| 30 | - $this->addOptionArray($control['options']); |
|
| 31 | - } else { |
|
| 32 | - // let's find if the method we need to call comes from an already defined object |
|
| 33 | - if (isset($control['object'])) { |
|
| 34 | - if (method_exists($control['object'], $control['method'])) { |
|
| 35 | - if ($option_array = $control['object']->{$control['method']}()) { |
|
| 36 | - // Adding the options array to the XoopsFormSelect |
|
| 37 | - $this->addOptionArray($option_array); |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - } else { |
|
| 41 | - // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 42 | - if (isset($control['itemHandler'])) { |
|
| 43 | - if (!$control['module']) { |
|
| 44 | - // Creating the specified core object handler |
|
| 45 | - $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 46 | - } else { |
|
| 47 | - $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 48 | - } |
|
| 49 | - } else { |
|
| 50 | - $controlHandler = $object->handler; |
|
| 51 | - } |
|
| 29 | + if (isset($control['options'])) { |
|
| 30 | + $this->addOptionArray($control['options']); |
|
| 31 | + } else { |
|
| 32 | + // let's find if the method we need to call comes from an already defined object |
|
| 33 | + if (isset($control['object'])) { |
|
| 34 | + if (method_exists($control['object'], $control['method'])) { |
|
| 35 | + if ($option_array = $control['object']->{$control['method']}()) { |
|
| 36 | + // Adding the options array to the XoopsFormSelect |
|
| 37 | + $this->addOptionArray($option_array); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 42 | + if (isset($control['itemHandler'])) { |
|
| 43 | + if (!$control['module']) { |
|
| 44 | + // Creating the specified core object handler |
|
| 45 | + $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 46 | + } else { |
|
| 47 | + $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 48 | + } |
|
| 49 | + } else { |
|
| 50 | + $controlHandler = $object->handler; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - // Checking if the specified method exists |
|
| 54 | - if (method_exists($controlHandler, $control['method'])) { |
|
| 55 | - // TODO: How could I pass the parameters in the following call ... |
|
| 56 | - if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 57 | - // Adding the options array to the XoopsFormSelect |
|
| 58 | - $this->addOptionArray($option_array); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - } |
|
| 53 | + // Checking if the specified method exists |
|
| 54 | + if (method_exists($controlHandler, $control['method'])) { |
|
| 55 | + // TODO: How could I pass the parameters in the following call ... |
|
| 56 | + if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 57 | + // Adding the options array to the XoopsFormSelect |
|
| 58 | + $this->addOptionArray($option_array); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -24,82 +24,82 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class SmartMlObject extends SmartObject |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * SmartMlObject constructor. |
|
| 29 | - */ |
|
| 30 | - public function __construct() |
|
| 31 | - { |
|
| 32 | - $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
| 33 | - $this->setControl('language', 'language'); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * If object is not new, change the control of the not-multilanguage fields |
|
| 38 | - * |
|
| 39 | - * We need to intercept this function from SmartObject because if the object is not new... |
|
| 40 | - */ |
|
| 41 | - // function getForm() { |
|
| 42 | - |
|
| 43 | - //} |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Strip Multilanguage Fields |
|
| 47 | - * |
|
| 48 | - * Get rid of all the multilanguage fields to have an object with only global fields. |
|
| 49 | - * This will be usefull when creating the ML object for the first time. Then we will be able |
|
| 50 | - * to create translations. |
|
| 51 | - */ |
|
| 52 | - public function stripMultilanguageFields() |
|
| 53 | - { |
|
| 54 | - $objectVars =& $this->getVars(); |
|
| 55 | - $newObjectVars = array(); |
|
| 56 | - foreach ($objectVars as $key => $var) { |
|
| 57 | - if (!$var['multilingual']) { |
|
| 58 | - $newObjectVars[$key] = $var; |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - $this->vars = $newObjectVars; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - public function stripNonMultilanguageFields() |
|
| 65 | - { |
|
| 66 | - $objectVars =& $this->getVars(); |
|
| 67 | - $newObjectVars = array(); |
|
| 68 | - foreach ($objectVars as $key => $var) { |
|
| 69 | - if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
| 70 | - $newObjectVars[$key] = $var; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - $this->vars = $newObjectVars; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Make non multilanguage fields read only |
|
| 78 | - * |
|
| 79 | - * This is used when we are creating/editing a translation. |
|
| 80 | - * We only want to edit the multilanguag fields, not the global one. |
|
| 81 | - */ |
|
| 82 | - public function makeNonMLFieldReadOnly() |
|
| 83 | - { |
|
| 84 | - foreach ($this->getVars() as $key => $var) { |
|
| 85 | - //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
| 86 | - if (!$var['multilingual'] && $key != $this->handler->keyName) { |
|
| 87 | - $this->setControl($key, 'label'); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * @param bool $onlyUrl |
|
| 94 | - * @param bool $withimage |
|
| 95 | - * @return string |
|
| 96 | - */ |
|
| 97 | - public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
| 98 | - { |
|
| 99 | - $controller = new SmartObjectController($this->handler); |
|
| 100 | - |
|
| 101 | - return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
| 102 | - } |
|
| 27 | + /** |
|
| 28 | + * SmartMlObject constructor. |
|
| 29 | + */ |
|
| 30 | + public function __construct() |
|
| 31 | + { |
|
| 32 | + $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
| 33 | + $this->setControl('language', 'language'); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * If object is not new, change the control of the not-multilanguage fields |
|
| 38 | + * |
|
| 39 | + * We need to intercept this function from SmartObject because if the object is not new... |
|
| 40 | + */ |
|
| 41 | + // function getForm() { |
|
| 42 | + |
|
| 43 | + //} |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Strip Multilanguage Fields |
|
| 47 | + * |
|
| 48 | + * Get rid of all the multilanguage fields to have an object with only global fields. |
|
| 49 | + * This will be usefull when creating the ML object for the first time. Then we will be able |
|
| 50 | + * to create translations. |
|
| 51 | + */ |
|
| 52 | + public function stripMultilanguageFields() |
|
| 53 | + { |
|
| 54 | + $objectVars =& $this->getVars(); |
|
| 55 | + $newObjectVars = array(); |
|
| 56 | + foreach ($objectVars as $key => $var) { |
|
| 57 | + if (!$var['multilingual']) { |
|
| 58 | + $newObjectVars[$key] = $var; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + $this->vars = $newObjectVars; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + public function stripNonMultilanguageFields() |
|
| 65 | + { |
|
| 66 | + $objectVars =& $this->getVars(); |
|
| 67 | + $newObjectVars = array(); |
|
| 68 | + foreach ($objectVars as $key => $var) { |
|
| 69 | + if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
| 70 | + $newObjectVars[$key] = $var; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + $this->vars = $newObjectVars; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Make non multilanguage fields read only |
|
| 78 | + * |
|
| 79 | + * This is used when we are creating/editing a translation. |
|
| 80 | + * We only want to edit the multilanguag fields, not the global one. |
|
| 81 | + */ |
|
| 82 | + public function makeNonMLFieldReadOnly() |
|
| 83 | + { |
|
| 84 | + foreach ($this->getVars() as $key => $var) { |
|
| 85 | + //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
| 86 | + if (!$var['multilingual'] && $key != $this->handler->keyName) { |
|
| 87 | + $this->setControl($key, 'label'); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * @param bool $onlyUrl |
|
| 94 | + * @param bool $withimage |
|
| 95 | + * @return string |
|
| 96 | + */ |
|
| 97 | + public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
| 98 | + { |
|
| 99 | + $controller = new SmartObjectController($this->handler); |
|
| 100 | + |
|
| 101 | + return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,60 +107,60 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | class SmartPersistableMlObjectHandler extends SmartPersistableObjectHandler |
| 109 | 109 | { |
| 110 | - /** |
|
| 111 | - * @param null $criteria |
|
| 112 | - * @param bool $id_as_key |
|
| 113 | - * @param bool $as_object |
|
| 114 | - * @param bool $debug |
|
| 115 | - * @param bool $language |
|
| 116 | - * @return array |
|
| 117 | - */ |
|
| 118 | - public function getObjects( |
|
| 119 | - $criteria = null, |
|
| 120 | - $id_as_key = false, |
|
| 121 | - $as_object = true, |
|
| 122 | - $debug = false, |
|
| 123 | - $language = false |
|
| 124 | - ) { |
|
| 125 | - // Create the first part of the SQL query to join the "_text" table |
|
| 126 | - $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; |
|
| 127 | - |
|
| 128 | - if ($language) { |
|
| 129 | - // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
| 130 | - |
|
| 131 | - // if no criteria was previously created, let's create it |
|
| 132 | - if (!$criteria) { |
|
| 133 | - $criteria = new CriteriaCompo(); |
|
| 134 | - } |
|
| 135 | - $criteria->add(new Criteria('language', $language)); |
|
| 136 | - |
|
| 137 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * @param mixed $id |
|
| 145 | - * @param bool $language |
|
| 146 | - * @param bool $as_object |
|
| 147 | - * @param bool $debug |
|
| 148 | - * @return mixed |
|
| 149 | - */ |
|
| 150 | - public function &get($id, $language = false, $as_object = true, $debug = false) |
|
| 151 | - { |
|
| 152 | - if (!$language) { |
|
| 153 | - return parent::get($id, $as_object, $debug); |
|
| 154 | - } else { |
|
| 155 | - $criteria = new CriteriaCompo(); |
|
| 156 | - $criteria->add(new Criteria('language', $language)); |
|
| 157 | - |
|
| 158 | - return parent::get($id, $as_object, $debug, $criteria); |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - public function changeTableNameForML() |
|
| 163 | - { |
|
| 164 | - $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
| 165 | - } |
|
| 110 | + /** |
|
| 111 | + * @param null $criteria |
|
| 112 | + * @param bool $id_as_key |
|
| 113 | + * @param bool $as_object |
|
| 114 | + * @param bool $debug |
|
| 115 | + * @param bool $language |
|
| 116 | + * @return array |
|
| 117 | + */ |
|
| 118 | + public function getObjects( |
|
| 119 | + $criteria = null, |
|
| 120 | + $id_as_key = false, |
|
| 121 | + $as_object = true, |
|
| 122 | + $debug = false, |
|
| 123 | + $language = false |
|
| 124 | + ) { |
|
| 125 | + // Create the first part of the SQL query to join the "_text" table |
|
| 126 | + $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; |
|
| 127 | + |
|
| 128 | + if ($language) { |
|
| 129 | + // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
| 130 | + |
|
| 131 | + // if no criteria was previously created, let's create it |
|
| 132 | + if (!$criteria) { |
|
| 133 | + $criteria = new CriteriaCompo(); |
|
| 134 | + } |
|
| 135 | + $criteria->add(new Criteria('language', $language)); |
|
| 136 | + |
|
| 137 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * @param mixed $id |
|
| 145 | + * @param bool $language |
|
| 146 | + * @param bool $as_object |
|
| 147 | + * @param bool $debug |
|
| 148 | + * @return mixed |
|
| 149 | + */ |
|
| 150 | + public function &get($id, $language = false, $as_object = true, $debug = false) |
|
| 151 | + { |
|
| 152 | + if (!$language) { |
|
| 153 | + return parent::get($id, $as_object, $debug); |
|
| 154 | + } else { |
|
| 155 | + $criteria = new CriteriaCompo(); |
|
| 156 | + $criteria->add(new Criteria('language', $language)); |
|
| 157 | + |
|
| 158 | + return parent::get($id, $as_object, $debug, $criteria); |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + public function changeTableNameForML() |
|
| 163 | + { |
|
| 164 | + $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
| 165 | + } |
|
| 166 | 166 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 14 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
|
| 14 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php'; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * SmartObject base Multilanguage-enabled class |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function stripMultilanguageFields() |
| 53 | 53 | { |
| 54 | - $objectVars =& $this->getVars(); |
|
| 54 | + $objectVars = & $this->getVars(); |
|
| 55 | 55 | $newObjectVars = array(); |
| 56 | 56 | foreach ($objectVars as $key => $var) { |
| 57 | 57 | if (!$var['multilingual']) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function stripNonMultilanguageFields() |
| 65 | 65 | { |
| 66 | - $objectVars =& $this->getVars(); |
|
| 66 | + $objectVars = & $this->getVars(); |
|
| 67 | 67 | $newObjectVars = array(); |
| 68 | 68 | foreach ($objectVars as $key => $var) { |
| 69 | 69 | if ($var['multilingual'] || $key == $this->handler->keyName) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $language = false |
| 124 | 124 | ) { |
| 125 | 125 | // Create the first part of the SQL query to join the "_text" table |
| 126 | - $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; |
|
| 126 | + $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; |
|
| 127 | 127 | |
| 128 | 128 | if ($language) { |
| 129 | 129 | // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
@@ -161,6 +161,6 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | public function changeTableNameForML() |
| 163 | 163 | { |
| 164 | - $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
| 164 | + $this->table = $this->db->prefix($this->_moduleName.'_'.$this->_itemname.'_text'); |
|
| 165 | 165 | } |
| 166 | 166 | } |
@@ -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'; |
|
| 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'; |
|
| 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 XoopsDatabase $db |
|
| 159 | - */ |
|
| 160 | - public function __construct(XoopsDatabase $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 XoopsDatabase $db |
|
| 159 | + */ |
|
| 160 | + public function __construct(XoopsDatabase $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 | } |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 31 | 31 | |
| 32 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
|
| 33 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 32 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php'; |
|
| 33 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Class SmartobjectCurrency |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function getDefaultCurrencyControl() |
| 140 | 140 | { |
| 141 | - $radio_box = '<input name="default_currency" value="' . $this->getVar('currencyid') . '" type="radio"'; |
|
| 141 | + $radio_box = '<input name="default_currency" value="'.$this->getVar('currencyid').'" type="radio"'; |
|
| 142 | 142 | if ($this->getVar('default_currency', 'e')) { |
| 143 | 143 | $radio_box .= 'checked'; |
| 144 | 144 | } |
@@ -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 XoopsObject |
|
| 20 | - * |
|
| 21 | - * @static |
|
| 22 | - * @staticvar object |
|
| 23 | - */ |
|
| 24 | - public static function getInstance() |
|
| 25 | - { |
|
| 26 | - static $instance; |
|
| 27 | - if (null === $instance) { |
|
| 28 | - $instance = new static(); |
|
| 29 | - } |
|
| 16 | + /** |
|
| 17 | + * Access the only instance of this class |
|
| 18 | + * |
|
| 19 | + * @return XoopsObject |
|
| 20 | + * |
|
| 21 | + * @static |
|
| 22 | + * @staticvar object |
|
| 23 | + */ |
|
| 24 | + public static function getInstance() |
|
| 25 | + { |
|
| 26 | + static $instance; |
|
| 27 | + if (null === $instance) { |
|
| 28 | + $instance = new static(); |
|
| 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 | - require_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 | + require_once $filename; |
|
| 43 | + $function = 'smarthook_' . $lower_hook_name; |
|
| 44 | + if (function_exists($function)) { |
|
| 45 | + $function(); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -37,10 +37,10 @@ |
||
| 37 | 37 | public function executeHook($hook_name) |
| 38 | 38 | { |
| 39 | 39 | $lower_hook_name = strtolower($hook_name); |
| 40 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
| 40 | + $filename = SMARTOBJECT_ROOT_PATH.'include/custom_code/'.$lower_hook_name.'.php'; |
|
| 41 | 41 | if (file_exists($filename)) { |
| 42 | 42 | require_once $filename; |
| 43 | - $function = 'smarthook_' . $lower_hook_name; |
|
| 43 | + $function = 'smarthook_'.$lower_hook_name; |
|
| 44 | 44 | if (function_exists($function)) { |
| 45 | 45 | $function(); |
| 46 | 46 | } |
@@ -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 | - require_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 | + require_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 XoopsDatabase $db |
|
| 151 | - * @param $modulename |
|
| 152 | - */ |
|
| 153 | - public function __construct(XoopsDatabase $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 XoopsDatabase $db |
|
| 151 | + * @param $modulename |
|
| 152 | + */ |
|
| 153 | + public function __construct(XoopsDatabase $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 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 14 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartseoobject.php'; |
|
| 14 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartseoobject.php'; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Class SmartobjectCategory |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | global $myts; |
| 96 | 96 | $objectArray = parent::toArray(); |
| 97 | 97 | if ($objectArray['image']) { |
| 98 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
| 98 | + $objectArray['image'] = $this->getImageDir().$objectArray['image']; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $objectArray; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getCategoryPath($withAllLink = true, $currentCategory = false) |
| 113 | 113 | { |
| 114 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 114 | + require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
| 115 | 115 | $controller = new SmartObjectController($this->handler); |
| 116 | 116 | |
| 117 | 117 | if (!$this->_categoryPath) { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | exit; |
| 129 | 129 | } |
| 130 | 130 | $parentid = $parentObj->getVar('parentid'); |
| 131 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
| 131 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory).' > '.$ret; |
|
| 132 | 132 | } |
| 133 | 133 | $this->_categoryPath = $ret; |
| 134 | 134 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | if (!$this->allCategoriesId) { |
| 205 | 205 | $ret = array(); |
| 206 | - $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
| 206 | + $sql = 'SELECT categoryid, parentid FROM '.$this->table.' AS '.$this->_itemname.' ORDER BY parentid'; |
|
| 207 | 207 | |
| 208 | 208 | $result = $this->db->query($sql); |
| 209 | 209 | |
@@ -22,157 +22,157 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class SmartObjectTreeTable extends SmartObjectTable |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * SmartObjectTreeTable constructor. |
|
| 27 | - * @param SmartPersistableObjectHandler $objectHandler |
|
| 28 | - * @param bool $criteria |
|
| 29 | - * @param array $actions |
|
| 30 | - * @param bool $userSide |
|
| 31 | - */ |
|
| 32 | - public function __construct( |
|
| 33 | - SmartPersistableObjectHandler $objectHandler, |
|
| 34 | - $criteria = false, |
|
| 35 | - $actions = array('edit', 'delete'), |
|
| 36 | - $userSide = false |
|
| 37 | - ) { |
|
| 38 | - $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide); |
|
| 39 | - $this->_isTree = true; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Get children objects given a specific parentid |
|
| 44 | - * |
|
| 45 | - * @var int $parentid id of the parent which children we want to retreive |
|
| 46 | - * @return array of SmartObject |
|
| 47 | - */ |
|
| 48 | - public function getChildrenOf($parentid = 0) |
|
| 49 | - { |
|
| 50 | - return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @param $object |
|
| 55 | - * @param int $level |
|
| 56 | - */ |
|
| 57 | - public function createTableRow($object, $level = 0) |
|
| 58 | - { |
|
| 59 | - $aObject = array(); |
|
| 60 | - |
|
| 61 | - $i = 0; |
|
| 62 | - |
|
| 63 | - $aColumns = array(); |
|
| 64 | - $doWeHaveActions = false; |
|
| 65 | - |
|
| 66 | - foreach ($this->_columns as $column) { |
|
| 67 | - $aColumn = array(); |
|
| 68 | - |
|
| 69 | - if ($i == 0) { |
|
| 70 | - $class = 'head'; |
|
| 71 | - } elseif ($i % 2 == 0) { |
|
| 72 | - $class = 'even'; |
|
| 73 | - } else { |
|
| 74 | - $class = 'odd'; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
|
| 78 | - $method = $column->_customMethodForValue; |
|
| 79 | - $value = $object->$method(); |
|
| 80 | - } else { |
|
| 81 | - /** |
|
| 82 | - * If the column is the identifier, then put a link on it |
|
| 83 | - */ |
|
| 84 | - if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
| 85 | - $value = $object->getItemLink(); |
|
| 86 | - } else { |
|
| 87 | - $value = $object->getVar($column->getKeyName()); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $space = ''; |
|
| 92 | - if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
| 93 | - for ($i = 0; $i < $level; ++$i) { |
|
| 94 | - $space .= '--'; |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - if ($space !== '') { |
|
| 99 | - $space .= ' '; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - $aColumn['value'] = $space . $value; |
|
| 103 | - $aColumn['class'] = $class; |
|
| 104 | - $aColumn['width'] = $column->getWidth(); |
|
| 105 | - $aColumn['align'] = $column->getAlign(); |
|
| 106 | - $aColumn['key'] = $column->getKeyName(); |
|
| 107 | - |
|
| 108 | - $aColumns[] = $aColumn; |
|
| 109 | - ++$i; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - $aObject['columns'] = $aColumns; |
|
| 113 | - |
|
| 114 | - $class = $class === 'even' ? 'odd' : 'even'; |
|
| 115 | - $aObject['class'] = $class; |
|
| 116 | - |
|
| 117 | - $actions = array(); |
|
| 118 | - |
|
| 119 | - // Adding the custom actions if any |
|
| 120 | - foreach ($this->_custom_actions as $action) { |
|
| 121 | - if (method_exists($object, $action)) { |
|
| 122 | - $actions[] = $object->$action(); |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 127 | - $controller = new SmartObjectController($this->_objectHandler); |
|
| 128 | - |
|
| 129 | - if (in_array('edit', $this->_actions)) { |
|
| 130 | - $actions[] = $controller->getEditItemLink($object, false, true); |
|
| 131 | - } |
|
| 132 | - if (in_array('delete', $this->_actions)) { |
|
| 133 | - $actions[] = $controller->getDeleteItemLink($object, false, true); |
|
| 134 | - } |
|
| 135 | - $aObject['actions'] = $actions; |
|
| 136 | - |
|
| 137 | - $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); |
|
| 138 | - $aObject['id'] = $object->id(); |
|
| 139 | - $this->_aObjects[] = $aObject; |
|
| 140 | - |
|
| 141 | - $childrenObjects = $this->getChildrenOf($object->id()); |
|
| 142 | - |
|
| 143 | - $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; |
|
| 144 | - |
|
| 145 | - if ($childrenObjects) { |
|
| 146 | - ++$level; |
|
| 147 | - foreach ($childrenObjects as $subObject) { |
|
| 148 | - $this->createTableRow($subObject, $level); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - public function createTableRows() |
|
| 154 | - { |
|
| 155 | - $this->_aObjects = array(); |
|
| 156 | - |
|
| 157 | - if (count($this->_objects) > 0) { |
|
| 158 | - foreach ($this->getChildrenOf() as $object) { |
|
| 159 | - $this->createTableRow($object); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $this->_tpl->assign('smartobject_objects', $this->_aObjects); |
|
| 163 | - } else { |
|
| 164 | - $colspan = count($this->_columns) + 1; |
|
| 165 | - $this->_tpl->assign('smartobject_colspan', $colspan); |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * @return mixed |
|
| 171 | - */ |
|
| 172 | - public function fetchObjects() |
|
| 173 | - { |
|
| 174 | - $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid'); |
|
| 175 | - |
|
| 176 | - return $ret; |
|
| 177 | - } |
|
| 25 | + /** |
|
| 26 | + * SmartObjectTreeTable constructor. |
|
| 27 | + * @param SmartPersistableObjectHandler $objectHandler |
|
| 28 | + * @param bool $criteria |
|
| 29 | + * @param array $actions |
|
| 30 | + * @param bool $userSide |
|
| 31 | + */ |
|
| 32 | + public function __construct( |
|
| 33 | + SmartPersistableObjectHandler $objectHandler, |
|
| 34 | + $criteria = false, |
|
| 35 | + $actions = array('edit', 'delete'), |
|
| 36 | + $userSide = false |
|
| 37 | + ) { |
|
| 38 | + $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide); |
|
| 39 | + $this->_isTree = true; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Get children objects given a specific parentid |
|
| 44 | + * |
|
| 45 | + * @var int $parentid id of the parent which children we want to retreive |
|
| 46 | + * @return array of SmartObject |
|
| 47 | + */ |
|
| 48 | + public function getChildrenOf($parentid = 0) |
|
| 49 | + { |
|
| 50 | + return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @param $object |
|
| 55 | + * @param int $level |
|
| 56 | + */ |
|
| 57 | + public function createTableRow($object, $level = 0) |
|
| 58 | + { |
|
| 59 | + $aObject = array(); |
|
| 60 | + |
|
| 61 | + $i = 0; |
|
| 62 | + |
|
| 63 | + $aColumns = array(); |
|
| 64 | + $doWeHaveActions = false; |
|
| 65 | + |
|
| 66 | + foreach ($this->_columns as $column) { |
|
| 67 | + $aColumn = array(); |
|
| 68 | + |
|
| 69 | + if ($i == 0) { |
|
| 70 | + $class = 'head'; |
|
| 71 | + } elseif ($i % 2 == 0) { |
|
| 72 | + $class = 'even'; |
|
| 73 | + } else { |
|
| 74 | + $class = 'odd'; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
|
| 78 | + $method = $column->_customMethodForValue; |
|
| 79 | + $value = $object->$method(); |
|
| 80 | + } else { |
|
| 81 | + /** |
|
| 82 | + * If the column is the identifier, then put a link on it |
|
| 83 | + */ |
|
| 84 | + if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
| 85 | + $value = $object->getItemLink(); |
|
| 86 | + } else { |
|
| 87 | + $value = $object->getVar($column->getKeyName()); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $space = ''; |
|
| 92 | + if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
| 93 | + for ($i = 0; $i < $level; ++$i) { |
|
| 94 | + $space .= '--'; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + if ($space !== '') { |
|
| 99 | + $space .= ' '; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + $aColumn['value'] = $space . $value; |
|
| 103 | + $aColumn['class'] = $class; |
|
| 104 | + $aColumn['width'] = $column->getWidth(); |
|
| 105 | + $aColumn['align'] = $column->getAlign(); |
|
| 106 | + $aColumn['key'] = $column->getKeyName(); |
|
| 107 | + |
|
| 108 | + $aColumns[] = $aColumn; |
|
| 109 | + ++$i; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + $aObject['columns'] = $aColumns; |
|
| 113 | + |
|
| 114 | + $class = $class === 'even' ? 'odd' : 'even'; |
|
| 115 | + $aObject['class'] = $class; |
|
| 116 | + |
|
| 117 | + $actions = array(); |
|
| 118 | + |
|
| 119 | + // Adding the custom actions if any |
|
| 120 | + foreach ($this->_custom_actions as $action) { |
|
| 121 | + if (method_exists($object, $action)) { |
|
| 122 | + $actions[] = $object->$action(); |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 127 | + $controller = new SmartObjectController($this->_objectHandler); |
|
| 128 | + |
|
| 129 | + if (in_array('edit', $this->_actions)) { |
|
| 130 | + $actions[] = $controller->getEditItemLink($object, false, true); |
|
| 131 | + } |
|
| 132 | + if (in_array('delete', $this->_actions)) { |
|
| 133 | + $actions[] = $controller->getDeleteItemLink($object, false, true); |
|
| 134 | + } |
|
| 135 | + $aObject['actions'] = $actions; |
|
| 136 | + |
|
| 137 | + $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); |
|
| 138 | + $aObject['id'] = $object->id(); |
|
| 139 | + $this->_aObjects[] = $aObject; |
|
| 140 | + |
|
| 141 | + $childrenObjects = $this->getChildrenOf($object->id()); |
|
| 142 | + |
|
| 143 | + $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; |
|
| 144 | + |
|
| 145 | + if ($childrenObjects) { |
|
| 146 | + ++$level; |
|
| 147 | + foreach ($childrenObjects as $subObject) { |
|
| 148 | + $this->createTableRow($subObject, $level); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + public function createTableRows() |
|
| 154 | + { |
|
| 155 | + $this->_aObjects = array(); |
|
| 156 | + |
|
| 157 | + if (count($this->_objects) > 0) { |
|
| 158 | + foreach ($this->getChildrenOf() as $object) { |
|
| 159 | + $this->createTableRow($object); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $this->_tpl->assign('smartobject_objects', $this->_aObjects); |
|
| 163 | + } else { |
|
| 164 | + $colspan = count($this->_columns) + 1; |
|
| 165 | + $this->_tpl->assign('smartobject_colspan', $colspan); |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * @return mixed |
|
| 171 | + */ |
|
| 172 | + public function fetchObjects() |
|
| 173 | + { |
|
| 174 | + $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid'); |
|
| 175 | + |
|
| 176 | + return $ret; |
|
| 177 | + } |
|
| 178 | 178 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @subpackage SmartObjectTable |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
| 12 | +require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttable.php'; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * SmartObjectTreeTable class |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $space .= ' '; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $aColumn['value'] = $space . $value; |
|
| 102 | + $aColumn['value'] = $space.$value; |
|
| 103 | 103 | $aColumn['class'] = $class; |
| 104 | 104 | $aColumn['width'] = $column->getWidth(); |
| 105 | 105 | $aColumn['align'] = $column->getAlign(); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 126 | + require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
| 127 | 127 | $controller = new SmartObjectController($this->_objectHandler); |
| 128 | 128 | |
| 129 | 129 | if (in_array('edit', $this->_actions)) { |
@@ -19,165 +19,165 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class SmartobjectAbout |
| 21 | 21 | { |
| 22 | - public $_lang_aboutTitle; |
|
| 23 | - public $_lang_author_info; |
|
| 24 | - public $_lang_developer_lead; |
|
| 25 | - public $_lang_developer_contributor; |
|
| 26 | - public $_lang_developer_website; |
|
| 27 | - public $_lang_developer_email; |
|
| 28 | - public $_lang_developer_credits; |
|
| 29 | - public $_lang_module_info; |
|
| 30 | - public $_lang_module_status; |
|
| 31 | - public $_lang_module_release_date; |
|
| 32 | - public $_lang_module_demo; |
|
| 33 | - public $_lang_module_support; |
|
| 34 | - public $_lang_module_bug; |
|
| 35 | - public $_lang_module_submit_bug; |
|
| 36 | - public $_lang_module_feature; |
|
| 37 | - public $_lang_module_submit_feature; |
|
| 38 | - public $_lang_module_disclaimer; |
|
| 39 | - public $_lang_author_word; |
|
| 40 | - public $_lang_version_history; |
|
| 41 | - public $_lang_by; |
|
| 42 | - public $_tpl; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * SmartobjectAbout constructor. |
|
| 46 | - * @param string $aboutTitle |
|
| 47 | - */ |
|
| 48 | - public function __construct($aboutTitle = 'About') |
|
| 49 | - { |
|
| 50 | - global $xoopsModule, $xoopsConfig; |
|
| 51 | - |
|
| 52 | - $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
| 53 | - if (file_exists($fileName)) { |
|
| 54 | - require_once $fileName; |
|
| 55 | - } else { |
|
| 56 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
| 57 | - } |
|
| 58 | - $this->_aboutTitle = $aboutTitle; |
|
| 59 | - |
|
| 60 | - $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR; |
|
| 61 | - $this->_lang_developer_website = _CO_SOBJECT_DEVELOPER_WEBSITE; |
|
| 62 | - $this->_lang_developer_email = _CO_SOBJECT_DEVELOPER_EMAIL; |
|
| 63 | - $this->_lang_developer_credits = _CO_SOBJECT_DEVELOPER_CREDITS; |
|
| 64 | - $this->_lang_module_info = _CO_SOBJECT_MODULE_INFO; |
|
| 65 | - $this->_lang_module_status = _CO_SOBJECT_MODULE_STATUS; |
|
| 66 | - $this->_lang_module_release_date = _CO_SOBJECT_MODULE_RELEASE_DATE; |
|
| 67 | - $this->_lang_module_demo = _CO_SOBJECT_MODULE_DEMO; |
|
| 68 | - $this->_lang_module_support = _CO_SOBJECT_MODULE_SUPPORT; |
|
| 69 | - $this->_lang_module_bug = _CO_SOBJECT_MODULE_BUG; |
|
| 70 | - $this->_lang_module_submit_bug = _CO_SOBJECT_MODULE_SUBMIT_BUG; |
|
| 71 | - $this->_lang_module_feature = _CO_SOBJECT_MODULE_FEATURE; |
|
| 72 | - $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE; |
|
| 73 | - $this->_lang_module_disclaimer = _CO_SOBJECT_MODULE_DISCLAIMER; |
|
| 74 | - $this->_lang_author_word = _CO_SOBJECT_AUTHOR_WORD; |
|
| 75 | - $this->_lang_version_history = _CO_SOBJECT_VERSION_HISTORY; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @param $value |
|
| 80 | - * @return mixed |
|
| 81 | - */ |
|
| 82 | - public function sanitize($value) |
|
| 83 | - { |
|
| 84 | - $myts = MyTextSanitizer::getInstance(); |
|
| 85 | - |
|
| 86 | - return $myts->displayTarea($value, 1); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public function render() |
|
| 90 | - { |
|
| 91 | - /** |
|
| 92 | - * @todo move the output to a template |
|
| 93 | - * @todo make the output XHTML compliant |
|
| 94 | - */ |
|
| 95 | - |
|
| 96 | - $myts = MyTextSanitizer::getInstance(); |
|
| 97 | - |
|
| 98 | - global $xoopsModule; |
|
| 99 | - |
|
| 100 | - smart_xoops_cp_header(); |
|
| 101 | - |
|
| 102 | - /** @var XoopsModuleHandler $moduleHandler */ |
|
| 103 | - $moduleHandler = xoops_getHandler('module'); |
|
| 104 | - $versioninfo = $moduleHandler->get($xoopsModule->getVar('mid')); |
|
| 105 | - |
|
| 106 | - //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
|
| 107 | - |
|
| 108 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 109 | - |
|
| 110 | - // --- |
|
| 111 | - // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
| 112 | - // $this->_tpl = new XoopsTpl(); |
|
| 113 | - $this->_tpl = new XoopsTpl(); |
|
| 114 | - // --- |
|
| 115 | - |
|
| 116 | - $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
| 117 | - $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
|
| 118 | - $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
|
| 119 | - $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
|
| 120 | - $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); |
|
| 121 | - |
|
| 122 | - // Left headings... |
|
| 123 | - if ($versioninfo->getInfo('author_realname') !== '') { |
|
| 124 | - $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
| 125 | - } else { |
|
| 126 | - $author_name = $versioninfo->getInfo('author'); |
|
| 127 | - } |
|
| 128 | - $this->_tpl->assign('module_author_name', $author_name); |
|
| 129 | - |
|
| 130 | - $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); |
|
| 131 | - |
|
| 132 | - $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); |
|
| 133 | - |
|
| 134 | - // Developers Information |
|
| 135 | - $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); |
|
| 136 | - $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); |
|
| 137 | - $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); |
|
| 138 | - $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); |
|
| 139 | - $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); |
|
| 140 | - |
|
| 141 | - $people = $versioninfo->getInfo('people'); |
|
| 142 | - if ($people) { |
|
| 143 | - $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map(array($this, 'sanitize'), $people['developers']) : false); |
|
| 144 | - $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map(array($this, 'sanitize'), $people['testers']) : false); |
|
| 145 | - $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map(array($this, 'sanitize'), $people['translators']) : false); |
|
| 146 | - $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map(array($this, 'sanitize'), $people['documenters']) : false); |
|
| 147 | - $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map(array($this, 'sanitize'), $people['other']) : false); |
|
| 148 | - } |
|
| 149 | - //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); |
|
| 150 | - |
|
| 151 | - // Module Development information |
|
| 152 | - $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); |
|
| 153 | - $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); |
|
| 154 | - $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); |
|
| 155 | - $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); |
|
| 156 | - $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); |
|
| 157 | - $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); |
|
| 158 | - $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); |
|
| 159 | - $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); |
|
| 160 | - |
|
| 161 | - // Warning |
|
| 162 | - $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); |
|
| 163 | - |
|
| 164 | - // Author's note |
|
| 165 | - $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); |
|
| 166 | - |
|
| 167 | - // For changelog thanks to 3Dev |
|
| 168 | - global $xoopsModule; |
|
| 169 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
| 170 | - if (is_file($filename)) { |
|
| 171 | - $filesize = filesize($filename); |
|
| 172 | - $handle = fopen($filename, 'r'); |
|
| 173 | - $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true)); |
|
| 174 | - fclose($handle); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - $this->_tpl->display('db:smartobject_about.tpl'); |
|
| 178 | - |
|
| 179 | - smart_modFooter(); |
|
| 180 | - |
|
| 181 | - xoops_cp_footer(); |
|
| 182 | - } |
|
| 22 | + public $_lang_aboutTitle; |
|
| 23 | + public $_lang_author_info; |
|
| 24 | + public $_lang_developer_lead; |
|
| 25 | + public $_lang_developer_contributor; |
|
| 26 | + public $_lang_developer_website; |
|
| 27 | + public $_lang_developer_email; |
|
| 28 | + public $_lang_developer_credits; |
|
| 29 | + public $_lang_module_info; |
|
| 30 | + public $_lang_module_status; |
|
| 31 | + public $_lang_module_release_date; |
|
| 32 | + public $_lang_module_demo; |
|
| 33 | + public $_lang_module_support; |
|
| 34 | + public $_lang_module_bug; |
|
| 35 | + public $_lang_module_submit_bug; |
|
| 36 | + public $_lang_module_feature; |
|
| 37 | + public $_lang_module_submit_feature; |
|
| 38 | + public $_lang_module_disclaimer; |
|
| 39 | + public $_lang_author_word; |
|
| 40 | + public $_lang_version_history; |
|
| 41 | + public $_lang_by; |
|
| 42 | + public $_tpl; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * SmartobjectAbout constructor. |
|
| 46 | + * @param string $aboutTitle |
|
| 47 | + */ |
|
| 48 | + public function __construct($aboutTitle = 'About') |
|
| 49 | + { |
|
| 50 | + global $xoopsModule, $xoopsConfig; |
|
| 51 | + |
|
| 52 | + $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
| 53 | + if (file_exists($fileName)) { |
|
| 54 | + require_once $fileName; |
|
| 55 | + } else { |
|
| 56 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
| 57 | + } |
|
| 58 | + $this->_aboutTitle = $aboutTitle; |
|
| 59 | + |
|
| 60 | + $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR; |
|
| 61 | + $this->_lang_developer_website = _CO_SOBJECT_DEVELOPER_WEBSITE; |
|
| 62 | + $this->_lang_developer_email = _CO_SOBJECT_DEVELOPER_EMAIL; |
|
| 63 | + $this->_lang_developer_credits = _CO_SOBJECT_DEVELOPER_CREDITS; |
|
| 64 | + $this->_lang_module_info = _CO_SOBJECT_MODULE_INFO; |
|
| 65 | + $this->_lang_module_status = _CO_SOBJECT_MODULE_STATUS; |
|
| 66 | + $this->_lang_module_release_date = _CO_SOBJECT_MODULE_RELEASE_DATE; |
|
| 67 | + $this->_lang_module_demo = _CO_SOBJECT_MODULE_DEMO; |
|
| 68 | + $this->_lang_module_support = _CO_SOBJECT_MODULE_SUPPORT; |
|
| 69 | + $this->_lang_module_bug = _CO_SOBJECT_MODULE_BUG; |
|
| 70 | + $this->_lang_module_submit_bug = _CO_SOBJECT_MODULE_SUBMIT_BUG; |
|
| 71 | + $this->_lang_module_feature = _CO_SOBJECT_MODULE_FEATURE; |
|
| 72 | + $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE; |
|
| 73 | + $this->_lang_module_disclaimer = _CO_SOBJECT_MODULE_DISCLAIMER; |
|
| 74 | + $this->_lang_author_word = _CO_SOBJECT_AUTHOR_WORD; |
|
| 75 | + $this->_lang_version_history = _CO_SOBJECT_VERSION_HISTORY; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @param $value |
|
| 80 | + * @return mixed |
|
| 81 | + */ |
|
| 82 | + public function sanitize($value) |
|
| 83 | + { |
|
| 84 | + $myts = MyTextSanitizer::getInstance(); |
|
| 85 | + |
|
| 86 | + return $myts->displayTarea($value, 1); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + public function render() |
|
| 90 | + { |
|
| 91 | + /** |
|
| 92 | + * @todo move the output to a template |
|
| 93 | + * @todo make the output XHTML compliant |
|
| 94 | + */ |
|
| 95 | + |
|
| 96 | + $myts = MyTextSanitizer::getInstance(); |
|
| 97 | + |
|
| 98 | + global $xoopsModule; |
|
| 99 | + |
|
| 100 | + smart_xoops_cp_header(); |
|
| 101 | + |
|
| 102 | + /** @var XoopsModuleHandler $moduleHandler */ |
|
| 103 | + $moduleHandler = xoops_getHandler('module'); |
|
| 104 | + $versioninfo = $moduleHandler->get($xoopsModule->getVar('mid')); |
|
| 105 | + |
|
| 106 | + //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
|
| 107 | + |
|
| 108 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 109 | + |
|
| 110 | + // --- |
|
| 111 | + // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
| 112 | + // $this->_tpl = new XoopsTpl(); |
|
| 113 | + $this->_tpl = new XoopsTpl(); |
|
| 114 | + // --- |
|
| 115 | + |
|
| 116 | + $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
| 117 | + $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
|
| 118 | + $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
|
| 119 | + $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
|
| 120 | + $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); |
|
| 121 | + |
|
| 122 | + // Left headings... |
|
| 123 | + if ($versioninfo->getInfo('author_realname') !== '') { |
|
| 124 | + $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
| 125 | + } else { |
|
| 126 | + $author_name = $versioninfo->getInfo('author'); |
|
| 127 | + } |
|
| 128 | + $this->_tpl->assign('module_author_name', $author_name); |
|
| 129 | + |
|
| 130 | + $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); |
|
| 131 | + |
|
| 132 | + $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); |
|
| 133 | + |
|
| 134 | + // Developers Information |
|
| 135 | + $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); |
|
| 136 | + $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); |
|
| 137 | + $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); |
|
| 138 | + $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); |
|
| 139 | + $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); |
|
| 140 | + |
|
| 141 | + $people = $versioninfo->getInfo('people'); |
|
| 142 | + if ($people) { |
|
| 143 | + $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map(array($this, 'sanitize'), $people['developers']) : false); |
|
| 144 | + $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map(array($this, 'sanitize'), $people['testers']) : false); |
|
| 145 | + $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map(array($this, 'sanitize'), $people['translators']) : false); |
|
| 146 | + $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map(array($this, 'sanitize'), $people['documenters']) : false); |
|
| 147 | + $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map(array($this, 'sanitize'), $people['other']) : false); |
|
| 148 | + } |
|
| 149 | + //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); |
|
| 150 | + |
|
| 151 | + // Module Development information |
|
| 152 | + $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); |
|
| 153 | + $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); |
|
| 154 | + $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); |
|
| 155 | + $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); |
|
| 156 | + $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); |
|
| 157 | + $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); |
|
| 158 | + $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); |
|
| 159 | + $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); |
|
| 160 | + |
|
| 161 | + // Warning |
|
| 162 | + $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); |
|
| 163 | + |
|
| 164 | + // Author's note |
|
| 165 | + $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); |
|
| 166 | + |
|
| 167 | + // For changelog thanks to 3Dev |
|
| 168 | + global $xoopsModule; |
|
| 169 | + $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
| 170 | + if (is_file($filename)) { |
|
| 171 | + $filesize = filesize($filename); |
|
| 172 | + $handle = fopen($filename, 'r'); |
|
| 173 | + $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true)); |
|
| 174 | + fclose($handle); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + $this->_tpl->display('db:smartobject_about.tpl'); |
|
| 178 | + |
|
| 179 | + smart_modFooter(); |
|
| 180 | + |
|
| 181 | + xoops_cp_footer(); |
|
| 182 | + } |
|
| 183 | 183 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | global $xoopsModule, $xoopsConfig; |
| 51 | 51 | |
| 52 | - $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
| 52 | + $fileName = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/modinfo.php'; |
|
| 53 | 53 | if (file_exists($fileName)) { |
| 54 | 54 | require_once $fileName; |
| 55 | 55 | } else { |
| 56 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
| 56 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/modinfo.php'; |
|
| 57 | 57 | } |
| 58 | 58 | $this->_aboutTitle = $aboutTitle; |
| 59 | 59 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | //smart_adminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
| 107 | 107 | |
| 108 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 108 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 109 | 109 | |
| 110 | 110 | // --- |
| 111 | 111 | // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->_tpl = new XoopsTpl(); |
| 114 | 114 | // --- |
| 115 | 115 | |
| 116 | - $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
| 116 | + $this->_tpl->assign('module_url', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/'); |
|
| 117 | 117 | $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
| 118 | 118 | $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
| 119 | 119 | $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | // Left headings... |
| 123 | 123 | if ($versioninfo->getInfo('author_realname') !== '') { |
| 124 | - $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
| 124 | + $author_name = $versioninfo->getInfo('author').' ('.$versioninfo->getInfo('author_realname').')'; |
|
| 125 | 125 | } else { |
| 126 | 126 | $author_name = $versioninfo->getInfo('author'); |
| 127 | 127 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // For changelog thanks to 3Dev |
| 168 | 168 | global $xoopsModule; |
| 169 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
| 169 | + $filename = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/changelog.txt'; |
|
| 170 | 170 | if (is_file($filename)) { |
| 171 | 171 | $filesize = filesize($filename); |
| 172 | 172 | $handle = fopen($filename, 'r'); |
@@ -35,19 +35,19 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | class SmartobjectTag extends SmartMlObject |
| 37 | 37 | { |
| 38 | - /** |
|
| 39 | - * SmartobjectTag constructor. |
|
| 40 | - */ |
|
| 41 | - public function __construct() |
|
| 42 | - { |
|
| 43 | - $this->initVar('tagid', XOBJ_DTYPE_INT, '', true); |
|
| 44 | - $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true); |
|
| 45 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC); |
|
| 46 | - $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC); |
|
| 38 | + /** |
|
| 39 | + * SmartobjectTag constructor. |
|
| 40 | + */ |
|
| 41 | + public function __construct() |
|
| 42 | + { |
|
| 43 | + $this->initVar('tagid', XOBJ_DTYPE_INT, '', true); |
|
| 44 | + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true); |
|
| 45 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC); |
|
| 46 | + $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC); |
|
| 47 | 47 | |
| 48 | - // call parent constructor to get Multilanguage field initiated |
|
| 49 | - $this->SmartMlObject(); |
|
| 50 | - } |
|
| 48 | + // call parent constructor to get Multilanguage field initiated |
|
| 49 | + $this->SmartMlObject(); |
|
| 50 | + } |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -55,27 +55,27 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | class SmartobjectTagHandler extends SmartPersistableMlObjectHandler |
| 57 | 57 | { |
| 58 | - /** |
|
| 59 | - * SmartobjectTagHandler constructor. |
|
| 60 | - * @param XoopsDatabase $db |
|
| 61 | - */ |
|
| 62 | - public function __construct(XoopsDatabase $db) |
|
| 63 | - { |
|
| 64 | - parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
| 65 | - } |
|
| 58 | + /** |
|
| 59 | + * SmartobjectTagHandler constructor. |
|
| 60 | + * @param XoopsDatabase $db |
|
| 61 | + */ |
|
| 62 | + public function __construct(XoopsDatabase $db) |
|
| 63 | + { |
|
| 64 | + parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @return mixed |
|
| 69 | - */ |
|
| 70 | - public function getLanguages() |
|
| 71 | - { |
|
| 72 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 73 | - $aLanguages = XoopsLists::getLangList(); |
|
| 74 | - $ret['default'] = _CO_SOBJECT_ALL; |
|
| 75 | - foreach ($aLanguages as $lang) { |
|
| 76 | - $ret[$lang] = $lang; |
|
| 77 | - } |
|
| 67 | + /** |
|
| 68 | + * @return mixed |
|
| 69 | + */ |
|
| 70 | + public function getLanguages() |
|
| 71 | + { |
|
| 72 | + require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 73 | + $aLanguages = XoopsLists::getLangList(); |
|
| 74 | + $ret['default'] = _CO_SOBJECT_ALL; |
|
| 75 | + foreach ($aLanguages as $lang) { |
|
| 76 | + $ret[$lang] = $lang; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - return $ret; |
|
| 80 | - } |
|
| 79 | + return $ret; |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // -------------------------------------------------------------------------// |
| 29 | 29 | |
| 30 | 30 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 31 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartmlobject.php'; |
|
| 31 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartmlobject.php'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Class SmartobjectTag |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getLanguages() |
| 71 | 71 | { |
| 72 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 72 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 73 | 73 | $aLanguages = XoopsLists::getLangList(); |
| 74 | 74 | $ret['default'] = _CO_SOBJECT_ALL; |
| 75 | 75 | foreach ($aLanguages as $lang) { |