Example #1
0
 function getmenuchildAction()
 {
     $r = $this->getRequest();
     $node = $r->getParam('node');
     $modelFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowset = $modelFolder->getMenu($node);
     $this->view->rowset = $rowset;
 }
Example #2
0
 private function _get_position($id)
 {
     if ($id == 'root') {
         return "";
     }
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $result = $tblFolder->find($id)->current();
     return $result->path . $result->guid;
 }
 function viewAction()
 {
     $request = $this->getRequest();
     $itemGuid = $request->getParam('guid');
     //		$aclAdapter = Kutu_Acl::manager();
     //		$aUsers = $aclAdapter->getUsers();
     //		$aGroups = $aclAdapter->getGroups();
     //		$aTmp = array();
     //		for ($i=0;$i<count($aUsers);$i++)
     //		{
     //			$aTmp[$i]['username'] = $aUsers[$i];
     //			$aPerms = $aclAdapter->getPermissionsOnContent($aUsers[$i], null, $itemGuid);
     //			for($ii=0;$ii<count($aPerms);$ii++)
     //			{
     //				$aTmp[$i]['perms'][$aPerms[$ii]] = 1;
     //			}
     //		}
     //		$this->view->aDataUser = $aTmp;
     //		$aTmp = array();
     //		for($i=0;$i<count($aGroups);$i++)
     //		{
     //			$aTmp[$i]['group'] = $aGroups[$i]['value'];
     //
     //			$aPerms = $aclAdapter->getPermissionsOnContent(null, $aGroups[$i]['value'], $itemGuid);
     //			for($ii=0;$ii<count($aPerms);$ii++)
     //			{
     //				$aTmp[$i]['perms'][$aPerms[$ii]] = 1;
     //			}
     //		}
     //		$this->view->aDataGroup = $aTmp;
     $this->view->itemGuid = $itemGuid;
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->find($itemGuid);
     if (count($rowset) > 0) {
         $row = $rowset->current();
         $this->view->itemTitle = 'CATALOG : ' . $row->shortTitle;
     } else {
         $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
         $rowset = $tblFolder->find($itemGuid);
         if (count($rowset) > 0) {
             $row = $rowset->current();
             $this->view->itemTitle = 'FOLDER : ' . $row->title;
         }
     }
 }
Example #4
0
 private function _traverseFolder($folderGuid, $sGuid, $level)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $sGuid = '';
     foreach ($rowSet as $row) {
         $sTab = '';
         for ($i = 0; $i < $level; $i++) {
             $sTab .= '-';
         }
         if ($level == 0) {
             $option = '{"guid":"' . $row->guid . '",' . '"title":"' . $row->title . '"},';
         } else {
             $option = '{"guid":"' . $row->guid . '",' . '"title":"' . $sTab . $row->title . '"},';
         }
         $sGuid .= $option . $this->_traverseFolder($row->guid, '', $level + 1);
     }
     return $sGuid;
 }
Example #5
0
 public function forceDelete($folderGuid)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowset = $tblFolder->fetchChildren($folderGuid);
     $rowFolder = $tblFolder->find($folderGuid)->current();
     foreach ($rowset as $row) {
         $this->forceDelete($row->guid);
     }
     $rowsetCatalogFolder = $rowFolder->findDependentRowsetCatalogFolder();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $holCatalog = new Pandamp_Core_Hol_Catalog();
     if (count($rowsetCatalogFolder)) {
         foreach ($rowsetCatalogFolder as $rowCatalogFolder) {
             $rowCatalog = $tblCatalog->find($rowCatalogFolder->catalogGuid)->current();
             $holCatalog->delete($rowCatalog->guid);
         }
         $this->delete($rowFolder->guid);
     } else {
         $this->delete($rowFolder->guid);
     }
 }
Example #6
0
 static function getNode($node)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowFolder = $tblFolder->find($node)->current();
     if ($rowFolder) {
         $path = explode("/", $rowFolder->path);
         $rpath = $path[0];
         $rowFolder1 = $tblFolder->find($rpath)->current();
         if ($rowFolder1) {
             $rowFolder2 = $tblFolder->find($rowFolder1->parentGuid)->current();
             if ($rowFolder2) {
                 if ($rowFolder2->title == "Peraturan") {
                     return "nprt";
                 } elseif ($rowFolder2->title == "Putusan") {
                     return "npts";
                 } else {
                     return "node";
                 }
             } else {
                 return "node";
             }
         } else {
             return "node";
         }
     } else {
         return "node";
     }
 }
Example #7
0
 function moveToFolderAction()
 {
     $targetGuid = $this->_getParam('targetGuid') ? $this->_getParam('targetGuid') : '';
     $currentGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $row = $tblFolder->find($currentGuid)->current();
     if (empty($currentGuid) || $currentGuid == 'root') {
         $this->view->success = false;
         $this->view->error = "Can't move ROOT";
     } else {
         try {
             $row->move($targetGuid);
             $this->view->success = true;
             $this->view->message = "Move to Folder Success";
         } catch (Exception $e) {
             $this->view->success = false;
             $this->view->error = $e->getMessage();
         }
     }
 }
 function _traverseFolderDowload($folderGuid, $sGuid, $level)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rows = $tblCatalog->downloadCatalog($row->guid);
     if (count($rows)) {
         foreach ($rows as $rowset) {
             $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
             $rowsetCatalog = $tblCatalog->find($rowset->itemGuid);
             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;
                 $parentGuid = $rowset->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;
                 //$c = ROOT_DIR.'/data/download/file';
                 echo $parentGuid . '<br>';
                 //					if(file_exists($sDir1))
                 //					{
                 //header("Content-type: $contentType");
                 //header("Content-Disposition: attachment; filename=$oriName");
                 //@readfile($sDir2);
                 //						exec('xcopy '.$sDir1.' d:\\www\holmp\data\download\file /e/i');
                 //					}
                 //					if(file_exists($sDir2))
                 //					{
                 //						exec('xcopy '.$sDir2.' d:\\www\holmp\data\download\file /e/i');
                 //					}
             }
         }
     }
 }
Example #9
0
 function isAllowed($username, $itemGuid, $action, $section = 'content')
 {
     if ($this->checkAcl("action", 'all', 'user', $username, 'content', 'all-access')) {
         return true;
     }
     if ($section == 'content') {
         //			if($this->checkAcl("dms",'all','user', $username, false,false))
         //				return true;
         /**
          * TODO
          */
         switch ($action) {
             case 'create':
                 if ($this->checkAcl("action", 'create', 'user', $username, false, false)) {
                     return true;
                 }
             case 'read':
                 if ($this->checkAcl("action", 'read', 'user', $username, false, false) || $acl->checkAcl("action", 'update', 'user', $username, false, false)) {
                     return true;
                 }
             case 'update':
                 if ($this->checkAcl("action", 'update', 'user', $username, false, false)) {
                     return true;
                 }
             case 'delete':
                 if ($this->checkAcl("action", 'delete', 'user', $username, false, false)) {
                     return true;
                 }
         }
         //			if ($this->checkAcl('action', $action, 'user', $username, 'admin', 'content'))
         //				return true;
         //check if itemGuid exist in table KutuCatalog
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $rowset = $tblCatalog->find($itemGuid);
         if (count($rowset) > 0) {
             $row = $rowset->current();
             if ($row->profileGuid != 'kutu_folder') {
                 //if user was the creator of the item, allow everything
                 if ($row->createdBy == $username) {
                     return true;
                 }
                 $aAclId = $this->searchAcl('action', false, false, false, false, 'content', $itemGuid);
                 if (count($aAclId) > 0) {
                     return $this->checkAcl('action', $action, 'user', $username, 'content', $itemGuid);
                 } else {
                     //check permission of the folder which this catalog belongs to
                     $rowset1 = $row->findDependentRowset('Pandamp_Modules_Dms_Catalog_Model_CatalogFolder');
                     $flagFolderPermission = false;
                     foreach ($rowset1 as $row1) {
                         if ($this->_traverseFolderPermission($username, $row1->folderGuid, $action)) {
                             $flagFolderPermission = true;
                         }
                     }
                     return $flagFolderPermission;
                 }
             }
         }
         //check if itemGuid exist in table KutuFolder
         $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
         $rowset = $tblFolder->find($itemGuid);
         if (count($rowset) > 0) {
             return $this->_traverseFolderPermission($username, $itemGuid, $action);
         }
     }
     //check at section
     $aAclId = $this->searchAcl('action', false, false, false, false, $section, $itemGuid);
     if (count($aAclId) > 0) {
         return $this->checkAcl('action', $action, 'user', $username, $section, $itemGuid);
     }
     //check at feature section
     /*$aAclId = $this->searchAcl('action', false, false, false, false, 'feature', $itemGuid);
     		if(count($aAclId)>0)
     		{
     			return $this->checkAcl('action', $action, 'user', $username, 'feature', $itemGuid);
     		}*/
     return false;
 }
 function saveAction()
 {
     $parentGuid = $this->_getParam('parentGuid') ? $this->_getParam('parentGuid') : '';
     $guid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $title = $this->_getParam('title') ? $this->_getParam('title') : '';
     $description = $this->_getParam('description') ? $this->_getParam('description') : '';
     $type = $this->_getParam('type') ? $this->_getParam('type') : '';
     $viewOrder = $this->_getParam('viewOrder') ? $this->_getParam('viewOrder') : 0;
     $cmsParams = $this->_getParam('cmsParams') ? $this->_getParam('cmsParams') : '';
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     if (empty($guid)) {
         if (empty($parentGuid)) {
             throw new Zend_Exception('parentGuid must be supplied!');
         }
         $newRow = $tblFolder->createRow();
         $newRow->parentGuid = $parentGuid;
         $newRow->title = $title;
         $newRow->description = $description;
         $newRow->type = $type;
         $newRow->viewOrder = $viewOrder;
         $newRow->cmsParams = $cmsParams;
         $newRow->save();
     } else {
         $rowset = $tblFolder->find($guid);
         if (count($rowset)) {
             $row = $rowset->current();
             $row->title = $title;
             $row->description = $description;
             $row->type = $type;
             $row->viewOrder = $viewOrder;
             $row->cmsParams = $cmsParams;
             $row->save();
         }
     }
 }
Example #11
0
 function viewFolderNavigationPutusanAction()
 {
     $browserUrl = ROOT_URL . '/pusatdata/view/npts';
     $folderGuid = $this->_getParam('npts') ? $this->_getParam('npts') : 'root';
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $aPath = array();
     if ($folderGuid == 'root') {
         $aPath[0]['title'] = 'Root';
         $aPath[0]['url'] = $browserUrl;
     } else {
         $rowFolder = $tblFolder->find($folderGuid)->current();
         if (!empty($rowFolder->path)) {
             $aFolderGuid = explode("/", $rowFolder->path);
             $sPath = 'root >';
             $aPath[0]['title'] = 'Root';
             $aPath[0]['url'] = $browserUrl;
             $i = 1;
             if (count($aFolderGuid)) {
                 $sPath1 = '';
                 foreach ($aFolderGuid as $guid) {
                     if (!empty($guid)) {
                         $rowFolder1 = $tblFolder->find($guid)->current();
                         $sPath1 .= $rowFolder1->title . ' > ';
                         $aPath[$i]['title'] = $rowFolder1->title . ' > ';
                         $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder1->guid;
                         $i++;
                     }
                 }
                 $aPath[$i]['title'] = $rowFolder->title;
                 $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid;
             }
         } else {
             $aPath[0]['title'] = 'Root';
             $aPath[0]['url'] = $browserUrl;
             $aPath[1]['title'] = $rowFolder->title;
             $aPath[1]['url'] = $browserUrl . '/' . $rowFolder->guid;
         }
     }
     $this->view->aPath = $aPath;
 }