当前位置: 首页>>代码示例>>PHP>>正文


PHP Criteria::addOrder方法代码示例

本文整理汇总了PHP中Criteria::addOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addOrder方法的具体用法?PHP Criteria::addOrder怎么用?PHP Criteria::addOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Criteria的用法示例。


在下文中一共展示了Criteria::addOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getItemPhotos

 function getItemPhotos($itemId)
 {
     $c = new Criteria();
     $c->add("itemId", $itemId);
     $c->addOrder("photoId");
     return $this->findAll($c, "photoId, src, altText");
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:7,代码来源:PhotoModel.php

示例2: getTagCloud

 public function getTagCloud()
 {
     $c = new Criteria();
     $c->addOrder("searchTimes DESC");
     $c->add("banned", "0");
     $c->setLimit(Config::get("numberOfTagInTagCloud"));
     $tags = $this->findAll($c);
     if (count($tags) < min(Config::get("numberOfTagInTagCloud"), Config::get("minNumberOfTagInTagCloud"))) {
         return array();
     }
     usort($tags, array($this, "sortTag"));
     $maxSearchTimes = 0;
     $minSearchTimes = pow(2, 32);
     $minSize = 1;
     $maxSize = 10;
     foreach ($tags as $tag) {
         $maxSearchTimes = max($maxSearchTimes, $tag['searchTimes']);
     }
     foreach ($tags as $tag) {
         $minSearchTimes = min($minSearchTimes, $tag['searchTimes']);
     }
     $range = $maxSearchTimes - $minSearchTimes;
     if ($range == 0) {
         $range = 1;
     }
     $step = ($maxSize - $minSize) / $range;
     foreach ($tags as &$tag) {
         $tag['size'] = intval($minSize + ($tag['searchTimes'] - $minSearchTimes) * $step);
     }
     return $tags;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:31,代码来源:SearchTagModel.php

示例3: searchValidated

 function searchValidated($values, $page = false)
 {
     $c = new Criteria();
     $c->add("status", "validated");
     $c->add($this->getForbiddenRule());
     $c->addOrder("sites.priority DESC");
     $this->addDefaultSortingOrder($c);
     if (!empty($values['phrase']) || !empty($values['where'])) {
         $phrase = !empty($values['phrase']) ? $values['phrase'] : false;
         $where = !empty($values['where']) ? $values['where'] : false;
         $c->add($this->createSearchCriteria($phrase, $where));
     }
     if (empty($values['categoryId'])) {
         $values['categoryId'] = 0;
     }
     if (isset($values['categoryId'])) {
         $c->addInnerJoin("categoryparents", "categoryparents.childId", "sites.categoryId");
         $c->add("categoryparents.parentId", $values['categoryId']);
         if (!empty($values['extraField'])) {
             $c2 = $this->extraField->createExtraFieldsCriteria($values['categoryId'], $values['extraField']);
             $c->add($c2);
         }
     }
     if ($page !== false) {
         $c->setPagination($page, Config::get("sitesPerPageInSearch"));
     }
     $c->setCalcFoundRows(true);
     $items = $this->selectWithNewFlag($c);
     return $items;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:30,代码来源:SiteSearcherModel.php

示例4: indexAction

 /**
  * 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);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:50,代码来源:CategoryController.php

示例5: getCategoriesForSelect

 function getCategoriesForSelect()
 {
     $c = new Criteria();
     $c->addOrder("parentId");
     $c->addInnerJoin("categories", "categories.categoryId", "categoryparents.childId");
     $c->add("depth", 1);
     return $this->findAll($c, "categoryparents.childId as categoryId, categoryparents.parentId, name, possibleTender", true);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:8,代码来源:CategoryParentModel.php

示例6: getSiteValidatedComments

 function getSiteValidatedComments($siteId)
 {
     $c = new Criteria();
     $c->add("siteId", $siteId);
     $c->add("validated", "1");
     $c->addOrder("commentId DESC");
     return $this->comment->findAll($c);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:8,代码来源:CommentModel.php

示例7: getOptions

 function getOptions($fieldId)
 {
     $c = new Criteria();
     $c->add("fieldId", $fieldId);
     $c->addOrder("position");
     $options = $this->extraFieldOption->findAll($c);
     return $options;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:8,代码来源:ExtraFieldModel.php

示例8: indexAction

 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));
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:12,代码来源:TagController.php

示例9: getChilds

 function getChilds($categoryId, $recursive = false, $c = null, $fields = "*")
 {
     if ($c === null) {
         $c = new Criteria();
         $c->addOrder("name");
     } else {
         $c = clone $c;
     }
     if ($recursive) {
         $c->addInnerJoin("categories", "categories.categoryId", "categoryparents.childId");
         return $this->categoryParent->getChilds($categoryId, true, $c, $fields);
     } else {
         $c->add("parentCategoryId", $categoryId);
         return $this->findAll($c, $fields);
     }
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:16,代码来源:CategoryModel.php

示例10: displayCategoriesAction

 /**
  * Display left menu categories
  */
 function displayCategoriesAction()
 {
     //get category to display set in /site/category
     $parentId = Display::get("currentCategoryId", 0);
     $cacheItemName = "categoryMenuHtml" . $parentId . Config::get("language") . "Template" . Config::get("templateName");
     //check is this menu was cached before
     $cache = Cacher::getInstance();
     if (($categoriesHtml = $cache->load($cacheItemName, false)) === null) {
         $c = new Criteria();
         $c->addOrder('position, name');
         $categories = $this->category->getChilds($parentId, false, $c);
         $this->set("categories", $categories);
         $this->viewFile = "menuleft/categories";
         $categoriesHtml = $this->render();
         $cache->save($categoriesHtml, $cacheItemName, false, array("category"));
     }
     return $categoriesHtml;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:21,代码来源:MenuController.php

示例11: getSitesThatOwnAKeyword

 function getSitesThatOwnAKeyword($keywordId, $page = false)
 {
     $c = new Criteria();
     $c->add("status", "validated");
     $c->addInnerJoin("keywordsofsites", "keywordsofsites.siteId", "sites.siteId");
     $c->add("keywordsofsites.keywordId", $keywordId);
     $c->addOrder("priority DESC");
     $this->addDefaultSortingOrder($c);
     if ($page !== false) {
         $this->addPageCriteria($c, $page, Config::get("sitesPerPageInKeywords"));
     }
     return $this->selectWithNewFlag($c);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:13,代码来源:SiteListModel.php

示例12: getChilds

 public function getChilds($parentId, $recursive = false, Criteria $c = null, $fields = null)
 {
     if (empty($c)) {
         $c = new Criteria();
     }
     if (empty($fields)) {
         $fields = "childId";
         if ($recursive) {
             $fields .= ", depth";
         }
     }
     $c->add("parentId", $parentId);
     if (!$recursive) {
         $c->add("depth", 1);
     } else {
         $c->addOrder("depth");
     }
     return $this->findAll($c, $fields);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:19,代码来源:ParentModel.php

示例13: indexAction

 /**
  * Display all criterions - managment page
  */
 function indexAction()
 {
     $c = new Criteria();
     $c->addOrder("name");
     $this->set("adCriterias", $this->adCriteria->findAll($c));
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:9,代码来源:AdController.php

示例14: explode

    $pers_tipo = $personal->pers_tipo;
    $per_ID = $persona->per_ID;
    $bloques_horario = $class_horario->generarBloques();
    $smarty->assign("bloques_horario", $bloques_horario);
    $horario->FK_personal_pers_ID = $personal->pers_ID;
    $horario->hrs_anio = $_SESSION['base_datos']->anio;
    $criteria->find($horario);
    $valores_horario['lunes'] = explode(";", $horario->hrs_lunes);
    $valores_horario['martes'] = explode(";", $horario->hrs_martes);
    $valores_horario['miercoles'] = explode(";", $horario->hrs_miercoles);
    $valores_horario['jueves'] = explode(";", $horario->hrs_jueves);
    $valores_horario['viernes'] = explode(";", $horario->hrs_viernes);
    $valores_horario['sabado'] = explode(";", $horario->hrs_sabado);
    $smarty->assign("valores_horario", $valores_horario);
    $criteria->createCriteria($observacion);
    $criteria->addOrder(Order::desc("obs_ID"));
    $criteria->add(Restrictions::eq("FK_persona_per_ID", $persona->per_ID));
    $criteria->add(Restrictions::eq("obs_anio", $_SESSION['base_datos']->anio));
    $listObservaciones = $criteria->lista();
    $smarty->assign("listObservaciones", $listObservaciones);
}
if (isset($_GET['exito']) && !isset($_POST['guardar'])) {
    if ($_GET['exito'] == "exito") {
        $smarty->assign("exito", "La información se ha guardado exitosamente");
    }
}
if (isset($_POST['guardar']) && postForm($_POST['postID'])) {
    if ($_POST['guardar'] == "Enviar Foto") {
        if ($persona->per_ID) {
            subirFotoAlumno($per_ID);
        }
开发者ID:ranmadxs,项目名称:dorcl,代码行数:31,代码来源:PER-mantenedor.php

示例15: manageAction

 /**
  * Managment panel list of all sites which can be managed
  */
 function manageAction()
 {
     $c = new Criteria();
     $c->add("webmasterId", $this->userId);
     $c->add("sites.status", "banned", "<>");
     $c->addOrder("sites.status");
     $c->addOrder("siteTitle");
     $c->addLeftJoin("packages", "packages.packageId", "sites.packageId");
     $sites = $this->site->findAll($c, "sites.*, packages.name as packageName");
     $this->site->attachParents($sites);
     $this->set("sites", $sites);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:15,代码来源:WebmasterController.php


注:本文中的Criteria::addOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。