예제 #1
0
파일: search.php 프로젝트: gudwin/extasy
 /**
  *   -------------------------------------------------------------------------------------------
  *   Принимает вызов, возвращает результаты поиск
  *   @return
  *   -------------------------------------------------------------------------------------------
  */
 public function search($keyword, $start, $limit, $callback)
 {
     try {
         $aResult = Sitemap_Sample::search($keyword, $start, $limit);
         $nTotal = Sitemap_Sample::getTotalCount();
         $this->aOutput['totalcount'] = $nTotal;
         $this->aOutput['item'] = array();
         foreach ($aResult as $row) {
             $this->aOutput['item'][] = array('id' => $row['id'], 'name' => $row['name'], 'full_url' => $row['full_url'], 'date_updated' => $row['unixtimestamp']);
         }
     } catch (Exception $e) {
         $this->aOutput['error'] = 'Ошибка поиска, слишком короткая фраза';
     }
     $this->outputJSONP($callback);
 }
예제 #2
0
파일: Search.php 프로젝트: gudwin/extasy
 protected function searchSitemap()
 {
     try {
         ACLUser::checkCurrentUserGrants([SitemapModel::PermissionName]);
         $items = \Sitemap_Sample::search($this->searchPhrase, 0, 10);
     } catch (\Exception $e) {
         $items = [];
     }
     foreach ($items as $row) {
         $isScript = !empty($row['script_admin_url']);
         $add = new SearchResultModel();
         $add->title = $row['name'];
         $add->icon = 'glyphicon glyphicon-user';
         //
         if (!$isScript) {
             $route = CMS::getInstance()->getDispatcher()->getNamed('dashboard.sitemap.manage');
             $add->link = $route->buildUrl() . '?id=' . $row['id'];
         } else {
             $add->link = sprintf('http://%s%s', CMS::getDashboardWWWRoot(), $row['script_admin_url']);
         }
         $this->results[] = $add;
     }
 }