protected function _postDelete() { $registry = Zend_Registry::getInstance(); $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT); $cdn = $config->getOption('cdn'); //find related docs and delete them $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->relatedGuid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')"); if (count($rowsetRelatedDocs)) { foreach ($rowsetRelatedDocs as $rowRelatedDoc) { $systemname = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowRelatedDoc->itemGuid, 'docSystemName'); $parentGuid = $rowRelatedDoc->relatedGuid; $sDir1 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $systemname; $sDir2 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname; //$sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$systemname; //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$parentGuid.DIRECTORY_SEPARATOR.$systemname; if (file_exists($sDir1)) { unlink($sDir1); } else { if (file_exists($sDir2)) { unlink($sDir2); } } $systemname = $rowRelatedDoc->itemGuid; $parentGuid = $rowRelatedDoc->relatedGuid; $sDir = $cdn['static']['dir']['images']; $sDir2 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $parentGuid; //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'; //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$parentGuid; if (file_exists($sDir . "/" . $systemname . ".gif")) { unlink($sDir . "/" . $systemname . ".gif"); } if (file_exists($sDir . "/tn_" . $systemname . ".gif")) { unlink($sDir . "/tn_" . $systemname . ".gif"); } if (file_exists($sDir . "/" . $systemname . ".jpg")) { unlink($sDir . "/" . $systemname . ".jpg"); } if (file_exists($sDir . "/tn_" . $systemname . ".jpg")) { unlink($sDir . "/tn_" . $systemname . ".jpg"); } if (file_exists($sDir . "/" . $systemname . ".jpeg")) { unlink($sDir . "/" . $systemname . ".jpeg"); } if (file_exists($sDir . "/tn_" . $systemname . ".jpeg")) { unlink($sDir . "/tn_" . $systemname . ".jpeg"); } if (file_exists($sDir . "/" . $systemname . ".png")) { unlink($sDir . "/" . $systemname . ".png"); } if (file_exists($sDir . "/tn_" . $systemname . ".png")) { unlink($sDir . "/tn_" . $systemname . ".png"); } if (file_exists($sDir2 . "/" . $systemname . ".gif")) { unlink($sDir2 . "/" . $systemname . ".gif"); } if (file_exists($sDir2 . "/tn_" . $systemname . ".gif")) { unlink($sDir2 . "/tn_" . $systemname . ".gif"); } if (file_exists($sDir2 . "/" . $systemname . ".jpg")) { unlink($sDir2 . "/" . $systemname . ".jpg"); } if (file_exists($sDir2 . "/tn_" . $systemname . ".jpg")) { unlink($sDir2 . "/tn_" . $systemname . ".jpg"); } if (file_exists($sDir2 . "/" . $systemname . ".jpeg")) { unlink($sDir2 . "/" . $systemname . ".jpeg"); } if (file_exists($sDir2 . "/tn_" . $systemname . ".jpeg")) { unlink($sDir2 . "/tn_" . $systemname . ".jpeg"); } if (file_exists($sDir2 . "/" . $systemname . ".png")) { unlink($sDir2 . "/" . $systemname . ".png"); } if (file_exists($sDir2 . "/tn_" . $systemname . ".png")) { unlink($sDir2 . "/tn_" . $systemname . ".png"); } $tblCatalog = new App_Model_Db_Table_Catalog(); $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current(); $rowCatalog->delete(); } } }
protected function _postDelete() { //find related docs and delete them $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')"); if (count($rowsetRelatedDocs)) { foreach ($rowsetRelatedDocs as $rowRelatedDoc) { $tblCatalog = new App_Model_Db_Table_Catalog(); $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current(); if ($rowCatalog) { $rowCatalog->delete(); } } } $registry = Zend_Registry::getInstance(); $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT); $cdn = $config->getOption('cdn'); if ($this->profileGuid == 'kutu_doc') { //get parentGuid $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')"); if (count($rowsetRelatedItem)) { foreach ($rowsetRelatedItem as $rowRelatedItem) { //must delete the physical files $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute(); $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value; $parentGuid = $rowRelatedItem->relatedGuid; $sDir1 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $systemname; $sDir2 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname; //$sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$systemname; //$sDir2 = 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 App_Model_Db_Table_CatalogAttribute(); $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'"); //delete catalogGuid from table CatalogFolder $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder(); $tblCatalogFolder->delete("catalogGuid='{$this->guid}'"); //delete guid from table AssetSetting $tblAssetSetting = new App_Model_Db_Table_AssetSetting(); $tblAssetSetting->delete("guid='{$this->guid}'"); //delete from table relatedItem $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $tblRelatedItem->delete("itemGuid='{$this->guid}'"); $tblRelatedItem->delete("relatedGuid='{$this->guid}'"); $indexingEngine = Pandamp_Search::manager(); try { $hits = $indexingEngine->deleteCatalogFromIndex($this->guid); } catch (Exception $e) { } //delete physical catalog folder from uploads/files/[catalogGuid] $sDir = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $this->guid; //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$this->guid; try { if (is_dir($sDir)) { rmdir($sDir); } } catch (Exception $e) { } $sDir = $cdn['static']['dir']['images']; //$sDir = 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) { } }
public function getLegalBasis($catalogGuid) { $relatedItemDb = new App_Model_Db_Table_RelatedItem(); $relatedItems = $relatedItemDb->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs='RELATED_BASE'"); if (count($relatedItems) > 0) { return $relatedItems; } return; }
public function getImplementingRegulations($catalogGuid) { $relatedItemDb = new App_Model_Db_Table_RelatedItem(); $relatedItems = $relatedItemDb->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_BASE'"); if (count($relatedItems) > 0) { return $relatedItems; } return; }
public function getCatalogRelation($catalogGuid) { $relatedItemDb = new App_Model_Db_Table_RelatedItem(); $relatedItem = $relatedItemDb->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs IN ('RELATED_OTHER','RELATED_ISSUE','RELATED_Clinic')"); if (count($relatedItem) > 0) { return $relatedItem; } return; }
function dasarhukumAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_CLINIC_BASE'"; $rowsetRelatedItem = $tblRelatedItem->fetchAll($where); $num_rows = count($rowsetRelatedItem); $this->view->numberOfRows = $num_rows; $this->view->rowsetRelatedItem = $rowsetRelatedItem; }
public function getChildHistory($guid, $parent) { $helper = new Pandamp_Core_Hol_Relation(); $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $h1 = $tblRelatedItem->fetchAll("relatedGuid='{$guid}' AND relateAs IN ('ISROOT','AMEND','REPEAL','ESTABLISH')"); if (count($h1) > 0) { $data1 = array(); $content1 = 0; foreach ($h1 as $h1story) { $data1[$content1]['itemGuid'] = $h1story->itemGuid; $data1[$content1]['relatedGuid'] = $h1story->relatedGuid; $data1[$content1]['relateAs'] = $h1story->relateAs; $data1[$content1]['parent'] = $parent; $content1++; } } $h2 = $tblRelatedItem->fetchAll("itemGuid='{$guid}' AND relateAs IN ('ISROOT','AMEND','REPEAL','ESTABLISH')"); if (count($h2) > 0) { $data2 = array(); $content2 = 0; foreach ($h2 as $h) { $data2[$content2]['itemGuid'] = $h->relatedGuid; $data2[$content2]['relatedGuid'] = $h->relatedGuid; $data2[$content2]['relateAs'] = $h->relateAs; $data2[$content2]['parent'] = $parent; $content2++; } if (count($h1) > 0) { $merge = array_merge($data1, $data2); $merge = $helper->findperaturanyear($merge, $parent); return $merge; } return $helper->findperaturanyear($data2, $parent); } if (isset($data1)) { return $helper->findperaturanyear($data1, $parent); } }
public function getFilesImg($catalogGuid) { $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); //$where = "relatedGuid='$catalogGuid' AND relateAs='RELATED_FILE'"; $where = "relatedGuid='{$catalogGuid}' AND relateAs = 'RELATED_IMAGE'"; $rowsetRelatedItem = $tblRelatedItem->fetchAll($where); return $rowsetRelatedItem; }
public function otherAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_OTHER'"; $rowsetRelatedItem = $tblRelatedItem->fetchAll($where); $this->view->rowsetRelatedItem = $rowsetRelatedItem; }
private function _extractText_ZendDb($guid, $systemName, $fileName, $mimeType) { //$c = $this->_registry->get('config'); $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rowset = $tblRelatedItem->fetchAll("itemGuid='{$guid}' AND relateAs='RELATED_FILE'"); if (count($rowset)) { $row = $rowset->current(); $parentCatalogGuid = $row->relatedGuid; if (!empty($systemName)) { $fileName = $systemName; } $sDir1 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $fileName; $sDir2 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentCatalogGuid . DIRECTORY_SEPARATOR . $fileName; $sDir = ''; if (file_exists($sDir1)) { $sDir = $sDir1; } else { if (file_exists($sDir2)) { $sDir = $sDir2; } } if (!empty($sDir)) { $outpath = $sDir . '.txt'; switch ($mimeType) { case 'application/pdf': $pdfExtractor = $this->_pdfExtractor; system("{$pdfExtractor} " . $sDir . ' ' . $outpath, $ret); if ($ret == 0) { $value = file_get_contents($outpath); unlink($outpath); //echo 'content PDF: '. $sDir.' ' . strlen($value); if (strlen($value) > 20) { return $this->clean_string_input($value); } else { echo 'content file kosong'; return ''; } } if ($ret == 127) { //print "Could not find pdftotext tool."; return ''; } if ($ret == 1) { //print "Could not find pdf file."; return ''; } break; case 'text/html': case 'text/plain': $docHtml = Zend_Search_Lucene_Document_Html::loadHTMLFile($sDir); return $docHtml->getFieldValue('body'); break; case 'application/x-javascript': case 'application/octet-stream': case 'application/msword': if (strpos(strtolower($fileName), '.doc')) { $extractor = $this->_wordExtractor; system("{$extractor} -m cp850.txt " . $sDir . ' > ' . $outpath, $ret); if ($ret == 0) { $value = file_get_contents($outpath); unlink($outpath); //echo $value; return $value; } if ($ret == 127) { //print "Could not find pdftotext tool."; return ''; } if ($ret == 1) { //print "Could not find pdf file."; return ''; } } else { return ''; } break; default: return ''; break; } } } return ''; }
function downloadFileAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $catalogGuid = $this->_getParam('guid'); $parentGuid = $this->_getParam('parent'); $tblCatalog = new App_Model_Db_Table_Catalog(); $rowsetCatalog = $tblCatalog->find($catalogGuid); if (count($rowsetCatalog)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); $guidUser = $identity->kopel; } $tblAsetSetting = new App_Model_Db_Table_AssetSetting(); $rowAset = $tblAsetSetting->find($catalogGuid)->current(); if ($rowAset) { $rowAset->valueInt = $rowAset->valueInt + 1; } else { $rowAset = $tblAsetSetting->fetchNew(); $rowAset->guid = $catalogGuid; $rowAset->application = "kutu_doc"; $rowAset->part = isset($guidUser) ? $guidUser : ''; $rowAset->valueType = gethostbyaddr($_SERVER['REMOTE_ADDR']); $rowAset->valueInt = 1; } $rowAset->save(); $rowCatalog = $rowsetCatalog->current(); $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute(); $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value; $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value; $oriName = $oname = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value; $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'"); $registry = Zend_Registry::getInstance(); $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT); $cdn = $config->getOption('cdn'); $flagFileFound = false; foreach ($rowsetRelatedItem as $rowRelatedItem) { if (!$flagFileFound) { $parentGuid = $rowRelatedItem->relatedGuid; $sDir1 = $cdn['static']['dir']['files'] . "/" . $systemname; $sDir2 = $cdn['static']['dir']['files'] . "/" . $parentGuid . "/" . $systemname; $sDir3 = $cdn['static']['dir']['files'] . "/" . $oname; $sDir4 = $cdn['static']['dir']['files'] . "/" . $parentGuid . "/" . $oname; if (file_exists($sDir1)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir1); die; } else { if (file_exists($sDir2)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir2); die; } } if (file_exists($sDir3)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir3); die; } if (file_exists($sDir4)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir4); die; } else { $flagFileFound = false; $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/dms/browser/forbidden'); } } } } else { $flagFileFound = false; $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/dms/browser/forbidden'); } }
function _getNodes($node, $relateAs = 'RELATED_ITEM') { $a = array(); $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $tblCatalogAttribute = new App_Model_Db_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; }
public function save($aData) { if (empty($aData['profileGuid'])) { throw new Zend_Exception('Catalog Profile can not be EMPTY!'); } $profileGuid = $aData['profileGuid']; if ($profileGuid == 'klinik') { $title = $aData['fixedCommentTitle']; } else { $title = $aData['fixedTitle']; } $setsticky = false; $sticky = isset($aData['stickyCategory']) && !empty($aData['stickyCategory']) ? $aData['stickyCategory'] : 0; if ($sticky == 1) { $setsticky = true; } $slug = Pandamp_Utility_String::removeSign($title, '-', true); if (isset($aData['keywordintegrasi']) && !empty($aData['keywordintegrasi'])) { $ckey = explode(',', $aData['fixedKeywords']); $mckey = array_merge($aData['keywordintegrasi'], $ckey); $umckey = array_intersect_key($mckey, array_unique(array_map('strtolower', $mckey))); $umckey = rtrim(implode(',', $umckey), ','); $aData['fixedKeywords'] = $umckey; unset($aData['keywordintegrasi']); } if (isset($aData['fixedNarsum']) && !empty($aData['fixedNarsum'])) { $fn = implode(',', $aData['fixedNarsum']); $aData['fixedNarsum'] = $fn; } $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 (isset($aData['shortTitle']) && !empty($aData['shortTitle'])) { $slug = $aData['shortTitle']; } //if not empty, there are 2 possibilities $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid); if ($tblCatalog->fetchRow($where)) { $rowCatalog = $tblCatalog->find($catalogGuid)->current(); $rowCatalog->shortTitle = $slug; $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; $rowCatalog->sticky = (int) $setsticky; } else { $rowCatalog = $tblCatalog->fetchNew(); $rowCatalog->guid = $catalogGuid; $rowCatalog->shortTitle = $slug; $rowCatalog->profileGuid = $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; $rowCatalog->sticky = (int) $setsticky; } 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) { /*$aid = $rowProfileAttribute->attributeGuid; $rowCatalogAttribute = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue( $catalogGuid, $rowProfileAttribute->attributeGuid); if ($rowCatalogAttribute) { $ca = new App_Model_Db_Table_CatalogAttribute(); $ca->update( [ 'value' => $aData[$aid] ], [ 'catalogGuid = ?' => $catalogGuid, 'attributeGuid = ?' => $rowProfileAttribute->attributeGuid ] ); } else { $ca = new App_Model_Db_Table_CatalogAttribute(); $ca->insert([ 'catalogGuid' => $catalogGuid, 'attributeGuid' => $rowProfileAttribute->attributeGuid, 'value' => $aData[$aid] ]); }*/ 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(); } //category if (isset($aData['selectedNode']) && !empty($aData['selectedNode'])) { $categories = array_map('trim', explode(',', $aData['selectedNode'])); $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder(); $cf = $tblCatalogFolder->fetchAll("catalogGuid='{$catalogGuid}'"); if (count($cf)) { foreach ($cf as $cfol) { $cts[] = $cfol->folderGuid; if (!in_array($cfol->folderGuid, $categories)) { $tblCatalogFolder->delete("catalogGuid='{$cfol->catalogGuid}' AND folderGuid='{$cfol->folderGuid}'"); } } } foreach ($categories as $category) { $rowCatalog->copyToFolder($category); } } //save to table CatalogFolder only if folderGuid is not empty /*if (!empty($folderGuid)) { $rowCatalog->copyToFolder($folderGuid); }*/ // copy to other categories /*if (!empty($aData['categories'])) { $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder(); $cf = $tblCatalogFolder->fetchAll("catalogGuid='$catalogGuid'"); if (count($cf)) { $sa=""; foreach ($cf as $cfol) { $cts[] = $cfol->folderGuid; if (!in_array($cfol->folderGuid, $aData['categories'])) { $tblCatalogFolder->delete("catalogGuid='$cfol->catalogGuid' AND folderGuid='$cfol->folderGuid'"); $sa="del"; } } if ($sa=="del") { $auth = Zend_Auth::getInstance(); $group = $auth->getIdentity()->name; $group = strtolower(str_replace(" ", "", $group)); $zl = Zend_Registry::get("Zend_Locale"); $lang = $zl->getLanguage(); $cache = Pandamp_Cache::getInstance(); $sel = join("_", $cts); $cache->remove('categoryCheckbox_'.$sel.'_'.$lang.'_'.$group); } } foreach ($aData['categories'] as $category) { $rowCatalog->copyToFolder($category); } }*/ /** * @todo Relasi Katalog */ if (isset($aData['relIds'])) { $relatedItemDb = new App_Model_Db_Table_RelatedItem(); $relatedItemDb->delete(array('relatedGuid=?' => $catalogGuid, 'relateAs IN (?)' => array('RELATED_OTHER', 'RELATED_Clinic', 'RELATED_ISSUE', 'RELATED_HISTORY', 'RELATED_BASE', 'RELATED_TRANSLATION_ID', 'RELATED_TRANSLATION_EN'))); for ($i = 0; $i < count($aData['relIds']); $i++) { if ($aData['relIds'][$i] and $aData['relGuids'][$i]) { $relatedItemDb->insert(array('itemGuid' => $aData['relIds'][$i], 'relatedGuid' => $catalogGuid, 'relateAs' => $aData['relGuids'][$i])); } } } /** * @todo Upload File */ if (isset($aData['filename']) && !empty($aData['filename'])) { $catalogDb = new App_Model_Db_Table_Catalog(); for ($i = 0; $i < count($aData['filename']); $i++) { $fileName = $aData['filename'][$i]; $fileUrls = json_decode(stripslashes($aData['fileUrl'][$i])); foreach ($fileUrls as $index => $value) { if ($index == "original") { $title = ''; $slug = ''; if (isset($aData['attr_caption_' . $value->id]) && !empty($aData['attr_caption_' . $value->id])) { $title = $aData['attr_caption_' . $value->id][0]; $slug = Pandamp_Utility_String::removeSign($title, '-', true); } if ($value->type == 'file') { $relatedType = 'RELATED_FILE'; } elseif ($value->type == 'image') { $relatedType = 'RELATED_IMAGE'; } $rowDocCatalog = $catalogDb->fetchNew(); $rowDocCatalog->guid = $value->id; $rowDocCatalog->shortTitle = $slug; $rowDocCatalog->profileGuid = $aData['profile']; $docCatalogGuid = $rowDocCatalog->save(); $rowsetDocCatalogAttribute = $rowDocCatalog->findDependentRowsetCatalogAttribute(); $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docSystemName', $value->title); $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docOriginalName', $fileName); $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docSize', $value->size); $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docMimeType', $value->filetype); $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'fixedTitle', $title); $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docViewOrder', 0); $this->relateTo($docCatalogGuid, $catalogGuid, $relatedType); } } } } /** * Copy|Use image * Untuk satu article satu image */ if (isset($aData['fixedFileImage'])) { $fixedFileImage = $aData['fixedFileImage']; $fixedFileImage = basename($fixedFileImage); if (strpos($fixedFileImage, 'tn_') !== false) { $basename = str_replace('tn_', '', $fixedFileImage); } else { $basename = str_replace('thumbnail_', '', $fixedFileImage); } $guidBasename = pathinfo($basename, PATHINFO_FILENAME); $eiTitle = $aData['fileImage'] ? $aData['fileImage'] : ''; $eslug = Pandamp_Utility_String::removeSign($eiTitle, '-', true); $rel = array(); $relatedItemDb = new App_Model_Db_Table_RelatedItem(); $relItems = $relatedItemDb->fetchAll("relatedGuid='" . $catalogGuid . "' AND relateAs='RELATED_IMAGE'"); if ($relItems) { foreach ($relItems as $relItem) { $catalogDb = new App_Model_Db_Table_Catalog(); $catalog = $catalogDb->fetchRow("guid='" . $relItem['itemGuid'] . "' AND status!=-1"); if ($catalog) { $rel[] = $relItem['itemGuid']; } } } if (isset($rel[0]) && count($rel) == 1 && $rel[0] == $guidBasename) { $rowEImageCatalog = $tblCatalog->find($guidBasename)->current(); $rowEImageCatalog->shortTitle = $eslug; } else { if (isset($rel[0])) { $this->delete($rel[0]); } // jika ingin mengganti gambar dari yang sudah ada $of = $tblCatalog->find($guidBasename)->current(); if ($of) { $cd = $of->createdDate; $cb = $of->createdBy; } else { $cb = $aData['username']; $cd = date("Y-m-d H:i:s"); } $rowEImageCatalog = $tblCatalog->fetchNew(); $rowEImageCatalog->shortTitle = $eslug; $rowEImageCatalog->profileGuid = $aData['profile']; $rowEImageCatalog->createdDate = $cd; $rowEImageCatalog->createdBy = $cb; } $catalogEGuid = $rowEImageCatalog->save(); $rowsetEImageCatalogAttribute = $rowEImageCatalog->findDependentRowsetCatalogAttribute(); /** * @TODO docSystemName * digunakan sebagai inti|pemisah dari image * jika dia hasil copy dari catalog lain atau file original nya sendiri * maka yg diambil adalah attribute ini */ $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docSystemName', $basename); $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docOriginalName', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docOriginalName')); $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docSize', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docSize')); $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docMimeType', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docMimeType')); $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docViewOrder', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docViewOrder')); $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'fixedTitle', $eiTitle); $this->relateTo($catalogEGuid, $catalogGuid, 'RELATED_IMAGE'); } /** * @todo BLOCK solr core-catalog */ $indexingEngine = Pandamp_Search::manager(); $indexingEngine->indexCatalog($catalogGuid); /** * @todo BLOCK New solr corehol $registry = Zend_Registry::getInstance(); $application = Zend_Registry::get(Pandamp_Keys::REGISTRY_APP_OBJECT); $res = $application->getOption('resources')['indexing']['solr']['write']; $esolr = new Pandamp_Search_Adapter_Esolr($res['host'], $res['port'], $res['dir4']); $esolr->indexCatalog($catalogGuid); */ /** * @todo BLOCK solr shortenerUrl core3 $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if (null === $viewRenderer->view) { $viewRenderer->initView(); } $view = $viewRenderer->view; // create shortener url $kopel = Zend_Auth::getInstance()->getIdentity()->kopel; $cfg = Pandamp_Config::getConfig(); $config = Pandamp_Application::getOption('resources'); $indexingConfig = $config['indexing']['solr']['write']; $hukumn = new Pandamp_Search_Adapter_Solrh($indexingConfig['host'], $indexingConfig['port'], $indexingConfig['dir3']); $catalogAttributeDb = new App_Model_Db_Table_CatalogAttribute(); $zl = Zend_Registry::get('Zend_Locale'); if ($zl->getLanguage() == 'id') { if ($profileGuid == 'klinik') $url_content = $cfg->web->url->base.'/klinik/detail/'.$catalogGuid.'/'.$slug; else if (in_array($profileGuid, array('kutu_peraturan','kutu_putusan','kutu_peraturan_kolonial','kutu_rancangan_peraturan'))) $url_content = $cfg->web->url->base.'/pusatdata/detail/'.$catalogGuid.'/'.$view->getLabelNode($folderGuid).'/'.$folderGuid.'/'.$slug; else $url_content = $cfg->web->url->base.'/berita/baca/'.$catalogGuid.'/'.$slug; } else if ($zl->getLanguage() == 'en') { $url_content = $cfg->web->en->url->base.'/pages/'.$catalogGuid.'/'.$slug(strip_tags(title)); } //$q = "url:\"".$url_content."\" kopel:".$kopel; $q = "url:\"".$url_content."\""; $db = Zend_Registry::get('db4'); $data = array('url' => $url_content, 'createdate' => date("Y-m-d h:i:s"), 'remoteip' => Pandamp_Lib_Formater::getHttpRealIp(), 'kopel' => $kopel); $hits = $hukumn->find($q,0,1); if (isset($hits->response->docs[0])) { $row = $hits->response->docs[0]; $hid = $row->id; $db->update('urls',$data,"id=$hid"); } else { $insert = $db->insert('urls', $data); $hid = $db->lastInsertId('urls', 'id'); } // indexing shortener url $hukumn->indexCatalog($hid); */ /* try { $url = 'http://developers.facebook.com/tools/lint/?url={'.$url_content.'}&format=json'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_exec($ch); $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } catch (Exception $e) { //die($e->getMessage()); } */ /** * Updated Dec 10, 2013 06:01 */ //$dir = $cfg->cdn->hol->static->url . DS . 'temp' . DS . 'cache'; //Pandamp_Core_FileCache::clear($dir . DS . 'url'); //Pandamp_Core_FileCache::clear($dir . DS . 'action'); /* if (Pandamp_Pio::manager()->ping()) { Pandamp_Pio::manager()->addEvent([ 'guid' => $catalogGuid, 'category' => $profileGuid ]); } */ self::addCache($folderGuid); //after indexing, update isIndex and indexedDate in table KutuCatalog return $catalogGuid; }
function getchild($guid, $level = 0) { $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $where = "relatedGuid='{$guid}' AND relateAs IN ('REPEAL','AMEND')"; $rowsetRelatedItem = $tblRelatedItem->fetchAll($where, 'relatedGuid DESC'); foreach ($rowsetRelatedItem as $row) { $sTab = " "; for ($i = 0; $i < $level; $i++) { $sTab .= " "; } if ($row->relateAs === "REPEAL") { $status = "dicabut"; } if ($row->relateAs === "AMEND") { $status = "dirubah"; } $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->itemGuid, 'fixedTitle'); if ($row->relateAs === "AMEND") { echo $sTab . " <a href='{$row->itemGuid}'>{$title}</a> [" . $status . "]<br>"; // echo $sTab." "; // $this->isroot($row->itemGuid); $this->getchild($row->itemGuid, $level + 1); } else { echo $sTab . "<a href='{$row->itemGuid}'>{$title}</a> [" . $status . "]<br>"; // echo $sTab; // $this->isroot($row->itemGuid); $this->getchild($row->itemGuid, $level + 1); } } }
function downloadFileAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $catalogGuid = $this->_getParam('guid'); $parentGuid = $this->_getParam('parent'); $tblCatalog = new App_Model_Db_Table_Catalog(); $rowsetCatalog = $tblCatalog->find($catalogGuid); if (count($rowsetCatalog)) { $auth = Zend_Auth::getInstance(); //$sso = new Pandamp_Session_Remote(); //$user = $sso->getInfo(); if ($auth->hasIdentity()) { $guidUser = $auth->getIdentity()->guid; } $tblAsetSetting = new App_Model_Db_Table_AssetSetting(); $rowAset = $tblAsetSetting->find($catalogGuid)->current(); if ($rowAset) { $rowAset->valueInt = $rowAset->valueInt + 1; } else { $rowAset = $tblAsetSetting->fetchNew(); $rowAset->guid = $catalogGuid; $rowAset->application = "kutu_doc"; $rowAset->part = isset($guidUser) ? $guidUser : ''; $rowAset->valueType = gethostbyaddr($_SERVER['REMOTE_ADDR']); $rowAset->valueInt = 1; } $rowAset->save(); $rowCatalog = $rowsetCatalog->current(); $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute(); $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value; $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value; $oriName = $oname = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value; $tblRelatedItem = new App_Model_Db_Table_RelatedItem(); $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'"); $flagFileFound = false; foreach ($rowsetRelatedItem as $rowRelatedItem) { if (!$flagFileFound) { $parentGuid = $rowRelatedItem->relatedGuid; $sDir1 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname; $sDir2 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname; $sDir3 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $oname; $sDir4 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $oname; if (file_exists($sDir1)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir1); die; } else { if (file_exists($sDir2)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir2); die; } } if (file_exists($sDir3)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir3); die; } if (file_exists($sDir4)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir4); die; } else { $flagFileFound = false; $this->_forward('forbidden', 'browser', 'hold'); } } } } else { $flagFileFound = false; $this->_forward('forbidden', 'browser', 'hold'); } }
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; // } // } }