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


PHP PaginatedList::count方法代码示例

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


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

示例1: buildSearchResultProducts

 /**
  * Builds the DataObject of filtered products
  *
  * @return DataList
  * 
  * @author Sebastian Diel <sdiel@πixeltricks.de>
  * @since 23.09.2014
  */
 public function buildSearchResultProducts()
 {
     $searchResultProducts = $this->searchResultProducts;
     $productsPerPage = $this->getProductsPerPageSetting();
     $SQL_start = $this->getSqlOffset();
     $searchQuery = $this->getSearchQuery();
     $searchTerms = explode(' ', $searchQuery);
     $filter = '';
     $useExtensionResults = $this->extend('updateSearchResult', $searchResultProducts, $searchQuery, $SQL_start);
     if (empty($useExtensionResults)) {
         $this->listFilters['original'] = sprintf('
            "SilvercartProduct"."SilvercartProductGroupID" IS NOT NULL AND
            "SilvercartProduct"."SilvercartProductGroupID" > 0 AND
            "SPGPL"."ID" > 0 AND
            "SilvercartProduct"."isActive" = 1 AND (
                 (
                     "SilvercartProductLanguage"."Title" LIKE \'%s%%\' OR
                     "SilvercartProductLanguage"."ShortDescription" LIKE \'%s%%\' OR
                     "SilvercartProductLanguage"."LongDescription" LIKE \'%s%%\' OR
                     "SilvercartProductLanguage"."Title" LIKE \'%%%s%%\' OR
                     "SilvercartProductLanguage"."ShortDescription" LIKE \'%%%s%%\' OR
                     "SilvercartProductLanguage"."LongDescription" LIKE \'%%%s%%\'
                 ) OR
                "SilvercartProductLanguage"."MetaKeywords" LIKE \'%%%s%%\' OR
                "SilvercartProduct"."ProductNumberShop" LIKE \'%%%s%%\' OR
                "SilvercartProduct"."EANCode" LIKE \'%%%s%%\' OR
                 STRCMP(
                     SOUNDEX("SilvercartProductLanguage"."Title"), SOUNDEX(\'%s\')
                 ) = 0
             )
             ', $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery);
         if (count(self::$registeredFilterPlugins) > 0) {
             foreach (self::$registeredFilterPlugins as $registeredPlugin) {
                 $pluginFilters = $registeredPlugin->filter();
                 if (is_array($pluginFilters)) {
                     $this->listFilters = array_merge($this->listFilters, $pluginFilters);
                 }
             }
         }
         $this->extend('updateListFilters', $this->listFilters, $searchTerms);
         foreach ($this->listFilters as $listFilter) {
             if (empty($filter)) {
                 $filter = $listFilter;
             } else {
                 if (strpos(trim($listFilter), 'AND') !== 0 && strpos(trim($listFilter), 'OR') !== 0) {
                     $listFilter = 'AND ' . $listFilter;
                 }
                 $filter = '(' . $filter . ') ' . $listFilter;
             }
         }
         if (SilvercartProduct::defaultSort() == 'relevance') {
             $sort = '';
         } else {
             $sort = SilvercartProduct::defaultSort();
         }
         $searchResultProductsRaw = SilvercartProduct::getProducts($filter, $sort, array(array('table' => 'SilvercartProductGroupPage_Live', 'on' => '"SPGPL"."ID" = "SilvercartProduct"."SilvercartProductGroupID"', 'alias' => 'SPGPL')));
         $searchResultProducts = new PaginatedList($searchResultProductsRaw, $this->getRequest());
         $searchResultProducts->setPageStart($SQL_start);
         $searchResultProducts->setPageLength($productsPerPage);
     }
     $this->searchResultProducts = $searchResultProducts;
     $this->totalNumberOfProducts = $searchResultProducts->count();
     $searchQueryObject = SilvercartSearchQuery::get_by_query(Convert::raw2sql($searchQuery));
     if ($searchQueryObject->Hits != $this->totalNumberOfProducts) {
         $searchQueryObject->Hits = $this->totalNumberOfProducts;
         $searchQueryObject->write();
     }
     return $this->searchResultProducts;
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:77,代码来源:SilvercartSearchResultsPage.php

示例2: DataObjectsToBeUpdated

 public function DataObjectsToBeUpdated()
 {
     if (!self::$objects) {
         $table = $this->SecureTableToBeUpdated();
         $field = $this->SecureFieldToBeUpdated();
         $where = '';
         if (isset($this->requestParams["where"]) && $this->requestParams["where"]) {
             $where = urldecode($this->requestParams["where"]);
         }
         $sort = '';
         if (isset($this->requestParams["sort"]) && $this->requestParams["sort"]) {
             $sort = urldecode($this->requestParams["sort"]);
         }
         $titleField = 'Title';
         if (isset($this->requestParams["titlefield"]) && $this->requestParams["titlefield"]) {
             $titleField = urldecode($this->requestParams["titlefield"]);
         }
         $start = 0;
         if (isset($this->requestParams["start"])) {
             $start = intval($this->requestParams["start"]);
         }
         if (isset($_GET["debug"])) {
             print_r("SELECT * FROM {$table} {$where} SORT BY {$sort} LIMIT {$start}, " . Config::inst()->get("DataObjectOneFieldUpdateController", "page_size"));
         }
         $dataList = $table::get()->where($where)->sort($sort);
         $objects = new PaginatedList($dataList, $this->request);
         $objects->setPageLength(Config::inst()->get("DataObjectOneFieldUpdateController", "page_size"));
         $arrayList = new ArrayList();
         if ($objects->count()) {
             $testObject = $objects->first();
             if (!$testObject->canEdit()) {
                 Security::permissionFailure($this, _t('Security.PERMFAILURE', ' This page is secured and you need administrator rights to access it. Enter your credentials below and we will send you right along.'));
                 return;
             }
             foreach ($objects as $obj) {
                 $obj->FormField = $obj->dbObject($field)->scaffoldFormField();
                 $obj->FormField->setName($obj->ClassName . "/" . $obj->ID);
                 //3.0TODO Check that I work vvv.
                 $obj->FormField->addExtraClass("updateField");
                 $obj->FieldToBeUpdatedValue = $obj->{$field};
                 $obj->FormField->setValue($obj->{$field});
                 $arrayList->push(new ArrayData(array("FormField" => $obj->FormField, "MyTitle" => $obj->{$titleField}())));
             }
         }
         self::$objects = $arrayList;
         self::$objects_without_field = $objects;
     }
     return self::$objects;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-dataobjectsorter,代码行数:49,代码来源:DataObjectOneFieldUpdateController.php


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