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


PHP Batch::getByID方法代码示例

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


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

示例1: batchjsonAction

 function batchjsonAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $batchID = $this->_request->getParam('batchID');
     Zend_Loader::loadClass('Batch');
     Zend_Loader::loadClass('Document');
     $batchObj = new Batch();
     $batch = $batchObj->getByID($batchID);
     if (!$batch) {
         throw new Zend_Controller_Action_Exception('Cannnot find this page: ' . $this->_request->getRequestUri(), 404);
     }
     $batch["documents"] = $batchObj->documents;
     header('Content-Type: application/json; charset=utf8');
     echo Zend_Json::encode($batch);
 }
开发者ID:shawngraham,项目名称:gap2,代码行数:15,代码来源:GeoparseController.php

示例2: getLemnatizedXMLbyID

 function getLemnatizedXMLbyID($docID)
 {
     $output = false;
     $docObj = new Document();
     $doc = $docObj->getByID($docID);
     if (is_array($doc)) {
         if (!$this->docID) {
             $this->docID = $docID;
         }
         if (!$this->batchID) {
             $this->batchID = $docObj->batchID;
         }
         $parserID = $docObj->parserID;
         $batchObj = new Batch();
         $batch = $batchObj->getByID($docObj->batchID);
         $edinaObj = new Geoparser_EdinaText();
         $edinaObj->prepSettings();
         $edinaObj->batchName = $batchObj->parserID;
         //Parser ID of the batch
         $edinaObj->resourceID = $docObj->parserID;
         //Parser ID of the resource for parsing
         $edinaObj->resultFormat = "xml";
         $requestFile = $docObj->parserID . ".lem.xml";
         //this is the file type to get
         $requestLink = false;
         foreach ($docObj->pLinks as $pLink) {
             if (strstr($pLink["edina-href"], $requestFile)) {
                 $requestLink = $pLink["edina-href"];
                 //yeah! we found the same format, and lemnatization status, so use this link
                 break;
             }
         }
         $edinaObj->resourceURI = $requestLink;
         $respBody = $edinaObj->cacheGetResult();
         //get the result or use the cache to get it
         if ($edinaObj->HTTPstatusOK) {
             $output = $respBody;
             //these are the XML we're looking for
         }
     }
     return $output;
 }
开发者ID:shawngraham,项目名称:gap2,代码行数:42,代码来源:EdinaParse.php

示例3: docReviewAction

 function docReviewAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     Zend_Loader::loadClass('Batch');
     Zend_Loader::loadClass('Document');
     $docObj = new Document();
     if (isset($_GET["docID"])) {
         $docID = $_GET["docID"];
         $doc = $docObj->getByID($docID);
         $parserID = $docObj->parserID;
     } elseif (isset($_GET["parserID"])) {
         $parserID = $_GET["parserID"];
         $doc = $docObj->getByParserID($parserID);
         $docID = $doc->id;
     }
     if (isset($_GET["type"])) {
         $type = $_GET["type"];
         if (substr($type, 0, 1) != ".") {
             $type = "." . $type;
         }
     } else {
         $type = "";
     }
     $format = "json";
     //default to JSON format result
     $outputHeader = 'Content-Type: application/json; charset=utf8';
     if (isset($_GET["format"])) {
         $format = $_GET["format"];
         if ($format == "xml" || $format == "kml") {
             $outputHeader = 'Content-Type: application/xml; charset=utf8';
         }
     }
     if (!$doc) {
         //$this->view->requestURI = $this->_request->getRequestUri();
         //return $this->render('404error');
         throw new Zend_Controller_Action_Exception('Cannnot find this page: ' . $this->_request->getRequestUri(), 404);
     } else {
         $doc["result"] = false;
         //default to no result found
         $output = Zend_Json::encode($doc);
         $batchObj = new Batch();
         $batch = $batchObj->getByID($docObj->batchID);
         Zend_Loader::loadClass('Geoparser_Edina');
         Zend_Loader::loadClass('Geoparser_EdinaText');
         $edinaObj = new Geoparser_EdinaText();
         $edinaObj->prepSettings();
         $edinaObj->batchName = $batchObj->parserID;
         //Parser ID of the batch
         $edinaObj->resourceID = $docObj->parserID;
         //Parser ID of the resource for parsing
         $edinaObj->resultFormat = $format;
         if (is_array($docObj->pLinks)) {
             $requestFile = $docObj->parserID . $type . "." . $format;
             //this is the file type to get
             $requestLink = false;
             foreach ($docObj->pLinks as $pLink) {
                 if (strstr($pLink["edina-href"], $requestFile)) {
                     $requestLink = $pLink["edina-href"];
                     //yeah! we found the same format, and lemnatization status, so use this link
                     break;
                 }
             }
             $edinaObj->resourceURI = $requestLink;
             $respBody = $edinaObj->cacheGetResult();
             //get the result or use the cache to get it
             if ($edinaObj->HTTPstatusOK) {
                 if ($format == "json") {
                     $doc["result"] = Zend_Json::decode($respBody);
                     $output = Zend_Json::encode($doc);
                 } else {
                     $output = $respBody;
                 }
             } else {
                 throw new Zend_Controller_Action_Exception('Cannot complete request' . $respBody, 500);
             }
         }
         header($outputHeader);
         echo $output;
     }
     //end case with document in database
 }
开发者ID:shawngraham,项目名称:gap2,代码行数:81,代码来源:EdinaController.php


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