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


PHP FileList::filterByDateAdded方法代码示例

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


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

示例1: getRequestedSearchResults

 public function getRequestedSearchResults()
 {
     $fileList = new FileList();
     $fileList->enableStickySearchRequest();
     Loader::model('file_set');
     if ($_REQUEST['submit_search']) {
         $fileList->resetSearchRequest();
     }
     $req = $fileList->getSearchRequest();
     // first thing, we check to see if a saved search is being used
     if (isset($_REQUEST['fssID'])) {
         $fs = FileSet::getByID($_REQUEST['fssID']);
         if ($fs->getFileSetType() == FileSet::TYPE_SAVED_SEARCH) {
             $req = $fs->getSavedSearchRequest();
             $columns = $fs->getSavedSearchColumns();
             $colsort = $columns->getDefaultSortColumn();
             $fileList->addToSearchRequest('ccm_order_dir', $colsort->getColumnDefaultSortDirection());
             $fileList->addToSearchRequest('ccm_order_by', $colsort->getColumnKey());
         }
     }
     if (!isset($columns)) {
         $columns = FileManagerColumnSet::getCurrent();
     }
     $this->set('searchRequest', $req);
     $this->set('columns', $columns);
     $col = $columns->getDefaultSortColumn();
     $fileList->sortBy($col->getColumnKey(), $col->getColumnDefaultSortDirection());
     $keywords = htmlentities($req['fKeywords'], ENT_QUOTES, APP_CHARSET);
     if ($keywords != '') {
         $fileList->filterByKeywords($keywords);
     }
     if ($req['numResults']) {
         $fileList->setItemsPerPage($req['numResults']);
     }
     if (isset($req['fsIDNone']) && $req['fsIDNone'] == 1 || is_array($req['fsID']) && in_array(-1, $req['fsID'])) {
         $fileList->filterBySet(false);
     } else {
         if (is_array($req['fsID'])) {
             foreach ($req['fsID'] as $fsID) {
                 $fs = FileSet::getByID($fsID);
                 $fileList->filterBySet($fs);
             }
         } else {
             if (isset($req['fsID']) && $req['fsID'] != '' && $req['fsID'] > 0) {
                 $set = $req['fsID'];
                 $fs = FileSet::getByID($set);
                 $fileList->filterBySet($fs);
             }
         }
     }
     if (isset($_GET['fType']) && $_GET['fType'] != '') {
         $type = $_GET['fType'];
         $fileList->filterByType($type);
     }
     if (isset($_GET['fExtension']) && $_GET['fExtension'] != '') {
         $ext = $_GET['fExtension'];
         $fileList->filterByExtension($ext);
     }
     $selectedSets = array();
     if (is_array($req['selectedSearchField'])) {
         foreach ($req['selectedSearchField'] as $i => $item) {
             // due to the way the form is setup, index will always be one more than the arrays
             if ($item != '') {
                 switch ($item) {
                     case "extension":
                         $extension = $req['extension'];
                         $fileList->filterByExtension($extension);
                         break;
                     case "type":
                         $type = $req['type'];
                         $fileList->filterByType($type);
                         break;
                     case "date_added":
                         $dateFrom = $req['date_from'];
                         $dateTo = $req['date_to'];
                         if ($dateFrom != '') {
                             $dateFrom = date('Y-m-d', strtotime($dateFrom));
                             $fileList->filterByDateAdded($dateFrom, '>=');
                             $dateFrom .= ' 00:00:00';
                         }
                         if ($dateTo != '') {
                             $dateTo = date('Y-m-d', strtotime($dateTo));
                             $dateTo .= ' 23:59:59';
                             $fileList->filterByDateAdded($dateTo, '<=');
                         }
                         break;
                     case 'added_to':
                         $ocID = $req['ocIDSearchField'];
                         if ($ocID > 0) {
                             $fileList->filterByOriginalPageID($ocID);
                         }
                         break;
                     case "size":
                         $from = $req['size_from'];
                         $to = $req['size_to'];
                         $fileList->filterBySize($from, $to);
                         break;
                     default:
                         Loader::model('file_attributes');
                         $akID = $item;
//.........这里部分代码省略.........
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:101,代码来源:search.php


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