function indexingCatalogAction() { $guid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $catalogGuid = $this->_getParam('catalogGuid') ? $this->_getParam('catalogGuid') : ''; $solrAdapter = Pandamp_Search::manager(); try { $solrAdapter->indexCatalog($catalogGuid); $tblTmpIndex = new Pandamp_Modules_Extension_Index_Model_TmpIndex(); $tblTmpIndex->delete("guid='{$guid}'"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $username = '******' . $auth->getIdentity()->username; } else { $username = '******'; } // log to assetSetting $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'"); if ($rowAsset) { $rowAsset->valueText = "Update indexing-catalog at " . date("d-m-Y 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 = "Indexing catalog at " . date("d-m-Y H:i:s") . $username; } $rowAsset->save(); $this->view->success = true; } catch (Exception $e) { $this->view->success = false; } }
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) . ' <font color=green>[' . $formater->getCatalogAuthor($row->catalogGuid) . ']</font>' . ' ' . $isFile->GetCatalogIsFile($row->catalogGuid) . ' <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); }