示例#1
0
 function commentAction()
 {
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $modelCatalog->fetchAll("profileGuid='comment'");
     foreach ($rowset as $row) {
         $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
         try {
             $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment();
             $comment = $modelComment->fetchNew();
             $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
             $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='" . $row->guid . "' AND relateAs='RELATED_COMMENT'");
             $comment->object_id = $rowsetRelatedItem->relatedGuid;
             $comment->userid = 0;
             $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
             $comment->name = $rowsetCatalogAttribute->findByAttributeGuid('fixedName')->value;
             $comment->email = $rowsetCatalogAttribute->findByAttributeGuid('fixedEmail')->value;
             $comment->title = $rowsetCatalogAttribute->findByAttributeGuid('fixedJudul')->value;
             $comment->comment = $rowsetCatalogAttribute->findByAttributeGuid('fixedComment')->value;
             $comment->ip = 0;
             $comment->date = $row->createdDate;
             $comment->published = $row->status;
             $comment->checked_out_time = $row->publishedDate;
             $comment->save();
             echo $comment->title . ' saved<br>';
         } catch (Zend_Exception $e) {
             echo $e->getMessage() . '<br>';
         }
     }
 }
示例#2
0
 public function delete($catalogGuid)
 {
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->find($catalogGuid);
     if (count($rowset)) {
         $row = $rowset->current();
         $profileGuid = $row->profileGuid;
         if ($row->profileGuid == 'kutu_doc') {
             $rowRelatedItem = $tblRelatedItem->fetchRow("itemGuid='{$row->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')");
         }
         $row->delete();
         //if deleted catalog is kutu_doc then re-index its parentGuid
         if ($profileGuid == 'kutu_doc') {
             $indexingEngine = Pandamp_Search::manager();
             $indexingEngine->indexCatalog($rowRelatedItem->relatedGuid);
         }
     }
 }
示例#3
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);
 }
示例#4
0
 public function searchAction()
 {
     $query = $this->_getParam('query');
     $category = $this->_getParam('qbox');
     $isrelate = $this->_getParam('isrelate');
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     try {
         switch ($category) {
             case 1:
                 $query = $query . ' profile:article';
                 break;
             case 2:
                 $query = $query . ' profile:klinik';
                 break;
             case 3:
                 $query = $query . ' profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan)';
                 break;
             default:
                 $query = $query;
         }
         $indexingEngine = Pandamp_Search::manager();
         $hits = $indexingEngine->find($query, $start, $end);
         $a = array();
         $a['totalCount'] = $hits->response->numFound;
         $i = 0;
         if ($hits->response->numFound > 0) {
             foreach ($hits->response->docs as $hit) {
                 $a['search'][$i]['guid'] = $hit->id;
                 if ($hit->profile == 'kutu_doc') {
                     $title = 'File : ' . $hit->title;
                 } else {
                     $title = isset($hit->title) ? $hit->title : 'No-Title';
                 }
                 $a['search'][$i]['title'] = $title;
                 if (!isset($hit->subTitle)) {
                     $subTitle = '';
                 } else {
                     $subTitle = $hit->subTitle;
                 }
                 $a['search'][$i]['subtitle'] = $subTitle;
                 if ($hit->profile == 'kutu_doc') {
                     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
                     $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='{$hit->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='{$hit->id}'");
                     if ($rowsetCatalogFolder) {
                         $parentGuid = $rowsetCatalogFolder->folderGuid;
                     } else {
                         $parentGuid = '';
                     }
                 }
                 $a['search'][$i]['folderGuid'] = $parentGuid;
                 if ($isrelate) {
                     $a['search'][$i]['value'] = 'Select Relation';
                 }
                 $i++;
             }
         }
         if ($hits->response->numFound == 0) {
             $a['search'][0]['guid'] = 'XXX';
             $a['search'][0]['title'] = "No Data";
             $a['search'][0]['subtitle'] = "-";
         }
     } catch (Exception $e) {
         $a['search'][0]['guid'] = 'XXX';
         $a['search'][0]['title'] = "No Data";
         $a['search'][0]['subtitle'] = $e->getMessage();
     }
     echo Zend_Json::encode($a);
 }