|
19 | 19 | */ |
20 | 20 |
|
21 | 21 | use Xmf\Request; |
22 | | -use Xoopsmodules\publisher; |
| 22 | +use XoopsModules\Publisher; |
23 | 23 |
|
24 | 24 | require_once __DIR__ . '/admin_header.php'; |
25 | 25 |
|
|
34 | 34 |
|
35 | 35 | switch ($op) { |
36 | 36 | case 'del': |
37 | | - $categoryObj = $helper->getHandler('category')->get($categoryid); |
| 37 | + $categoryObj = $helper->getHandler('Category')->get($categoryid); |
38 | 38 | $confirm = Request::getInt('confirm', '', 'POST'); |
39 | 39 | $name = Request::getString('name', '', 'POST'); |
40 | 40 | if ($confirm) { |
41 | | - if (!$helper->getHandler('category')->delete($categoryObj)) { |
| 41 | + if (!$helper->getHandler('Category')->delete($categoryObj)) { |
42 | 42 | redirect_header('category.php', 1, _AM_PUBLISHER_DELETE_CAT_ERROR); |
43 | 43 | // exit(); |
44 | 44 | } |
|
57 | 57 | $nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST'); |
58 | 58 | //end of fx2024 code |
59 | 59 |
|
60 | | - publisher\Utility::cpHeader(); |
61 | | - publisher\Utility::editCategory(true, $categoryid, $nb_subcats); |
| 60 | + Publisher\Utility::cpHeader(); |
| 61 | + Publisher\Utility::editCategory(true, $categoryid, $nb_subcats); |
62 | 62 | break; |
63 | 63 |
|
64 | 64 | case 'addcategory': |
65 | 65 | global $modify; |
66 | 66 |
|
67 | 67 | $parentid = Request::getInt('parentid'); |
68 | 68 | if (0 != $categoryid) { |
69 | | - $categoryObj = $helper->getHandler('category')->get($categoryid); |
| 69 | + $categoryObj = $helper->getHandler('Category')->get($categoryid); |
70 | 70 | } else { |
71 | | - $categoryObj = $helper->getHandler('category')->create(); |
| 71 | + $categoryObj = $helper->getHandler('Category')->create(); |
72 | 72 | } |
73 | 73 |
|
74 | 74 | // Uploading the image, if any |
|
82 | 82 | $max_size = $helper->getConfig('maximum_filesize'); |
83 | 83 | $max_imgwidth = $helper->getConfig('maximum_image_width'); |
84 | 84 | $max_imgheight = $helper->getConfig('maximum_image_height'); |
85 | | - $allowed_mimetypes = publisher\Utility::getAllowedImagesTypes(); |
| 85 | + $allowed_mimetypes = Publisher\Utility::getAllowedImagesTypes(); |
86 | 86 | if (('' == $temp['tmp_name']) || !is_readable($temp['tmp_name'])) { |
87 | 87 | redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); |
88 | 88 | // exit(); |
89 | 89 | } |
90 | 90 |
|
91 | 91 | xoops_load('XoopsMediaUploader'); |
92 | | - $uploader = new XoopsMediaUploader(publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); |
| 92 | + $uploader = new \XoopsMediaUploader(Publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); |
93 | 93 | if ($uploader->fetchMedia($filename) && $uploader->upload()) { |
94 | 94 | $categoryObj->setVar('image', $uploader->getSavedFileName()); |
95 | 95 | } else { |
|
130 | 130 | } |
131 | 131 |
|
132 | 132 | if (!$categoryObj->store()) { |
133 | | - redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher\Utility::formatErrors($categoryObj->getErrors())); |
| 133 | + redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . Publisher\Utility::formatErrors($categoryObj->getErrors())); |
134 | 134 | // exit; |
135 | 135 | } |
136 | 136 | // TODO : put this function in the category class |
137 | | - publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); |
138 | | - publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); |
139 | | - publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); |
| 137 | + Publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); |
| 138 | + Publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); |
| 139 | + Publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); |
140 | 140 |
|
141 | 141 | //Added by fx2024 |
142 | 142 | $parentCat = $categoryObj->categoryid(); |
143 | 143 | $sizeof = count(Request::getArray('scname', [], 'POST')); |
144 | 144 | for ($i = 0; $i < $sizeof; ++$i) { |
145 | 145 | $temp = Request::getArray('scname', [], 'POST'); |
146 | 146 | if ('' != $temp[$i]) { |
147 | | - $categoryObj = $helper->getHandler('category')->create(); |
| 147 | + $categoryObj = $helper->getHandler('Category')->create(); |
148 | 148 | $temp2 = Request::getArray('scname', [], 'POST'); |
149 | 149 | $categoryObj->setVar('name', $temp2[$i]); |
150 | 150 | $categoryObj->setVar('parentid', $parentCat); |
151 | 151 |
|
152 | 152 | if (!$categoryObj->store()) { |
153 | | - redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher\Utility::formatErrors($categoryObj->getErrors())); |
| 153 | + redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . Publisher\Utility::formatErrors($categoryObj->getErrors())); |
154 | 154 | // exit; |
155 | 155 | } |
156 | 156 | // TODO : put this function in the category class |
157 | | - publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); |
158 | | - publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); |
159 | | - publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); |
| 157 | + Publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); |
| 158 | + Publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); |
| 159 | + Publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | //end of fx2024 code |
|
170 | 170 | $categoryid = 0; |
171 | 171 | $nb_subcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST'); |
172 | 172 |
|
173 | | - $categoryObj = $helper->getHandler('category')->create(); |
| 173 | + $categoryObj = $helper->getHandler('Category')->create(); |
174 | 174 | $categoryObj->setVar('name', Request::getString('name', '', 'POST')); |
175 | 175 | $categoryObj->setVar('description', Request::getString('description', '', 'POST')); |
176 | 176 | $categoryObj->setVar('weight', Request::getInt('weight', 0, 'POST')); |
177 | 177 | if (isset($parentCat)) { |
178 | 178 | $categoryObj->setVar('parentid', $parentCat); |
179 | 179 | } |
180 | 180 |
|
181 | | - publisher\Utility::cpHeader(); |
182 | | - publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); |
| 181 | + Publisher\Utility::cpHeader(); |
| 182 | + Publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); |
183 | 183 | exit(); |
184 | 184 | break; |
185 | 185 | //end of fx2024 code |
|
190 | 190 | break; |
191 | 191 | case 'default': |
192 | 192 | default: |
193 | | - publisher\Utility::cpHeader(); |
| 193 | + Publisher\Utility::cpHeader(); |
194 | 194 | //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); |
195 | 195 |
|
196 | 196 | echo "<br>\n"; |
|
200 | 200 | echo '</div></form>'; |
201 | 201 |
|
202 | 202 | // Creating the objects for top categories |
203 | | - $categoriesObj = $helper->getHandler('category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0); |
| 203 | + $categoriesObj = $helper->getHandler('Category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0); |
204 | 204 |
|
205 | | - publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); |
| 205 | + Publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); |
206 | 206 |
|
207 | 207 | echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
208 | 208 | echo '<tr>'; |
|
211 | 211 | echo "<th width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . '</strong></td>'; |
212 | 212 | echo "<th width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; |
213 | 213 | echo '</tr>'; |
214 | | - $totalCategories = $helper->getHandler('category')->getCategoriesCount(0); |
| 214 | + $totalCategories = $helper->getHandler('Category')->getCategoriesCount(0); |
215 | 215 | if (count($categoriesObj) > 0) { |
216 | 216 | foreach ($categoriesObj as $key => $thiscat) { |
217 | | - publisher\Utility::displayCategory($thiscat); |
| 217 | + Publisher\Utility::displayCategory($thiscat); |
218 | 218 | } |
219 | 219 | unset($key, $thiscat); |
220 | 220 | } else { |
|
225 | 225 | } |
226 | 226 | echo "</table>\n"; |
227 | 227 | require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
228 | | - $pagenav = new XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); |
| 228 | + $pagenav = new \XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); |
229 | 229 | echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
230 | 230 | echo '<br>'; |
231 | | - publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); |
| 231 | + Publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); |
232 | 232 | echo '<br>'; |
233 | 233 | //editcat(false); |
234 | 234 | break; |
|
0 commit comments