function indexAction($page = 1) { $perPage = 25; $c = new Criteria(); $c->addOrder("searchTimes DESC"); $c->setPagination($page, $perPage); $tags = $this->searchTag->findAll($c); $this->set("tags", $tags); //prepare pagination data $totalPages = ceil($this->searchTag->getCount() / $perPage); $this->set("pageNavigation", array("baseLink" => "/admin/tag/index/", "totalPages" => $totalPages, "currentPage" => $page)); }
/** * Display category data (subcategories, sites inside, forms to add site in this category or set ads) */ function indexAction($parentCategoryId = 0, $page = 1) { //if isn't root category = 0 if ($parentCategoryId) { $perPage = 50; //get category data $currentCategory = $this->category->findByPk($parentCategoryId); //if this category doesn't exists' if (!$currentCategory) { return $this->return404(); } //set category data $this->set("currentCategory", $currentCategory); //get validated sites inside this category $c = new Criteria(); $c->setPagination($page, $perPage); $this->set("sites", $this->siteList->getSitesInCategory($parentCategoryId, $c)); //prepare pagination data $c = new Criteria(); $c->add("categoryId", $parentCategoryId); $c->add("status", "validated"); $totalPages = ceil($this->site->getCount($c) / $perPage); $this->set("pageNavigation", array("baseLink" => "/admin/category/index/{$parentCategoryId}/", "totalPages" => $totalPages, "currentPage" => $page)); $c = new Criteria(); $c->add("role", "webmaster"); $this->set("webmasters", $this->user->getArray($c, "email")); $this->set("tempId", md5(rand())); } //set this category id $this->set("parentCategoryId", $parentCategoryId); //get category parents path $this->set("categoryParentsData", $this->category->getParents($parentCategoryId)); //get select menu for categories $this->set("categoriesSelect", $this->category->createOptionsList()); //set data for site form $this->set("allKeywordsList", $this->keyword->generateSortedList()); $this->set("yesNoOptions", array("0" => _t("No"), "1" => _t("Yes"))); $this->set("priorites", range(0, 10)); $this->set("adCriterias", $this->adCriteria->getSelectList()); //get subcategories in this category $c = new Criteria(); $c->addOrder("position"); $c->addOrder("name"); $this->set("categories", $this->category->getChilds($parentCategoryId, false, $c)); require CODE_ROOT_DIR . "config/flags.php"; $this->set("countryFlags", $countryFlags); }
function bannedAction($page = 1) { $itemsPerPage = 20; $c = new Criteria(); $c->add('status', 'banned'); $c->setPagination($page, $itemsPerPage); $c->setCalcFoundRows(true); $this->set('sites', $this->site->findAll($c)); $totalPages = ceil($this->site->getFoundRowsCount() / $itemsPerPage); $this->set('pageNavigation', array('baseLink' => '/admin/site/banned/', 'totalPages' => $totalPages, 'currentPage' => $page)); }