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


PHP ServiceUtil::getTerm方法代码示例

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


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

示例1: view

 public function view($page)
 {
     require_once 'ServiceUtil.php';
     require_once 'Config.php';
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     $pageName = $page;
     $pageName = str_replace(str_split('_'), '%20', $pageName);
     $pageName = str_replace(str_split(','), '%2c', $pageName);
     $util = new ServiceUtil();
     $termObj = $util->getTerm($pageName);
     //var_dump($termObj);
     if (!is_null($termObj) && count($termObj) > 0) {
         $data['termObj'] = $termObj;
         $page_title = $pageName = str_replace(str_split('_,'), ' ', $pageName);
         $data['page_title'] = "Term:" . $page_title;
         $data['enable_config'] = false;
         $this->load->view('templates/header2', $data);
         $this->load->view('pages/DisplayTermLanding', $data);
         $this->load->view('templates/footer2', $data);
     } else {
         show_404();
     }
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:24,代码来源:Term.php

示例2: doSearch

 private function doSearch($keywords)
 {
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
     //$protocol = "http";
     $domainName = $_SERVER['HTTP_HOST'];
     require_once 'ServiceUtil.php';
     require_once 'Config.php';
     $this->load->helper('url');
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     $util = new ServiceUtil();
     $keywords = str_replace(" ", "%20", $keywords);
     /*$sources = $this->loadSourcesConfig($data);
       if($sources != null)
       {
           $data['ks_sources'] = $sources;
           
       }*/
     //Loading categories configurations
     /*$categories = $this->loadCategoriesConfig($data);
       if($categories != null)
       {
           $data['categories'] = $categories;
       }*/
     $termResult = $util->getTerm($keywords);
     //var_dump($termResult);
     $termSize = 0;
     if (!is_null($termResult)) {
         $termSize = count($termResult);
     }
     //echo "------Term size:".$termSize."<br/>\n";
     if ($termSize == 1) {
         //echo "------Curie:".$termResult[0]->curie."<br/>\n";
         if (isset($termResult[0]->curie)) {
             //echo "<br/><center>Redirecting to ".$termResult[0]->curie." ...</center>";
             //redirect($protocol."://".$domainName."/".Config::$localContextName."/index.php/pages/view/".$termResult[0]->curie, 'refresh');
             redirect($protocol . $domainName . "/" . Config::$localContextName . "/index.php/pages/view/" . $termResult[0]->curie, 'location', 301);
         }
         return;
     }
     $searchResult = $util->searchTerm($keywords);
     $data['keywords'] = $keywords;
     $data['termResult'] = $termResult;
     if (!is_null($termResult)) {
         $searchResult = array_merge($termResult, $searchResult);
         $unique = array();
         $uniqueArray = array();
         foreach ($searchResult as $row) {
             if (isset($unique[$row->curie])) {
                 continue;
             } else {
                 $unique[$row->curie] = $row->curie;
                 array_push($uniqueArray, $row);
             }
         }
         $searchResult = $uniqueArray;
     }
     $data['searchResult'] = $searchResult;
     $data['page_title'] = "Search";
     $data['enable_config'] = false;
     $data['disableTopSearchBar'] = true;
     //var_dump($termResult);
     $this->load->view('templates/header2', $data);
     //$this->load->view('pages/'.$page, $data);
     $this->load->view('pages/search_result', $data);
     $this->load->view('templates/footer2', $data);
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:67,代码来源:Search.php

示例3: view

 public function view($page = 'home')
 {
     //require  'Globals.php';
     //$enableCaching = false;
     //require_once 'CacheConfig.php';
     //require_once  'JsonClientUtil.php';
     //require_once 'Config.php';
     $this->load->helper('url');
     require_once 'ServiceUtil.php';
     $util = new ServiceUtil();
     require_once 'Config.php';
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     //$this->loadJsonConfig($data);
     //init();
     /*if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
      	{
              	// Whoops, we don't have a page for that!
              	show_404();
      	}*/
     $pageName = NULL;
     $termObj = NULL;
     $pageName = $page;
     $pos = strpos($pageName, ":");
     //echo "----pos:".$pos;
     if ($pos == false) {
         $pageName = str_replace("_", "%20", $page);
         $pageName = str_replace(",", "%2c", $pageName);
         $data["page"] = $page;
     }
     $isNifID = false;
     $originalPageName = "";
     //Loading sources configurations
     /*$sources = $this->loadSourcesConfig($data);
       if($sources != null)
       {
           $data['ks_sources'] = $sources;
           
       }*/
     //Loading categories configurations
     /*$categories = $this->loadCategoriesConfig($data);
       if($categories != null)
       {
           $data['categories'] = $categories;
       }*/
     if ($pos != false) {
         $termObj[0] = $util->getObjByCurie($pageName);
         #echo "\n-------Willy----!is_null(termObj):".!is_null($termObj)."\n";
         if (!is_null($termObj) && !is_null($termObj[0])) {
             $data['curie'] = $termObj[0]->curie;
             if (count($termObj[0]->labels) > 0) {
                 $data['pageName'] = $termObj[0]->labels[0];
                 $pageName = $data['pageName'];
                 //echo "PageName here-----".$pageName;
                 $originalPageName = $pageName;
                 $pageName = str_replace(" ", "%20", $pageName);
                 // echo "<br/>PageName here-----".$pageName;
                 $pageName = str_replace(",", "%2c", $pageName);
                 // echo "<br/>PageName here-----".$pageName;
                 $data['pageName'] = $pageName;
                 $isNifID = true;
             } else {
                 $data['pageName'] = $pageName;
             }
         } else {
             $data['pageName'] = $pageName;
             $termObj = getTerm($pageName);
         }
     } else {
         $data['pageName'] = $pageName;
         //echo "-----pageName:".$pageName;
         $termObj = $util->getTerm($pageName);
         //var_dump($termObj);
         $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
         $domainName = $_SERVER['HTTP_HOST'];
         if (!is_null($termObj)) {
             //echo "-------------termObj size: ".count($termObj);
             if (count($termObj) == 1 && isset($termObj[0]) && !is_null($termObj[0]->curie)) {
                 //redirect('http://google.com', 'location');
                 redirect($protocol . "://" . $domainName . "/" . Config::$localContextName . "/index.php/pages/view/" . $termObj[0]->curie, 'refresh');
             }
             if (count($termObj) > 1) {
                 //http://localhost/NeuroKS/index.php/TermLanding/view/cerebellum%20purkinje%20cell
                 //redirect($protocol.":/".$domainName."/".Config::$localContextName."/index.php/Term/view/".$page, 'refresh');
                 $data['termObj'] = $termObj;
                 $temp_page_title = $pageName = str_replace(str_split('_,'), ' ', $page);
                 $data['page_title'] = "Term:" . $temp_page_title;
                 $data['enable_config'] = false;
                 //redirect('http://google.com', 'location');
                 //redirect($protocol."://".$domainName."/".Config::$localContextName."/index.php/pages/view/".$termObj[0]->curie, 'refresh');
                 //exit(0);
                 $this->load->view('templates/header2', $data);
                 $this->load->view('pages/DisplayTermLanding', $data);
                 $this->load->view('templates/footer2', $data);
                 return;
                 //exit(0);
             }
             $data['curie'] = $termObj[0]->curie;
         }
     }
//.........这里部分代码省略.........
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:101,代码来源:Pages_1.php


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