コード例 #1
0
 public function search($search_text, $page = 1)
 {
     global $OUTPUT;
     $ret = array();
     $list = array();
     $ret['nologin'] = true;
     if (empty($page)) {
         $page = 1;
     }
     // Pagination not working
     //$searchlist = WebService::standardSearch($this->repositoryClient,'2','2',$search_text,1+($page-1)*repository_hive::$resultsPerPage,repository_hive::$resultsPerPage);
     $searchlist = WebService::standardSearch($this->id, $search_text, -1, -1);
     $searchArray = $searchlist['searchResults']['list'];
     foreach ($searchArray as $value) {
         $list[] = array('shorttitle' => $value['title'], 'title' => $value['filename'], 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($value['filename'], 32))->out(false), 'source' => $value['bureauId'] . '|' . $value['aliasId'] . '|' . urlencode($value['filename']));
     }
     // Pagination
     // NOT WORKING
     //$ret['pages'] = ceil($searchlist['totalNumberOfResults']/repository_hive::$resultsPerPage);
     $ret['list'] = $list;
     return $ret;
 }