예제 #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
 protected function _postDelete()
 {
     //find related docs and delete them
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($this->profileGuid == 'kutu_doc') {
         //get parentGuid
         $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
         if (count($rowsetRelatedItem)) {
             foreach ($rowsetRelatedItem as $rowRelatedItem) {
                 //must delete the physical files
                 $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute();
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 if (file_exists($sDir1)) {
                     //delete file
                     unlink($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         //delete file
                         unlink($sDir2);
                     }
                 }
             }
         }
     }
     //delete from table CatalogAttribute
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'");
     //delete catalogGuid from table CatalogFolder
     $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder();
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}'");
     //delete guid from table AssetSetting
     $tblAssetSetting = new Kutu_Core_Orm_Table_AssetSetting();
     $tblAssetSetting->delete("guid='{$this->guid}'");
     //delete from table relatedItem
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $tblRelatedItem->delete("itemGuid='{$this->guid}'");
     $tblRelatedItem->delete("relatedGuid='{$this->guid}'");
     //delete physical catalog folder from uploads/files/[catalogGuid]
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $this->guid;
     try {
         if (is_dir($sDir)) {
             rmdir($sDir);
         }
     } catch (Exception $e) {
     }
     //delete from index
     try {
         $indexingEngine = Kutu_Search::manager();
         $indexingEngine->deleteCatalogFromIndex($this->guid);
     } catch (Exception $e) {
     }
     //delete from ACL
 }
예제 #3
0
파일: Catalog.php 프로젝트: hukumonline/idh
 protected function _postDelete()
 {
     //find related docs and delete them
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($this->profileGuid == 'kutu_doc') {
         //get parentGuid
         $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
         if (count($rowsetRelatedItem)) {
             foreach ($rowsetRelatedItem as $rowRelatedItem) {
                 //must delete the physical files
                 $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute();
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 if (file_exists($sDir1)) {
                     //delete file
                     unlink($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         //delete file
                         unlink($sDir2);
                     }
                 }
             }
         }
     }
     //delete from table CatalogAttribute
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'");
     //delete catalogGuid from table CatalogFolder
     $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder();
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}'");
     //delete guid from table AssetSetting
     $tblAssetSetting = new Kutu_Core_Orm_Table_AssetSetting();
     $tblAssetSetting->delete("guid='{$this->guid}'");
     //delete from table relatedItem
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $tblRelatedItem->delete("itemGuid='{$this->guid}'");
     $tblRelatedItem->delete("relatedGuid='{$this->guid}'");
     //delete from lucene index
     //check if guid exist in index, then delete
     //		$indexEngine = new Kutu_Search_Index_Engine();
     //		$indexEngine->deleteCatalogFromIndex($this->guid);
     $registry = Zend_Registry::getInstance();
     $conf = $registry->get('config');
     $indexingEngine = Kutu_Search::manager();
     try {
         $hits = $indexingEngine->deleteCatalogFromIndex($this->guid);
     } catch (Exception $e) {
     }
     /*
     $tblTmpIndex = new Kutu_Core_Orm_Table_TmpIndex();
     $rowTmpIndex = $tblTmpIndex->fetchNew();
     $rowTmpIndex->catalogGuid = $this->guid;
     $rowTmpIndex->status = 'delete';
     $rowTmpIndex->save();
     */
     $tblTmpIndex = new Kutu_Core_Orm_Table_TmpIndex();
     $tblTmpIndex->delete("catalogGuid='{$this->guid}'");
     //delete physical catalog folder from uploads/files/[catalogGuid]
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $this->guid;
     try {
         if (is_dir($sDir)) {
             rmdir($sDir);
         }
     } catch (Exception $e) {
     }
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images';
     try {
         if (file_exists($sDir . "/" . $this->guid . ".gif")) {
             unlink($sDir . "/" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".gif")) {
             unlink($sDir . "/tn_" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpg")) {
             unlink($sDir . "/" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpg")) {
             unlink($sDir . "/tn_" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpeg")) {
             unlink($sDir . "/" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpeg")) {
             unlink($sDir . "/tn_" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".png")) {
             unlink($sDir . "/" . $this->guid . ".png");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".png")) {
             unlink($sDir . "/tn_" . $this->guid . ".png");
         }
     } catch (Exception $e) {
     }
     //delete from ACL
 }
예제 #4
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;
 }
예제 #5
0
 protected function _populateCatalogAttribute()
 {
     $this->_aRowCatalogAttribute = array();
     $tableProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute();
     $profileGuid = $this->_rowCatalog->profileGuid;
     $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
     $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
     $rowsetCatalogAttribute = $this->_rowCatalog->findDependentRowsetCatalogAttribute();
     foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
         if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
             //array_push($this->_aRowCatalogAttribute);
             $this->_aRowCatalogAttribute[$rowCatalogAttribute->attributeGuid] = $rowCatalogAttribute;
             //echo "rowcatalogattribute:" . $rowCatalogAttribute->attributeGuid;
         } else {
             $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $this->_rowCatalog->guid;
             $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid;
             $this->_aRowCatalogAttribute[$rowCatalogAttribute->attributeGuid] = $rowCatalogAttribute;
         }
     }
 }
예제 #6
0
 function putusan_ptsHakim()
 {
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $rowsetCatalogAttribute = $tblCatalogAttribute->fetchAll("attributeGuid='ptsHakim'");
     foreach ($rowsetCatalogAttribute as $rowCatalogAttribute) {
         switch ($rowCatalogAttribute->value) {
             case 'Majelis':
                 $rowCatalogAttribute->value = 'majelis';
                 $rowCatalogAttribute->save();
                 break;
             case 'Tunggal':
                 $rowCatalogAttribute->value = 'tunggal';
                 $rowCatalogAttribute->save();
                 break;
         }
     }
 }
예제 #7
0
파일: Catalog.php 프로젝트: psykomo/kutump
 public function save($aData)
 {
     //do minimal pre-requisite of aData
     if (empty($aData['fixedTitle'])) {
         throw new Zend_Exception('Catalog Title can not be EMPTY!');
     }
     if (empty($aData['profileGuid'])) {
         throw new Zend_Exception('Catalog Profile can not be EMPTY!');
     }
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $gman = new Kutu_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();
         //echo "guid ditemukan:" .$rowCatalog->guid;
         $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : $rowCatalog->shortTitle;
         //$rowCatalog->profileGuid = $request->getParam('profileGuid');
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : $rowCatalog->publishedDate;
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : $rowCatalog->expiredDate;
         //$rowCatalog->createdBy = $request->getParam('createdBy');
         //$rowCatalog->modifiedBy = ($aData['username'])?$aData['username']:'';
         //$rowCatalog->createdDate = $request->getParam('createdDate');
         //$rowCatalog->modifiedDate = $aData['modifiedDate'];
         //$rowCatalog->deletedDate = $request->getParam('deletedDate');
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : $rowCatalog->status;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : $rowCatalog->price;
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         //echo "guid tidak ditemukan";
         $rowCatalog->guid = $catalogGuid;
         $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : '';
         $rowCatalog->profileGuid = $aData['profileGuid'];
         $rowCatalog->publishedDate = '0000-00-00 00:00:00';
         $rowCatalog->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 Kutu_Core_Orm_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);
             //echo "rowcatalogattribute:" . $rowCatalogAttribute->attributeGuid;
         } else {
             $tblCatalogAttribute = new Kutu_Core_Orm_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)) {
         $rowCatalog->copyToFolder($folderGuid);
     }
     //do indexing
     $indexingEngine = Kutu_Search::manager();
     $indexingEngine->indexCatalog($catalogGuid);
     //after indexing, update isIndex and indexedDate in table KutuCatalog
     return $catalogGuid;
 }
 private function _createDocs($sourceCatalogId, $guidPrefix = 'lgsimpfl')
 {
     // get all related documents
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $this->_dbSource->setFetchMode(Zend_Db::FETCH_OBJ);
     $rowsetDocItem = $this->_dbSource->fetchAll("SELECT * from tblDms_DocItem A  \n\t\t\t\tWHERE A.CatalogID = {$sourceCatalogId}");
     foreach ($rowsetDocItem as $rowDocItem) {
         $rowsetCatalog = $tblCatalog->find($guidPrefix . $rowDocItem->DocItemID);
         if (count($rowsetCatalog) == 0) {
             $rowCatalog = $tblCatalog->fetchNew();
             $rowCatalog->guid = $guidPrefix . $rowDocItem->DocItemID;
             echo "KITI: " . $rowCatalog->guid;
             $sFileAsli = str_replace(array('_', '.'), '-', $rowDocItem->DocFileAsli);
             $rowCatalog->shortTitle = $sFileAsli;
             $rowCatalog->profileGuid = "kutu_doc";
             $rowCatalog->createdBy = $rowDocItem->DocCreator;
             $rowCatalog->modifiedBy = $rowDocItem->DocModifier;
             $rowCatalog->createdDate = $rowDocItem->DocCreated;
             $rowCatalog->modifiedDate = $rowDocItem->DocModified;
             $rowCatalog->save();
             $rowExp = $this->_dbSource->fetchRow("Select * from tblDms_Exp_Seq where DocItemID={$rowDocItem->DocItemID} AND DocumentID={$rowDocItem->CatalogID}");
             //	untuk catalogAttributenya tambahan agar isinya fixedTitle,dsb itu
             // fixedTitle
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'fixedTitle';
             if (empty($rowExp->Friendlyname)) {
                 $rowCatalogAttribute->value = $rowDocItem->DocFileAsli;
             } else {
                 $rowCatalogAttribute->value = $rowExp->Friendlyname;
             }
             $rowCatalogAttribute->save();
             // fixedKeywords
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'fixedKeywords';
             $rowCatalogAttribute->value = "";
             $rowCatalogAttribute->save();
             // fixedDescription
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'fixedDescription';
             $rowCatalogAttribute->value = "";
             $rowCatalogAttribute->save();
             // fixedLanguage
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'fixedLanguage';
             $rowCatalogAttribute->value = "en";
             $rowCatalogAttribute->save();
             // docCategoryGuid
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'docCategoryGuid';
             $rowCatalogAttribute->value = "";
             $rowCatalogAttribute->save();
             // docSystemName
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'docSystemName';
             $rowCatalogAttribute->value = $rowDocItem->DocFileName;
             $rowCatalogAttribute->save();
             // docOriginalName
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'docOriginalName';
             $rowCatalogAttribute->value = $rowDocItem->DocFileAsli;
             $rowCatalogAttribute->save();
             // docSize
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'docSize';
             $rowCatalogAttribute->value = $rowDocItem->DocSize;
             $rowCatalogAttribute->save();
             // docMimeType
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowCatalogAttribute->attributeGuid = 'docMimeType';
             $rowCatalogAttribute->value = $rowDocItem->DocType;
             $rowCatalogAttribute->save();
         } else {
             echo 'Data tidak disimpan';
         }
         // related the file/document as RELATED_FILE
         $rowsetRelatedItem = $tblRelatedItem->find($guidPrefix . $rowDocItem->DocItemID, 'lgsimpdms' . $rowDocItem->CatalogID, "RELATED_FILE");
         if (count($rowsetRelatedItem) == 0) {
             $rowRelation = $tblRelatedItem->createNew();
             $rowRelation->itemGuid = $guidPrefix . $rowDocItem->DocItemID;
             $rowRelation->relatedGuid = 'lgsimpdms' . $rowDocItem->CatalogID;
             $rowRelation->relateAs = "RELATED_FILE";
             if (isset($rowExp->Sequence)) {
                 $rowRelation->valueIntRelation = $rowExp->Sequence;
             }
             $rowRelation->save();
             //echo "<font color=blue>Record ke = ".$r." dari itemGuid = fl".$row->DocItemID." - ".$row->CatalogID." relasi file di-saved</font><br>";
         }
     }
 }