XoopsModules25x /
tdmdownloads
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /** |
||
| 4 | * TDMDownload |
||
| 5 | * |
||
| 6 | * You may not change or alter any portion of this comment or credits |
||
| 7 | * of supporting developers from this source code or any supporting source code |
||
| 8 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | * This program is distributed in the hope that it will be useful, |
||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 12 | * |
||
| 13 | * @copyright Gregory Mage (Aka Mage) |
||
| 14 | * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
| 15 | * @author Gregory Mage (Aka Mage) |
||
| 16 | */ |
||
| 17 | |||
| 18 | use XoopsModules\Tdmdownloads\{ |
||
| 19 | Helper, |
||
| 20 | Tree |
||
| 21 | }; |
||
| 22 | |||
| 23 | require_once __DIR__ . '/header.php'; |
||
| 24 | $moduleDirName = basename(__DIR__); |
||
| 25 | |||
| 26 | /** @var \XoopsModules\Tdmdownloads\Helper $helper */ |
||
| 27 | $helper = Helper::getInstance(); |
||
| 28 | |||
| 29 | // template d'affichage |
||
| 30 | $GLOBALS['xoopsOption']['template_main'] = 'tdmdownloads_viewcat.tpl'; |
||
| 31 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 32 | /** @var \xos_opal_Theme $xoTheme */ |
||
| 33 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $moduleDirName . '/assets/css/styles.css', null); |
||
| 34 | $cid = \Xmf\Request::getInt('cid', 0, 'REQUEST'); |
||
| 35 | |||
| 36 | // pour les permissions |
||
| 37 | $categories = $utility->getItemIds('tdmdownloads_view', $moduleDirName); |
||
| 38 | |||
| 39 | // redirection si la catégorie n'existe pas |
||
| 40 | $criteria = new \CriteriaCompo(); |
||
| 41 | $criteria->add(new \Criteria('cat_cid', $cid)); |
||
| 42 | if (0 === $cid || 0 === $categoryHandler->getCount($criteria)) { |
||
| 43 | redirect_header('index.php', 3, _MD_TDMDOWNLOADS_CAT_NONEXISTENT); |
||
| 44 | } |
||
| 45 | // pour les permissions (si pas de droit, redirection) |
||
| 46 | if (!in_array($cid, $categories)) { |
||
| 47 | redirect_header('index.php', 2, _NOPERM); |
||
| 48 | } |
||
| 49 | |||
| 50 | //tableau des catégories |
||
| 51 | $criteria = new \CriteriaCompo(); |
||
| 52 | $criteria->setSort('cat_weight ASC, cat_title'); |
||
| 53 | $criteria->setOrder('ASC'); |
||
| 54 | $criteria->add(new \Criteria('cat_cid', '(' . implode(',', $categories) . ')', 'IN')); |
||
| 55 | $downloadscatArray = $categoryHandler->getAll($criteria); |
||
| 56 | $mytree = new Tree($downloadscatArray, 'cat_cid', 'cat_pid'); |
||
| 57 | |||
| 58 | //tableau des téléchargements |
||
| 59 | $criteria = new \CriteriaCompo(); |
||
| 60 | $criteria->add(new \Criteria('status', 0, '!=')); |
||
| 61 | $criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN')); |
||
| 62 | $downloadsArray = $downloadsHandler->getAll($criteria); |
||
| 63 | $xoopsTpl->assign('lang_thereare', sprintf(_MD_TDMDOWNLOADS_INDEX_THEREARE, count($downloadsArray))); |
||
| 64 | |||
| 65 | //navigation |
||
| 66 | $navCategory = $utility->getPathTreeUrl($mytree, $cid, $downloadscatArray, 'cat_title', $prefix = ' <img src="assets/images/deco/arrow.gif" alt="arrow"> ', true, 'ASC'); |
||
| 67 | $xoopsTpl->assign('category_path', $navCategory); |
||
| 68 | |||
| 69 | // info catégorie |
||
| 70 | $xoopsTpl->assign('category_id', $cid); |
||
| 71 | $cat_info = $categoryHandler->get($cid); |
||
| 72 | $xoopsTpl->assign('cat_description', $cat_info->getVar('cat_description_main')); |
||
| 73 | $uploadurl = XOOPS_URL . '/uploads/' . $moduleDirName . '/images/cats/'; |
||
| 74 | $categoryObject = $categoryHandler->get($cid); |
||
| 75 | $tempCategory = [ |
||
| 76 | 'image' => $cat_info->getVar('cat_imgurl'), |
||
| 77 | 'id' => $cat_info->getVar('cat_cid'), |
||
| 78 | 'title' => $cat_info->getVar('cat_title'), |
||
| 79 | 'description_main' => $cat_info->getVar('cat_description_main'), |
||
| 80 | ]; |
||
| 81 | if (!empty($tempCategory['image'])) { |
||
| 82 | $tempCategory['image'] = $uploadurl . $tempCategory['image']; |
||
| 83 | } |
||
| 84 | $xoopsTpl->assign('category', $tempCategory); |
||
| 85 | |||
| 86 | //affichage des catégories |
||
| 87 | $xoopsTpl->assign('nb_catcol', $helper->getConfig('nb_catcol')); |
||
| 88 | $count = 1; |
||
| 89 | $keywords = ''; |
||
| 90 | foreach (array_keys($downloadscatArray) as $i) { |
||
| 91 | /** @var \XoopsModules\Tdmdownloads\Category[] $downloadscatArray */ |
||
| 92 | |||
| 93 | if ($downloadscatArray[$i]->getVar('cat_pid') == $cid) { |
||
| 94 | $totaldownloads = $utility->getNumbersOfEntries($mytree, $categories, $downloadsArray, $downloadscatArray[$i]->getVar('cat_cid')); |
||
| 95 | |||
| 96 | $subcategories_arr = $mytree->getFirstChild($downloadscatArray[$i]->getVar('cat_cid')); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 97 | |||
| 98 | $chcount = 0; |
||
| 99 | |||
| 100 | $subcategories = ''; |
||
| 101 | |||
| 102 | //pour les mots clef |
||
| 103 | |||
| 104 | $keywords .= $downloadscatArray[$i]->getVar('cat_title') . ','; |
||
| 105 | |||
| 106 | foreach (array_keys($subcategories_arr) as $j) { |
||
| 107 | /** @var \XoopsModules\Tdmdownloads\Category[] $subcategories_arr */ |
||
| 108 | |||
| 109 | if ($chcount >= $helper->getConfig('nbsouscat')) { |
||
| 110 | $subcategories .= '<li>[<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/viewcat.php?cid=' . $downloadscatArray[$i]->getVar('cat_cid') . '">+</a>]</li>'; |
||
| 111 | |||
| 112 | break; |
||
| 113 | } |
||
| 114 | |||
| 115 | $subcategories .= '<li><a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/viewcat.php?cid=' . $subcategories_arr[$j]->getVar('cat_cid') . '">' . $subcategories_arr[$j]->getVar('cat_title') . '</a></li>'; |
||
| 116 | |||
| 117 | $keywords .= $downloadscatArray[$i]->getVar('cat_title') . ','; |
||
| 118 | |||
| 119 | ++$chcount; |
||
| 120 | } |
||
| 121 | |||
| 122 | $xoopsTpl->append( |
||
| 123 | 'subcategories', |
||
| 124 | [ |
||
| 125 | 'image' => $uploadurl . $downloadscatArray[$i]->getVar('cat_imgurl'), |
||
| 126 | 'id' => $downloadscatArray[$i]->getVar('cat_cid'), |
||
| 127 | 'title' => $downloadscatArray[$i]->getVar('cat_title'), |
||
| 128 | 'description_main' => $downloadscatArray[$i]->getVar('cat_description_main'), |
||
| 129 | 'infercategories' => $subcategories, |
||
| 130 | 'totaldownloads' => $totaldownloads, |
||
| 131 | 'count' => $count, |
||
| 132 | ] |
||
| 133 | ); |
||
| 134 | |||
| 135 | ++$count; |
||
| 136 | } |
||
| 137 | } |
||
| 138 | |||
| 139 | //pour afficher les résumés |
||
| 140 | //---------------------------------------------------------------------------------------------------------------------------------------------------- |
||
| 141 | //téléchargements récents |
||
| 142 | if (1 == $helper->getConfig('bldate')) { |
||
| 143 | $criteria = new \CriteriaCompo(); |
||
| 144 | |||
| 145 | $criteria->add(new \Criteria('status', 0, '!=')); |
||
| 146 | |||
| 147 | $criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN')); |
||
| 148 | |||
| 149 | $criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST'))); |
||
| 150 | |||
| 151 | $criteria->setSort('date'); |
||
| 152 | |||
| 153 | $criteria->setOrder('DESC'); |
||
| 154 | |||
| 155 | $criteria->setLimit($helper->getConfig('nbbl')); |
||
| 156 | |||
| 157 | $downloadsArray = $downloadsHandler->getAll($criteria); |
||
| 158 | |||
| 159 | foreach (array_keys($downloadsArray) as $i) { |
||
| 160 | /** @var \XoopsModules\Tdmdownloads\Downloads[] $downloadsArray */ |
||
| 161 | |||
| 162 | $title = $downloadsArray[$i]->getVar('title'); |
||
| 163 | |||
| 164 | if (mb_strlen($title) >= $helper->getConfig('longbl')) { |
||
| 165 | $title = mb_substr($title, 0, $helper->getConfig('longbl')) . '...'; |
||
| 166 | } |
||
| 167 | |||
| 168 | $date = formatTimestamp($downloadsArray[$i]->getVar('date'), 's'); |
||
| 169 | |||
| 170 | $xoopsTpl->append( |
||
| 171 | 'bl_date', |
||
| 172 | [ |
||
| 173 | 'id' => $downloadsArray[$i]->getVar('lid'), |
||
| 174 | 'cid' => $downloadsArray[$i]->getVar('cid'), |
||
| 175 | 'date' => $date, |
||
| 176 | 'title' => $title, |
||
| 177 | ] |
||
| 178 | ); |
||
| 179 | } |
||
| 180 | } |
||
| 181 | //plus téléchargés |
||
| 182 | if (1 == $helper->getConfig('blpop')) { |
||
| 183 | $criteria = new \CriteriaCompo(); |
||
| 184 | |||
| 185 | $criteria->add(new \Criteria('status', 0, '!=')); |
||
| 186 | |||
| 187 | $criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN')); |
||
| 188 | |||
| 189 | $criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST'))); |
||
| 190 | |||
| 191 | $criteria->setSort('hits'); |
||
| 192 | |||
| 193 | $criteria->setOrder('DESC'); |
||
| 194 | |||
| 195 | $criteria->setLimit($helper->getConfig('nbbl')); |
||
| 196 | |||
| 197 | $downloadsArray = $downloadsHandler->getAll($criteria); |
||
| 198 | |||
| 199 | foreach (array_keys($downloadsArray) as $i) { |
||
| 200 | $title = $downloadsArray[$i]->getVar('title'); |
||
| 201 | |||
| 202 | if (mb_strlen($title) >= $helper->getConfig('longbl')) { |
||
| 203 | $title = mb_substr($title, 0, $helper->getConfig('longbl')) . '...'; |
||
| 204 | } |
||
| 205 | |||
| 206 | $xoopsTpl->append( |
||
| 207 | 'bl_pop', |
||
| 208 | [ |
||
| 209 | 'id' => $downloadsArray[$i]->getVar('lid'), |
||
| 210 | 'cid' => $downloadsArray[$i]->getVar('cid'), |
||
| 211 | 'hits' => $downloadsArray[$i]->getVar('hits'), |
||
| 212 | 'title' => $title, |
||
| 213 | ] |
||
| 214 | ); |
||
| 215 | } |
||
| 216 | } |
||
| 217 | //mieux notés |
||
| 218 | if (1 == $helper->getConfig('blrating')) { |
||
| 219 | $criteria = new \CriteriaCompo(); |
||
| 220 | |||
| 221 | $criteria->add(new \Criteria('status', 0, '!=')); |
||
| 222 | |||
| 223 | $criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN')); |
||
| 224 | |||
| 225 | $criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST'))); |
||
| 226 | |||
| 227 | $criteria->setSort('rating'); |
||
| 228 | |||
| 229 | $criteria->setOrder('DESC'); |
||
| 230 | |||
| 231 | $criteria->setLimit($helper->getConfig('nbbl')); |
||
| 232 | |||
| 233 | $downloadsArray = $downloadsHandler->getAll($criteria); |
||
| 234 | |||
| 235 | foreach (array_keys($downloadsArray) as $i) { |
||
| 236 | $title = $downloadsArray[$i]->getVar('title'); |
||
| 237 | |||
| 238 | if (mb_strlen($title) >= $helper->getConfig('longbl')) { |
||
| 239 | $title = mb_substr($title, 0, $helper->getConfig('longbl')) . '...'; |
||
| 240 | } |
||
| 241 | |||
| 242 | $rating = number_format((float)$downloadsArray[$i]->getVar('rating'), 1); |
||
| 243 | |||
| 244 | $xoopsTpl->append( |
||
| 245 | 'bl_rating', |
||
| 246 | [ |
||
| 247 | 'id' => $downloadsArray[$i]->getVar('lid'), |
||
| 248 | 'cid' => $downloadsArray[$i]->getVar('cid'), |
||
| 249 | 'rating' => $rating, |
||
| 250 | 'title' => $title, |
||
| 251 | ] |
||
| 252 | ); |
||
| 253 | } |
||
| 254 | } |
||
| 255 | // affichage du résumé |
||
| 256 | $bl_affichage = 1; |
||
| 257 | if (0 === $helper->getConfig('bldate') && 0 === $helper->getConfig('blpop') && 0 === $helper->getConfig('blrating')) { |
||
| 258 | $bl_affichage = 0; |
||
| 259 | } |
||
| 260 | //---------------------------------------------------------------------------------------------------------------------------------------------------- |
||
| 261 | |||
| 262 | // affichage des téléchargements |
||
| 263 | if ($helper->getConfig('perpage') > 0) { |
||
| 264 | $xoopsTpl->assign('nb_dowcol', $helper->getConfig('nb_dowcol')); |
||
| 265 | |||
| 266 | //Utilisation d'une copie d'écran avec la largeur selon les préférences |
||
| 267 | |||
| 268 | if (1 == $helper->getConfig('useshots')) { |
||
| 269 | $xoopsTpl->assign('shotwidth', $helper->getConfig('shotwidth')); |
||
| 270 | |||
| 271 | $xoopsTpl->assign('show_screenshot', true); |
||
| 272 | |||
| 273 | $xoopsTpl->assign('img_float', $helper->getConfig('img_float')); |
||
| 274 | } |
||
| 275 | |||
| 276 | $criteria = new \CriteriaCompo(); |
||
| 277 | |||
| 278 | $criteria->add(new \Criteria('status', 0, '!=')); |
||
| 279 | |||
| 280 | $criteria->add(new \Criteria('cid', '(' . implode(',', $categories) . ')', 'IN')); |
||
| 281 | |||
| 282 | $criteria->add(new \Criteria('cid', \Xmf\Request::getInt('cid', 0, 'REQUEST'))); |
||
| 283 | |||
| 284 | $numrows = $downloadsHandler->getCount($criteria); |
||
| 285 | |||
| 286 | $xoopsTpl->assign('lang_thereare', sprintf(_MD_TDMDOWNLOADS_CAT_THEREARE, $numrows)); |
||
| 287 | |||
| 288 | // Pour un affichage sur plusieurs pages |
||
| 289 | |||
| 290 | if (\Xmf\Request::hasVar('limit', 'REQUEST')) { |
||
| 291 | $criteria->setLimit(\Xmf\Request::getInt('limit', 0, 'REQUEST')); |
||
| 292 | |||
| 293 | $limit = \Xmf\Request::getInt('limit', 0, 'REQUEST'); |
||
| 294 | } else { |
||
| 295 | $criteria->setLimit($helper->getConfig('perpage')); |
||
| 296 | |||
| 297 | $limit = $helper->getConfig('perpage'); |
||
| 298 | } |
||
| 299 | |||
| 300 | if (\Xmf\Request::hasVar('start', 'REQUEST')) { |
||
| 301 | $criteria->setStart(\Xmf\Request::getInt('start', 0, 'REQUEST')); |
||
| 302 | |||
| 303 | $start = \Xmf\Request::getInt('start', 0, 'REQUEST'); |
||
| 304 | } else { |
||
| 305 | $criteria->setStart(0); |
||
| 306 | |||
| 307 | $start = 0; |
||
| 308 | } |
||
| 309 | |||
| 310 | if (\Xmf\Request::hasVar('sort', 'REQUEST')) { |
||
| 311 | $criteria->setSort(\Xmf\Request::getString('sort', '', 'REQUEST')); |
||
| 312 | |||
| 313 | $sort = \Xmf\Request::getString('sort', '', 'REQUEST'); |
||
| 314 | } else { |
||
| 315 | $criteria->setSort('date'); |
||
| 316 | |||
| 317 | $sort = 'date'; |
||
| 318 | } |
||
| 319 | |||
| 320 | if (\Xmf\Request::hasVar('order', 'REQUEST')) { |
||
| 321 | $criteria->setOrder(\Xmf\Request::getString('order', '', 'REQUEST')); |
||
| 322 | |||
| 323 | $order = \Xmf\Request::getString('order', '', 'REQUEST'); |
||
| 324 | } else { |
||
| 325 | $criteria->setOrder('DESC'); |
||
| 326 | |||
| 327 | $order = 'DESC'; |
||
| 328 | } |
||
| 329 | |||
| 330 | $downloadsArray = $downloadsHandler->getAll($criteria); |
||
| 331 | |||
| 332 | if ($numrows > $limit) { |
||
| 333 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 334 | |||
| 335 | $pagenav = new \XoopsPageNav($numrows, $limit, $start, 'start', 'limit=' . $limit . '&cid=' . \Xmf\Request::getInt('cid', 0, 'REQUEST') . '&sort=' . $sort . '&order=' . $order); |
||
| 336 | |||
| 337 | $pagenav = $pagenav->renderNav(4); |
||
| 338 | } else { |
||
| 339 | $pagenav = ''; |
||
| 340 | } |
||
| 341 | |||
| 342 | $xoopsTpl->assign('pagenav', $pagenav); |
||
| 343 | |||
| 344 | $summary = ''; |
||
| 345 | |||
| 346 | $cpt = 0; |
||
| 347 | |||
| 348 | $categories = $utility->getItemIds('tdmdownloads_download', $moduleDirName); |
||
| 349 | |||
| 350 | $item = $utility->getItemIds('tdmdownloads_download_item', $moduleDirName); |
||
| 351 | |||
| 352 | foreach (array_keys($downloadsArray) as $i) { |
||
| 353 | if ('blank.gif' === $downloadsArray[$i]->getVar('logourl')) { |
||
| 354 | $logourl = ''; |
||
| 355 | } else { |
||
| 356 | $logourl = $downloadsArray[$i]->getVar('logourl'); |
||
| 357 | |||
| 358 | $logourl = $uploadurl_shots . $logourl; |
||
| 359 | } |
||
| 360 | |||
| 361 | $datetime = formatTimestamp($downloadsArray[$i]->getVar('date'), 's'); |
||
| 362 | |||
| 363 | $submitter = \XoopsUser::getUnameFromId($downloadsArray[$i]->getVar('submitter')); |
||
| 364 | |||
| 365 | $description = $downloadsArray[$i]->getVar('description'); |
||
| 366 | |||
| 367 | //permet d'afficher uniquement la description courte |
||
| 368 | |||
| 369 | if (false === mb_strpos($description, '[pagebreak]')) { |
||
| 370 | $descriptionShort = $description; |
||
| 371 | } else { |
||
| 372 | $descriptionShort = mb_substr($description, 0, mb_strpos($description, '[pagebreak]')); |
||
| 373 | } |
||
| 374 | |||
| 375 | // pour les vignettes "new" et "mis à jour" |
||
| 376 | |||
| 377 | $new = $utility->getStatusImage($downloadsArray[$i]->getVar('date'), $downloadsArray[$i]->getVar('status')); |
||
| 378 | |||
| 379 | $pop = $utility->getPopularImage($downloadsArray[$i]->getVar('hits')); |
||
| 380 | |||
| 381 | // Défini si la personne est un admin |
||
| 382 | |||
| 383 | $adminlink = ''; |
||
| 384 | |||
| 385 | if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { |
||
| 386 | $adminlink = '<a href="' |
||
| 387 | . XOOPS_URL |
||
| 388 | . '/modules/' |
||
| 389 | . $moduleDirName |
||
| 390 | . '/admin/downloads.php?op=view_downloads&downloads_lid=' |
||
| 391 | . $downloadsArray[$i]->getVar('lid') |
||
| 392 | . '" title="' |
||
| 393 | . _MD_TDMDOWNLOADS_EDITTHISDL |
||
| 394 | . '"><img src="' |
||
| 395 | . XOOPS_URL |
||
| 396 | . '/modules/' |
||
| 397 | . $moduleDirName |
||
| 398 | . '/assets/images/icons/16/edit.png" width="16px" height="16px" border="0" alt="' |
||
| 399 | . _MD_TDMDOWNLOADS_EDITTHISDL |
||
| 400 | . '"></a>'; |
||
| 401 | } |
||
| 402 | |||
| 403 | //permission de télécharger |
||
| 404 | |||
| 405 | $downloadPermission = true; |
||
| 406 | |||
| 407 | if (1 === $helper->getConfig('permission_download')) { |
||
| 408 | if (!in_array($downloadsArray[$i]->getVar('cid'), $categories)) { |
||
| 409 | $downloadPermission = false; |
||
| 410 | } |
||
| 411 | } else { |
||
| 412 | if (!in_array($downloadsArray[$i]->getVar('lid'), $item)) { |
||
| 413 | $downloadPermission = false; |
||
| 414 | } |
||
| 415 | } |
||
| 416 | |||
| 417 | // utilisation du sommaire |
||
| 418 | |||
| 419 | ++$cpt; |
||
| 420 | |||
| 421 | $summary = $cpt . '- <a href="#l' . $cpt . '">' . $downloadsArray[$i]->getVar('title') . '</a><br>'; |
||
| 422 | |||
| 423 | $xoopsTpl->append('summary', ['title' => $summary, 'count' => $cpt]); |
||
| 424 | |||
| 425 | $xoopsTpl->append( |
||
| 426 | 'file', |
||
| 427 | [ |
||
| 428 | 'id' => $downloadsArray[$i]->getVar('lid'), |
||
| 429 | 'cid' => $downloadsArray[$i]->getVar('cid'), |
||
| 430 | 'title' => $downloadsArray[$i]->getVar('title'), |
||
| 431 | 'rating' => number_format((float)$downloadsArray[$i]->getVar('rating'), 1), |
||
| 432 | 'hits' => $downloadsArray[$i]->getVar('hits'), |
||
| 433 | 'new' => $new, |
||
| 434 | 'pop' => $pop, |
||
| 435 | 'logourl' => $logourl, |
||
| 436 | 'updated' => $datetime, |
||
| 437 | 'description_short' => $descriptionShort, |
||
| 438 | 'adminlink' => $adminlink, |
||
| 439 | 'submitter' => $submitter, |
||
| 440 | 'perm_download' => $downloadPermission, |
||
| 441 | 'count' => $cpt, |
||
| 442 | ] |
||
| 443 | ); |
||
| 444 | |||
| 445 | //pour les mots clef |
||
| 446 | |||
| 447 | $keywords .= $downloadsArray[$i]->getVar('title') . ','; |
||
| 448 | } |
||
| 449 | |||
| 450 | if (0 == $numrows) { |
||
| 451 | $bl_affichage = 0; |
||
| 452 | } |
||
| 453 | |||
| 454 | $xoopsTpl->assign('bl_affichage', $bl_affichage); |
||
| 455 | |||
| 456 | // affichage du sommaire |
||
| 457 | |||
| 458 | if ($helper->getConfig('autosummary')) { |
||
| 459 | if (0 == $numrows) { |
||
| 460 | $xoopsTpl->assign('aff_summary', false); |
||
| 461 | } else { |
||
| 462 | $xoopsTpl->assign('aff_summary', true); |
||
| 463 | } |
||
| 464 | } else { |
||
| 465 | $xoopsTpl->assign('aff_summary', false); |
||
| 466 | } |
||
| 467 | |||
| 468 | // sort menu display |
||
| 469 | |||
| 470 | if ($numrows > 1) { |
||
| 471 | $xoopsTpl->assign('navigation', true); |
||
| 472 | |||
| 473 | $sortorder = $sort . $order; |
||
| 474 | |||
| 475 | if ('hitsASC' === $sortorder) { |
||
| 476 | $displaySort = _MD_TDMDOWNLOADS_CAT_POPULARITYLTOM; |
||
| 477 | } |
||
| 478 | |||
| 479 | if ('hitsDESC' === $sortorder) { |
||
| 480 | $displaySort = _MD_TDMDOWNLOADS_CAT_POPULARITYMTOL; |
||
| 481 | } |
||
| 482 | |||
| 483 | if ('titleASC' === $sortorder) { |
||
| 484 | $displaySort = _MD_TDMDOWNLOADS_CAT_TITLEATOZ; |
||
| 485 | } |
||
| 486 | |||
| 487 | if ('titleDESC' === $sortorder) { |
||
| 488 | $displaySort = _MD_TDMDOWNLOADS_CAT_TITLEZTOA; |
||
| 489 | } |
||
| 490 | |||
| 491 | if ('dateASC' === $sortorder) { |
||
| 492 | $displaySort = _MD_TDMDOWNLOADS_CAT_DATEOLD; |
||
| 493 | } |
||
| 494 | |||
| 495 | if ('dateDESC' === $sortorder) { |
||
| 496 | $displaySort = _MD_TDMDOWNLOADS_CAT_DATENEW; |
||
| 497 | } |
||
| 498 | |||
| 499 | if ('ratingASC' === $sortorder) { |
||
| 500 | $displaySort = _MD_TDMDOWNLOADS_CAT_RATINGLTOH; |
||
| 501 | } |
||
| 502 | |||
| 503 | if ('ratingDESC' === $sortorder) { |
||
| 504 | $displaySort = _MD_TDMDOWNLOADS_CAT_RATINGHTOL; |
||
| 505 | } |
||
| 506 | |||
| 507 | $xoopsTpl->assign('affichage_tri', sprintf(_MD_TDMDOWNLOADS_CAT_CURSORTBY, $displaySort)); |
||
| 508 | } |
||
| 509 | } |
||
| 510 | |||
| 511 | // référencement |
||
| 512 | // titre de la page |
||
| 513 | $pagetitle = $utility->getPathTreeUrl($mytree, $cid, $downloadscatArray, 'cat_title', $prefix = ' - ', false, 'DESC'); |
||
| 514 | $xoopsTpl->assign('xoops_pagetitle', $pagetitle); |
||
| 515 | //description |
||
| 516 | $xoTheme->addMeta('meta', 'description', strip_tags($downloadscatArray[$cid]->getVar('cat_description_main'))); |
||
| 517 | //keywords |
||
| 518 | $keywords = mb_substr($keywords, 0, -1); |
||
| 519 | $xoTheme->addMeta('meta', 'keywords', $keywords); |
||
| 520 | |||
| 521 | $GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
||
| 522 | |||
| 523 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
| 524 |