예제 #1
0
 public function getCatalogTitle($catalogGuid)
 {
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $where2 = "catalogGuid='{$catalogGuid}' AND attributeGuid='fixedTitle'";
     $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
     if (isset($rowCatalogAttribute->value) && !empty($rowCatalogAttribute->value)) {
         return $rowCatalogAttribute->value;
     } else {
         return 'No-Title';
     }
 }
예제 #2
0
 function _getNodes($node, $relateAs = 'RELATED_ITEM')
 {
     $a = array();
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_RelatedItem');
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $where = "relatedGuid='{$node}' AND relateAs='{$relateAs}'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     foreach ($rowsetRelatedItem as $row) {
         $aTmp2['node'] = $row->itemGuid;
         $aTmp2['nodeLeft'] = $row->itemGuid;
         $aTmp2['nodeRight'] = $node;
         $aTmp2['description'] = $row->description;
         $aTmp2['relationType'] = $row->relationType;
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['title'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['title'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedSubTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['subTitle'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['subTitle'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedDate'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['fixedDate'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['fixedDate'] = '';
         }
         array_push($a, $aTmp2);
     }
     $where = "itemGuid='{$node}' AND relateAs='{$relateAs}'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     foreach ($rowsetRelatedItem as $row) {
         $aTmp2['node'] = $row->relatedGuid;
         $aTmp2['nodeLeft'] = $node;
         $aTmp2['nodeRight'] = $row->relatedGuid;
         $aTmp2['description'] = $row->description;
         $aTmp2['relationType'] = $row->relationType;
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['title'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['title'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedSubTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['subTitle'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['subTitle'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedDate'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['fixedDate'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['fixedDate'] = '';
         }
         array_push($a, $aTmp2);
     }
     return $a;
 }
 private function _migrateColumn($sourceColumnId, $targetFolderGuid)
 {
     // in Intra Prima a column can have sub column, but
     // fortunately, all columns in LGS Online don't have sub-columns.
     // So, we don't need to process sub-columns.
     //$this->_guidPrefix = 'lgscl'
     $sqlSource = "SELECT * from tblArticle where Column_ID='{$sourceColumnId}'";
     $this->_dbSource->setFetchMode(Zend_Db::FETCH_OBJ);
     $results = $this->_dbSource->fetchAll($sqlSource);
     if (count($results)) {
         foreach ($results as $row) {
             // do mapping here
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowCatalog = $tblCatalog->find($this->_guidPrefix . $row->Article_ID);
             if (count($rowCatalog) <= 0) {
                 $rowCatalog = $tblCatalog->fetchNew();
                 $rowCatalog->guid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalog->shortTitle = '';
                 $rowCatalog->profileGuid = "article";
                 $rowCatalog->createdBy = "admin";
                 $rowCatalog->modifiedBy = 'admin';
                 $rowCatalog->createdDate = $row->Date_Create;
                 $rowCatalog->modifiedDate = $row->LastUpdate;
                 $rowCatalog->publishedDate = $row->Date_Publish;
                 $rowCatalog->expiredDate = $row->Date_Expired;
                 if ($row->IsPublished === 1) {
                     $rowCatalog->status = 99;
                 } else {
                     $rowCatalog->status = $row->IsPublished;
                 }
                 $rowCatalog->save();
                 $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedTitle';
                 $rowCatalogAttribute->value = $this->_cleanChars($row->Title);
                 $rowCatalogAttribute->save();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedSubTitle';
                 $rowCatalogAttribute->value = $this->_cleanChars($row->Sub_Title);
                 $rowCatalogAttribute->save();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedDescription';
                 $rowCatalogAttribute->value = $this->_cleanChars($row->Description);
                 $rowCatalogAttribute->save();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedContent';
                 $rowCatalogAttribute->value = $this->_cleanChars($row->Content);
                 $rowCatalogAttribute->save();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedAuthor';
                 $rowCatalogAttribute->value = $this->_cleanChars($row->Source);
                 $rowCatalogAttribute->save();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedKeywords';
                 $rowCatalogAttribute->value = '';
                 $rowCatalogAttribute->save();
                 $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
                 $rowCatalogAttribute->catalogGuid = $this->_guidPrefix . $row->Article_ID;
                 $rowCatalogAttribute->attributeGuid = 'fixedLanguage';
                 $rowCatalogAttribute->value = 'en';
                 $rowCatalogAttribute->save();
                 //update KutuCatalogFolder
                 $rowCatalog = $tblCatalog->find($this->_guidPrefix . $row->Article_ID)->current();
                 $rowCatalog->copyToFolder($targetFolderGuid);
                 //do indexing
                 $indexingEngine = Kutu_Search::manager();
                 try {
                     $indexingEngine->indexCatalog($this->_guidPrefix . $row->Article_ID);
                 } catch (Exception $e) {
                     $sE = 'guid: ' . $this->_guidPrefix . $row->Article_ID . '<br>';
                     echo $sE . $e->getMessage() . '<br>&nbsp;<br>';
                     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
                     $rowCatalogAttribute = $tblCatalogAttribute->fetchRow("catalogGuid='{$rowCatalog->guid}' AND attributeGuid='fixedContent'");
                     include KUTU_ROOT_DIR . '/lib/htmLawed/htmLawed.php';
                     $config = array('clean_ms_char' => 2);
                     //$sTmp = htmLawed($sTmp);
                     $rowCatalogAttribute->value = $this->_cleanMsWordHtml($rowCatalogAttribute->value);
                     $rowCatalogAttribute->save();
                     //echo $rowCatalogAttribute->value;
                     try {
                         $indexingEngine->indexCatalog($rowCatalog->guid);
                     } catch (Exception $e) {
                         echo "TETEP AJA ERROR LAGI!";
                     }
                 }
                 //die('1 row processed: '.$this->_guidPrefix.$row->Article_ID);
             }
             // process Related Article
             $this->_migrateColumnRelatedItems($row->Article_ID);
         }
     }
 }