/** * Charge les modèles par catégorie * * @param string $catName nom de la catégorie * @param array $where1 [optional] * @param string $order [optional] * @param boolean $horsCat [optional] * * @return array */ static function loadModeleByCat($catName, $where1 = null, $order = "nom", $horsCat = null) { $ds = CSQLDataSource::get("std"); $where = array(); if (is_array($catName)) { $where = array_merge($where, $catName); } elseif (is_string($catName)) { $where["nom"] = $ds->prepare("= %", $catName); } $category = new CFilesCategory(); $resultCategory = $category->loadList($where); $documents = array(); if (count($resultCategory) || $horsCat) { $where = array(); if ($horsCat) { $resultCategory[0] = ""; $where[] = "file_category_id IS NULL OR file_category_id " . CSQLDataSource::prepareIn(array_keys($resultCategory)); } else { $where["file_category_id"] = CSQLDataSource::prepareIn(array_keys($resultCategory)); } $where["object_id"] = " IS NULL"; if ($where1) { if (is_array($where1)) { $where = array_merge($where, $where1); } elseif (is_string($where1)) { $where[] = $where1; } } $resultDoc = new CCompteRendu(); $documents = $resultDoc->loadList($where, $order); } return $documents; }
$page = intval(CValue::get('page', 0)); $filter = CValue::getOrSession("filter", ""); $eligible_file_view = CValue::getOrSession("eligible_file_view"); $class = CValue::getOrSession("class"); $step = 25; $order = "class, nom"; $where = array(); if ($eligible_file_view == "1") { $where["eligible_file_view"] = "= '1'"; } if ($eligible_file_view == "0") { $where["eligible_file_view"] = "= '0'"; } if ($class) { $where["class"] = "= '{$class}'"; } $category = new CFilesCategory(); if ($filter) { $categories = $category->seek($filter, $where, "{$page}, {$step}", true, null, $order); $total_categories = $category->_totalSeek; } else { $categories = $category->loadList($where, $order, "{$page}, {$step}"); $total_categories = $category->countList($where); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("categories", $categories); $smarty->assign("total_categories", $total_categories); $smarty->assign("page", $page); $smarty->assign("step", $step); $smarty->display("inc_list_categories.tpl");