Ejemplo n.º 1
0
 function fholdAction()
 {
     $r = $this->getRequest();
     $query = $r->getParam('query') ? $r->getParam('query') : '';
     $category = $r->getParam('ct') ? $r->getParam('ct') : '';
     $indexingEngine = Pandamp_Search::manager();
     if (empty($query)) {
         $hits = $indexingEngine->find("fjkslfjdkfjls", 0, 1);
     } else {
         if ($category) {
             $querySolr = $query . ' -profile:kutu_doc status:99 profile:' . $category . ';publishedDate desc';
         } else {
             $querySolr = $query . ' -profile:kutu_doc status:99;publishedDate desc';
         }
         $hits = $indexingEngine->find($querySolr, 0, 1);
     }
     $content = 0;
     $data = array();
     foreach ($hits->facet_counts->facet_fields->regulationType as $facet => $count) {
         if ($count == 0) {
             continue;
         } else {
             $data[$content][0] = $facet;
             $data[$content][1] = $count;
         }
         $content++;
     }
     $this->view->aData = $data;
     $this->view->query = $query;
 }
Ejemplo n.º 2
0
 function viewResultAction()
 {
     $time_start = microtime(true);
     $query = $this->_getParam('query') ? $this->_getParam('query') : '';
     $a = array();
     $querynum = $query . ' profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan)';
     $a['query'] = $query;
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 1);
     $num = Pandamp_Lib_Formater::findCatalog($querynum);
     //$num = $hits->response->numFound;
     $limit = 20;
     $a['totalCount'] = $num;
     $a['limit'] = $limit;
     $ii = 0;
     if ($a['totalCount'] == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     }
     $this->view->aData = $a;
     $this->view->query = $query;
     $this->view->hits = $hits;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2);
 }
Ejemplo n.º 3
0
 function viewResultAction()
 {
     $time_start = microtime(true);
     $query = $this->_getParam('query') ? $this->_getParam('query') : '';
     $category = $this->_getParam('category') ? $this->_getParam('category') : '';
     $a = array();
     if ($category) {
         $querynum = $query . ' profile:klinik status:99 kategoriklinik:' . $category;
     } else {
         $querynum = $query . ' profile:klinik status:99';
     }
     $a['query'] = $query;
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 1);
     $num = Pandamp_Lib_Formater::findCatalog($querynum);
     $limit = 20;
     $a['totalCount'] = $num;
     $a['limit'] = $limit;
     $ii = 0;
     if ($a['totalCount'] == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][$ii]['modifiedDate'] = '';
     }
     $this->view->aData = $a;
     $this->view->query = $query;
     $this->view->ct = $category;
     $this->view->hits = $hits;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2);
 }
Ejemplo n.º 4
0
 public function delrelAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $request = $this->getRequest();
     $itemGuid = $request->getParam('itemGuid');
     $relatedGuid = $request->getParam('relatedGuid');
     $relateAs = $request->getParam('relateAs');
     $result = 'RESULT_ERROR';
     if ($request->isPost()) {
         /*$catalogDb = new App_Model_Db_Table_Catalog();
         		$catalogDb->update([
         				'deletedDate' => new Zend_Db_Expr('NOW()'),
         				'deletedBy' => Zend_Auth::getInstance()->getIdentity()->username,
         				'status' => -1
         			], "guid='".$itemGuid."'");*/
         $tblRelatedItem = new Pandamp_Core_Hol_Relation();
         $tblRelatedItem->delete($itemGuid, $relatedGuid, $relateAs);
         $result = 'RESULT_OK';
     }
     try {
         $indexingEngine = Pandamp_Search::manager();
         $indexingEngine->deleteCatalogFromIndex($itemGuid);
         $queue = Zend_Registry::get(Bootstrap::NAME_ORDERQUEUE);
         $queue->addJob('Pandamp_Job_Catalog', ['guid' => $itemGuid], false);
         /*$this->view->addHitsBySolr(json_encode([[
         			"delete" => $itemGuid
         		]]));*/
     } catch (Zend_Exception $e) {
         Zend_Registry::get('Zend_Log')->err($e->__toString());
     }
     $this->getResponse()->setBody($result);
 }
Ejemplo n.º 5
0
 public function searchAction()
 {
     $query = $this->_getParam('query') ? $this->_getParam('query') : '';
     $relatedGuid = $this->_getParam('relatedGuid') ? $this->_getParam('relatedGuid') : '';
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query);
     $this->view->hits = $hits;
     $this->view->relatedGuid = $relatedGuid;
 }
Ejemplo n.º 6
0
 function indexAction()
 {
     $time_start = microtime(true);
     $r = $this->getRequest();
     $query = $r->getParam('keyword') ? $r->getParam('keyword') : '';
     $category = $r->getParam('category') ? $r->getParam('category') : '';
     $indexingEngine = Pandamp_Search::manager();
     if (empty($query)) {
         $hits = $indexingEngine->find("fjkslfjdkfjls", 0, 1);
     } else {
         if ($category) {
             $querySolr = $query . ' -profile:kutu_doc status:99 profile:' . $category . ';publishedDate desc';
         } else {
             $querySolr = $query . ' -profile:kutu_doc status:99;publishedDate desc';
         }
         $hits = $indexingEngine->find($querySolr, 0, 1);
     }
     $solrNumFound = $hits->response->numFound;
     $a = array();
     $a['query'] = $query;
     $a['totalCount'] = $solrNumFound;
     $a['limit'] = 20;
     $ii = 0;
     if ($a['totalCount'] == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     }
     $this->view->aData = $a;
     $this->view->hits = $hits;
     $this->_helper->layout()->searchQuery = $query;
     switch ($category) {
         case "kutu_peraturan":
         case "kutu_putusan":
         case "kutu_rancangan_peraturan":
         case "kutu_peraturan_kolonial":
             $ct = "(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan)";
             break;
         case "isuhangat":
             $ct = "article";
             break;
         default:
             $ct = $category;
             break;
     }
     $this->_helper->layout()->categorySearchQuery = $ct;
     $this->view->query = $query;
     $this->view->ct = $category;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2);
 }
Ejemplo n.º 7
0
 public function selectAuthorClinic($attributes = array())
 {
     $selectedId = isset($attributes['selected']) ? $attributes['selected'] : null;
     $disableId = isset($attributes['disable']) ? $attributes['disable'] : null;
     $output = "<select onchange='javascript:document.peraturan.submit();' class='{$attributes['class']}' name='{$attributes['name']}' id='{$attributes['id']}'>" . self::EOL . '<option value="">All</option>' . self::EOL;
     $ie = Pandamp_Search::manager();
     $query = "profile:author";
     $hits = $ie->find($query);
     $solrNumFound = count($hits->response->docs);
     for ($i = 0; $i < $solrNumFound; $i++) {
         $row = $hits->response->docs[$i];
         $selected = $selectedId == null || $selectedId != $row->id ? '' : ' selected="selected"';
         $disable = $disableId == null || $disableId != $row->id ? '' : ' disabled';
         $output .= sprintf('<option value="%s"%s%s>%s</option>', $row->id, $selected, $disable, $row->title) . self::EOL;
     }
     $output .= '</select>' . self::EOL;
     return $output;
 }
Ejemplo n.º 8
0
 function mitralainAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $query = "profile:klinik status:99 -sumber:{$catalogGuid}";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 1);
     $content = 0;
     $data = array();
     foreach ($hits->facet_counts->facet_fields->sumber as $facet => $count) {
         if (!$facet || $count == 0) {
             continue;
         } else {
             $data[$content][0] = $facet;
             $data[$content][1] = $count;
         }
         $content++;
     }
     $this->view->aData = $data;
 }
Ejemplo n.º 9
0
 function doindexckAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $title = "<h4>HUKUMONLINE INDONESIA: <small>indexing kategori klinik</small></h4><hr/>";
     echo $title . '<br>';
     $indexingEngine = Pandamp_Search::manager();
     $query = "profile:klinik kategoriklinik:lt501649fa53cd2 status:99";
     $hits = $indexingEngine->find($query);
     $solrNumFound = count($hits->response->docs);
     //$sSolr = "id:(";
     for ($ii = 0; $ii < $solrNumFound; $ii++) {
         if (isset($hits->response->docs[$ii])) {
             $row = $hits->response->docs[$ii];
             $indexingEngine->indexCatalog($row->id);
             $message = "\n\t                <div class='box box-info closeable'>\n\t                id&nbsp;:&nbsp;<abbr>" . $row->id . " - " . $row->title . "</abbr> data has been successfully indexed.\n\t                </div>";
             echo $message . '<br>';
             //$sSolr .= $row->id .' OR ';
         }
     }
     //$sSolr .= ')';
     //echo $sSolr;
 }
Ejemplo n.º 10
0
 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;
     }
 }
Ejemplo n.º 11
0
 function vcAction()
 {
     $time_start = microtime(true);
     $author = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $data = array();
     $query = "profile:klinik status:99 kontributor:{$author}";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query);
     $num_rows = count($hits->response->docs);
     $limit = 50;
     $data['folderGuid'] = $author;
     $data['totalCount'] = $num_rows;
     $data['totalCountRows'] = $num_rows;
     $data['limit'] = $limit;
     $this->view->aData = $data;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2) . ' detik';
 }
Ejemplo n.º 12
0
 public function getcatalogsearchAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $r = $this->getRequest();
     $query = $r->getParam('query') ? $r->getParam('query') : '';
     $category = $r->getParam('ct') ? $r->getParam('ct') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 25;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'publishedDate';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' desc';
     $a = array();
     $a['query'] = $query;
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $remoteSearchIn = $config->getOption('in');
     $remoteSearchEn = $config->getOption('en');
     $zl = Zend_Registry::get('Zend_Locale');
     if ($zl->getLanguage() == "id") {
         $status = "status:99";
     } else {
         $status = "status:1";
     }
     $indexingEngine = Pandamp_Search::manager();
     if (empty($query)) {
         $hits = $indexingEngine->find("fjkslfjdkfjls", 0, 1);
     } else {
         if ($category) {
             //$querySolr = $query.' -profile:kutu_doc profile:'.$category.';'.$orderBy.$sortOrder;
             $querySolr = $query . ' -profile:kutu_doc profile:' . $category;
         } else {
             //$querySolr = $query.' -profile:kutu_doc '.$status.';'.$orderBy.$sortOrder;
             $querySolr = $query . ' -profile:kutu_doc';
         }
         $hits = $indexingEngine->find($querySolr, $start, $limit);
     }
     $num = $hits->response->numFound;
     //$solrNumFound = count($hits->response->docs);
     $solrNumFound = $num;
     $ii = 0;
     if ($solrNumFound == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             if (isset($hits->response->docs[$ii])) {
                 $row = $hits->response->docs[$ii];
                 if (!empty($row)) {
                     if ($row->profile == "klinik") {
                         if (isset($hits->highlighting->{$row->id}->title[0])) {
                             if (isset($hits->highlighting->{$row->id}->kategori[0])) {
                                 $title = "[<b><font color='#FFAD29'>" . $hits->highlighting->{$row->id}->kategori[0] . "</font></b>]&nbsp;<a href='" . $remoteSearchIn['website'] . "/klinik/detail/" . $row->id . "' class='searchlink'>" . $hits->highlighting->{$row->id}->title[0] . "</a>";
                             } else {
                                 $title = "[<b><font color='#FFAD29'>" . $row->kategori . "</font></b>]&nbsp;<a href='" . $remoteSearchIn['website'] . "/klinik/detail/" . $row->id . "' class='searchlink'>" . $hits->highlighting->{$row->id}->title[0] . "</a>";
                             }
                         } else {
                             if (isset($hits->highlighting->{$row->id}->kategori[0])) {
                                 $title = "[<b><font color='#FFAD29'>" . $hits->highlighting->{$row->id}->kategori[0] . "</font></b>]&nbsp;<a href='" . $remoteSearchIn['website'] . "/klinik/detail/" . $row->id . "' class='searchlink'><b>{$row->title}</b></a>";
                             } else {
                                 $title = "[<b><font color='#FFAD29'>" . $row->kategori . "</font></b>]&nbsp;<a href='" . $remoteSearchIn['website'] . "/klinik/detail/" . $row->id . "' class='searchlink'><b>{$row->title}</b></a>";
                             }
                         }
                         if (isset($hits->highlighting->{$row->id}->commentQuestion[0])) {
                             $description = $row->commentQuestion ? "<u>Pertanyaan</u>: " . $hits->highlighting->{$row->id}->commentQuestion[0] : '';
                         } else {
                             $description = $row->commentQuestion ? "<u>Pertanyaan</u>: " . $row->commentQuestion : '';
                         }
                     } else {
                         if ($row->profile == "article") {
                             if ($zl->getLanguage() == "id") {
                                 if (isset($hits->highlighting->{$row->id}->title[0])) {
                                     $title = "<a href='" . $remoteSearchIn['website'] . "/berita/baca/" . $row->id . "/" . $row->shortTitle . "' class='searchlink'><b>" . $hits->highlighting->{$row->id}->title[0] . "</b></a>";
                                 } else {
                                     $title = "<a href='" . $remoteSearchIn['website'] . "/berita/baca/" . $row->id . "/" . $row->shortTitle . "' class='searchlink'><b>{$row->title}</b></a>";
                                 }
                             } else {
                                 if (isset($row->shortTitle)) {
                                     $st = "/" . $row->shortTitle;
                                 } else {
                                     $st = "";
                                 }
                                 if (isset($hits->highlighting->{$row->id}->title[0])) {
                                     $title = "<a href='" . $remoteSearchEn['website'] . "/pages/" . $row->id . $st . "' class='searchlink'><b>" . $hits->highlighting->{$row->id}->title[0] . "</b></a>";
                                 } else {
                                     $title = "<a href='" . $remoteSearchEn['website'] . "/pages/" . $row->id . $st . "' class='searchlink'><b>{$row->title}</b></a>";
                                 }
                             }
                             $description = isset($row->description) ? $row->description : '';
                         } else {
                             if ($row->profile == "kutu_peraturan" || $row->profile == "kutu_peraturan_kolonial" || $row->profile == "kutu_rancangan_peraturan" || $row->profile == "kutu_putusan") {
                                 $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
                                 $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$row->id}'");
                                 if ($rowsetCatalogFolder) {
                                     $parentGuid = $rowsetCatalogFolder->folderGuid;
                                 } else {
                                     $parentGuid = '';
                                 }
                                 $node = $this->getNode($parentGuid);
                                 if (isset($hits->highlighting->{$row->id}->title[0])) {
                                     $title = "<a href='" . $remoteSearchIn['website'] . "/pusatdata/detail/" . $row->id . "/" . $node . "/" . $parentGuid . "' class='searchlink'><b>" . $hits->highlighting->{$row->id}->title[0] . "</b></a>";
                                 } else {
                                     $title = "<a href='" . $remoteSearchIn['website'] . "/pusatdata/detail/" . $row->id . "/" . $node . "/" . $parentGuid . "' class='searchlink'><b>{$row->title}</b></a>";
                                 }
                                 $description = isset($row->description) ? $row->description : '';
                             } else {
                                 //$title = (isset($row->title))? $row->title : '';
                                 if (isset($row->title)) {
                                     if ($zl->getLanguage() == "id") {
                                         $title = "<a href='" . ROOT_URL . "' class='searchlink'><b>{$row->title}</b></a>";
                                     } else {
                                         if (isset($row->shortTitle)) {
                                             $st = "/" . $row->shortTitle;
                                         } else {
                                             $st = "";
                                         }
                                         $title = "<a href='" . $remoteSearchEn['website'] . "/pages/" . $row->id . $st . "' class='searchlink'><b>{$row->title}</b></a>";
                                     }
                                 } else {
                                     $title = "";
                                 }
                                 $description = isset($row->description) ? $row->description : '';
                             }
                         }
                     }
                     if (isset($hits->highlighting->{$row->id}->subTitle[0])) {
                         $subTitle = isset($row->subTitle) ? "<span class='subjudul'>" . $hits->highlighting->{$row->id}->subTitle[0] . "</span><br>" : '';
                     } else {
                         $subTitle = isset($row->subTitle) ? "<span class='subjudul'>" . $row->subTitle . "</span><br>" : '';
                     }
                     $profileSolr = str_replace("kutu_", "", $row->profile);
                     $profileSolr = str_replace("clinic_category", "clinic", $profileSolr);
                     $profileSolr = str_replace("financial_services", "financial services", $profileSolr);
                     $profileSolr = str_replace("general_corporate", "general corporate", $profileSolr);
                     $profileSolr = str_replace("oil_and_gas", "oil and gas", $profileSolr);
                     $profileSolr = str_replace("executive_alert", "executive alert", $profileSolr);
                     $profileSolr = str_replace("manufacturing_&_industry", "manufacturing & industry", $profileSolr);
                     $profileSolr = str_replace("consumer_goods", "consumer goods", $profileSolr);
                     $profileSolr = str_replace("telecommunications_and_media", "telecommunications and media", $profileSolr);
                     $profileSolr = str_replace("executive_summary", "executive summary", $profileSolr);
                     $profileSolr = str_replace("hot_news", "hot news", $profileSolr);
                     $profileSolr = str_replace("hot_issue_ile", "hot issue ILE", $profileSolr);
                     $profileSolr = str_replace("hot_issue_ild", "hot issue ILD", $profileSolr);
                     $profileSolr = str_replace("hot_issue_ilb", "hot issue ILB", $profileSolr);
                     $a['catalogs'][$ii]['profile'] = $profileSolr;
                     $a['catalogs'][$ii]['title'] = $title ? $title : '';
                     $a['catalogs'][$ii]['guid'] = $row->id;
                     $a['catalogs'][$ii]['score'] = "score:" . round($row->score, 4);
                     $a['catalogs'][$ii]['description'] = $description;
                     $a['catalogs'][$ii]['subTitle'] = isset($subTitle) ? $subTitle : '';
                     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");
                     $hari = $array_hari[date("N", strtotime($row->publishedDate))];
                     $a['catalogs'][$ii]['publishedDate'] = $hari . ', ' . date("d F Y", strtotime($row->publishedDate));
                 }
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Ejemplo n.º 13
0
 function searchAction()
 {
     $query = "profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan);year desc, regulationOrder desc";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 5);
     echo '<pre>';
     print_r($hits);
     echo '</pre>';
     die;
 }
Ejemplo n.º 14
0
 public function save($aData)
 {
     if (empty($aData['profileGuid'])) {
         throw new Zend_Exception('Catalog Profile can not be EMPTY!');
     }
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $gman = new Pandamp_Core_Guid();
     $catalogGuid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid();
     $folderGuid = isset($aData['folderGuid']) && !empty($aData['folderGuid']) ? $aData['folderGuid'] : '';
     //if not empty, there are 2 possibilities
     $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
     if ($tblCatalog->fetchRow($where)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : $rowCatalog->shortTitle;
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : $rowCatalog->publishedDate;
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : $rowCatalog->expiredDate;
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : $rowCatalog->status;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : $rowCatalog->price;
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         $rowCatalog->guid = $catalogGuid;
         $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : '';
         $rowCatalog->profileGuid = $aData['profileGuid'];
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : '0000-00-00 00:00:00';
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : '0000-00-00 00:00:00';
         $rowCatalog->createdBy = isset($aData['username']) ? $aData['username'] : '';
         $rowCatalog->modifiedBy = $rowCatalog->createdBy;
         $rowCatalog->createdDate = date("Y-m-d h:i:s");
         $rowCatalog->modifiedDate = $rowCatalog->createdDate;
         $rowCatalog->deletedDate = '0000-00-00 00:00:00';
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : 0;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : 0;
     }
     try {
         $catalogGuid = $rowCatalog->save();
     } catch (Exception $e) {
         die($e->getMessage());
     }
     $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute();
     $profileGuid = $rowCatalog->profileGuid;
     $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
     $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
     $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
         if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
         } else {
             $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $catalogGuid;
             $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid;
         }
         $rowCatalogAttribute->value = isset($aData[$rowProfileAttribute->attributeGuid]) ? $aData[$rowProfileAttribute->attributeGuid] : '';
         $rowCatalogAttribute->save();
     }
     //save to table CatalogFolder only if folderGuid is not empty
     if (!empty($folderGuid)) {
         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
         $rowsetCatalogFolder = $tblCatalogFolder->find($catalogGuid, $folderGuid);
         if (count($rowsetCatalogFolder) <= 0) {
             $rowCatalogFolder = $tblCatalogFolder->createRow(array('catalogGuid' => '', 'folderGuid' => ''));
             $rowCatalogFolder->catalogGuid = $catalogGuid;
             $rowCatalogFolder->folderGuid = $folderGuid;
             $rowCatalogFolder->save();
         }
     }
     //do indexing
     $indexingEngine = Pandamp_Search::manager();
     $indexingEngine->indexCatalog($catalogGuid);
     return $catalogGuid;
 }
Ejemplo n.º 15
0
 public function getsearcharticleAction()
 {
     $r = $this->getRequest();
     $query = $r->getParam('query') ? $r->getParam('query') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'regulationOrder';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' asc';
     $a = array();
     $query = $query . ' profile:article';
     $a['query'] = $query;
     $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['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             $row = $hits->response->docs[$ii];
             if (!empty($row)) {
                 if ($row->profile == 'kutu_doc') {
                     $title = 'File : ' . $row->title;
                     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
                     $rowset = $tblRelatedItem->fetchRow("itemGuid='{$row->id}'");
                     if ($rowset) {
                         $guid = $rowset->relatedGuid;
                     } else {
                         $guid = $row->id;
                     }
                 } else {
                     $title = $row->title;
                     $guid = $row->id;
                 }
                 $a['catalogs'][$ii]['title'] = $title;
                 $a['catalogs'][$ii]['guid'] = $guid;
                 if (!isset($row->shortTitle)) {
                     $a['catalogs'][$ii]['subTitle'] = '';
                 } else {
                     $a['catalogs'][$ii]['subTitle'] = $row->shortTitle;
                 }
                 if ($row->profile == 'kutu_doc') {
                     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
                     $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='{$row->id}' AND relateAs='RELATED_FILE'");
                     if ($rowsetRelatedItem) {
                         $parentGuid = $rowsetRelatedItem->relatedGuid;
                     } else {
                         $parentGuid = '';
                     }
                 } else {
                     $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
                     $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$row->id}'");
                     if ($rowsetCatalogFolder) {
                         $parentGuid = $rowsetCatalogFolder->folderGuid;
                     } else {
                         $parentGuid = '';
                     }
                 }
                 $a['catalogs'][$ii]['folderGuid'] = $parentGuid;
                 $a['catalogs'][$ii]['createdDate'] = $row->createdDate;
                 $a['catalogs'][$ii]['modifiedDate'] = $row->modifiedDate;
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Ejemplo n.º 16
0
 public function uploadFile_old($aDataCatalog, $relatedGuid)
 {
     if ($aDataCatalog['profileGuid'] != 'kutu_doc') {
         throw new Zend_Exception('Profile does not match profile for FILE');
     }
     if (empty($relatedGuid)) {
         throw new Zend_Exception('No RELATED GUID specified!');
     }
     $id = 1 + ($aDataCatalog['id'] - 1);
     for ($x = 1; $x < $id; $x++) {
         $title = $aDataCatalog['fixedTitle' . $x] ? $aDataCatalog['fixedTitle' . $x] : 'No-Title';
         $registry = Zend_Registry::getInstance();
         $files = $registry->get('files');
         if (isset($files['uploadedFile' . $x])) {
             $file = $files['uploadedFile' . $x];
             $this->checkTitle($aDataCatalog['fixedTitle' . $x]);
         }
         $type = $aDataCatalog['fixedType' . $x] ? $aDataCatalog['fixedType' . $x] : '';
         if ($type == 'file') {
             $relatedType = 'RELATED_FILE';
         } elseif ($type == 'image') {
             $relatedType = 'RELATED_IMAGE';
         } elseif ($type == 'video') {
             $relatedType = 'RELATED_VIDEO';
         }
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = isset($aDataCatalog['guid']) && !empty($aDataCatalog['guid']) ? $aDataCatalog['guid'] : $gman->generateGuid();
         $folderGuid = isset($aDataCatalog['folderGuid']) && !empty($aDataCatalog['folderGuid']) ? $aDataCatalog['folderGuid'] : '';
         $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
         if ($tblCatalog->fetchRow($where)) {
             $rowCatalog = $tblCatalog->find($catalogGuid)->current();
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : $rowCatalog->shortTitle;
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : $rowCatalog->publishedDate;
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : $rowCatalog->expiredDate;
             $rowCatalog->status = isset($aDataCatalog['status']) ? $aDataCatalog['status'] : $rowCatalog->status;
         } else {
             $rowCatalog = $tblCatalog->fetchNew();
             $rowCatalog->guid = $catalogGuid;
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : '';
             $rowCatalog->profileGuid = $aDataCatalog['profileGuid'];
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : '0000-00-00 00:00:00';
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : '0000-00-00 00:00:00';
             $rowCatalog->createdBy = isset($aDataCatalog['username']) ? $aDataCatalog['username'] : '';
             $rowCatalog->modifiedBy = $rowCatalog->createdBy;
             $rowCatalog->createdDate = date("Y-m-d h:i:s");
             $rowCatalog->modifiedDate = $rowCatalog->createdDate;
             $rowCatalog->deletedDate = '0000-00-00 00:00:00';
             $rowCatalog->status = isset($aDataCatalog['status']) ? $aDataCatalog['status'] : 0;
         }
         $catalogGuid = $rowCatalog->save();
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         if (isset($files['uploadedFile' . $x])) {
             if (isset($files['uploadedFile' . $x]['name']) && !empty($files['uploadedFile' . $x]['name'])) {
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSystemName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docOriginalName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSize', $file['size']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docMimeType', $file['type']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'fixedTitle', $title);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docViewOrder', 0);
                 if ($type == 'file') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 } elseif ($type == 'image') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images';
                     $file = $files['uploadedFile' . $x]['name'];
                     $ext = explode(".", $file);
                     $ext = strtolower(array_pop($ext));
                     if ($ext == "jpg" || $ext == "jpeg" || $ext == "gif" || $ext == "png") {
                         $target_path = $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext;
                         if (is_dir($target_path)) {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             chmod($target_path, 0644);
                             Pandamp_Lib_Formater::createthumb($target_path, $sDir . '/tn_' . $catalogGuid . "." . $ext, 130, 130);
                         } else {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             chmod($target_path, 0644);
                             Pandamp_Lib_Formater::createthumb($target_path, $sDir . '/tn_' . $catalogGuid . "." . $ext, 130, 130);
                         }
                     }
                 } elseif ($type == 'video') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'video' . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 }
             }
         }
         $this->relateTo($catalogGuid, $relatedGuid, $relatedType);
         $indexingEngine = Pandamp_Search::manager();
         $indexingEngine->indexCatalog($relatedGuid);
     }
 }
Ejemplo n.º 17
0
 /**
  * Find images
  */
 public function findimageAction()
 {
     $request = $this->getRequest();
     $pageIndex = $request->getParam('pageIndex', 1);
     $perPage = $request->getParam('perpage');
     $perPage = $perPage ? $perPage : 20;
     $offset = ($pageIndex - 1) * $perPage;
     $params = null;
     $exp = array();
     $params = $request->getParam('q');
     if (null != $params) {
         $exp = rawurldecode(base64_decode($params));
         $exp = Zend_Json::decode($exp);
     } else {
         $params = rawurlencode(base64_encode(Zend_Json::encode($exp)));
     }
     $indexingEngine = Pandamp_Search::manager();
     if ($exp['keyword'] == '*' || $exp['keyword'] == '') {
         $exp['keyword'] = '*:*';
     }
     $hits = $indexingEngine->find($exp['keyword'] . ' mimeType:image* profile:kutu_doc', $offset, $perPage, 'createdDate desc');
     $solrNumFound = count($hits->response->docs);
     $num_rows = $hits->response->numFound;
     $paginator = Zend_Paginator::factory($num_rows);
     $cache = Pandamp_Cache::getInstance();
     if ($cache) {
         Zend_Paginator::setCache($cache);
     }
     $paginator->setCacheEnabled(true);
     $paginator->setCurrentPageNumber($pageIndex);
     $paginator->setItemCountPerPage($perPage);
     $paginator = get_object_vars($paginator->getPages('Sliding'));
     $paginatorOptions = array('path' => $this->view->url(array('lang' => $this->view->getLanguage()), 'search_catalog_findimage'), 'itemLink' => null == $params ? 'page-%d' : 'page-%d?perpage=' . $perPage . '&q=' . $params);
     /**
      * Support searching from other page
      * For example, search files at adding set page
      */
     if (isset($exp['format']) && $exp['format'] == 'JSON') {
         $this->_helper->getHelper('viewRenderer')->setNoRender();
         $this->_helper->getHelper('layout')->disableLayout();
         $config = Pandamp_Application::getOption('cdn');
         if ($solrNumFound > $perPage) {
             $numRowset = $perPage;
         } else {
             $numRowset = $solrNumFound;
         }
         $res = array('files' => array(), 'paginator' => $this->view->paginator()->slide($paginator, $paginatorOptions));
         for ($i = 0; $i < $numRowset; $i++) {
             $row = $hits->response->docs[$i];
             $fs = 'thumbnail_';
             //$filename = $row->systemName; <-- metode ini kadang suka kosong
             $filename = $this->view->getCatalogAttribute($row->id, 'docSystemName');
             $fn = pathinfo($filename, PATHINFO_FILENAME);
             $ext = pathinfo($filename, PATHINFO_EXTENSION);
             //$ext = strtolower($ext);
             if (substr($fn, 0, 2) !== 'lt') {
                 $fn = $row->id;
                 $fs = 'tn_';
                 $filename = $fn . '.' . strtolower($ext);
             }
             $title = $this->view->getCatalogAttribute($fn, 'fixedTitle');
             $relDb = new App_Model_Db_Table_RelatedItem();
             $rel = $relDb->fetchRow("itemGuid='" . $fn . "' AND relateAs='RELATED_IMAGE'");
             $relGuid = isset($rel->relatedGuid) ? $rel->relatedGuid : '';
             if (is_array(@getimagesize($config['static']['url']['images'] . '/' . $relGuid . '/' . $fs . $filename))) {
                 $url = $config['static']['url']['images'] . '/' . $relGuid . '/' . $fs . $filename;
             } elseif (is_array(@getimagesize($config['static']['url']['images'] . '/' . $fs . $filename))) {
                 $url = $config['static']['url']['images'] . '/' . $fs . $filename;
             } else {
                 $url = 'http://static.hukumonline.com/frontend/default/images/kaze/karticle-img.jpg';
             }
             //$url = $config['static']['url']['images'].'/'.$rel->relatedGuid.'/'.$rel->itemGuid.'.'.strtolower($ext);
             //$url = $config['static']['url']['images'].'/upload/'.$pd1.'/'.$pd2.'/'.$pd3.'/'.$pd4.'/'.$fn.'_square'.'.'.$ext;
             $res['files'][] = array('id' => isset($fn) ? $fn : '', 'relatedGuid' => isset($relGuid) ? $relGuid : '', 'title' => isset($title) ? $title : '', 'url' => isset($url) ? $url : '');
         }
         $this->getResponse()->setBody(Zend_Json::encode($res));
     }
 }
Ejemplo n.º 18
0
 function searchAction()
 {
     $time_start = microtime(true);
     $r = $this->getRequest();
     $searchQuery = $r->getParam('as_q') ? $r->getParam('as_q') : '';
     $as_epq = $r->getParam('as_epq');
     $as_oq = $r->getParam('as_oq');
     $as_eq = $r->getParam('as_eq');
     $number = $r->getParam('nomor') ? $r->getParam('nomor') : '';
     $year = $r->getParam('tahun') ? $r->getParam('tahun') : '';
     $regulationType = $r->getParam('jenis_peraturan') ? $r->getParam('jenis_peraturan') : '';
     $lembaga_peradilan = $r->getParam('lembaga_peradilan') ? $r->getParam('lembaga_peradilan') : '';
     $hakim = $r->getParam('hakim') ? $r->getParam('hakim') : '';
     $pihak = $r->getParam('pihak') ? $r->getParam('pihak') : '';
     $pengacara = $r->getParam('pengacara') ? $r->getParam('pengacara') : '';
     $advQuery = array();
     if (isset($as_epq)) {
         array_push($advQuery, $as_epq);
     }
     if ($as_oq) {
         array_push($advQuery, "+" . $as_oq);
     }
     if ($as_eq) {
         array_push($advQuery, "-" . $as_eq);
     }
     if ($number) {
         array_push($advQuery, "number:" . $number);
     }
     if ($year) {
         array_push($advQuery, "year:" . $year);
     }
     if ($regulationType) {
         array_push($advQuery, "regulationOrder:" . $regulationType);
     }
     if ($lembaga_peradilan) {
         array_push($advQuery, "regulationOrder:" . $lembaga_peradilan);
     }
     if ($hakim) {
         array_push($advQuery, "all:" . $hakim);
     }
     if ($pihak) {
         array_push($advQuery, "all:" . $pihak);
     }
     if ($pengacara) {
         array_push($advQuery, "all:" . $pengacara);
     }
     for ($i = 0; $i < count($advQuery); $i++) {
         if ($searchQuery != "") {
             $searchQuery .= " ";
         }
         $searchQuery .= $advQuery[$i];
     }
     $queries = array($searchQuery);
     foreach ($queries as $query) {
         $indexingEngine = Pandamp_Search::manager();
         if (empty($query)) {
             $hits = $indexingEngine->find("fjkslfjdkfjls", 0, 1);
         } else {
             if ($category) {
                 $querySolr = $query . ' -profile:kutu_doc status:99 profile:' . $category . ';publishedDate desc';
             } else {
                 $querySolr = $query . ' -profile:kutu_doc status:99;publishedDate desc';
             }
             $hits = $indexingEngine->find($querySolr, 0, 1);
         }
     }
     $solrNumFound = $hits->response->numFound;
     $a = array();
     $a['query'] = $query;
     $a['totalCount'] = $solrNumFound;
     $a['limit'] = 20;
     $ii = 0;
     if ($a['totalCount'] == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     }
     $this->view->aData = $a;
     $this->view->hits = $hits;
     $this->view->query = $query;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2);
 }
Ejemplo n.º 19
0
 function fetchClinicByCategoryAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $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]['author'] = '';
         $a['klinikkategori'][0]['sid'] = '';
         $a['klinikkategori'][0]['source'] = '';
         $a['klinikkategori'][0]['publishedDate'] = '';
         $a['klinikkategori'][0]['existence'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             if (isset($hits->response->docs[$ii])) {
                 $row = $hits->response->docs[$ii];
                 $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'] . '/';
                 $smg = $cdn['static']['images'];
                 $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=\"" . $smg . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
                 }
                 $a['klinikkategori'][$ii]['guid'] = $row->id;
                 $a['klinikkategori'][$ii]['title'] = $row->title;
                 $a['klinikkategori'][$ii]['pertanyaan'] = $row->commentQuestion;
                 $a['klinikkategori'][$ii]['createdBy'] = $row->createdBy;
                 $a['klinikkategori'][$ii]['author'] = $row->kontributor;
                 $a['klinikkategori'][$ii]['sid'] = $row->sumber;
                 $a['klinikkategori'][$ii]['source'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->kontributor, 'fixedTitle');
                 $a['klinikkategori'][$ii]['publishedDate'] = date("d/m/Y", strtotime($row->publishedDate));
                 $a['klinikkategori'][$ii]['existence'] = '<div style="float:left;padding:2px;margin: 1px 10px 10px 0px;"><a href="">' . $txt_existence . '</a></div>';
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Ejemplo n.º 20
0
 public function getSolrDir()
 {
     $indexingEngine = Pandamp_Search::manager();
     return $indexingEngine->getSolrDir();
 }
Ejemplo n.º 21
0
 function deleteAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $title = "<h4>HUKUMONLINE INDONESIA: <small>search</small></h4><hr/>";
     echo $title . '<br>';
     $solr = new Apache_Solr_Service('nihki:sirkulasi@202.153.129.35', '8983', '/solr/core-catalog');
     if (!$solr->ping()) {
         echo 'Solr service not responding.';
         exit;
     }
     $a = array('fl17956', 'fl1131');
     foreach ($a as $c) {
         $indexingEngine = Pandamp_Search::manager();
         $indexingEngine->deleteCatalogFromIndex($c);
     }
 }
Ejemplo n.º 22
0
 function peraturanAction()
 {
     $this->_helper->layout->disableLayout();
     $query = "profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan);year desc, regulationOrder desc";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 4);
     $solrNumFound = count($hits->response->docs);
     $content = 0;
     $data = array();
     for ($ii = 0; $ii < $solrNumFound; $ii++) {
         $row = $hits->response->docs[$ii];
         $data[$content][0] = $row->title;
         $data[$content][1] = $row->subTitle;
         $data[$content][2] = $row->id;
         $content++;
     }
     $num_rows = $solrNumFound;
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Ejemplo n.º 23
0
 static function findCatalog($query)
 {
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 1);
     $num = $hits->response->numFound;
     return $num;
 }
Ejemplo n.º 24
0
 function kategoriklinikAction()
 {
     $this->_helper->layout->disableLayout();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $query = "kategoriklinik:{$catalogGuid} status:99";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query);
     $solrNumFound = count($hits->response->docs);
     $num_rows = $solrNumFound;
     $limit = 20;
     $data['catalogGuid'] = $catalogGuid;
     $data['totalCount'] = $num_rows;
     $data['limit'] = $limit;
     $this->view->aData = $data;
 }
Ejemplo n.º 25
0
 public function findperaturanyear(array $id, $parent = 0)
 {
     /*$solr = new Apache_Solr_Service( 'nihki:sirkulasi@202.153.129.35', '8983', '/solr/core-catalog' );
      	if ( ! $solr->ping() ) {
      		echo 'Solr service not responding.';
      		exit;
      	}*/
     //Pandamp_Debug::manager($this->search($id, 'itemGuid', 'lt546455c9b16cb'));
     if (empty($id)) {
         return;
     }
     $solrAdapter = Pandamp_Search::manager();
     $numi = count($id);
     $sSolr = "id:(";
     for ($i = 0; $i < $numi; $i++) {
         $row = $id[$i];
         if ($row['itemGuid']) {
             $sSolr .= $row['itemGuid'] . ' OR ';
         }
     }
     $sSolr = substr_replace($sSolr, "", -4) . ")";
     try {
         $solrResult = $solrAdapter->find($sSolr, 0, $numi, 'fixedDate desc', 'POST');
         $solrNumFound = $solrResult->response->numFound;
         $data = array();
         for ($ii = 0; $ii < $numi; $ii++) {
             if (isset($solrResult->response->docs[$ii])) {
                 $row = $solrResult->response->docs[$ii];
                 $data[$ii]['id'] = $row->id;
                 $data[$ii]['title'] = $row->title;
                 $data[$ii]['year'] = $row->year;
                 $data[$ii]['fixedDate'] = $solrAdapter->translateSolrDate($row->fixedDate);
                 $relateAs = $this->search($id, 'itemGuid', $row->id);
                 $data[$ii]['relateAs'] = $relateAs[0] ? $relateAs[0]['relateAs'] : '';
                 $data[$ii]['relatedGuid'] = $relateAs[0] ? $relateAs[0]['relatedGuid'] : '';
                 $data[$ii]['parent'] = $relateAs[0] ? $relateAs[0]['parent'] : '';
             }
         }
         return $data;
     } catch (Exception $e) {
     }
 }
Ejemplo n.º 26
0
 function viewerClinicAction()
 {
     $author = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $query = "profile:klinik status:99 kontributor:{$author};publishedDate desc";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query);
     $solrNumFound = count($hits->response->docs);
     $content = 0;
     $data = array();
     for ($ii = 0; $ii < $solrNumFound; $ii++) {
         $row = $hits->response->docs[$ii];
         $data[$content][0] = $row->title;
         $data[$content][1] = $row->commentQuestion;
         $data[$content][2] = $row->kategori;
         $data[$content][3] = $row->id;
         $data[$content][4] = $row->createdBy;
         $data[$content][5] = $row->createdBy;
         $data[$content][6] = $row->createdBy;
         $content++;
     }
     $num_rows = $solrNumFound;
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Ejemplo n.º 27
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);
 }
Ejemplo n.º 28
0
 function fcreateAction()
 {
     $r = $this->getRequest();
     $query = $r->getParam('query') ? $r->getParam('query') : '';
     $category = $r->getParam('ct') ? $r->getParam('ct') : '';
     $indexingEngine = Pandamp_Search::manager();
     if (empty($query)) {
         $hits = $indexingEngine->find("fjkslfjdkfjls", 0, 1);
     } else {
         if ($category) {
             //$querySolr = $query.' -profile:kutu_doc status:99 profile:'.$category.';publishedDate desc';
             $querySolr = $query . ' -profile:kutu_doc profile:' . $category;
         } else {
             //$querySolr = $query.' -profile:kutu_doc status:99;publishedDate desc';
             $querySolr = $query . ' -profile:kutu_doc';
         }
         $hits = $indexingEngine->find($querySolr, 0, 1);
     }
     $content = 0;
     $data = array();
     foreach ($hits->facet_counts->facet_fields->createdBy as $facet => $count) {
         if ($count == 0 || in_array($facet, array('comment', 'partner', 'kategoriklinik', 'kutu_signup'))) {
             continue;
         } else {
             $f = str_replace(array('kutu_'), "", $facet);
             $data[$content][0] = $f;
             $data[$content][1] = $count;
             $data[$content][3] = $facet;
         }
         $content++;
     }
     $this->view->aData = $data;
     $this->view->query = $query;
 }
Ejemplo n.º 29
0
 public function dcAction()
 {
     $request = $this->getRequest();
     $y = $request->getParam('y');
     $sort = $request->getParam('sort') ? $request->getParam('sort') : '';
     $p = $request->getParam('p') ? $request->getParam('p') : '';
     $by = $request->getParam('by') ? $request->getParam('by') : '';
     $author = $request->getParam('author') ? $request->getParam('author') : '';
     $ac = $request->getParam('authorclinic') ? $request->getParam('authorclinic') : '';
     $regulation = $request->getParam('regulation') ? $request->getParam('regulation') : '';
     $pageIndex = $request->getParam('page', 1);
     $perPage = $request->getParam('perpage', 10);
     $offset = ($pageIndex - 1) * $perPage;
     $pageRange = 10;
     if ($sort) {
         $sort = ';' . $sort;
     } else {
         $sort = '';
     }
     if ($by) {
         $createdBy = ' createdBy:' . $by;
     } else {
         $createdBy = '';
     }
     if ($author) {
         $fauthor = ' author:' . $author;
     } else {
         $fauthor = '';
     }
     if ($ac) {
         $fac = ' kontributor:' . $ac;
     } else {
         $fac = '';
     }
     if ($regulation) {
         $regulationType = ' regulationType:' . $regulation;
     } else {
         $regulationType = '';
     }
     if ($p == 'peraturan') {
         $profile = 'profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan)';
     } else {
         if ($p == 'article') {
             $profile = 'profile:(article OR isuhangat)';
         } else {
             if ($p == 'klinik') {
                 $profile = 'profile:klinik';
             } else {
                 $profile = 'profile:kutu_putusan';
             }
         }
     }
     $querySolr = $profile . $regulationType . $createdBy . $fauthor . $fac . " createdDate:{$y}*{$sort}";
     /*
     $db = Zend_Db_Table::getDefaultAdapter()->query
     ("SELECT guid from KutuCatalog where profileGuid IN ('kutu_peraturan','kutu_peraturan_kolonial','kutu_rancangan_peraturan') AND YEAR(createdDate)='". $y ."'");
     
     $rowset = $db->fetchAll(Zend_Db::FETCH_OBJ);
     
     $numi = count($rowset);
     */
     $solrAdapter = Pandamp_Search::manager();
     /*
             $sSolr = "id:(";
             for($i=0;$i<$numi;$i++)
             {
                 $row = $rowset[$i];
                 $sSolr .= $row->guid .' ';
             }
             $sSolr .= ')';
     
             if(!$numi)
     	$sSolr="id:(hfgjhfdfka)";
     */
     $solrResult = $solrAdapter->find($querySolr, $offset, $perPage);
     $solrNumFound = count($solrResult->response->docs);
     /*$solrResult = $solrAdapter->findAndSort($sSolr,$offset,$perPage, 'date desc');
       $solrNumFound = $solrResult->response->numFound;*/
     $content = 0;
     $data = array();
     if ($solrNumFound == 0) {
     } else {
         for ($ii = 0; $ii < $solrNumFound; $ii++) {
             if (isset($solrResult->response->docs[$ii])) {
                 $row = $solrResult->response->docs[$ii];
                 if (!empty($row)) {
                     $data[$ii][0] = $row->id;
                     $data[$ii][1] = $row->title;
                     $data[$ii][2] = $row->createdDate;
                     $data[$ii][3] = $row->modifiedDate;
                     $data[$ii][4] = $row->createdBy;
                     $data[$ii][5] = $row->modifiedBy;
                     if ($p == 'peraturan') {
                         $rowAssetDesktop = App_Model_Show_AssetSetting::show()->getHits($row->id, 'pusatdata');
                         $rowAssetMobile = App_Model_Show_AssetSetting::show()->getHits($row->id, 'pusatdata-mobile');
                         $data[$ii][6] = $rowAssetDesktop ? $rowAssetDesktop['valueInt'] . ' hits' : '';
                         $data[$ii][7] = $rowAssetMobile ? $rowAssetMobile['valueInt'] . ' hits' : '';
                         $data[$ii][8] = isset($row->number) ? $row->number : '';
                         $data[$ii][9] = $row->year;
                         $data[$ii][10] = isset($row->date) ? $row->date : '';
                         $data[$ii][11] = isset($row->regulationType) ? $row->regulationType : '';
                     } else {
                         if ($p == 'article') {
                             $rowAssetDesktop = App_Model_Show_AssetSetting::show()->getHits($row->id, 'TICKER');
                             $rowAssetMobile = App_Model_Show_AssetSetting::show()->getHits($row->id, 'TICKER-MOBILE');
                             $data[$ii][6] = $rowAssetDesktop ? $rowAssetDesktop['valueInt'] . ' hits' : '';
                             $data[$ii][7] = $rowAssetMobile ? $rowAssetMobile['valueInt'] . ' hits' : '';
                             $data[$ii][8] = isset($row->publishedDate) ? $row->publishedDate : '';
                             $data[$ii][9] = isset($row->author) ? $row->author : '';
                         }
                     }
                 }
             }
         }
         $this_url = $this->getRequest()->getRequestUri();
         $this_url = str_replace("&page={$pageIndex}", "", $this_url);
         if (strpos($this_url, '?')) {
             $sAddition = '&';
         } else {
             $sAddition = '?';
         }
         /**
          * Paginator
          */
         $paginator = Zend_Paginator::factory($solrResult->response->numFound);
         $paginator->setCurrentPagenumber($pageIndex);
         $paginator->setItemCountPerPage($perPage);
         $paginator->setPageRange($pageRange);
         $scrollType = 'Sliding';
         //change this to 'All', 'Elastic', 'Sliding' or 'Jumping' to test all scrolling types
         $paginator = get_object_vars($paginator->getPages($scrollType));
         $this->view->assign('this_url', $this_url . $sAddition);
         $this->view->assign('pageIndex', $pageIndex);
         $this->view->assign('paginator', $paginator);
         $this->view->assign('data', $data);
         $this->view->assign('numberOfRows', $solrNumFound);
     }
     $this->view->assign('y', $y);
     $this->view->assign('p', $p);
     $this->view->assign('by', $by);
     $this->view->assign('sort', $sort);
     $this->view->assign('author', $author);
     $this->view->assign('authorclinic', $ac);
     $this->view->assign('perpage', $perPage);
     $this->view->assign('regulation', $regulation);
     //$this->view->assign('totalOfRows', $numi);
     $this->view->assign('totalOfRows', $solrResult->response->numFound);
 }
Ejemplo n.º 30
0
 /**
  * @todo SOLR for category clinic
  */
 function kadetAction()
 {
     $this->_helper->layout->disableLayout();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
     $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
     $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid);
     if ($rowset) {
         $category = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedKategoriKlinik');
         /* Get Category from profile clinic_category */
         $findCategory = $decorator->getCatalogByGuidAsEntity($category);
         if (isset($findCategory)) {
             //$category = $modelCatalogAttribute->getCatalogAttributeValue($findCategory->getId(),'fixedTitle');
             $category = $findCategory->getId();
         }
     }
     //$this->view->category = $category;
     //$c = str_replace(' ','%',$category);
     //$query = "kategori:$c status:99 -id:$catalogGuid;publishedDate desc";
     $query = "profile:klinik kategoriklinik:{$category} status:99 -id:{$catalogGuid};publishedDate desc";
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 10);
     $solrNumFound = count($hits->response->docs);
     $content = 0;
     $data = array();
     for ($ii = 0; $ii < $solrNumFound; $ii++) {
         $row = $hits->response->docs[$ii];
         $data[$content][0] = $row->id;
         $data[$content][1] = $row->title;
         $content++;
     }
     $num_rows = $solrNumFound;
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }