Beispiel #1
0
 function viewFolderKu()
 {
     $time_start = microtime(true);
     $parentGuid = $this->_node;
     $columns = 4;
     $acl = Pandamp_Acl::manager();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         echo "You aren't login";
     }
     $identity = $auth->getIdentity();
     $packageId = $identity->packageId;
     $username = $identity->username;
     $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($packageId);
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowsetFolder = App_Model_Show_Folder::show()->fetchChildren($parentGuid);
     $num_rows = count($rowsetFolder);
     $rows = ceil($num_rows / $columns);
     if ($num_rows < $columns) {
         $columns = $num_rows;
     }
     if ($num_rows == 0) {
     }
     $in = 0;
     $data = array();
     foreach ($rowsetFolder as $rowFolder) {
         if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") {
             $content = 'all-access';
         } else {
             $content = $rowFolder['type'];
         }
         if ($acl->getPermissionsOnContent('', $aReturn['name'], $content)) {
             if ($rowFolder['title'] == "Kategori" || $rowFolder['title'] == "Peraturan" || $rowFolder['title'] == "Putusan") {
                 $title = "<font color=red><b>" . $rowFolder['title'] . "</b></font>";
             } else {
                 $title = $rowFolder['title'];
             }
             $data[$in][0] = $title;
             $data[$in][1] = $rowFolder['description'];
             $data[$in][2] = $rowFolder['guid'];
             $data[$in][3] = '';
         } else {
             continue;
         }
         $in++;
     }
     $this->view->rows = $rows;
     $this->view->columns = $columns;
     $this->view->data = $data;
     $this->view->numberOfFolders = $num_rows;
     $this->view->node = $parentGuid;
     if ($parentGuid != 'root') {
         $rowCurrentNode = $tblFolder->find($parentGuid)->current();
         $this->view->currentNodeTitle = $rowCurrentNode->title;
     } else {
         $this->view->currentNodeTitle = 'ROOT';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
 }
Beispiel #2
0
 public function getLabelNode($folderGuid)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowFolder = $tblFolder->find($folderGuid)->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";
     }
 }
Beispiel #3
0
 public function getFolder($folderGuid)
 {
     $modelFolder = new App_Model_Db_Table_Folder();
     $rowset = $modelFolder->find($folderGuid)->current();
     if ($rowset) {
         return $rowset;
     } else {
         return;
     }
 }
 private function _tf($folderGuid, $sGuid, $level)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowSet = $tblFolder->fetchAll("guid = '{$folderGuid}' AND NOT parentGuid=guid");
     $sGuid = '';
     foreach ($rowSet as $row) {
         $option = '"' . $row->parentGuid . '",';
         $sGuid .= $option . $this->_tf($row->parentGuid, '', $level + 1);
     }
     return $sGuid;
 }
Beispiel #5
0
 public function forceDelete($folderGuid)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row1 = $tblFolder->find($folderGuid)->current();
     foreach ($rowSet as $row) {
         $this->forceDelete($row->guid);
     }
     $rowsetCatalogFolder = $row1->findDependentRowsetCatalogFolder();
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $bpmCatalog = new Pandamp_Core_Hol_Catalog();
     if (count($rowsetCatalogFolder)) {
         foreach ($rowsetCatalogFolder as $rowCatalogFolder) {
             $rowCatalog = $tblCatalog->find($rowCatalogFolder->catalogGuid)->current();
             if ($rowCatalog) {
                 $bpmCatalog->delete($rowCatalog->guid);
             }
         }
         $this->delete($row1->guid);
     } else {
         $this->delete($row1->guid);
     }
 }
 public function view()
 {
     $zl = Zend_Registry::get("Zend_Locale");
     $browserUrl = ROOT_URL . '/' . $zl->getLanguage() . '/dms/explorer/browse/node';
     $folderGuid = $this->folderGuid ? $this->folderGuid : 'root';
     $tblFolder = new App_Model_Db_Table_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;
                 if ($rowFolder->title == 'Published') {
                     $aPath[$i]['url'] = ROOT_URL . '/' . $zl->getLanguage() . '/dms/clinic/browse/status/99/node/' . $rowFolder->guid;
                 } else {
                     if ($rowFolder->title == 'Selected') {
                         $aPath[$i]['url'] = ROOT_URL . '/' . $zl->getLanguage() . '/dms/clinic/browse/status/9/node/' . $rowFolder->guid;
                     } else {
                         if ($rowFolder->title == 'NA') {
                             $aPath[$i]['url'] = ROOT_URL . '/' . $zl->getLanguage() . '/dms/clinic/browse/status/2/node/' . $rowFolder->guid;
                         } else {
                             if ($rowFolder->title == 'Draft') {
                                 $aPath[$i]['url'] = ROOT_URL . '/' . $zl->getLanguage() . '/dms/clinic/browse/status/0/node/' . $rowFolder->guid;
                             } else {
                                 if ($rowFolder->title == 'Approved') {
                                     $aPath[$i]['url'] = ROOT_URL . '/' . $zl->getLanguage() . '/dms/clinic/browse/status/1/node/' . $rowFolder->guid;
                                 } else {
                                     $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;
 }
Beispiel #7
0
 public function copyOldAction()
 {
     $urlReferer = $_SERVER['HTTP_REFERER'];
     $r = $this->getRequest();
     $tblFolder = new App_Model_Db_Table_Folder();
     $guid = $r->getParam('guid');
     $message = '';
     if (is_array($guid)) {
         $sGuid = '';
         $sTitle = '';
         for ($i = 0; $i < count($guid); $i++) {
             $sGuid .= $guid[$i] . ';';
             $rowFolder = $tblFolder->find($guid[$i])->current();
             $sTitle .= $rowFolder->title . ', ';
         }
         $guid = $sGuid;
     } else {
         $sTitle = '';
         if (!empty($guid)) {
             $rowFolder = $tblFolder->find($guid)->current();
             $sTitle .= $rowFolder->title;
         }
     }
     if ($r->isPost()) {
         $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
         $urlReferer = $sessHistory->urlReferer;
         $tblFolder = new App_Model_Db_Table_Folder();
         $guid = $r->getParam('guid');
         $targetNode = $r->getParam('targetNode');
         if (is_array($guid)) {
             foreach ($guid as $folderId) {
                 $row = $tblFolder->createRow();
                 $row->copy($targetNode, $folderId);
             }
         } else {
             $guid = $r->getParam('guid');
             $targetNode = $r->getParam('targetNode');
             $row = $tblFolder->createRow();
             $row->copy($targetNode, $guid);
         }
         $message = "Data was successfully saved.";
     }
     $this->view->guid = $guid;
     $this->view->folderTitle = $sTitle;
     $backToNode = $r->getParam('backToNode');
     $this->view->backToNode = $backToNode;
     $rowFolder = $tblFolder->find($guid)->current();
     $this->view->row = $rowFolder;
     $this->view->message = $message;
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     $sessHistory->urlReferer = $urlReferer;
     $this->view->urlReferer = $sessHistory->urlReferer;
     $this->_helper->layout()->headerTitle = "Folder Management: Copy Folder";
 }
Beispiel #8
0
 private function fetchFolder($folderGuid, $space, $source, $target)
 {
     $folderDb = new App_Model_Db_Table_Folder();
     $folder = $folderDb->fetchRow("guid LIKE \"" . $folderGuid . "\"");
     $message = $space . " - " . $folder->title . " ( " . $folder->guid . " ) <br>";
     $this->printMessage($message, "red", "bold");
     $tgtPath = $target . "/" . $folder->title;
     $tgtPath = rtrim($tgtPath);
     if (!is_dir($tgtPath)) {
         if (!mkdir($tgtPath, 0777, true)) {
             die('Failed to create folders...[' . $tgtPath . "]");
         }
     }
     $this->copycatalog($folderGuid, $space . "&nbsp;&nbsp;&nbsp;&nbsp;", $source, $tgtPath);
     $folders = $folderDb->fetchChildren($folderGuid);
     if (count($folders) > 0) {
         foreach ($folders as $data) {
             echo "<br>";
             $this->fetchFolder($data->guid, $space . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $source, $tgtPath);
         }
     }
 }
Beispiel #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) || $this->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 App_Model_Db_Table_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 App_Model_Db_Table_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;
 }
Beispiel #10
0
 protected function _traverseFolderType($folderGuid, $sGuid, $level)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $sGuid = '';
     //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->_traverseFolderType($row->guid, '', $level + 1) . "";
         //echo $row->guid.'<br>';
         echo 'Update ' . $row->title . '<br>';
         $tblFolder = new App_Model_Db_Table_Folder();
         $rowFolder = $tblFolder->find($row->guid)->current();
         $rowFolder->type = 'cms-en';
         $rowFolder->save();
         //$sGuid .= $sTab.$row->title . '|<br>'. $this->_traverseFolder($row->guid, '', $level+1);
     }
 }
Beispiel #11
0
 function viewFolderNavigationPutusanAction()
 {
     $browserUrl = ROOT_URL . '/pusatdata/view/npts';
     $folderGuid = $this->_getParam('npts') ? $this->_getParam('npts') : 'root';
     $tblFolder = new App_Model_Db_Table_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;
 }