Exemplo n.º 1
0
 function getTokenIssues($tokenID)
 {
     $paraID = false;
     $context = false;
     $place = false;
     $db = $this->startDB();
     $sql = "SELECT * FROM gap_issues WHERE tokenID = {$tokenID}  AND active = 1 ORDER BY updated DESC;";
     $result = $db->fetchAll($sql, 2);
     $sql = "SELECT * FROM gap_issues WHERE tokenID = {$tokenID}  AND active = 0 ORDER BY updated DESC;";
     $resultOld = $db->fetchAll($sql, 2);
     $tokensObj = new Tokens();
     $tokenData = $tokensObj->getTokenByID($tokenID);
     $tokensObj->highlightToken = $tokenID;
     if (is_array($tokenData)) {
         $token = $tokenData["token"];
         $paraID = $tokenData["paraID"];
         $pageID = $tokenData["pageID"];
         $docID = $tokenData["docID"];
         $context = $tokensObj->getGapVisDocPage($docID, $pageID, $paraID, $tokenID);
         $place = $tokensObj->getPlaceByTokensID($tokenID);
         $related = false;
         $relatedPlaceTokens = false;
         if (is_array($place)) {
             $related = $tokensObj->getTokenIDsBySharedPlaceURIid($tokenID, $place["uriID"], $token);
             $relatedPlaceTokens = $tokensObj->getUniqueTokensFromPlaceURI($place["uri"]);
         }
         $docObj = new Document();
         $document = $docObj->getByID($docID);
     }
     $output = array("tokenID" => $tokenID, "token" => $token, "docID" => $docID, "document" => $document, "pageID" => $pageID, "context" => $context, "place" => $place, "related" => $related, "relatedPlaceTokens" => $relatedPlaceTokens, "issues" => $result, "oldIssues" => $resultOld, "oldPlaces" => $tokensObj->getTokenDeactivatedPlaceRefs($tokenID));
     return $output;
 }
Exemplo n.º 2
0
 public function searchAction()
 {
     $requestParams = $this->_request->getParams();
     Zend_Loader::loadClass("Issues");
     Zend_Loader::loadClass("Tokens");
     Zend_Loader::loadClass("Document");
     Zend_Loader::loadClass("GazetteerRefs");
     Zend_Loader::loadClass("GazetteerURIs");
     $docID = 1;
     //default to the first doc
     $relatedPlaceTokens = false;
     $placeURIs = false;
     $foundTokens = false;
     if (isset($requestParams["uri"])) {
         $this->view->searchTerm = $requestParams["uri"];
         $this->view->searchType = "Place URI";
         $tokensObj = new Tokens();
         //$tokensObj->tokenStructure($docID);
         $relatedPlaceTokens = $tokensObj->getUniqueTokensFromPlaceURI($requestParams["uri"]);
         if (isset($requestParams["docID"])) {
             if (strlen($requestParams["docID"]) > 0) {
                 $docID = $requestParams["docID"];
             }
         }
         $gazRefObj = new GazetteerRefs();
         $placeURIs = $gazRefObj->getListofURIs($docID);
     } elseif (isset($requestParams["q"])) {
         $searchTerm = $requestParams["q"];
         $this->view->searchTerm = $searchTerm;
         $this->view->searchType = "Token String";
         $startPage = false;
         $endPage = false;
         $structure = false;
         $page = 1;
         //default for paging through requests
         if (isset($requestParams["docID"])) {
             if (strlen($requestParams["docID"]) > 0) {
                 $docID = $requestParams["docID"];
             }
         }
         if (isset($requestParams["startPage"])) {
             if (strlen($requestParams["startPage"]) > 0) {
                 $startPage = $requestParams["startPage"];
             }
         }
         if (isset($requestParams["endPage"])) {
             if (strlen($requestParams["endPage"]) > 0) {
                 $endPage = $requestParams["endPage"];
             }
         }
         if (isset($requestParams["endPage"])) {
             if (strlen($requestParams["endPage"]) > 0) {
                 $endPage = $requestParams["endPage"];
             }
         }
         if (isset($requestParams["page"])) {
             if (strlen($requestParams["page"]) > 0) {
                 $page = $requestParams["page"];
             }
         }
         $tokensObj = new Tokens();
         $foundTokens = $tokensObj->getTokensByToken($searchTerm, $docID, $page, $startPage, $endPage, $structure);
     }
     $this->view->docID = $docID;
     $this->view->requestParams = $requestParams;
     $this->view->relatedPlaceTokens = $relatedPlaceTokens;
     $this->view->placeURIs = $placeURIs;
     $this->view->foundTokens = $foundTokens;
 }