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


PHP Dataset::getExtLinkList方法代码示例

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


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

示例1: searchByKey

 public function searchByKey($keyword, $page = 1)
 {
     if (!$_GET['keyword']) {
         Yii::app()->user->setFlash('keyword', 'Keyword can not be blank');
         $this->redirect(array("/site/index"));
     }
     $limit = 10;
     $keyword = $_GET['keyword'];
     $model = new SearchForm();
     $criteria = array();
     $criteria['keyword'] = strtolower($keyword);
     $model->keyword = $keyword;
     $params = array('type', 'dataset_type', 'author_id', 'project', 'file_type', 'file_format', 'pubdate_from', 'pubdate_to', 'common_name', 'size_from', 'size_to', 'exclude', 'external_link_type', 'size_from_unit', 'size_to_unit');
     $dates = array('pubdate_from', 'pubdate_to');
     foreach ($_GET as $key => $value) {
         if (in_array($key, $params) && $value) {
             $model->{$key} = $value;
             if ($key == "pubdate_from" || $key == "pubdate_to") {
                 $model->{$key} = strftime("%Y-%m-%d", strtotime($value));
             }
         }
     }
     $criteria['filetypes'] = $model->file_type;
     $criteria['formats'] = $model->file_format;
     $criteria['size'] = array('min' => 0, 'max' => 0);
     if ($model->size_from) {
         $criteria['size']['min'] = $this->convert_size($model->size_from, $model->size_from_unit);
     }
     if ($model->size_to) {
         $criteria['size']['max'] = $this->convert_size($model->size_to, $model->size_to_unit);
     }
     $criteria['types'] = $model->dataset_type;
     $criteria['pubs'] = array('start' => $model->pubdate_from, 'end' => $model->pubdate_to);
     $criteria['links'] = $model->external_link_type;
     $criteria['projects'] = $model->project;
     $criteria['names'] = $model->common_name;
     $criteria['author_id'] = $model->author_id;
     $display = array('dataset', 'sample', 'file');
     if ($model->type) {
         $display = $model->type;
     }
     $criteria['display'] = $display;
     $model->criteria = CJSON::encode($model->attributes, true);
     $result = $this->search($criteria);
     $model->query_result = CJSON::encode($result);
     //Yii::log(print_r($result, true), 'debug');
     $total_page = ceil(count($result['datasets']) / $limit);
     $list_dataset_types = Dataset::getTypeList($result['datasets']);
     $list_projects = Dataset::getProjectList($result['datasets']);
     $list_ext_types = Dataset::getExtLinkList($result['datasets']);
     $list_common_names = Sample::getCommonList($result['samples']);
     $list_formats = File::getFormatList($result['files']);
     $list_filetypes = File::getTypeList($result['files']);
     return array('datasets' => array('data' => $result['datasets'], 'total' => count($result['datasets'])), 'samples' => array('data' => $result['samples'], 'total' => count($result['samples'])), 'files' => array('data' => $result['files'], 'total' => count($result['files'])), 'model' => $model, 'list_dataset_types' => $list_dataset_types, 'list_projects' => $list_projects, 'list_ext_types' => $list_ext_types, 'list_common_names' => $list_common_names, 'list_formats' => $list_formats, 'list_filetypes' => $list_filetypes, 'display' => $display, 'total_page' => $total_page, 'page' => 1, 'limit' => 10);
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:55,代码来源:DatabaseSearch.php


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