コード例 #1
0
 function fetchDocumentAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $hTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $hType = new Pandamp_Controller_Action_Helper_GetCatalogDocType();
     $hSize = new Pandamp_Controller_Action_Helper_GetCatalogDocSize();
     $query = "SELECT * FROM `KutuCatalogAttribute`, `KutuRelatedItem` t2 WHERE `KutuCatalogAttribute`.catalogGuid=t2.itemGuid AND t2.relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO') AND t2.relatedGuid='{$catalogGuid}' AND `KutuCatalogAttribute`.attributeGuid = 'docViewOrder' ORDER BY `KutuCatalogAttribute`.value ASC";
     $db = Zend_Db_Table::getDefaultAdapter()->query($query);
     $rowsetRelatedItem = $db->fetchAll(Zend_Db::FETCH_OBJ);
     $a = array();
     $a['totalCount'] = count($rowsetRelatedItem);
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowsetRelatedItem as $row) {
             $a['document'][$i]['guid'] = $row->guid;
             $a['document'][$i]['itemGuid'] = $row->itemGuid;
             $a['document'][$i]['fixedTitle'] = $hTitle->getCatalogTitle($row->itemGuid);
             $a['document'][$i]['docType'] = $hType->GetCatalogDocType($row->itemGuid);
             $a['document'][$i]['docSize'] = $hSize->GetCatalogDocSize($row->itemGuid);
             $a['document'][$i]['docViewOrder'] = $row->value;
             $a['document'][$i]['relatedGuid'] = $row->relatedGuid;
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['document'][0]['guid'] = '';
         $a['document'][0]['itemGuid'] = "";
         $a['document'][0]['fixedTitle'] = "";
         $a['document'][0]['docType'] = '';
         $a['document'][0]['docSize'] = '';
         $a['document'][0]['docViewOrder'] = '';
         $a['document'][0]['relatedGuid'] = '';
     }
     echo Zend_Json::encode($a);
 }
コード例 #2
0
 function fetchClinicByCategoryAction()
 {
     $r = $this->getRequest();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'publishedDate';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' DESC';
     $query = "profile:klinik status:99 kategoriklinik:{$catalogGuid};publishedDate desc";
     $a = array();
     $a['query'] = $query;
     $vTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, $start, $limit);
     $num = $hits->response->numFound;
     $solrNumFound = count($hits->response->docs);
     $ii = 0;
     if ($solrNumFound == 0) {
         $a['klinikkategori'][0]['guid'] = 'XXX';
         $a['klinikkategori'][0]['title'] = 'Kategori klinik kosong';
         $a['klinikkategori'][0]['pertanyaan'] = "";
         $a['klinikkategori'][0]['createdBy'] = "";
         $a['klinikkategori'][0]['kategori'] = '';
         $a['klinikkategori'][0]['author'] = '';
         $a['klinikkategori'][0]['sumber'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             $row = $hits->response->docs[$ii];
             if (!empty($row)) {
                 $a['klinikkategori'][$ii]['guid'] = $row->id;
                 $a['klinikkategori'][$ii]['title'] = $row->title;
                 $a['klinikkategori'][$ii]['pertanyaan'] = $row->commentQuestion;
                 $a['klinikkategori'][$ii]['createdBy'] = 'Penanya:' . $row->createdBy;
                 $a['klinikkategori'][$ii]['kategori'] = $row->kategori;
                 $a['klinikkategori'][$ii]['author'] = 'Jawaban oleh : ' . $vTitle->getCatalogTitle($row->kontributor);
                 $a['klinikkategori'][$ii]['sumber'] = 'Sumber : ' . $vTitle->getCatalogTitle($row->sumber);
             }
         }
     }
     echo Zend_Json::encode($a);
 }
コード例 #3
0
ファイル: Solr.php プロジェクト: hukumonline/pmg
 public function reIndexCatalog()
 {
     gc_enable();
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $formater = new Pandamp_Lib_Formater();
     $title = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     //		$tbl = new Pandamp_Core_Orm_Table_Catalog();
     //		$rowset = $tbl->fetchAll(); //("profileGuid='Pandamp_peraturan'");
     $query = "SELECT * FROM KutuCatalog";
     $results = $this->_conn->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         //			if($iCount == 100)
         //				break;
         //			echo 'urutan: '.$iCount .'<br>';
         $nextRow = $rowset[$iCount + 1];
         //			echo 'current guid: '.$row->guid.'  '.'next guid: '.$nextRow->guid.'<br>';
         if ($row->modifiedBy !== $row->createdBy) {
             $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font>&nbsp;';
         } else {
             $modified = '';
         }
         echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . ']&nbsp;indexing:<font color=green>' . $title->getCatalogTitle($row->guid) . '</font>[current guid: ' . $row->guid . '  ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>]&nbsp;' . $modified . '[createdDate:<i>' . $formater->get_date($row->createdDate) . '</i>]</span></li>';
         $documents[] = $this->_createSolrDocument($row);
         if ($iCount % 500 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //					$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 //					echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid;
                 $log->err($e->getMessage());
                 throw new Zend_Exception($e->getMessage());
                 //					echo $e->getMessage().'<br>';
             }
         }
         flush();
     }
     echo '</ul></div></td></tr></table>';
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         //			$solr->optimize();
     } catch (Exception $e) {
         $log->err($e->getMessage());
         throw new Zend_Exception($e->getMessage());
         //			echo $e->getMessage().'<br>';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     //		echo'<br>WAKTU EKSEKUSI: '. $time;
     //		$log->info("WAKTU EKSEKUSI: ". $time." indexing catalog ".$iCount." dari ".$rowCount ." ".$username);
     echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>';
     // log to assetSetting
     $tblAssetSetting = new App_Model_Db_Table_AssetSetting();
     $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
     if ($rowAsset) {
         $rowAsset->valueText = "Update {$rowCount} indexing-catalog at " . date("Y-m-d H:i:s") . $username;
         $rowAsset->valueInt = $rowAsset->valueInt + 1;
     } else {
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = $gman->generateGuid();
         $rowAsset = $tblAssetSetting->fetchNew();
         $rowAsset->guid = $catalogGuid;
         $rowAsset->application = "INDEX CATALOG";
         $rowAsset->part = "KUTU";
         $rowAsset->valueType = "INDEX";
         $rowAsset->valueInt = 0;
         $rowAsset->valueText = $rowCount . " Indexing catalog at " . date("Y-m-d H:i:s") . $username;
     }
     $rowAsset->save();
 }
コード例 #4
0
ファイル: Solr.cancel.php プロジェクト: hukumonline/admin
 public function reIndexCatalog()
 {
     gc_enable();
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     //		$formater = new Pandamp_Lib_Formater();
     $title = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     //		$tbl = new Pandamp_Core_Orm_Table_Catalog();
     //		$rowset = $tbl->fetchAll(); //("profileGuid='Pandamp_peraturan'");
     //                if (strpos($this->_return,"id")) {
     //                    $query="SELECT * FROM KutuCatalog WHERE profileGuid NOT IN ('about_us','kutu_contact','kutu_email','kutu_kotik','kutu_mitra','kutu_signup','kategoriklinik','comment','partner','author')";
     //                } else if (strpos($this->_return,"en")) {
     //                    $query="SELECT * FROM KutuCatalog WHERE profileGuid IN ('article','consumer_goods','executive_alert','executive_summary','financial_services','general_corporate','hotile','hot_issue_ilb','hot_issue_ild','hot_news','ilb','ild','ile','manufacturing_&_industry','news','oil_and_gas','telecommunications_and_media')";
     //                }
     //$query="SELECT * FROM KutuCatalog WHERE profileGuid NOT IN ('about_us','kutu_contact','kutu_email','kutu_kotik','kutu_mitra','kutu_signup','kategoriklinik','comment','partner','author')";
     $query = "SELECT * FROM KutuCatalog";
     $results = $this->_conn->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         //			if($iCount == 100)
         //				break;
         //			echo 'urutan: '.$iCount .'<br>';
         $nextRow = $rowset[$iCount + 1];
         //			echo 'current guid: '.$row->guid.'  '.'next guid: '.$nextRow->guid.'<br>';
         if ($row->modifiedBy !== $row->createdBy) {
             $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font>&nbsp;';
         } else {
             $modified = '';
         }
         echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . ']&nbsp;indexing:<font color=green>' . $title->getCatalogTitle($row->guid, 'fixedTitle') . '</font>[current guid: ' . $row->guid . '  ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>]&nbsp;' . $modified . '[createdDate:<i>' . $row->createdDate . '</i>]</span></li>';
         $documents[] = $this->_createSolrDocument($row);
         if ($iCount % 500 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //					$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 //					echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid;
                 //$log->err($e->getMessage());
                 throw new Zend_Exception($e->getMessage());
                 //					echo $e->getMessage().'<br>';
             }
         }
         flush();
     }
     echo '</ul></div></td></tr></table>';
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         //$solr->optimize();
     } catch (Exception $e) {
         //$log->err($e->getMessage());
         throw new Zend_Exception($e->getMessage());
         //			echo $e->getMessage().'<br>';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     //		echo'<br>WAKTU EKSEKUSI: '. $time;
     //		$log->info("WAKTU EKSEKUSI: ". $time." indexing catalog ".$iCount." dari ".$rowCount ." ".$username);
     echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>';
     // log to assetSetting
     /*
     		$tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
     		$rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
     		if ($rowAsset)
     		{
     			$rowAsset->valueText = "Update $rowCount indexing-catalog at ".date("Y-m-d H:i:s").$username;
     			$rowAsset->valueInt = $rowAsset->valueInt + 1;			
     		}
     		else 
     		{
     			$gman = new Pandamp_Core_Guid();
     			$catalogGuid = $gman->generateGuid();
     			$rowAsset = $tblAssetSetting->fetchNew();	
     			$rowAsset->guid = $catalogGuid;
     			$rowAsset->application = "INDEX CATALOG";
     			$rowAsset->part = "KUTU";
     			$rowAsset->valueType = "INDEX";
     			$rowAsset->valueInt = 0;
     			$rowAsset->valueText = $rowCount." Indexing catalog at ".date("Y-m-d H:i:s").$username;
     		}
     		$rowAsset->save();
     *
     */
 }
コード例 #5
0
ファイル: ClinicController.php プロジェクト: hukumonline/pmg
 function fetchClinicByContributorAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $dateDiff = new Pandamp_Lib_DateDiff();
     $r = $this->getRequest();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'publishedDate';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' DESC';
     $query = "profile:klinik sumber:{$catalogGuid} status:99;publishedDate desc";
     $a = array();
     $a['query'] = $query;
     $vTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, $start, $limit);
     $num = $hits->response->numFound;
     $solrNumFound = count($hits->response->docs);
     $ii = 0;
     if ($solrNumFound == 0) {
         $a['klinikkategori'][0]['guid'] = 'XXX';
         $a['klinikkategori'][0]['title'] = 'Kategori klinik kosong';
         $a['klinikkategori'][0]['pertanyaan'] = "";
         $a['klinikkategori'][0]['createdBy'] = "";
         $a['klinikkategori'][0]['kategori'] = '';
         $a['klinikkategori'][0]['author'] = '';
         $a['klinikkategori'][0]['sumber'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             $row = $hits->response->docs[$ii];
             if (!empty($row)) {
                 $a['klinikkategori'][$ii]['guid'] = $row->id;
                 $a['klinikkategori'][$ii]['title'] = $row->title;
                 //$a['klinikkategori'][$ii]['pertanyaan'] = Pandamp_Lib_Formater::string_limit_words($row->commentQuestion,30);
                 $a['klinikkategori'][$ii]['createdBy'] = $row->createdBy;
                 $a['klinikkategori'][$ii]['kategori'] = $row->kategori;
                 $a['klinikkategori'][$ii]['pd'] = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($row->publishedDate)));
                 $a['klinikkategori'][$ii]['author'] = $vTitle->getCatalogTitle($row->kontributor, 'fixedTitle');
                 $a['klinikkategori'][$ii]['sumber'] = $vTitle->getCatalogTitle($row->sumber, 'fixedTitle');
                 $arraypictureformat = array("jpg", "jpeg", "gif");
                 $txt_allowedformat = implode('; ', $arraypictureformat);
                 $registry = Zend_Registry::getInstance();
                 $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
                 $cdn = $config->getOption('cdn');
                 $sDir = $cdn['static']['dir']['photo'];
                 $sDir2 = $cdn['static']['url']['photo'] . '/';
                 $modelUser = App_Model_Show_User::show()->getUserByName($row->createdBy);
                 $x = 0;
                 foreach ($arraypictureformat as $key => $val) {
                     if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                         $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                         $myext = $val;
                         $x = 1;
                         break;
                     }
                 }
                 if ($x == 1) {
                     $myphotosize = getimagesize($myphoto);
                     $dis = "";
                     if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                         $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                     }
                 } else {
                     $txt_existence = "<img src=\"" . $cdn['static']['images'] . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
                 }
                 $a['klinikkategori'][$ii]['img'] = $txt_existence;
                 $a['klinikkategori'][$ii]['kategoriklinik'] = $row->kategoriklinik;
                 $a['klinikkategori'][$ii]['kontributor'] = $row->kontributor;
                 $a['klinikkategori'][$ii]['source'] = $row->sumber;
             }
         }
     }
     echo Zend_Json::encode($a);
 }
コード例 #6
0
 function indexingTempAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $formater = new Kutu_Lib_Formater();
     $hTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $isFile = new Pandamp_Controller_Action_Helper_GetCatalogIsFile();
     $tblTmpIndex = new Pandamp_Modules_Extension_Index_Model_TmpIndex();
     $rowset = $tblTmpIndex->fetchAll(null, null, $end, $start);
     $rowCount = $tblTmpIndex->countCatalogsTempIndex();
     //		switch ($profileGuid)
     //		{
     //			case 'peraturan':
     //				$rowset = $tblTmpIndex->fetchAll("profileGuid IN ('kutu_doc','kutu_peraturan','kutu_putusan','kutu_peraturan_kolonial','kutu_rancangan_peraturan')",'',$end,$start);
     //				$rowCount = $tblTmpIndex->countCatalogsTempIndexPeraturan();
     //			break;
     //			case 'berita':
     //				$rowset = $tblTmpIndex->fetchAll("profileGuid IN ('aktual','suratpembaca','komunitas','news','talks','resensi','isuhangat','fokus','kolom','tokoh','jeda','tajuk','info','utama')",'',$end,$start);
     //				$rowCount = $tblTmpIndex->countCatalogsTempIndexArticle();
     //			break;
     //		}
     $a = array();
     $a['totalCount'] = $rowCount;
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['index'][$i]['guid'] = $row->guid;
             $a['index'][$i]['catalogGuid'] = $row->catalogGuid;
             $a['index'][$i]['title'] = $hTitle->getCatalogTitle($row->catalogGuid) . '&nbsp;<font color=green>[' . $formater->getCatalogAuthor($row->catalogGuid) . ']</font>' . '&nbsp;' . $isFile->GetCatalogIsFile($row->catalogGuid) . '&nbsp;<font color=blue>[' . $row->profileGuid . ']</font>';
             $a['index'][$i]['status'] = $row->status;
             $a['index'][$i]['createdDate'] = $formater->get_date($row->createdDate);
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['index'][0]['guid'] = '';
         $a['index'][0]['title'] = '';
         $a['index'][0]['status'] = "";
         $a['index'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }