XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
ImageListAction.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16require_once XOOPS_MODULE_PATH . '/legacy/class/AbstractListAction.class.php';
17require_once XOOPS_MODULE_PATH . '/legacy/forms/ImageFilterForm.class.php';
18
19/***
20 * @internal
21 */
23{
24 public $mImgcatId = null;
25
26 public function prepare(&$controller, &$xoopsUser)
27 {
28 $controller->setDialogMode(true);
29
30 $root =& $controller->mRoot;
31 $root->mLanguageManager->loadModuleMessageCatalog('legacy');
32 }
33
34 public function &_getHandler()
35 {
36 $handler =& xoops_getmodulehandler('image', 'legacy');
37 return $handler;
38 }
39
40 public function &_getFilterForm()
41 {
42 $filter =new Legacy_ImageFilterForm($this->_getPageNavi(), $this->_getHandler());
43 return $filter;
44 }
45
46 public function _getBaseUrl()
47 {
48 return XOOPS_URL . '/imagemanager.php?op=list';
49 }
50
51 public function getDefaultView(&$controller, &$xoopsUser)
52 {
53 $result = parent::getDefaultView($controller, $xoopsUser);
54 if (LEGACY_FRAME_VIEW_INDEX == $result) {
55 $this->mImgcatId = xoops_getrequest('imgcat_id');
56 $handler =& xoops_getmodulehandler('imagecategory', 'legacy');
57 $this->mCategory =& $handler->get($this->mImgcatId);
58 }
59
60 return $result;
61 }
62
63 public function executeViewIndex(&$controller, &$xoopsUser, &$render)
64 {
65 $render->setTemplateName('legacy_image_list.html');
66
67 foreach (array_keys($this->mObjects) as $key) {
68 $this->mObjects[$key]->loadImagecategory();
69 }
70
71 $render->setAttribute('objects', $this->mObjects);
72 $render->setAttribute('pageNavi', $this->mFilter->mNavi);
73
74 $render->setAttribute('imgcatId', $this->mImgcatId);
75
76 $handler =& xoops_getmodulehandler('imagecategory', 'legacy');
77
78 if (is_object($xoopsUser)) {
79 $groups = $xoopsUser->getGroups();
80 } else {
81 $groups = [XOOPS_GROUP_ANONYMOUS];
82 }
83 $categoryArr =& $handler->getObjectsWithReadPerm($groups, 1);
84
85 $render->setAttribute('categoryArr', $categoryArr);
86
87 //
88 // If current category object exists, check the permission of uploading.
89 //
90 $hasUploadPerm = null;
91 if (null !== $this->mCategory) {
92 $hasUploadPerm = $this->mCategory->hasUploadPerm($groups);
93 }
94 $render->setAttribute('hasUploadPerm', $hasUploadPerm);
95 $render->setAttribute('category', $this->mCategory);
96 //echo xoops_getrequest('target');die();
97 $render->setAttribute('target', htmlspecialchars(xoops_getrequest('target'), ENT_QUOTES));
98 }
99
100 public function executeViewError(&$controller, &$xoopsUser, &$render)
101 {
102 $controller->executeForward(XOOPS_URL . '/imagemanager.php?op=list');
103 }
104}