@@ -17,65 +17,65 @@ |
||
17 | 17 | */ |
18 | 18 | class PrinterFriendly |
19 | 19 | { |
20 | - public $_title; |
|
21 | - public $_dsc; |
|
22 | - public $_content; |
|
23 | - public $_tpl; |
|
24 | - public $_pageTitle = false; |
|
25 | - public $_width = 680; |
|
20 | + public $_title; |
|
21 | + public $_dsc; |
|
22 | + public $_content; |
|
23 | + public $_tpl; |
|
24 | + public $_pageTitle = false; |
|
25 | + public $_width = 680; |
|
26 | 26 | |
27 | - /** |
|
28 | - * SmartPrinterFriendly constructor. |
|
29 | - * @param $content |
|
30 | - * @param bool $title |
|
31 | - * @param bool $dsc |
|
32 | - */ |
|
33 | - public function __construct($content, $title = false, $dsc = false) |
|
34 | - { |
|
35 | - $this->_title = $title; |
|
36 | - $this->_dsc = $dsc; |
|
37 | - $this->_content = $content; |
|
38 | - } |
|
27 | + /** |
|
28 | + * SmartPrinterFriendly constructor. |
|
29 | + * @param $content |
|
30 | + * @param bool $title |
|
31 | + * @param bool $dsc |
|
32 | + */ |
|
33 | + public function __construct($content, $title = false, $dsc = false) |
|
34 | + { |
|
35 | + $this->_title = $title; |
|
36 | + $this->_dsc = $dsc; |
|
37 | + $this->_content = $content; |
|
38 | + } |
|
39 | 39 | |
40 | - public function render() |
|
41 | - { |
|
42 | - /** |
|
43 | - * @todo move the output to a template |
|
44 | - * @todo make the output XHTML compliant |
|
45 | - */ |
|
40 | + public function render() |
|
41 | + { |
|
42 | + /** |
|
43 | + * @todo move the output to a template |
|
44 | + * @todo make the output XHTML compliant |
|
45 | + */ |
|
46 | 46 | |
47 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
47 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
48 | 48 | |
49 | - $this->_tpl = new \XoopsTpl(); |
|
49 | + $this->_tpl = new \XoopsTpl(); |
|
50 | 50 | |
51 | - $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title); |
|
52 | - $this->_tpl->assign('smartobject_print_title', $this->_title); |
|
53 | - $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); |
|
54 | - $this->_tpl->assign('smartobject_print_content', $this->_content); |
|
55 | - $this->_tpl->assign('smartobject_print_width', $this->_width); |
|
51 | + $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ?: $this->_title); |
|
52 | + $this->_tpl->assign('smartobject_print_title', $this->_title); |
|
53 | + $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); |
|
54 | + $this->_tpl->assign('smartobject_print_content', $this->_content); |
|
55 | + $this->_tpl->assign('smartobject_print_width', $this->_width); |
|
56 | 56 | |
57 | - $current_urls = Smartobject\Utility::getCurrentUrls(); |
|
58 | - $current_url = $current_urls['full']; |
|
57 | + $current_urls = Smartobject\Utility::getCurrentUrls(); |
|
58 | + $current_url = $current_urls['full']; |
|
59 | 59 | |
60 | - $this->_tpl->assign('smartobject_print_currenturl', $current_url); |
|
61 | - $this->_tpl->assign('smartobject_print_url', $this->url); |
|
60 | + $this->_tpl->assign('smartobject_print_currenturl', $current_url); |
|
61 | + $this->_tpl->assign('smartobject_print_url', $this->url); |
|
62 | 62 | |
63 | - $this->_tpl->display('db:smartobject_print.tpl'); |
|
64 | - } |
|
63 | + $this->_tpl->display('db:smartobject_print.tpl'); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @param $text |
|
68 | - */ |
|
69 | - public function setPageTitle($text) |
|
70 | - { |
|
71 | - $this->_pageTitle = $text; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @param $text |
|
68 | + */ |
|
69 | + public function setPageTitle($text) |
|
70 | + { |
|
71 | + $this->_pageTitle = $text; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @param $width |
|
76 | - */ |
|
77 | - public function setWidth($width) |
|
78 | - { |
|
79 | - $this->_width = $width; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @param $width |
|
76 | + */ |
|
77 | + public function setWidth($width) |
|
78 | + { |
|
79 | + $this->_width = $width; |
|
80 | + } |
|
81 | 81 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | * @todo make the output XHTML compliant |
45 | 45 | */ |
46 | 46 | |
47 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
47 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
48 | 48 | |
49 | 49 | $this->_tpl = new \XoopsTpl(); |
50 | 50 |
@@ -30,117 +30,117 @@ |
||
30 | 30 | */ |
31 | 31 | class AdsenseHandler extends Smartobject\PersistableObjectHandler |
32 | 32 | { |
33 | - public $adFormats; |
|
34 | - public $adFormatsList; |
|
35 | - public $objects = false; |
|
33 | + public $adFormats; |
|
34 | + public $adFormatsList; |
|
35 | + public $objects = false; |
|
36 | 36 | // public $classname = Adsense::class; |
37 | 37 | |
38 | - /** |
|
39 | - * SmartobjectAdsenseHandler constructor. |
|
40 | - * @param \XoopsDatabase $db |
|
41 | - */ |
|
42 | - public function __construct(\XoopsDatabase $db) |
|
43 | - { |
|
44 | - parent::__construct($db, Adsense::class, 'adsenseid', 'description', '', 'smartobject'); |
|
45 | - $this->adFormats = []; |
|
46 | - $this->adFormatsList = []; |
|
47 | - |
|
48 | - $this->adFormats['728x90_as']['caption'] = '728 X 90 Leaderboard'; |
|
49 | - $this->adFormats['728x90_as']['width'] = 728; |
|
50 | - $this->adFormats['728x90_as']['height'] = 90; |
|
51 | - $this->adFormatsList['728x90_as'] = $this->adFormats['728x90_as']['caption']; |
|
52 | - |
|
53 | - $this->adFormats['468x60_as']['caption'] = '468 X 60 Banner'; |
|
54 | - $this->adFormats['468x60_as']['width'] = 468; |
|
55 | - $this->adFormats['468x60_as']['height'] = 60; |
|
56 | - $this->adFormatsList['468x60_as'] = $this->adFormats['468x60_as']['caption']; |
|
57 | - |
|
58 | - $this->adFormats['234x60_as']['caption'] = '234 X 60 Half Banner'; |
|
59 | - $this->adFormats['234x60_as']['width'] = 234; |
|
60 | - $this->adFormats['234x60_as']['height'] = 60; |
|
61 | - $this->adFormatsList['234x60_as'] = $this->adFormats['234x60_as']['caption']; |
|
62 | - |
|
63 | - $this->adFormats['120x600_as']['caption'] = '120 X 600 Skyscraper'; |
|
64 | - $this->adFormats['120x600_as']['width'] = 120; |
|
65 | - $this->adFormats['120x600_as']['height'] = 600; |
|
66 | - $this->adFormatsList['120x600_as'] = $this->adFormats['120x600_as']['caption']; |
|
67 | - |
|
68 | - $this->adFormats['160x600_as']['caption'] = '160 X 600 Wide Skyscraper'; |
|
69 | - $this->adFormats['160x600_as']['width'] = 160; |
|
70 | - $this->adFormats['160x600_as']['height'] = 600; |
|
71 | - $this->adFormatsList['160x600_as'] = $this->adFormats['160x600_as']['caption']; |
|
72 | - |
|
73 | - $this->adFormats['120x240_as']['caption'] = '120 X 240 Vertical Banner'; |
|
74 | - $this->adFormats['120x240_as']['width'] = 120; |
|
75 | - $this->adFormats['120x240_as']['height'] = 240; |
|
76 | - $this->adFormatsList['120x240_as'] = $this->adFormats['120x240_as']['caption']; |
|
77 | - |
|
78 | - $this->adFormats['336x280_as']['caption'] = '336 X 280 Large Rectangle'; |
|
79 | - $this->adFormats['336x280_as']['width'] = 136; |
|
80 | - $this->adFormats['336x280_as']['height'] = 280; |
|
81 | - $this->adFormatsList['336x280_as'] = $this->adFormats['336x280_as']['caption']; |
|
82 | - |
|
83 | - $this->adFormats['300x250_as']['caption'] = '300 X 250 Medium Rectangle'; |
|
84 | - $this->adFormats['300x250_as']['width'] = 300; |
|
85 | - $this->adFormats['300x250_as']['height'] = 250; |
|
86 | - $this->adFormatsList['300x250_as'] = $this->adFormats['300x250_as']['caption']; |
|
87 | - |
|
88 | - $this->adFormats['250x250_as']['caption'] = '250 X 250 Square'; |
|
89 | - $this->adFormats['250x250_as']['width'] = 250; |
|
90 | - $this->adFormats['250x250_as']['height'] = 250; |
|
91 | - $this->adFormatsList['250x250_as'] = $this->adFormats['250x250_as']['caption']; |
|
92 | - |
|
93 | - $this->adFormats['200x200_as']['caption'] = '200 X 200 Small Square'; |
|
94 | - $this->adFormats['200x200_as']['width'] = 200; |
|
95 | - $this->adFormats['200x200_as']['height'] = 200; |
|
96 | - $this->adFormatsList['200x200_as'] = $this->adFormats['200x200_as']['caption']; |
|
97 | - |
|
98 | - $this->adFormats['180x150_as']['caption'] = '180 X 150 Small Rectangle'; |
|
99 | - $this->adFormats['180x150_as']['width'] = 180; |
|
100 | - $this->adFormats['180x150_as']['height'] = 150; |
|
101 | - $this->adFormatsList['180x150_as'] = $this->adFormats['180x150_as']['caption']; |
|
102 | - |
|
103 | - $this->adFormats['125x125_as']['caption'] = '125 X 125 Button'; |
|
104 | - $this->adFormats['125x125_as']['width'] = 125; |
|
105 | - $this->adFormats['125x125_as']['height'] = 125; |
|
106 | - $this->adFormatsList['125x125_as'] = $this->adFormats['125x125_as']['caption']; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @return array |
|
111 | - */ |
|
112 | - public function getFormats() |
|
113 | - { |
|
114 | - return $this->adFormatsList; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @param $obj |
|
119 | - * @return bool |
|
120 | - */ |
|
121 | - public function beforeSave($obj) |
|
122 | - { |
|
123 | - if ('' === $obj->getVar('tag')) { |
|
124 | - $obj->setVar('tag', $title = $obj->generateTag()); |
|
125 | - } |
|
126 | - |
|
127 | - return true; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @return array|bool |
|
132 | - */ |
|
133 | - public function getAdsensesByTag() |
|
134 | - { |
|
135 | - if (!$this->objects) { |
|
136 | - $adsensesObj =& $this->getObjects(null, true); |
|
137 | - $ret = []; |
|
138 | - foreach ($adsensesObj as $adsenseObj) { |
|
139 | - $ret[$adsenseObj->getVar('tag')] = $adsenseObj; |
|
140 | - } |
|
141 | - $this->objects = $ret; |
|
142 | - } |
|
143 | - |
|
144 | - return $this->objects; |
|
145 | - } |
|
38 | + /** |
|
39 | + * SmartobjectAdsenseHandler constructor. |
|
40 | + * @param \XoopsDatabase $db |
|
41 | + */ |
|
42 | + public function __construct(\XoopsDatabase $db) |
|
43 | + { |
|
44 | + parent::__construct($db, Adsense::class, 'adsenseid', 'description', '', 'smartobject'); |
|
45 | + $this->adFormats = []; |
|
46 | + $this->adFormatsList = []; |
|
47 | + |
|
48 | + $this->adFormats['728x90_as']['caption'] = '728 X 90 Leaderboard'; |
|
49 | + $this->adFormats['728x90_as']['width'] = 728; |
|
50 | + $this->adFormats['728x90_as']['height'] = 90; |
|
51 | + $this->adFormatsList['728x90_as'] = $this->adFormats['728x90_as']['caption']; |
|
52 | + |
|
53 | + $this->adFormats['468x60_as']['caption'] = '468 X 60 Banner'; |
|
54 | + $this->adFormats['468x60_as']['width'] = 468; |
|
55 | + $this->adFormats['468x60_as']['height'] = 60; |
|
56 | + $this->adFormatsList['468x60_as'] = $this->adFormats['468x60_as']['caption']; |
|
57 | + |
|
58 | + $this->adFormats['234x60_as']['caption'] = '234 X 60 Half Banner'; |
|
59 | + $this->adFormats['234x60_as']['width'] = 234; |
|
60 | + $this->adFormats['234x60_as']['height'] = 60; |
|
61 | + $this->adFormatsList['234x60_as'] = $this->adFormats['234x60_as']['caption']; |
|
62 | + |
|
63 | + $this->adFormats['120x600_as']['caption'] = '120 X 600 Skyscraper'; |
|
64 | + $this->adFormats['120x600_as']['width'] = 120; |
|
65 | + $this->adFormats['120x600_as']['height'] = 600; |
|
66 | + $this->adFormatsList['120x600_as'] = $this->adFormats['120x600_as']['caption']; |
|
67 | + |
|
68 | + $this->adFormats['160x600_as']['caption'] = '160 X 600 Wide Skyscraper'; |
|
69 | + $this->adFormats['160x600_as']['width'] = 160; |
|
70 | + $this->adFormats['160x600_as']['height'] = 600; |
|
71 | + $this->adFormatsList['160x600_as'] = $this->adFormats['160x600_as']['caption']; |
|
72 | + |
|
73 | + $this->adFormats['120x240_as']['caption'] = '120 X 240 Vertical Banner'; |
|
74 | + $this->adFormats['120x240_as']['width'] = 120; |
|
75 | + $this->adFormats['120x240_as']['height'] = 240; |
|
76 | + $this->adFormatsList['120x240_as'] = $this->adFormats['120x240_as']['caption']; |
|
77 | + |
|
78 | + $this->adFormats['336x280_as']['caption'] = '336 X 280 Large Rectangle'; |
|
79 | + $this->adFormats['336x280_as']['width'] = 136; |
|
80 | + $this->adFormats['336x280_as']['height'] = 280; |
|
81 | + $this->adFormatsList['336x280_as'] = $this->adFormats['336x280_as']['caption']; |
|
82 | + |
|
83 | + $this->adFormats['300x250_as']['caption'] = '300 X 250 Medium Rectangle'; |
|
84 | + $this->adFormats['300x250_as']['width'] = 300; |
|
85 | + $this->adFormats['300x250_as']['height'] = 250; |
|
86 | + $this->adFormatsList['300x250_as'] = $this->adFormats['300x250_as']['caption']; |
|
87 | + |
|
88 | + $this->adFormats['250x250_as']['caption'] = '250 X 250 Square'; |
|
89 | + $this->adFormats['250x250_as']['width'] = 250; |
|
90 | + $this->adFormats['250x250_as']['height'] = 250; |
|
91 | + $this->adFormatsList['250x250_as'] = $this->adFormats['250x250_as']['caption']; |
|
92 | + |
|
93 | + $this->adFormats['200x200_as']['caption'] = '200 X 200 Small Square'; |
|
94 | + $this->adFormats['200x200_as']['width'] = 200; |
|
95 | + $this->adFormats['200x200_as']['height'] = 200; |
|
96 | + $this->adFormatsList['200x200_as'] = $this->adFormats['200x200_as']['caption']; |
|
97 | + |
|
98 | + $this->adFormats['180x150_as']['caption'] = '180 X 150 Small Rectangle'; |
|
99 | + $this->adFormats['180x150_as']['width'] = 180; |
|
100 | + $this->adFormats['180x150_as']['height'] = 150; |
|
101 | + $this->adFormatsList['180x150_as'] = $this->adFormats['180x150_as']['caption']; |
|
102 | + |
|
103 | + $this->adFormats['125x125_as']['caption'] = '125 X 125 Button'; |
|
104 | + $this->adFormats['125x125_as']['width'] = 125; |
|
105 | + $this->adFormats['125x125_as']['height'] = 125; |
|
106 | + $this->adFormatsList['125x125_as'] = $this->adFormats['125x125_as']['caption']; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @return array |
|
111 | + */ |
|
112 | + public function getFormats() |
|
113 | + { |
|
114 | + return $this->adFormatsList; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @param $obj |
|
119 | + * @return bool |
|
120 | + */ |
|
121 | + public function beforeSave($obj) |
|
122 | + { |
|
123 | + if ('' === $obj->getVar('tag')) { |
|
124 | + $obj->setVar('tag', $title = $obj->generateTag()); |
|
125 | + } |
|
126 | + |
|
127 | + return true; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @return array|bool |
|
132 | + */ |
|
133 | + public function getAdsensesByTag() |
|
134 | + { |
|
135 | + if (!$this->objects) { |
|
136 | + $adsensesObj =& $this->getObjects(null, true); |
|
137 | + $ret = []; |
|
138 | + foreach ($adsensesObj as $adsenseObj) { |
|
139 | + $ret[$adsenseObj->getVar('tag')] = $adsenseObj; |
|
140 | + } |
|
141 | + $this->objects = $ret; |
|
142 | + } |
|
143 | + |
|
144 | + return $this->objects; |
|
145 | + } |
|
146 | 146 | } |
@@ -132,7 +132,7 @@ |
||
132 | 132 | public function getAdsensesByTag() |
133 | 133 | { |
134 | 134 | if (!$this->objects) { |
135 | - $adsensesObj =& $this->getObjects(null, true); |
|
135 | + $adsensesObj = & $this->getObjects(null, true); |
|
136 | 136 | $ret = []; |
137 | 137 | foreach ($adsensesObj as $adsenseObj) { |
138 | 138 | $ret[$adsenseObj->getVar('tag')] = $adsenseObj; |
@@ -22,163 +22,163 @@ |
||
22 | 22 | */ |
23 | 23 | class About |
24 | 24 | { |
25 | - public $_lang_aboutTitle; |
|
26 | - public $_lang_author_info; |
|
27 | - public $_lang_developer_lead; |
|
28 | - public $_lang_developer_contributor; |
|
29 | - public $_lang_developer_website; |
|
30 | - public $_lang_developer_email; |
|
31 | - public $_lang_developer_credits; |
|
32 | - public $_lang_module_info; |
|
33 | - public $_lang_module_status; |
|
34 | - public $_lang_module_release_date; |
|
35 | - public $_lang_module_demo; |
|
36 | - public $_lang_module_support; |
|
37 | - public $_lang_module_bug; |
|
38 | - public $_lang_module_submit_bug; |
|
39 | - public $_lang_module_feature; |
|
40 | - public $_lang_module_submit_feature; |
|
41 | - public $_lang_module_disclaimer; |
|
42 | - public $_lang_author_word; |
|
43 | - public $_lang_version_history; |
|
44 | - public $_lang_by; |
|
45 | - public $_tpl; |
|
46 | - |
|
47 | - /** |
|
48 | - * SmartobjectAbout constructor. |
|
49 | - * @param string $aboutTitle |
|
50 | - */ |
|
51 | - public function __construct($aboutTitle = 'About') |
|
52 | - { |
|
53 | - global $xoopsModule, $xoopsConfig; |
|
54 | - |
|
55 | - /** @var Smartobject\Helper $helper */ |
|
56 | - $helper = Smartobject\Helper::getInstance(); |
|
57 | - $helper->loadLanguage('modinfo'); |
|
25 | + public $_lang_aboutTitle; |
|
26 | + public $_lang_author_info; |
|
27 | + public $_lang_developer_lead; |
|
28 | + public $_lang_developer_contributor; |
|
29 | + public $_lang_developer_website; |
|
30 | + public $_lang_developer_email; |
|
31 | + public $_lang_developer_credits; |
|
32 | + public $_lang_module_info; |
|
33 | + public $_lang_module_status; |
|
34 | + public $_lang_module_release_date; |
|
35 | + public $_lang_module_demo; |
|
36 | + public $_lang_module_support; |
|
37 | + public $_lang_module_bug; |
|
38 | + public $_lang_module_submit_bug; |
|
39 | + public $_lang_module_feature; |
|
40 | + public $_lang_module_submit_feature; |
|
41 | + public $_lang_module_disclaimer; |
|
42 | + public $_lang_author_word; |
|
43 | + public $_lang_version_history; |
|
44 | + public $_lang_by; |
|
45 | + public $_tpl; |
|
46 | + |
|
47 | + /** |
|
48 | + * SmartobjectAbout constructor. |
|
49 | + * @param string $aboutTitle |
|
50 | + */ |
|
51 | + public function __construct($aboutTitle = 'About') |
|
52 | + { |
|
53 | + global $xoopsModule, $xoopsConfig; |
|
54 | + |
|
55 | + /** @var Smartobject\Helper $helper */ |
|
56 | + $helper = Smartobject\Helper::getInstance(); |
|
57 | + $helper->loadLanguage('modinfo'); |
|
58 | 58 | |
59 | - $this->_aboutTitle = $aboutTitle; |
|
60 | - |
|
61 | - $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR; |
|
62 | - $this->_lang_developer_website = _CO_SOBJECT_DEVELOPER_WEBSITE; |
|
63 | - $this->_lang_developer_email = _CO_SOBJECT_DEVELOPER_EMAIL; |
|
64 | - $this->_lang_developer_credits = _CO_SOBJECT_DEVELOPER_CREDITS; |
|
65 | - $this->_lang_module_info = _CO_SOBJECT_MODULE_INFO; |
|
66 | - $this->_lang_module_status = _CO_SOBJECT_MODULE_STATUS; |
|
67 | - $this->_lang_module_release_date = _CO_SOBJECT_MODULE_RELEASE_DATE; |
|
68 | - $this->_lang_module_demo = _CO_SOBJECT_MODULE_DEMO; |
|
69 | - $this->_lang_module_support = _CO_SOBJECT_MODULE_SUPPORT; |
|
70 | - $this->_lang_module_bug = _CO_SOBJECT_MODULE_BUG; |
|
71 | - $this->_lang_module_submit_bug = _CO_SOBJECT_MODULE_SUBMIT_BUG; |
|
72 | - $this->_lang_module_feature = _CO_SOBJECT_MODULE_FEATURE; |
|
73 | - $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE; |
|
74 | - $this->_lang_module_disclaimer = _CO_SOBJECT_MODULE_DISCLAIMER; |
|
75 | - $this->_lang_author_word = _CO_SOBJECT_AUTHOR_WORD; |
|
76 | - $this->_lang_version_history = _CO_SOBJECT_VERSION_HISTORY; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @param $value |
|
81 | - * @return mixed |
|
82 | - */ |
|
83 | - public function sanitize($value) |
|
84 | - { |
|
85 | - $myts = \MyTextSanitizer::getInstance(); |
|
86 | - |
|
87 | - return $myts->displayTarea($value, 1); |
|
88 | - } |
|
89 | - |
|
90 | - public function render() |
|
91 | - { |
|
92 | - /** |
|
93 | - * @todo move the output to a template |
|
94 | - * @todo make the output XHTML compliant |
|
95 | - */ |
|
96 | - |
|
97 | - $myts = \MyTextSanitizer::getInstance(); |
|
98 | - |
|
99 | - global $xoopsModule; |
|
100 | - |
|
101 | - Smartobject\Utility::getXoopsCpHeader(); |
|
102 | - |
|
103 | - /** @var XoopsModuleHandler $moduleHandler */ |
|
104 | - $moduleHandler = xoops_getHandler('module'); |
|
105 | - $versioninfo = $moduleHandler->get($xoopsModule->getVar('mid')); |
|
106 | - |
|
107 | - //Smartobject\Utility::getAdminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
|
108 | - |
|
109 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
110 | - |
|
111 | - // --- |
|
112 | - // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
113 | - // $this->_tpl = new \XoopsTpl(); |
|
114 | - $this->_tpl = new \XoopsTpl(); |
|
115 | - // --- |
|
116 | - |
|
117 | - $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
118 | - $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
|
119 | - $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
|
120 | - $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
|
121 | - $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); |
|
122 | - |
|
123 | - // Left headings... |
|
124 | - if ('' !== $versioninfo->getInfo('author_realname')) { |
|
125 | - $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
126 | - } else { |
|
127 | - $author_name = $versioninfo->getInfo('author'); |
|
128 | - } |
|
129 | - $this->_tpl->assign('module_author_name', $author_name); |
|
130 | - |
|
131 | - $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); |
|
132 | - |
|
133 | - $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); |
|
134 | - |
|
135 | - // Developers Information |
|
136 | - $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); |
|
137 | - $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); |
|
138 | - $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); |
|
139 | - $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); |
|
140 | - $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); |
|
141 | - |
|
142 | - $people = $versioninfo->getInfo('people'); |
|
143 | - if ($people) { |
|
144 | - $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map([$this, 'sanitize'], $people['developers']) : false); |
|
145 | - $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map([$this, 'sanitize'], $people['testers']) : false); |
|
146 | - $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map([$this, 'sanitize'], $people['translators']) : false); |
|
147 | - $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map([$this, 'sanitize'], $people['documenters']) : false); |
|
148 | - $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map([$this, 'sanitize'], $people['other']) : false); |
|
149 | - } |
|
150 | - //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); |
|
151 | - |
|
152 | - // Module Development information |
|
153 | - $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); |
|
154 | - $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); |
|
155 | - $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); |
|
156 | - $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); |
|
157 | - $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); |
|
158 | - $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); |
|
159 | - $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); |
|
160 | - $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); |
|
161 | - |
|
162 | - // Warning |
|
163 | - $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); |
|
164 | - |
|
165 | - // Author's note |
|
166 | - $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); |
|
167 | - |
|
168 | - // For changelog thanks to 3Dev |
|
169 | - global $xoopsModule; |
|
170 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
171 | - if (is_file($filename)) { |
|
172 | - $filesize = filesize($filename); |
|
173 | - $handle = fopen($filename, 'r'); |
|
174 | - $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true)); |
|
175 | - fclose($handle); |
|
176 | - } |
|
177 | - |
|
178 | - $this->_tpl->display('db:smartobject_about.tpl'); |
|
179 | - |
|
180 | - Smartobject\Utility::getModFooter(); |
|
181 | - |
|
182 | - xoops_cp_footer(); |
|
183 | - } |
|
59 | + $this->_aboutTitle = $aboutTitle; |
|
60 | + |
|
61 | + $this->_lang_developer_contributor = _CO_SOBJECT_DEVELOPER_CONTRIBUTOR; |
|
62 | + $this->_lang_developer_website = _CO_SOBJECT_DEVELOPER_WEBSITE; |
|
63 | + $this->_lang_developer_email = _CO_SOBJECT_DEVELOPER_EMAIL; |
|
64 | + $this->_lang_developer_credits = _CO_SOBJECT_DEVELOPER_CREDITS; |
|
65 | + $this->_lang_module_info = _CO_SOBJECT_MODULE_INFO; |
|
66 | + $this->_lang_module_status = _CO_SOBJECT_MODULE_STATUS; |
|
67 | + $this->_lang_module_release_date = _CO_SOBJECT_MODULE_RELEASE_DATE; |
|
68 | + $this->_lang_module_demo = _CO_SOBJECT_MODULE_DEMO; |
|
69 | + $this->_lang_module_support = _CO_SOBJECT_MODULE_SUPPORT; |
|
70 | + $this->_lang_module_bug = _CO_SOBJECT_MODULE_BUG; |
|
71 | + $this->_lang_module_submit_bug = _CO_SOBJECT_MODULE_SUBMIT_BUG; |
|
72 | + $this->_lang_module_feature = _CO_SOBJECT_MODULE_FEATURE; |
|
73 | + $this->_lang_module_submit_feature = _CO_SOBJECT_MODULE_SUBMIT_FEATURE; |
|
74 | + $this->_lang_module_disclaimer = _CO_SOBJECT_MODULE_DISCLAIMER; |
|
75 | + $this->_lang_author_word = _CO_SOBJECT_AUTHOR_WORD; |
|
76 | + $this->_lang_version_history = _CO_SOBJECT_VERSION_HISTORY; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @param $value |
|
81 | + * @return mixed |
|
82 | + */ |
|
83 | + public function sanitize($value) |
|
84 | + { |
|
85 | + $myts = \MyTextSanitizer::getInstance(); |
|
86 | + |
|
87 | + return $myts->displayTarea($value, 1); |
|
88 | + } |
|
89 | + |
|
90 | + public function render() |
|
91 | + { |
|
92 | + /** |
|
93 | + * @todo move the output to a template |
|
94 | + * @todo make the output XHTML compliant |
|
95 | + */ |
|
96 | + |
|
97 | + $myts = \MyTextSanitizer::getInstance(); |
|
98 | + |
|
99 | + global $xoopsModule; |
|
100 | + |
|
101 | + Smartobject\Utility::getXoopsCpHeader(); |
|
102 | + |
|
103 | + /** @var XoopsModuleHandler $moduleHandler */ |
|
104 | + $moduleHandler = xoops_getHandler('module'); |
|
105 | + $versioninfo = $moduleHandler->get($xoopsModule->getVar('mid')); |
|
106 | + |
|
107 | + //Smartobject\Utility::getAdminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
|
108 | + |
|
109 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
110 | + |
|
111 | + // --- |
|
112 | + // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
113 | + // $this->_tpl = new \XoopsTpl(); |
|
114 | + $this->_tpl = new \XoopsTpl(); |
|
115 | + // --- |
|
116 | + |
|
117 | + $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
118 | + $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
|
119 | + $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
|
120 | + $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
|
121 | + $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); |
|
122 | + |
|
123 | + // Left headings... |
|
124 | + if ('' !== $versioninfo->getInfo('author_realname')) { |
|
125 | + $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
126 | + } else { |
|
127 | + $author_name = $versioninfo->getInfo('author'); |
|
128 | + } |
|
129 | + $this->_tpl->assign('module_author_name', $author_name); |
|
130 | + |
|
131 | + $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); |
|
132 | + |
|
133 | + $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); |
|
134 | + |
|
135 | + // Developers Information |
|
136 | + $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); |
|
137 | + $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); |
|
138 | + $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); |
|
139 | + $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); |
|
140 | + $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); |
|
141 | + |
|
142 | + $people = $versioninfo->getInfo('people'); |
|
143 | + if ($people) { |
|
144 | + $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map([$this, 'sanitize'], $people['developers']) : false); |
|
145 | + $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map([$this, 'sanitize'], $people['testers']) : false); |
|
146 | + $this->_tpl->assign('module_people_translators', isset($people['translators']) ? array_map([$this, 'sanitize'], $people['translators']) : false); |
|
147 | + $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map([$this, 'sanitize'], $people['documenters']) : false); |
|
148 | + $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map([$this, 'sanitize'], $people['other']) : false); |
|
149 | + } |
|
150 | + //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); |
|
151 | + |
|
152 | + // Module Development information |
|
153 | + $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); |
|
154 | + $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); |
|
155 | + $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); |
|
156 | + $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); |
|
157 | + $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); |
|
158 | + $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); |
|
159 | + $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); |
|
160 | + $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); |
|
161 | + |
|
162 | + // Warning |
|
163 | + $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); |
|
164 | + |
|
165 | + // Author's note |
|
166 | + $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); |
|
167 | + |
|
168 | + // For changelog thanks to 3Dev |
|
169 | + global $xoopsModule; |
|
170 | + $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
171 | + if (is_file($filename)) { |
|
172 | + $filesize = filesize($filename); |
|
173 | + $handle = fopen($filename, 'r'); |
|
174 | + $this->_tpl->assign('module_version_history', $myts->displayTarea(fread($handle, $filesize), true)); |
|
175 | + fclose($handle); |
|
176 | + } |
|
177 | + |
|
178 | + $this->_tpl->display('db:smartobject_about.tpl'); |
|
179 | + |
|
180 | + Smartobject\Utility::getModFooter(); |
|
181 | + |
|
182 | + xoops_cp_footer(); |
|
183 | + } |
|
184 | 184 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | //Smartobject\Utility::getAdminMenu(-1, $this->_aboutTitle . " " . $versioninfo->getInfo('name')); |
108 | 108 | |
109 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
109 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
110 | 110 | |
111 | 111 | // --- |
112 | 112 | // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $this->_tpl = new \XoopsTpl(); |
115 | 115 | // --- |
116 | 116 | |
117 | - $this->_tpl->assign('module_url', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); |
|
117 | + $this->_tpl->assign('module_url', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/'); |
|
118 | 118 | $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); |
119 | 119 | $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); |
120 | 120 | $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | // Left headings... |
124 | 124 | if ('' !== $versioninfo->getInfo('author_realname')) { |
125 | - $author_name = $versioninfo->getInfo('author') . ' (' . $versioninfo->getInfo('author_realname') . ')'; |
|
125 | + $author_name = $versioninfo->getInfo('author').' ('.$versioninfo->getInfo('author_realname').')'; |
|
126 | 126 | } else { |
127 | 127 | $author_name = $versioninfo->getInfo('author'); |
128 | 128 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | // For changelog thanks to 3Dev |
169 | 169 | global $xoopsModule; |
170 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt'; |
|
170 | + $filename = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/changelog.txt'; |
|
171 | 171 | if (is_file($filename)) { |
172 | 172 | $filesize = filesize($filename); |
173 | 173 | $handle = fopen($filename, 'r'); |
@@ -30,22 +30,22 @@ |
||
30 | 30 | */ |
31 | 31 | class ObjectCurrencyHandler extends Smartobject\PersistableObjectHandler |
32 | 32 | { |
33 | - /** |
|
34 | - * SmartObjectCurrencyHandler constructor. |
|
35 | - * @param \XoopsDatabase $db |
|
36 | - */ |
|
37 | - public function __construct(\XoopsDatabase $db) |
|
38 | - { |
|
39 | - parent::__construct($db, 'currency', 'currencyid', 'name', '', 'smartobject'); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function getCurrencies() |
|
46 | - { |
|
47 | - $currenciesObj =& $this->getObjects(null, true); |
|
48 | - |
|
49 | - return $currenciesObj; |
|
50 | - } |
|
33 | + /** |
|
34 | + * SmartObjectCurrencyHandler constructor. |
|
35 | + * @param \XoopsDatabase $db |
|
36 | + */ |
|
37 | + public function __construct(\XoopsDatabase $db) |
|
38 | + { |
|
39 | + parent::__construct($db, 'currency', 'currencyid', 'name', '', 'smartobject'); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function getCurrencies() |
|
46 | + { |
|
47 | + $currenciesObj =& $this->getObjects(null, true); |
|
48 | + |
|
49 | + return $currenciesObj; |
|
50 | + } |
|
51 | 51 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
24 | 24 | |
25 | 25 | //require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
26 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
26 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class SmartObjectCurrencyHandler |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getCurrencies() |
46 | 46 | { |
47 | - $currenciesObj =& $this->getObjects(null, true); |
|
47 | + $currenciesObj = & $this->getObjects(null, true); |
|
48 | 48 | |
49 | 49 | return $currenciesObj; |
50 | 50 | } |
@@ -29,27 +29,27 @@ |
||
29 | 29 | */ |
30 | 30 | class TagHandler extends Smartobject\PersistableMlObjectHandler |
31 | 31 | { |
32 | - /** |
|
33 | - * SmartobjectTagHandler constructor. |
|
34 | - * @param \XoopsDatabase $db |
|
35 | - */ |
|
36 | - public function __construct(\XoopsDatabase $db) |
|
37 | - { |
|
38 | - parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
39 | - } |
|
32 | + /** |
|
33 | + * SmartobjectTagHandler constructor. |
|
34 | + * @param \XoopsDatabase $db |
|
35 | + */ |
|
36 | + public function __construct(\XoopsDatabase $db) |
|
37 | + { |
|
38 | + parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @return mixed |
|
43 | - */ |
|
44 | - public function getLanguages() |
|
45 | - { |
|
46 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
47 | - $aLanguages = XoopsLists::getLangList(); |
|
48 | - $ret['default'] = _CO_SOBJECT_ALL; |
|
49 | - foreach ($aLanguages as $lang) { |
|
50 | - $ret[$lang] = $lang; |
|
51 | - } |
|
41 | + /** |
|
42 | + * @return mixed |
|
43 | + */ |
|
44 | + public function getLanguages() |
|
45 | + { |
|
46 | + require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
47 | + $aLanguages = XoopsLists::getLangList(); |
|
48 | + $ret['default'] = _CO_SOBJECT_ALL; |
|
49 | + foreach ($aLanguages as $lang) { |
|
50 | + $ret[$lang] = $lang; |
|
51 | + } |
|
52 | 52 | |
53 | - return $ret; |
|
54 | - } |
|
53 | + return $ret; |
|
54 | + } |
|
55 | 55 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function getLanguages() |
45 | 45 | { |
46 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
46 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
47 | 47 | $aLanguages = XoopsLists::getLangList(); |
48 | 48 | $ret['default'] = _CO_SOBJECT_ALL; |
49 | 49 | foreach ($aLanguages as $lang) { |
@@ -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 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
24 | 24 | |
25 | 25 | //require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
26 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
26 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class SmartobjectCurrency |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getDefaultCurrencyControl() |
133 | 133 | { |
134 | - $radio_box = '<input name="default_currency" value="' . $this->getVar('currencyid') . '" type="radio"'; |
|
134 | + $radio_box = '<input name="default_currency" value="'.$this->getVar('currencyid').'" type="radio"'; |
|
135 | 135 | if ($this->getVar('default_currency', 'e')) { |
136 | 136 | $radio_box .= 'checked'; |
137 | 137 | } |
@@ -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 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $language = false |
38 | 38 | ) { |
39 | 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; |
|
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 | 42 | if ($language) { |
43 | 43 | // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | |
76 | 76 | public function changeTableNameForML() |
77 | 77 | { |
78 | - $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
78 | + $this->table = $this->db->prefix($this->_moduleName.'_'.$this->_itemname.'_text'); |
|
79 | 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(); |