Example #1
0
 function doindexAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $title = "<h4>HUKUMONLINE INDONESIA: <small>indexing</small></h4><hr/>";
     echo $title . '<br>';
     $modelCatalogFolder = new App_Model_Db_Table_CatalogFolder();
     $rowset = $modelCatalogFolder->fetchAll("folderGuid='fb16'", NULL, 2, 0);
     $solrAdapter = Pandamp_Search::manager();
     //$solrAdapter->emptyIndex();
     $solrAdapter->reIndexCatalog();
     //$solrAdapter->indexCatalog("hol10111");
     /*
             $numi = count($rowset);
             for($i=0;$i<$numi;$i++)
             {
        $row = $rowset[$i];
        $solrAdapter->indexCatalog($row['catalogGuid']);
        //$solrAdapter->deleteCatalogFromIndex($row['catalogGuid']);
        $message = "
            <div class='box box-info closeable'>
            CatalogGuid&nbsp;:&nbsp;<abbr>".$row['catalogGuid']."</abbr> data has been successfully indexed.
            </div>";
        echo $message.'<br>';
             }
     *
     */
 }
Example #2
0
 public function getNode($catalogGuid)
 {
     $modelCatalogFolder = new App_Model_Db_Table_CatalogFolder();
     $rowset = $modelCatalogFolder->fetchRow("catalogGuid='" . $catalogGuid . "'");
     if ($rowset) {
         return $rowset->folderGuid;
     } else {
         return;
     }
 }
Example #3
0
 public function copyFolderContent($currentFolderGuid, $newCatalogGuid)
 {
     $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
     $rowset = $tblCatalogFolder->fetchAll("folderGuid = '{$currentFolderGuid}'");
     if (count($rowset) > 0) {
         foreach ($rowset as $row) {
             $newContent = $tblCatalogFolder->createRow();
             $newContent->folderGuid = $newCatalogGuid;
             $newContent->catalogGuid = $row->catalogGuid;
             $newContent->save();
         }
     }
 }
Example #4
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;
 }
Example #5
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);
 }
Example #6
0
 public function removeFromFolder($catalogGuid, $folderGuid)
 {
     $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
     $rowset = $tblCatalogFolder->fetchAll("catalogGuid='{$catalogGuid}'");
     if (count($rowset) > 1) {
         try {
             $tblCatalogFolder->delete("catalogGuid='{$catalogGuid}' AND folderGuid='{$folderGuid}'");
         } catch (Exception $e) {
             throw new Zend_Exception($e->getMessage());
         }
     } else {
         throw new Zend_Exception("Can not remove from the only FOLDER.");
     }
 }
Example #7
0
 function _browseAction()
 {
     $r = $this->getRequest();
     $sOffset = $r->getParam('sOffset') ? $r->getParam('sOffset') : 0;
     $this->view->sOffset = $sOffset;
     $sLimit = $r->getParam('sLimit') ? $r->getParam('sLimit') : 0;
     $this->view->sLimit = $sLimit;
     $category = $r->getParam('category') ? $r->getParam('category') : '';
     if ($category == "all") {
         $category = "";
     }
     $query = $r->getParam('q') ? $r->getParam('q') : '';
     $indexingEngine = Pandamp_Search::manager();
     if (empty($query)) {
         //$hits = $indexingEngine->find("*:*;publishedDate desc",$sOffset, $sLimit);
         $hits = $indexingEngine->find("*:*", $sOffset, $sLimit);
     } else {
         if ($category) {
             $querySolr = $query . ' profile:' . $category;
         } else {
             //$hits = $indexingEngine->find($query." -profile:kutu_doc;publishedDate desc",$sOffset, $sLimit);
             $querySolr = $query . " -profile:kutu_doc";
         }
         $hits = $indexingEngine->find($querySolr, $sOffset, $sLimit);
     }
     $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] = isset($row->title) ? $row->title : '';
         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
         $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$row->id}'");
         if ($rowsetCatalogFolder) {
             $parentGuid = $rowsetCatalogFolder->folderGuid;
         } else {
             $parentGuid = '';
         }
         $data[$content][2] = $parentGuid;
         $profileSolr = str_replace("kutu_", "", $row->profile);
         $data[$content][3] = $profileSolr;
         $data[$content][4] = $row->createdDate;
         $data[$content][5] = $row->createdBy;
         $data[$content][6] = $row->modifiedDate;
         $data[$content][7] = $row->modifiedBy;
         $data[$content][8] = $row->publishedDate;
         $data[$content][9] = $row->status;
         $content++;
     }
     switch ($category) {
         case "kutu_peraturan":
         case "kutu_rancangan_peraturan":
         case "kutu_peraturan_kolonial":
             $ct = "(kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_peraturan)";
             break;
         case "":
             $ct = "all";
             break;
         default:
             $ct = $category;
             break;
     }
     $this->_helper->layout()->categorySearchQuery = $ct;
     $num_rows = $solrNumFound;
     $this->view->query = $query;
     $this->view->totalItems = $hits->response->numFound;
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #8
0
 protected function _traverseFolder_($folderGuid, $sGuid, $level)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $sGuid = '';
     /*
     if(count($rowSet))
     {
     	$sGuid = $row->guid;
     }
     else
     {
     	$sGuid = $row->guid;
     }
     */
     //		if(true)
     //		{
     //echo $level;
     foreach ($rowSet as $row) {
         //$sTab = '<ul>';
         //$sTab = '';
         //for($i=0;$i<$level;$i++)
         //$sTab .= '<li>';
         //$option = '<option value="'.$row->guid.'">'.$sTab.$row->title.'</option>';
         //$option = '"'.$row->guid.'" :'.'"'.$sTab.$row->title.'",';
         //$option = $sTab.$row->title;
         $sGuid .= $this->_traverseFolder_($row->guid, '', $level + 1) . "";
         //echo $row->guid.'<br>';
         echo 'Insert ' . $row->title . '<br>';
         $tblFolder = new App_Model_Db_Table_Migration_Detik_Folder();
         $rowFolder = $tblFolder->fetchNew();
         $rowFolder->guid = $row->guid;
         $rowFolder->title = $row->title;
         $rowFolder->description = $row->description;
         $rowFolder->parentGuid = $row->parentGuid;
         $rowFolder->path = $row->path;
         $rowFolder->type = $row->type;
         $rowFolder->viewOrder = $row->viewOrder;
         $rowFolder->cmsParams = $row->cmsParams;
         //$rowFolder->save();
         $rowCatalog = App_Model_Show_Catalog::show()->fetchCatalogInFolder4Mig($row->guid);
         //print_r($row->guid);die();
         if ($rowCatalog) {
             foreach ($rowCatalog as $rc) {
                 $rowsetCatalogAttributeJenis = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rc['guid'], 'prtJenis');
                 //print_r($rowsetCatalogAttributeJenis);
                 if ($rowsetCatalogAttributeJenis == 'Undang-Undang ' || $rowsetCatalogAttributeJenis == "uu" || $rowsetCatalogAttributeJenis == "pp" || $rowsetCatalogAttributeJenis == "Peraturan Pemerintah" || $rowsetCatalogAttributeJenis == "konstitusi") {
                     $modelMigrationCatalog = new App_Model_Db_Table_Migration_Detik_Catalog();
                     $where = $modelMigrationCatalog->getAdapter()->quoteInto('guid=?', $rc['guid']);
                     if (!$modelMigrationCatalog->fetchRow($where)) {
                         $data1 = array('guid' => $rc['guid'], 'shortTitle' => $rc['shortTitle'], 'profileGuid' => $rc['profileGuid'], 'publishedDate' => $rc['publishedDate'], 'expiredDate' => $rc['expiredDate'], 'createdBy' => $rc['createdBy'], 'modifiedBy' => $rc['modifiedBy'], 'createdDate' => $rc['createdDate'], 'modifiedDate' => $rc['modifiedDate'], 'deletedDate' => $rc['deletedDate'], 'price' => isset($rc['price']) ? $rc['price'] : 0, 'status' => $rc['status']);
                         $modelMigrationCatalog->insert($data1);
                         $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
                         $rcam = $tblCatalogAttribute->fetchAll("catalogGuid='" . $rc['guid'] . "'");
                         foreach ($rcam as $rowca) {
                             $modelMigrationCatalogAttribute = new App_Model_Db_Table_Migration_Detik_CatalogAttribute();
                             $data2 = array('catalogGuid' => $rowca->catalogGuid, 'attributeGuid' => $rowca->attributeGuid, 'value' => $rowca->value);
                             $modelMigrationCatalogAttribute->insert($data2);
                         }
                         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
                         $rcfm = $tblCatalogFolder->fetchAll("catalogGuid='" . $rc['guid'] . "'");
                         foreach ($rcfm as $rowcf) {
                             $modelMigrationCatalogFolder = new App_Model_Db_Table_Migration_Detik_CatalogFolder();
                             $data3 = array('catalogGuid' => $rowcf->catalogGuid, 'folderGuid' => $rowcf->folderGuid);
                             $modelMigrationCatalogFolder->insert($data3);
                         }
                         $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
                         $rrim = $tblRelatedItem->fetchAll("relatedGuid='" . $rc['guid'] . "'");
                         foreach ($rrim as $rowri) {
                             $modelMigrationRelatedItem = new App_Model_Db_Table_Migration_Detik_RelatedItem();
                             $rowRelated = $modelMigrationRelatedItem->createNew();
                             $rowRelated->itemGuid = $rowri->itemGuid;
                             $rowRelated->relatedGuid = $rowri->relatedGuid;
                             $rowRelated->relateAs = $rowri->relateAs;
                             $rowRelated->valueIntRelation = $rowri->valueIntRelation;
                             $rowRelated->save();
                         }
                     }
                 }
             }
         }
         //$sGuid .= $sTab.$row->title . '|<br>'. $this->_traverseFolder($row->guid, '', $level+1);
     }
     //			if(count($rowSet))
     //			{
     //				return $sGuid;
     //			}
     //			else
     //			{
     //				return $sGuid;
     //			}
     //		}
 }
Example #9
0
 function viewFolderNavigationAction()
 {
     $browserUrl = ROOT_URL . '/pusatdata/view/node';
     $folderGuid = $this->_getParam('node') ? $this->_getParam('node') : 'root';
     $tblFolder = new App_Model_Db_Table_Folder();
     $aPath = array();
     if ($folderGuid == 'root') {
         $aPath[0]['title'] = 'Root';
         $aPath[0]['url'] = $browserUrl;
     } else {
         $rowFolder = $tblFolder->find($folderGuid)->current();
         if (!isset($rowFolder)) {
             $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
             $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$folderGuid}'");
             if ($rowsetCatalogFolder) {
                 $rowFolder = $tblFolder->find($rowsetCatalogFolder->folderGuid)->current();
             }
         }
         if (!empty($rowFolder->path)) {
             $aFolderGuid = explode("/", $rowFolder->path);
             $sPath = 'root >';
             $aPath[0]['title'] = 'Root';
             $aPath[0]['url'] = $browserUrl;
             $i = 1;
             if (count($aFolderGuid)) {
                 $sPath1 = '';
                 foreach ($aFolderGuid as $guid) {
                     if (!empty($guid)) {
                         $rowFolder1 = $tblFolder->find($guid)->current();
                         $sPath1 .= $rowFolder1->title . ' > ';
                         $aPath[$i]['title'] = $rowFolder1->title;
                         $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder1->guid;
                         $i++;
                     }
                 }
                 $aPath[$i]['title'] = $rowFolder->title;
                 $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid;
             }
         } else {
             $aPath[0]['title'] = 'Root';
             $aPath[0]['url'] = $browserUrl;
             $aPath[1]['title'] = $rowFolder->title;
             $aPath[1]['url'] = $browserUrl . '/' . $rowFolder->guid;
         }
     }
     $this->view->aPath = $aPath;
 }
Example #10
0
 public function moveToFolder($sourceFolder, $targetFolder)
 {
     $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
     $this->copyToFolder($targetFolder);
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}' AND folderGuid='{$sourceFolder}'");
 }
Example #11
0
 public function getcatalogsearchAction()
 {
     $this->_helper->layout()->disableLayout();
     $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;
     $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 . ';' . $orderBy . $sortOrder;
         } else {
             $querySolr = $query . ' -profile:kutu_doc status:99;' . $orderBy . $sortOrder;
         }
         $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='" . ROOT_URL . "/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='" . ROOT_URL . "/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='" . ROOT_URL . "/klinik/detail/" . $row->id . "' class='searchlink'><b>{$row->title}</b></a>";
                             } else {
                                 $title = "[<b><font color='#FFAD29'>" . $row->kategori . "</font></b>]&nbsp;<a href='" . ROOT_URL . "/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 (isset($hits->highlighting->{$row->id}->title[0])) {
                                 $title = "<a href='" . ROOT_URL . "/berita/baca/" . $row->id . "/" . $row->shortTitle . "' class='searchlink'><b>" . $hits->highlighting->{$row->id}->title[0] . "</b></a>";
                             } else {
                                 $title = "<a href='" . ROOT_URL . "/berita/baca/" . $row->id . "/" . $row->shortTitle . "' 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='" . ROOT_URL . "/pusatdata/detail/" . $row->id . "/" . $node . "/" . $parentGuid . "' class='searchlink'><b>" . $hits->highlighting->{$row->id}->title[0] . "</b></a>";
                                 } else {
                                     $title = "<a href='" . ROOT_URL . "/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 : '';
                                 $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);
                     $a['catalogs'][$ii]['profile'] = $profileSolr;
                     $a['catalogs'][$ii]['title'] = $title ? $title : '';
                     $a['catalogs'][$ii]['guid'] = $row->id;
                     $a['catalogs'][$ii]['score'] = "score:" . $row->score;
                     $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);
 }