function beritaterkaitAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_Clinic'"; $rowsetRelatedItem = $tblRelatedItem->fetchAll($where); $num_rows = count($rowsetRelatedItem); $this->view->numberOfRows = $num_rows; $this->view->rowsetRelatedItem = $rowsetRelatedItem; }
function downloadFileAction() { $catalogGuid = $this->_getParam('guid'); $parentGuid = $this->_getParam('parent'); $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowsetCatalog = $tblCatalog->find($catalogGuid); if (count($rowsetCatalog)) { $rowCatalog = $rowsetCatalog->current(); $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute(); $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value; $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value; $oriName = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value; $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_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; if (file_exists($sDir1)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$filename}"); @readfile($sDir1); } else { if (file_exists($sDir2)) { $flagFileFound = true; header("Content-type: {$contentType}"); header("Content-Disposition: attachment; filename={$oriName}"); @readfile($sDir2); } else { $flagFileFound = false; } } } } } else { echo 'NO FILE'; } }
function downloadFile_OldAction() { $this->_helper->layout()->disableLayout(); $catalogGuid = $this->_getParam('guid'); $parentGuid = $this->_getParam('parent'); $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowsetCatalog = $tblCatalog->find($catalogGuid); if (count($rowsetCatalog)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $guidUser = $auth->getIdentity()->kopel; } $tblAsetSetting = new Pandamp_Modules_Dms_Catalog_Model_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 Pandamp_Modules_Dms_Catalog_Model_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'); } }
function listcommentAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $page = $this->_getParam('page') ? $this->_getParam('page') : 1; $limit = 25; $start = $limit * ($page - 1); sleep(2); $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $rowset = $tblRelatedItem->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs='RELATED_COMMENT'"); $relatedGuid = array(); foreach ($rowset as $related) { $relatedGuid[] = $related->itemGuid; } if ($relatedGuid) { $data = Pandamp_Lib_Formater::implode_with_keys(", ", $relatedGuid, "'"); $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowset = $tblCatalog->fetchAll("guid in({$data}) AND status=99", '', $limit, $start); $rowset1 = $tblCatalog->fetchAll("guid in({$data}) AND status=99"); $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); $row = $decorator->getCatalogByGuidAsEntity($catalogGuid); $st = $row->getShortTitle(); $num_rows = count($rowset1); $numPage = ceil($num_rows / $limit); $pagination = ''; for ($i = 1; $i <= $numPage; $i++) { $pagination .= "<li><a href='/berita/baca/{$catalogGuid}/{$st}/p/{$i}' title='Halaman {$i}' rev='{$i}'>{$i}</a></li>"; } // check is AJAX request or not if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->pagination = $pagination; } $this->view->catalogGuid = $catalogGuid; $this->view->numberOfRows = $num_rows; $this->view->rows = $rowset; $this->view->limit = $limit; } }
function _getNodes($node) { $a = array(); $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $tblCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); $where = "relatedGuid='{$node}' AND relateAs='RELATED_HISTORY'"; $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='RELATED_HISTORY' AND relatedItemType >= 1"; $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; }
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 Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE')"); if (count($rowsetRelatedDocs)) { foreach ($rowsetRelatedDocs as $rowRelatedDoc) { $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current(); $rowCatalog->delete(); } } if ($this->profileGuid == 'kutu_doc') { //get parentGuid $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE')"); if (count($rowsetRelatedItem)) { foreach ($rowsetRelatedItem as $rowRelatedItem) { //must delete the physical files $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute(); $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value; $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; $sDir1 = $cdn['static']['dir']['files'] . "/" . $systemname; $sDir2 = $cdn['static']['dir']['files'] . "/" . $parentGuid . "/" . $systemname; $sDir1_Remote = $cdn['remote']['dir']['files'] . "/" . $systemname; $sDir2_Remote = $cdn['remote']['dir']['files'] . "/" . $parentGuid . "/" . $systemname; if (file_exists($sDir1)) { // delete file unlink($sDir1); // check remote file if (file_exists($sDir1_Remote)) { $this->remoteDeleteFile($sDir1_Remote); } } else { if (file_exists($sDir2)) { //delete file unlink($sDir2); // check remote file if (file_exists($sDir2_Remote)) { $this->remoteDeleteFile($sDir2_Remote); } } } $img1 = $cdn['static']['dir']['images'] . "/" . $systemname; $img2 = $cdn['static']['dir']['images'] . "/" . $parentGuid . "/" . $systemname; $img1_Remote = $cdn['remote']['dir']['images'] . "/" . $systemname; $img2_Remote = $cdn['remote']['dir']['images'] . "/" . $parentGuid . "/" . $systemname; if (file_exists($img1)) { // delete file unlink($img1); // check remote file if (file_exists($img1_Remote)) { $this->remoteDeleteFile($img1_Remote); } } else { if (file_exists($img2)) { //delete file unlink($img2); // check remote file if (file_exists($img2_Remote)) { $this->remoteDeleteFile($img2_Remote); } } } } } } //delete from table CatalogAttribute $tblCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'"); //delete catalogGuid from table CatalogFolder $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder(); $tblCatalogFolder->delete("catalogGuid='{$this->guid}'"); //delete guid from table AssetSetting $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $tblAssetSetting->delete("guid='{$this->guid}'"); //delete from table relatedItem $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_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 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$this->guid; $sDir = $cdn['static']['dir']['files'] . "/" . $this->guid; $sDir_Remote = $cdn['remote']['dir']['files'] . "/" . $this->guid; try { if (is_dir($sDir)) { rmdir($sDir); // check remote is_dir if (is_dir($sDir_Remote)) { $this->remoteRemoveDir($sDir_Remote); } } } catch (Exception $e) { } //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'; $sDir = $cdn['static']['dir']['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) { } $sDir = $cdn['remote']['dir']['images']; try { if (file_exists($sDir . "/" . $this->guid . ".gif")) { $this->remoteDeleteFile($sDir . "/" . $this->guid . ".gif"); } if (file_exists($sDir . "/tn_" . $this->guid . ".gif")) { $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".gif"); } if (file_exists($sDir . "/" . $this->guid . ".jpg")) { $this->remoteDeleteFile($sDir . "/" . $this->guid . ".jpg"); } if (file_exists($sDir . "/tn_" . $this->guid . ".jpg")) { $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".jpg"); } if (file_exists($sDir . "/" . $this->guid . ".jpeg")) { $this->remoteDeleteFile($sDir . "/" . $this->guid . ".jpeg"); } if (file_exists($sDir . "/tn_" . $this->guid . ".jpeg")) { $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".jpeg"); } if (file_exists($sDir . "/" . $this->guid . ".png")) { $this->remoteDeleteFile($sDir . "/" . $this->guid . ".png"); } if (file_exists($sDir . "/tn_" . $this->guid . ".png")) { $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".png"); } } catch (Exception $e) { } }
public function otherAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_OTHER'"; $rowsetRelatedItem = $tblRelatedItem->fetchAll($where); $this->view->rowsetRelatedItem = $rowsetRelatedItem; }