1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | namespace XoopsModules\Publisher\Form; |
||||||
6 | |||||||
7 | /* |
||||||
8 | You may not change or alter any portion of this comment or credits |
||||||
9 | of supporting developers from this source code or any supporting source code |
||||||
10 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
11 | |||||||
12 | This program is distributed in the hope that it will be useful, |
||||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
15 | */ |
||||||
16 | |||||||
17 | /** |
||||||
18 | * Publisher form class |
||||||
19 | * |
||||||
20 | * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ |
||||||
21 | * @license http://www.fsf.org/copyleft/gpl.html GNU public license |
||||||
22 | * @since 1.0 |
||||||
23 | * @author trabis <[email protected]> |
||||||
24 | */ |
||||||
25 | |||||||
26 | use Xmf\Request; |
||||||
27 | use XoopsModules\Publisher\{Constants, |
||||||
28 | Form, |
||||||
29 | FormDateTime, |
||||||
30 | Helper, |
||||||
31 | ThemeTabForm, |
||||||
32 | Utility |
||||||
33 | }; |
||||||
34 | use XoopsModules\Tag\FormTag; |
||||||
35 | |||||||
36 | require_once \dirname(__DIR__, 2) . '/include/common.php'; |
||||||
37 | |||||||
38 | \xoops_load('XoopsFormLoader'); |
||||||
39 | \xoops_load('XoopsLists'); |
||||||
40 | require_once $GLOBALS['xoops']->path('class/tree.php'); |
||||||
41 | //require_once PUBLISHER_ROOT_PATH . '/class/formdatetime.php'; |
||||||
42 | //require_once PUBLISHER_ROOT_PATH . '/class/themetabform.php'; |
||||||
43 | |||||||
44 | /** |
||||||
45 | * Class ItemForm |
||||||
46 | */ |
||||||
47 | class ItemForm extends ThemeTabForm |
||||||
48 | { |
||||||
49 | public $checkperm = true; |
||||||
50 | public $tabs = [ |
||||||
51 | \_CO_PUBLISHER_TAB_MAIN => 'mainTab', |
||||||
52 | \_CO_PUBLISHER_TAB_IMAGES => 'imagesTab', |
||||||
53 | \_CO_PUBLISHER_TAB_FILES => 'filesTab', |
||||||
54 | \_CO_PUBLISHER_TAB_OTHERS => 'othersTab', |
||||||
55 | ]; |
||||||
56 | public $mainTab = [ |
||||||
57 | Constants::PUBLISHER_SUBTITLE, |
||||||
58 | Constants::PUBLISHER_ITEM_SHORT_URL, |
||||||
59 | Constants::PUBLISHER_ITEM_TAG, |
||||||
60 | Constants::PUBLISHER_SUMMARY, |
||||||
61 | Constants::PUBLISHER_DOHTML, |
||||||
62 | Constants::PUBLISHER_DOSMILEY, |
||||||
63 | Constants::PUBLISHER_DOXCODE, |
||||||
64 | Constants::PUBLISHER_DOIMAGE, |
||||||
65 | Constants::PUBLISHER_DOLINEBREAK, |
||||||
66 | Constants::PUBLISHER_DATESUB, |
||||||
67 | Constants::PUBLISHER_STATUS, |
||||||
68 | Constants::PUBLISHER_AUTHOR_ALIAS, |
||||||
69 | Constants::PUBLISHER_NOTIFY, |
||||||
70 | Constants::PUBLISHER_AVAILABLE_PAGE_WRAP, |
||||||
71 | Constants::PUBLISHER_UID, |
||||||
72 | ]; |
||||||
73 | public $imagesTab = [ |
||||||
74 | Constants::PUBLISHER_IMAGE_ITEM, |
||||||
75 | ]; |
||||||
76 | public $filesTab = [ |
||||||
77 | Constants::PUBLISHER_ITEM_UPLOAD_FILE, |
||||||
78 | ]; |
||||||
79 | public $othersTab = [ |
||||||
80 | Constants::PUBLISHER_ITEM_META_KEYWORDS, |
||||||
81 | Constants::PUBLISHER_ITEM_META_DESCRIPTION, |
||||||
82 | Constants::PUBLISHER_WEIGHT, |
||||||
83 | Constants::PUBLISHER_ALLOWCOMMENTS, |
||||||
84 | ]; |
||||||
85 | |||||||
86 | /** |
||||||
87 | * @param $checkperm |
||||||
88 | */ |
||||||
89 | public function setCheckPermissions($checkperm) |
||||||
90 | { |
||||||
91 | $this->checkperm = (bool)$checkperm; |
||||||
92 | } |
||||||
93 | |||||||
94 | /** |
||||||
95 | * @param $item |
||||||
96 | * |
||||||
97 | * @return bool |
||||||
98 | */ |
||||||
99 | public function isGranted($item) |
||||||
100 | { |
||||||
101 | $helper = Helper::getInstance(); |
||||||
102 | $ret = false; |
||||||
103 | if (!$this->checkperm || $helper->getHandler('Permission')->isGranted('form_view', $item)) { |
||||||
104 | $ret = true; |
||||||
105 | } |
||||||
106 | |||||||
107 | return $ret; |
||||||
108 | } |
||||||
109 | |||||||
110 | /** |
||||||
111 | * @param $tab |
||||||
112 | * |
||||||
113 | * @return bool |
||||||
114 | */ |
||||||
115 | public function hasTab($tab) |
||||||
116 | { |
||||||
117 | if (!isset($tab, $this->tabs[$tab])) { |
||||||
118 | return false; |
||||||
119 | } |
||||||
120 | |||||||
121 | $tabRef = $this->tabs[$tab]; |
||||||
122 | $items = $this->$tabRef; |
||||||
123 | foreach ($items as $item) { |
||||||
124 | if ($this->isGranted($item)) { |
||||||
125 | return true; |
||||||
126 | } |
||||||
127 | } |
||||||
128 | |||||||
129 | return false; |
||||||
130 | } |
||||||
131 | |||||||
132 | /** |
||||||
133 | * @param \XoopsObject $obj |
||||||
134 | * |
||||||
135 | * @return $this |
||||||
136 | */ |
||||||
137 | public function createElements($obj) |
||||||
138 | { |
||||||
139 | $helper = Helper::getInstance(); |
||||||
140 | $timeoffset = null; |
||||||
141 | |||||||
142 | $allowedEditors = Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors')); |
||||||
143 | |||||||
144 | if (\is_object($GLOBALS['xoopsUser'])) { |
||||||
145 | $group = $GLOBALS['xoopsUser']->getGroups(); |
||||||
146 | $currentUid = $GLOBALS['xoopsUser']->uid(); |
||||||
147 | $timeoffset = $GLOBALS['xoopsUser']->getVar('timezone_offset'); |
||||||
148 | } else { |
||||||
149 | $group = [XOOPS_GROUP_ANONYMOUS]; |
||||||
150 | $currentUid = 0; |
||||||
151 | } |
||||||
152 | |||||||
153 | $this->setExtra('enctype="multipart/form-data"'); |
||||||
154 | |||||||
155 | $this->startTab(\_CO_PUBLISHER_TAB_MAIN); |
||||||
156 | |||||||
157 | // Category |
||||||
158 | $categoryFormSelect = new \XoopsFormSelect(\_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e')); |
||||||
159 | $categoryFormSelect->setDescription(\_CO_PUBLISHER_CATEGORY_DSC); |
||||||
160 | $categoryFormSelect->addOptionArray($helper->getHandler('Category')->getCategoriesForSubmit()); |
||||||
161 | $this->addElement($categoryFormSelect); |
||||||
162 | |||||||
163 | // ITEM TITLE |
||||||
164 | $this->addElement(new \XoopsFormText(\_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true); |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
165 | |||||||
166 | // SUBTITLE |
||||||
167 | if ($this->isGranted(Constants::PUBLISHER_SUBTITLE)) { |
||||||
168 | $this->addElement(new \XoopsFormText(\_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e'))); |
||||||
169 | } |
||||||
170 | |||||||
171 | // SHORT URL |
||||||
172 | if ($this->isGranted(Constants::PUBLISHER_ITEM_SHORT_URL)) { |
||||||
173 | $textShortUrl = new \XoopsFormText(\_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->short_url('e')); |
||||||
0 ignored issues
–
show
The method
short_url() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
174 | $textShortUrl->setDescription(\_CO_PUBLISHER_ITEM_SHORT_URL_DSC); |
||||||
175 | $this->addElement($textShortUrl); |
||||||
176 | } |
||||||
177 | |||||||
178 | // TAGS |
||||||
179 | if (\xoops_isActiveModule('tag') && $this->isGranted(Constants::PUBLISHER_ITEM_TAG)) { |
||||||
180 | require_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php'); |
||||||
181 | $textTags = new FormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0); |
||||||
0 ignored issues
–
show
It seems like
$obj->getVar('item_tag', 'e') can also be of type array and array ; however, parameter $value of XoopsModules\Tag\FormTag::__construct() does only seem to accept integer|string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
182 | $textTags->setClass('form-control'); |
||||||
183 | $this->addElement($textTags); |
||||||
184 | } |
||||||
185 | |||||||
186 | // SELECT EDITOR |
||||||
187 | $nohtml = !$obj->dohtml(); |
||||||
0 ignored issues
–
show
The method
dohtml() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsComment or XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
188 | if (1 === \count($allowedEditors)) { |
||||||
189 | $editor = $allowedEditors[0]; |
||||||
190 | } elseif (\count($allowedEditors) > 0) { |
||||||
191 | $editor = Request::getString('editor', '', 'POST'); |
||||||
192 | if (!empty($editor)) { |
||||||
193 | Utility::setCookieVar('publisher_editor', $editor); |
||||||
194 | } else { |
||||||
195 | $editor = Utility::getCookieVar('publisher_editor'); |
||||||
196 | if (empty($editor) && \is_object($GLOBALS['xoopsUser'])) { |
||||||
197 | // $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile |
||||||
198 | $editor = $GLOBALS['xoopsUser']->getVar('publisher_editor') ?? ''; // Need set through user profile |
||||||
199 | } |
||||||
200 | } |
||||||
201 | $editor = (empty($editor) || !\in_array($editor, $allowedEditors, true)) ? $helper->getConfig('submit_editor') : $editor; |
||||||
202 | |||||||
203 | $formEditor = new \XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors); |
||||||
204 | $this->addElement($formEditor); |
||||||
205 | } else { |
||||||
206 | $editor = $helper->getConfig('submit_editor'); |
||||||
207 | } |
||||||
208 | |||||||
209 | $editorConfigs = []; |
||||||
210 | $editorConfigs['rows'] = !$helper->getConfig('submit_editor_rows') ? 35 : $helper->getConfig('submit_editor_rows'); |
||||||
211 | $editorConfigs['cols'] = !$helper->getConfig('submit_editor_cols') ? 60 : $helper->getConfig('submit_editor_cols'); |
||||||
212 | $editorConfigs['width'] = !$helper->getConfig('submit_editor_width') ? '100%' : $helper->getConfig('submit_editor_width'); |
||||||
213 | $editorConfigs['height'] = !$helper->getConfig('submit_editor_height') ? '400px' : $helper->getConfig('submit_editor_height'); |
||||||
214 | |||||||
215 | // SUMMARY |
||||||
216 | if ($this->isGranted(Constants::PUBLISHER_SUMMARY)) { |
||||||
217 | // Description |
||||||
218 | //$summaryText = new \XoopsFormTextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60); |
||||||
219 | $editorConfigs['name'] = 'summary'; |
||||||
220 | $editorConfigs['value'] = $obj->getVar('summary', 'e'); |
||||||
221 | $summaryText = new \XoopsFormEditor(\_CO_PUBLISHER_SUMMARY, $editor, $editorConfigs, $nohtml, $onfailure = null); |
||||||
222 | $summaryText->setDescription(\_CO_PUBLISHER_SUMMARY_DSC); |
||||||
223 | $this->addElement($summaryText); |
||||||
224 | } |
||||||
225 | |||||||
226 | // BODY |
||||||
227 | $editorConfigs['name'] = 'body'; |
||||||
228 | $editorConfigs['value'] = $obj->getVar('body', 'e'); |
||||||
229 | $bodyText = new \XoopsFormEditor(\_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null); |
||||||
230 | $bodyText->setDescription(\_CO_PUBLISHER_BODY_DSC); |
||||||
231 | $this->addElement($bodyText); |
||||||
232 | |||||||
233 | // VARIOUS OPTIONS |
||||||
234 | if ($this->isGranted(Constants::PUBLISHER_DOHTML) |
||||||
235 | || $this->isGranted(Constants::PUBLISHER_DOSMILEY) |
||||||
236 | || $this->isGranted(Constants::PUBLISHER_DOXCODE) |
||||||
237 | || $this->isGranted(Constants::PUBLISHER_DOIMAGE) |
||||||
238 | || $this->isGranted(Constants::PUBLISHER_DOLINEBREAK)) { |
||||||
239 | if ($this->isGranted(Constants::PUBLISHER_DOHTML)) { |
||||||
240 | $htmlRadio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO); |
||||||
241 | $this->addElement($htmlRadio); |
||||||
242 | } |
||||||
243 | if ($this->isGranted(Constants::PUBLISHER_DOSMILEY)) { |
||||||
244 | $smiley_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO); |
||||||
0 ignored issues
–
show
The method
dosmiley() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsComment or XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
245 | $this->addElement($smiley_radio); |
||||||
246 | } |
||||||
247 | if ($this->isGranted(Constants::PUBLISHER_DOXCODE)) { |
||||||
248 | $xcode_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO); |
||||||
0 ignored issues
–
show
The method
doxcode() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsComment or XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
249 | $this->addElement($xcode_radio); |
||||||
250 | } |
||||||
251 | if ($this->isGranted(Constants::PUBLISHER_DOIMAGE)) { |
||||||
252 | $image_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO); |
||||||
0 ignored issues
–
show
The method
doimage() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsComment or XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
253 | $this->addElement($image_radio); |
||||||
254 | } |
||||||
255 | if ($this->isGranted(Constants::PUBLISHER_DOLINEBREAK)) { |
||||||
256 | $linebreak_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO); |
||||||
0 ignored issues
–
show
The method
dobr() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsComment or XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
257 | $this->addElement($linebreak_radio); |
||||||
258 | } |
||||||
259 | } |
||||||
260 | |||||||
261 | // Available pages to wrap |
||||||
262 | if ($this->isGranted(Constants::PUBLISHER_AVAILABLE_PAGE_WRAP)) { |
||||||
263 | $wrapPages = \XoopsLists::getHtmlListAsArray(Utility::getUploadDir(true, 'content')); |
||||||
264 | $availableWrapPagesText = []; |
||||||
265 | foreach ($wrapPages as $page) { |
||||||
266 | $availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap=$page] \");' onmouseover='style.cursor=\"pointer\"'>$page</span>"; |
||||||
267 | } |
||||||
268 | $availableWrapPages = new \XoopsFormLabel(\_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, \implode(', ', $availableWrapPagesText)); |
||||||
269 | $availableWrapPages->setDescription(\_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC); |
||||||
270 | $this->addElement($availableWrapPages); |
||||||
271 | } |
||||||
272 | |||||||
273 | $userUid = $obj->getVar('itemid') > 0 ? $obj->uid() : $currentUid; |
||||||
0 ignored issues
–
show
The method
uid() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsUser or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
274 | if ($this->isGranted(Constants::PUBLISHER_UID)) { |
||||||
275 | $this->addElement(new \XoopsFormSelectUser(\_CO_PUBLISHER_UID, 'uid', false, $userUid, 1, false), false); |
||||||
276 | } else { |
||||||
277 | $this->addElement(new \XoopsFormHidden('uid', $userUid)); |
||||||
278 | } |
||||||
279 | |||||||
280 | // Uid |
||||||
281 | /* We need to retreive the users manually because for some reason, on the frxoops.org server, |
||||||
282 | the method users::getobjects encounters a memory error |
||||||
283 | */ // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL |
||||||
284 | /* |
||||||
285 | if ($this->isGranted(Constants::PUBLISHER_UID)) { |
||||||
286 | $uidSelect = new \XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false); |
||||||
287 | $uidSelect->setDescription(_CO_PUBLISHER_UID_DSC); |
||||||
288 | $sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC'; |
||||||
289 | $result = $obj->db->query($sql); |
||||||
290 | $usersArray = []; |
||||||
291 | $usersArray[0] = $GLOBALS['xoopsConfig']['anonymous']; |
||||||
292 | while (($myrow = $obj->db->fetchArray($result)) !== false) { |
||||||
293 | $usersArray[$myrow['uid']] = $myrow['uname']; |
||||||
294 | } |
||||||
295 | $uidSelect->addOptionArray($usersArray); |
||||||
296 | $this->addElement($uidSelect); |
||||||
297 | } |
||||||
298 | */ |
||||||
299 | |||||||
300 | /* else { |
||||||
301 | $hidden = new \XoopsFormHidden('uid', $obj->uid()); |
||||||
302 | $this->addElement($hidden); |
||||||
303 | unset($hidden); |
||||||
304 | }*/ |
||||||
305 | |||||||
306 | // Author ALias |
||||||
307 | if ($this->isGranted(Constants::PUBLISHER_AUTHOR_ALIAS)) { |
||||||
308 | $element = new \XoopsFormText(\_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e')); |
||||||
309 | $element->setDescription(\_CO_PUBLISHER_AUTHOR_ALIAS_DSC); |
||||||
310 | $this->addElement($element); |
||||||
311 | unset($element); |
||||||
312 | } |
||||||
313 | |||||||
314 | // STATUS |
||||||
315 | if ($this->isGranted(Constants::PUBLISHER_STATUS)) { |
||||||
316 | $options = [ |
||||||
317 | Constants::PUBLISHER_STATUS_SUBMITTED => \_CO_PUBLISHER_SUBMITTED, |
||||||
318 | Constants::PUBLISHER_STATUS_PUBLISHED => \_CO_PUBLISHER_PUBLISHED, |
||||||
319 | Constants::PUBLISHER_STATUS_OFFLINE => \_CO_PUBLISHER_OFFLINE, |
||||||
320 | Constants::PUBLISHER_STATUS_REJECTED => \_CO_PUBLISHER_REJECTED, |
||||||
321 | ]; |
||||||
322 | $statusSelect = new \XoopsFormSelect(\_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status')); |
||||||
323 | $statusSelect->addOptionArray($options); |
||||||
324 | $statusSelect->setDescription(\_CO_PUBLISHER_STATUS_DSC); |
||||||
325 | $this->addElement($statusSelect); |
||||||
326 | unset($statusSelect); |
||||||
327 | } |
||||||
328 | |||||||
329 | // Datesub |
||||||
330 | if ($this->isGranted(Constants::PUBLISHER_DATESUB)) { |
||||||
331 | if ($obj->isNew()) { |
||||||
332 | $datesub = \time(); |
||||||
333 | } else { |
||||||
334 | $datesub = (0 == $obj->getVar('datesub')) ? \time() : $obj->getVar('datesub'); |
||||||
335 | } |
||||||
336 | $datesub_datetime = new FormDateTime(\_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true); |
||||||
337 | // $datesub_datetime = new \XoopsFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true); |
||||||
338 | |||||||
339 | $datesub_datetime->setDescription(\_CO_PUBLISHER_DATESUB_DSC); |
||||||
340 | $this->addElement($datesub_datetime); |
||||||
341 | } |
||||||
342 | |||||||
343 | // Date expire |
||||||
344 | if ($this->isGranted(Constants::PUBLISHER_DATEEXPIRE)) { |
||||||
345 | if ($obj->isNew()) { |
||||||
346 | $dateexpire = \time(); |
||||||
347 | $dateexpire_opt = 0; |
||||||
348 | } elseif (0 == $obj->getVar('dateexpire')) { |
||||||
349 | $dateexpire_opt = 0; |
||||||
350 | $dateexpire = \time(); |
||||||
351 | } else { |
||||||
352 | $dateexpire_opt = 1; |
||||||
353 | $dateexpire = $obj->getVar('dateexpire'); |
||||||
354 | } |
||||||
355 | |||||||
356 | $dateExpireYesNo = new \XoopsFormRadioYN('', 'use_expire_yn', $dateexpire_opt); |
||||||
357 | $dateexpire = (int)\formatTimestamp($dateexpire, 'U', $timeoffset); //set to user timezone |
||||||
358 | $dateexpire_datetime = new \XoopsFormDateTime('', 'dateexpire', $size = 15, $dateexpire, true); |
||||||
359 | if (0 == $dateexpire_opt) { |
||||||
360 | $dateexpire_datetime->setExtra('disabled="disabled"'); |
||||||
361 | } |
||||||
362 | |||||||
363 | $dateExpireTray = new \XoopsFormElementTray(\_CO_PUBLISHER_DATEEXPIRE, ''); |
||||||
364 | $dateExpireTray->setDescription(\_CO_PUBLISHER_DATEEXPIRE_DSC); |
||||||
365 | $dateExpireTray->addElement($dateExpireYesNo); |
||||||
366 | $dateExpireTray->addElement($dateexpire_datetime); |
||||||
367 | $this->addElement($dateExpireTray); |
||||||
368 | } |
||||||
369 | |||||||
370 | // NOTIFY ON PUBLISH |
||||||
371 | if ($this->isGranted(Constants::PUBLISHER_NOTIFY)) { |
||||||
372 | $notify_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_NOTIFY, 'notify', $obj->notifypub(), _YES, _NO); |
||||||
0 ignored issues
–
show
The method
notifypub() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
373 | $this->addElement($notify_radio); |
||||||
374 | } |
||||||
375 | |||||||
376 | if ($this->hasTab(\_CO_PUBLISHER_TAB_IMAGES)) { |
||||||
377 | $this->startTab(\_CO_PUBLISHER_TAB_IMAGES); |
||||||
378 | } |
||||||
379 | |||||||
380 | // IMAGE --------------------------------------- |
||||||
381 | if ($this->isGranted(Constants::PUBLISHER_IMAGE_ITEM)) { |
||||||
382 | $objimages = $obj->getImages(); |
||||||
0 ignored issues
–
show
The method
getImages() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
383 | $mainarray = \is_object($objimages['main']) ? [$objimages['main']] : []; |
||||||
384 | $mergedimages = \array_merge($mainarray, $objimages['others']); |
||||||
385 | $objimage_array = []; |
||||||
386 | foreach ($mergedimages as $imageObj) { |
||||||
387 | $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); |
||||||
388 | } |
||||||
389 | |||||||
390 | /** @var \XoopsImagecategoryHandler $imgcatHandler */ |
||||||
391 | $imgcatHandler = \xoops_getHandler('imagecategory'); |
||||||
392 | if (\method_exists($imgcatHandler, 'getListByPermission')) { |
||||||
393 | $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1); |
||||||
394 | } else { |
||||||
395 | $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1); |
||||||
396 | } |
||||||
397 | $imgcatConfig = $helper->getConfig('submit_imgcat'); |
||||||
398 | if (\in_array(Constants::PUBLISHER_IMGCAT_ALL, $imgcatConfig, true)) { |
||||||
399 | $catids = \array_keys($catlist); |
||||||
400 | } else { |
||||||
401 | // compare selected in options with readable of user |
||||||
402 | $catlist = \array_intersect($catlist, $imgcatConfig); |
||||||
403 | $catids = \array_keys($catlist); |
||||||
404 | } |
||||||
405 | |||||||
406 | $imageObjs = []; |
||||||
407 | if (!empty($catids)) { |
||||||
408 | /** @var \XoopsImageHandler $imageHandler */ |
||||||
409 | $imageHandler = \xoops_getHandler('image'); |
||||||
410 | $criteria = new \CriteriaCompo(new \Criteria('imgcat_id', '(' . \implode(',', $catids) . ')', 'IN')); |
||||||
411 | $criteria->add(new \Criteria('image_display', 1)); |
||||||
412 | $criteria->setSort('image_nicename'); |
||||||
413 | $criteria->order = 'ASC'; // patch for XOOPS <= 2.5.10, does not set order correctly using setOrder() method |
||||||
414 | $imageObjs = $imageHandler->getObjects($criteria, true); |
||||||
415 | unset($criteria); |
||||||
416 | } |
||||||
417 | $image_array = []; |
||||||
418 | foreach ($imageObjs as $imageObj) { |
||||||
419 | $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); |
||||||
420 | } |
||||||
421 | |||||||
422 | $image_array = \array_diff($image_array, $objimage_array); |
||||||
423 | |||||||
424 | $imageSelect = new \XoopsFormSelect('', 'image_notused', '', 5); |
||||||
425 | $imageSelect->addOptionArray($image_array); |
||||||
426 | $imageSelect->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'"); |
||||||
427 | //$imageSelect->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'"); |
||||||
428 | unset($image_array); |
||||||
429 | |||||||
430 | $imageSelect2 = new \XoopsFormSelect('', 'image_item', '', 5, true); |
||||||
431 | $imageSelect2->addOptionArray($objimage_array); |
||||||
432 | $imageSelect2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'"); |
||||||
433 | |||||||
434 | $buttonadd = new \XoopsFormButton('', 'buttonadd', \_CO_PUBLISHER_ADD); |
||||||
435 | $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'"); |
||||||
436 | |||||||
437 | $buttonremove = new \XoopsFormButton('', 'buttonremove', \_CO_PUBLISHER_REMOVE); |
||||||
438 | $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'"); |
||||||
439 | |||||||
440 | $opentable = new \XoopsFormLabel('', '<table><tr><td>'); |
||||||
441 | $addcol = new \XoopsFormLabel('', '</td><td>'); |
||||||
442 | $addbreak = new \XoopsFormLabel('', '<br>'); |
||||||
443 | $closetable = new \XoopsFormLabel('', '</td></tr></table>'); |
||||||
444 | |||||||
445 | $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/ajaxupload.3.9.js'); |
||||||
446 | $js_data = new \XoopsFormLabel( |
||||||
447 | '', ' |
||||||
448 | |||||||
449 | <script type= "text/javascript"> |
||||||
450 | $publisher(document).ready(function () { |
||||||
451 | var button = $publisher("#publisher_upload_button"), interval; |
||||||
452 | new AjaxUpload(button,{ |
||||||
453 | action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons |
||||||
454 | responseType: "text/html", |
||||||
455 | name: "publisher_upload_file", |
||||||
456 | onSubmit : function (file, ext) { |
||||||
457 | // change button text, when user selects file |
||||||
458 | $publisher("#publisher_upload_message").html(" "); |
||||||
459 | button.html("<img src=\'' . PUBLISHER_URL . '/assets/images/loadingbar.gif\'>"); this.setData({ |
||||||
460 | "image_nicename": $publisher("#image_nicename").val(), |
||||||
461 | "imgcat_id" : $publisher("#imgcat_id").val() |
||||||
462 | }); |
||||||
463 | // If you want to allow uploading only 1 file at time, |
||||||
464 | // you can disable upload button |
||||||
465 | //this.disable(); |
||||||
466 | interval = window.setInterval(function () { |
||||||
467 | }, 200); |
||||||
468 | }, |
||||||
469 | onComplete: function (file, response) { |
||||||
470 | button.text("' . \_CO_PUBLISHER_IMAGE_UPLOAD_NEW . '"); |
||||||
471 | window.clearInterval(interval); |
||||||
472 | // enable upload button |
||||||
473 | this.enable(); |
||||||
474 | // add file to the list |
||||||
475 | var result = eval(response); |
||||||
476 | if ("success" == result[0]) { |
||||||
477 | $publisher("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>"); |
||||||
478 | publisher_updateSelectOption(\'image_item\', \'image_featured\'); |
||||||
479 | showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\') |
||||||
480 | } else { |
||||||
481 | $publisher("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>"); |
||||||
482 | } |
||||||
483 | } |
||||||
484 | }); |
||||||
485 | }); |
||||||
486 | </script> |
||||||
487 | |||||||
488 | ' |
||||||
489 | ); |
||||||
490 | $messages = new \XoopsFormLabel('', "<div id='publisher_upload_message'></div>"); |
||||||
491 | $button = new \XoopsFormLabel('', "<div id='publisher_upload_button'>" . \_CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>'); |
||||||
492 | $nicename = new \XoopsFormText('', 'image_nicename', 30, 30, \_CO_PUBLISHER_IMAGE_NICENAME); |
||||||
493 | |||||||
494 | // $imgcatHandler = xoops_getHandler('imagecategory'); |
||||||
495 | // if (method_exists($imgcatHandler, 'getListByPermission')) { |
||||||
496 | // $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1); |
||||||
497 | // } else { |
||||||
498 | // $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1); |
||||||
499 | // } |
||||||
500 | $imagecat = new \XoopsFormSelect('', 'imgcat_id', '', 1); |
||||||
501 | $imagecat->addOptionArray($catlist); |
||||||
502 | |||||||
503 | $imageUploadTray = new \XoopsFormElementTray(\_CO_PUBLISHER_IMAGE_UPLOAD, ''); |
||||||
504 | $imageUploadTray->addElement($js_data); |
||||||
505 | $imageUploadTray->addElement($messages); |
||||||
506 | $imageUploadTray->addElement($opentable); |
||||||
507 | $imageUploadTray->addElement($imagecat); |
||||||
508 | $imageUploadTray->addElement($addbreak); |
||||||
509 | $imageUploadTray->addElement($nicename); |
||||||
510 | $imageUploadTray->addElement($addbreak); |
||||||
511 | $imageUploadTray->addElement($button); |
||||||
512 | $imageUploadTray->addElement($closetable); |
||||||
513 | $this->addElement($imageUploadTray); |
||||||
514 | |||||||
515 | $imageTray = new \XoopsFormElementTray(\_CO_PUBLISHER_IMAGE_ITEMS, ''); |
||||||
516 | $imageTray->addElement($opentable); |
||||||
517 | |||||||
518 | $imageTray->addElement($imageSelect); |
||||||
519 | $imageTray->addElement($addbreak); |
||||||
520 | $imageTray->addElement($buttonadd); |
||||||
521 | |||||||
522 | $imageTray->addElement($addcol); |
||||||
523 | |||||||
524 | $imageTray->addElement($imageSelect2); |
||||||
525 | $imageTray->addElement($addbreak); |
||||||
526 | $imageTray->addElement($buttonremove); |
||||||
527 | |||||||
528 | $imageTray->addElement($closetable); |
||||||
529 | $imageTray->setDescription(\_CO_PUBLISHER_IMAGE_ITEMS_DSC); |
||||||
530 | $this->addElement($imageTray); |
||||||
531 | |||||||
532 | $imagename = \is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : ''; |
||||||
533 | $imageforpath = ('' != $imagename) ? $imagename : 'blank.gif'; |
||||||
534 | |||||||
535 | $imageSelect3 = new \XoopsFormSelect(\_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1); |
||||||
536 | $imageSelect3->addOptionArray($objimage_array); |
||||||
537 | $imageSelect3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'"); |
||||||
538 | $imageSelect3->setDescription(\_CO_PUBLISHER_IMAGE_ITEM_DSC); |
||||||
539 | $this->addElement($imageSelect3); |
||||||
540 | |||||||
541 | $image_preview = new \XoopsFormLabel(\_CO_PUBLISHER_IMAGE_PREVIEW, "<img src='" . XOOPS_URL . '/uploads/' . $imageforpath . "' name='image_display' id='image_display' alt=''>"); |
||||||
542 | $this->addElement($image_preview); |
||||||
543 | } |
||||||
544 | |||||||
545 | // FILES ----------------------------------- |
||||||
546 | if ($this->hasTab(\_CO_PUBLISHER_TAB_FILES)) { |
||||||
547 | $this->startTab(\_CO_PUBLISHER_TAB_FILES); |
||||||
548 | } |
||||||
549 | // File upload UPLOAD |
||||||
550 | if ($this->isGranted(Constants::PUBLISHER_ITEM_UPLOAD_FILE)) { |
||||||
551 | // NAME |
||||||
552 | $nameText = new \XoopsFormText(\_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, ''); |
||||||
553 | $nameText->setDescription(\_CO_PUBLISHER_FILE_NAME_DSC); |
||||||
554 | $this->addElement($nameText); |
||||||
555 | unset($nameText); |
||||||
556 | |||||||
557 | // DESCRIPTION |
||||||
558 | $descriptionText = new \XoopsFormTextArea(\_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', ''); |
||||||
559 | $descriptionText->setDescription(\_CO_PUBLISHER_FILE_DESCRIPTION_DSC); |
||||||
560 | $this->addElement($descriptionText); |
||||||
561 | unset($descriptionText); |
||||||
562 | |||||||
563 | $statusSelect = new \XoopsFormRadioYN(\_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1); //1 - active |
||||||
564 | $statusSelect->setDescription(\_CO_PUBLISHER_FILE_STATUS_DSC); |
||||||
565 | $this->addElement($statusSelect); |
||||||
566 | unset($statusSelect); |
||||||
567 | |||||||
568 | $fileBox = new \XoopsFormFile(\_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file', 0); |
||||||
569 | $fileBox->setDescription(\_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC); |
||||||
570 | $fileBox->setExtra("size ='50'"); |
||||||
571 | $this->addElement($fileBox); |
||||||
572 | unset($fileBox); |
||||||
573 | |||||||
574 | if (!$obj->isNew()) { |
||||||
575 | $filesObj = $helper->getHandler('File')->getAllFiles($obj->itemid()); |
||||||
0 ignored issues
–
show
The method
itemid() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
576 | if (\count($filesObj) > 0) { |
||||||
577 | $table = ''; |
||||||
578 | $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
||||||
579 | $table .= '<tr>'; |
||||||
580 | $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>"; |
||||||
581 | $table .= "<td width='150' class='bg3' align='left'><strong>" . \_AM_PUBLISHER_FILENAME . '</strong></td>'; |
||||||
582 | $table .= "<td class='bg3' align='left'><strong>" . \_AM_PUBLISHER_DESCRIPTION . '</strong></td>'; |
||||||
583 | $table .= "<td width='60' class='bg3' align='center'><strong>" . \_AM_PUBLISHER_HITS . '</strong></td>'; |
||||||
584 | $table .= "<td width='100' class='bg3' align='center'><strong>" . \_AM_PUBLISHER_UPLOADED_DATE . '</strong></td>'; |
||||||
585 | $table .= "<td width='60' class='bg3' align='center'><strong>" . \_AM_PUBLISHER_ACTION . '</strong></td>'; |
||||||
586 | $table .= '</tr>'; |
||||||
587 | |||||||
588 | foreach ($filesObj as $fileObj) { |
||||||
589 | $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . \_CO_PUBLISHER_EDITFILE . "' alt='" . \_CO_PUBLISHER_EDITFILE . "'></a>"; |
||||||
590 | $delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . \_CO_PUBLISHER_DELETEFILE . "' alt='" . \_CO_PUBLISHER_DELETEFILE . "'></a>"; |
||||||
591 | $not_visible = ''; |
||||||
592 | if (0 == $fileObj->status()) { |
||||||
593 | $not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'>"; |
||||||
594 | } |
||||||
595 | $table .= '<tr>'; |
||||||
596 | $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>'; |
||||||
597 | $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . '</td>'; |
||||||
598 | $table .= "<td class='even' align='left'>" . $fileObj->description() . '</td>'; |
||||||
599 | $table .= "<td class='even' align='center'>" . $fileObj->counter() . ''; |
||||||
600 | $table .= "<td class='even' align='center'>" . $fileObj->getDatesub() . '</td>'; |
||||||
601 | $table .= "<td class='even' align='center'> $modify $delete </td>"; |
||||||
602 | $table .= '</tr>'; |
||||||
603 | } |
||||||
604 | $table .= '</table>'; |
||||||
605 | |||||||
606 | $files_box = new \XoopsFormLabel(\_CO_PUBLISHER_FILES_LINKED, $table); |
||||||
607 | $this->addElement($files_box); |
||||||
608 | unset($files_box, $filesObj, $fileObj); |
||||||
609 | } |
||||||
610 | } |
||||||
611 | } |
||||||
612 | |||||||
613 | // OTHERS ----------------------------------- |
||||||
614 | if ($this->hasTab(\_CO_PUBLISHER_TAB_OTHERS)) { |
||||||
615 | $this->startTab(\_CO_PUBLISHER_TAB_OTHERS); |
||||||
616 | } |
||||||
617 | //$this->startTab(_CO_PUBLISHER_TAB_META); |
||||||
618 | // Meta Keywords |
||||||
619 | if ($this->isGranted(Constants::PUBLISHER_ITEM_META_KEYWORDS)) { |
||||||
620 | $text_meta_keywords = new \XoopsFormTextArea(\_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->meta_keywords('e'), 7, 60); |
||||||
0 ignored issues
–
show
The method
meta_keywords() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
621 | $text_meta_keywords->setDescription(\_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC); |
||||||
622 | $this->addElement($text_meta_keywords); |
||||||
623 | } |
||||||
624 | |||||||
625 | // Meta Description |
||||||
626 | if ($this->isGranted(Constants::PUBLISHER_ITEM_META_DESCRIPTION)) { |
||||||
627 | $text_meta_description = new \XoopsFormTextArea(\_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->meta_description('e'), 7, 60); |
||||||
0 ignored issues
–
show
The method
meta_description() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
628 | $text_meta_description->setDescription(\_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC); |
||||||
629 | $this->addElement($text_meta_description); |
||||||
630 | } |
||||||
631 | |||||||
632 | //$this->startTab(_CO_PUBLISHER_TAB_PERMISSIONS); |
||||||
633 | |||||||
634 | // COMMENTS |
||||||
635 | if ($this->isGranted(Constants::PUBLISHER_ALLOWCOMMENTS)) { |
||||||
636 | $addcomments_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->cancomment(), _YES, _NO); |
||||||
0 ignored issues
–
show
The method
cancomment() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
637 | $this->addElement($addcomments_radio); |
||||||
638 | } |
||||||
639 | |||||||
640 | // WEIGHT |
||||||
641 | if ($this->isGranted(Constants::PUBLISHER_WEIGHT)) { |
||||||
642 | $this->addElement(new \XoopsFormText(\_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->weight())); |
||||||
0 ignored issues
–
show
The method
weight() does not exist on XoopsObject . It seems like you code against a sub-type of XoopsObject such as XoopsModule or XoopsBlock or XoopsModules\Publisher\Item or XoopsModules\Publisher\File or XoopsModules\Publisher\Category .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
643 | } |
||||||
644 | |||||||
645 | $this->endTabs(); |
||||||
646 | |||||||
647 | //COMMON TO ALL TABS |
||||||
648 | |||||||
649 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
650 | |||||||
651 | if ($obj->isNew()) { |
||||||
652 | $buttonTray->addElement(new \XoopsFormButton('', 'additem', \_CO_PUBLISHER_CREATE, 'submit')); |
||||||
653 | $buttonTray->addElement(new \XoopsFormButton('', '', \_CO_PUBLISHER_CLEAR, 'reset')); |
||||||
654 | } else { |
||||||
655 | $buttonTray->addElement(new \XoopsFormButton('', 'additem', _SUBMIT, 'submit')); //orclone |
||||||
656 | } |
||||||
657 | |||||||
658 | $buttonTray->addElement(new \XoopsFormButton('', 'preview', \_CO_PUBLISHER_PREVIEW, 'submit')); |
||||||
659 | |||||||
660 | $butt_cancel = new \XoopsFormButton('', '', \_CO_PUBLISHER_CANCEL, 'button'); |
||||||
661 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||||||
662 | $buttonTray->addElement($butt_cancel); |
||||||
663 | |||||||
664 | $this->addElement($buttonTray); |
||||||
665 | |||||||
666 | $hidden = new \XoopsFormHidden('itemid', $obj->itemid()); |
||||||
667 | $this->addElement($hidden); |
||||||
668 | unset($hidden); |
||||||
669 | |||||||
670 | return $this; |
||||||
671 | } |
||||||
672 | } |
||||||
673 |