public function breadcrumbsAction()
 {
     $r = $this->getRequest();
     $browserUrl = KUTU_ROOT_URL . '/pages/g';
     $folderGuid = $r->getParam('node') ? $r->getParam('node') : 'root';
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Folder');
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $aPath = array();
     if ($folderGuid == 'root') {
         $aPath[0]['title'] = 'Home';
         $aPath[0]['url'] = KUTU_ROOT_URL . '/pages';
         //$this->_helper->layout()->mainFolderTitle = 'Browse Folder';
     } else {
         $rowFolder = $tblFolder->find($folderGuid)->current();
         //echo 'test' . $rowFolder->path;
         if (!empty($rowFolder->path)) {
             $aFolderGuid = explode("/", $rowFolder->path);
             $sPath = 'root >';
             $aPath[0]['title'] = 'Home';
             $aPath[0]['url'] = KUTU_ROOT_URL . '/pages';
             $i = 1;
             if (count($aFolderGuid)) {
                 //print_r($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++;
                     }
                 }
                 //echo $sPath . $sPath1 . $rowFolder->title;
                 $aPath[$i]['title'] = $rowFolder->title;
                 $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid;
             }
         } else {
             //echo "root > ". $rowFolder->title;
             $aPath[0]['title'] = 'Home';
             $aPath[0]['url'] = KUTU_ROOT_URL . '/pages';
             $aPath[1]['title'] = $rowFolder->title;
             $aPath[1]['url'] = $browserUrl . '/' . $rowFolder->guid;
         }
         //$this->_helper->layout()->mainFolderTitle = $rowFolder->title;
     }
     $this->view->aPath = $aPath;
 }
Exemple #2
0
 protected function _traverseFolder($folderGuid, $sGuid, $level)
 {
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Folder');
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $sGuid = '';
     if (count($rowSet)) {
         $sGuid = '<li>' . "<a href='" . KUTU_ROOT_URL . "/pages/g/{$row->guid}/h/1'>" . $row->title . '</a><ul>';
     } else {
         $sGuid = '<li>' . "<a href='" . KUTU_ROOT_URL . "/pages/g/{$row->guid}/h/1'>" . $row->title . '</a>';
     }
     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) . "";
             //$sGuid .= $sTab.$row->title . '|<br>'. $this->_traverseFolder($row->guid, '', $level+1);
         }
         if (count($rowSet)) {
             return $sGuid . '</ul></li>';
         } else {
             return $sGuid . '</li>';
         }
     }
 }
Exemple #3
0
 public function delete($folderGuid)
 {
     $tbl = new Kutu_Core_Orm_Table_Folder();
     $rowset = $tbl->find($folderGuid);
     if (count($rowset)) {
         $row = $rowset->current();
         $row->delete();
     }
 }
 function viewFolderKu()
 {
     $time_start = microtime(true);
     $parentGuid = $this->_node;
     $columns = 4;
     //Zend_Loader::loadClass('Kutu_Core_Orm_Table_Folder');
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowsetFolder = $tblFolder->fetchChildren($parentGuid);
     //        $db = Zend_Db_Table::getDefaultAdapter();
     //        if($parentGuid=='root')
     //        	$query = "select * from KutuFolder where parentGuid=guid";
     //        else
     //        	$query = "select * from KutuFolder where parentGuid='$parentGuid' AND NOT parentGuid=guid";
     //        $rs = $db->query($query);
     //        $rowsetFolder = $rs->fetchAll(PDO::FETCH_OBJ);
     $num_rows = count($rowsetFolder);
     $rows = ceil($num_rows / $columns);
     if ($num_rows < $columns) {
         $columns = $num_rows;
     }
     if ($num_rows == 0) {
         //echo 'No folder(s) found';
     }
     $kucrut = 0;
     $data = array();
     foreach ($rowsetFolder as $rowFolder) {
         //$rowFolder = $rowsetFolder[$kucrut];
         $data[$kucrut][0] = $rowFolder->title;
         $data[$kucrut][1] = $rowFolder->description;
         $data[$kucrut][2] = $rowFolder->guid;
         $data[$kucrut][3] = '';
         $kucrut++;
     }
     $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;
     //echo'<br>WAKTU EKSEKUSI: '. $time;
 }
Exemple #5
0
 public function indexAction()
 {
     //$this->_helper->layout()->setLayout('layout-iht');
     $r = $this->getRequest();
     $node = $r->getParam('node') ? $r->getParam('node') : 'lgs4a0ee4ab533b4';
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowFolder = $tblFolder->find($node)->current();
     $this->view->listTitle = $rowFolder->title;
     $this->view->pageTitle = $rowFolder->title;
     //View catalogs
     $this->view->currentNode = $node;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 12;
     $this->view->limit = $limit;
     $itemsPerPage = $limit;
     $this->view->itemsPerPage = $itemsPerPage;
     $offset = $r->getParam('offset') ? $r->getParam('offset') : 0;
     $this->view->offset = $offset;
     $sort = $r->getParam('sort') ? $r->getParam('sort') : "regulationType desc, year desc";
     //"regulationType desc, year desc";
     $this->view->sort = $sort;
     $db = Zend_Db_Table::getDefaultAdapter()->query("SELECT catalogGuid as guid from KutuCatalogFolder where folderGuid='{$node}'");
     $rowset = $db->fetchAll(Zend_Db::FETCH_OBJ);
     $solrAdapter = Kutu_Search::manager();
     $numi = count($rowset);
     $sSolr = "id:(";
     for ($i = 0; $i < $numi; $i++) {
         $row = $rowset[$i];
         $sSolr .= $row->guid . ' ';
     }
     $sSolr .= ')';
     if (!$numi) {
         $sSolr = "id:(hfgjhfdfka)";
     }
     $solrResult = $solrAdapter->findAndSort($sSolr, $offset, $limit, array($sort));
     $solrNumFound = count($solrResult->response->docs);
     $this->view->totalItems = $solrResult->response->numFound;
     $this->view->hits = $solrResult;
     $bpm = new Kutu_Core_Bpm_Catalog();
     $this->view->bpm = $bpm;
 }
Exemple #6
0
 function isAllowed($username, $itemGuid, $action, $section = 'content')
 {
     if ($this->checkAcl("site", 'all', 'user', $username, false, false)) {
         return true;
     }
     if ($section == 'content') {
         if ($this->checkAcl("dms", 'all', 'user', $username, false, false)) {
             return true;
         }
         switch ($action) {
             case 'create':
                 if ($this->checkAcl("dms", 'createCatalog', 'user', $username, false, false)) {
                     return true;
                 }
             case 'read':
                 if ($this->checkAcl("dms", 'readCatalog', 'user', $username, false, false) || $acl->checkAcl("dms", 'updateCatalog', 'user', $username, false, false)) {
                     return true;
                 }
             case 'update':
                 if ($this->checkAcl("dms", 'updateCatalog', 'user', $username, false, false)) {
                     return true;
                 }
             case 'delete':
                 if ($this->checkAcl("dms", 'deleteCatalog', '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 Kutu_Core_Orm_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('Kutu_Core_Orm_Table_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 Kutu_Core_Orm_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;
 }
Exemple #7
0
 function viewFolderNavigationDetailAction()
 {
     $browserUrl = KUTU_ROOT_URL . '/app/hold/browser/view/node';
     $browserUrlP = KUTU_ROOT_URL . '/app/hold/browser/view/nprt';
     $browserUrlT = KUTU_ROOT_URL . '/app/hold/browser/view/npts';
     $folderGuid = $this->_getParam('node') ? $this->_getParam('node') : 'root';
     //		$wview = $this->_request->getParams('nprt');print_r($wview['node']);
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $aPath = array();
     if ($folderGuid == 'root') {
         $aPath[0]['title'] = 'Root';
         $aPath[0]['url'] = $browserUrl;
     } else {
         $rowFolder = $tblFolder->find($folderGuid)->current();
         if (!isset($rowFolder)) {
             $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder();
             $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$folderGuid}'");
             $rowFolder = $tblFolder->find($rowsetCatalogFolder->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;
                         $rowFolder2 = $tblFolder->find($rowFolder1->guid)->current();
                         if ($rowFolder2->parentGuid == 'lt49714f3105801' || $rowFolder->parentGuid == $folderGuid) {
                             if (in_array($rowFolder2->guid, array('658', '761', '971'))) {
                                 $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder1->guid;
                             } elseif (in_array($rowFolder2->guid, array('137', '711'))) {
                                 $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder1->guid;
                             } else {
                                 $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder1->guid;
                             }
                         } else {
                             if (in_array($rowFolder2->parentGuid, array('658', '761', '971'))) {
                                 $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder1->guid;
                             } elseif (in_array($rowFolder2->parentGuid, array('137', '711'))) {
                                 $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder1->guid;
                             } else {
                                 $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder1->guid;
                             }
                         }
                         $i++;
                     }
                 }
                 $aPath[$i]['title'] = $rowFolder->title;
                 //					$aPath[$i]['url'] = $browserUrl.'/'.$rowFolder->guid;
                 if ($aFolderGuid[0] == 'lt49714f3105801' || $aFolderGuid[0] == $folderGuid) {
                     if (in_array($folderGuid, array('658', '761', '971'))) {
                         $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder->guid;
                     } elseif (in_array($folderGuid, array('137', '711'))) {
                         $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder->guid;
                     } else {
                         $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid;
                     }
                 } else {
                     if (in_array($aFolderGuid[0], array('658', '761', '971'))) {
                         $aPath[$i]['url'] = $browserUrlP . '/' . $rowFolder->guid;
                     } elseif (in_array($aFolderGuid[0], array('137', '711'))) {
                         $aPath[$i]['url'] = $browserUrlT . '/' . $rowFolder->guid;
                     } else {
                         $aPath[$i]['url'] = $browserUrl . '/' . $rowFolder->guid;
                     }
                 }
                 //print_r($aFolderGuid[0]);
             }
         } else {
             $aPath[0]['title'] = 'Root';
             $aPath[0]['url'] = $browserUrl;
             $aPath[1]['title'] = $rowFolder->title;
             $aPath[1]['url'] = $browserUrl . '/' . $rowFolder->guid;
         }
     }
     $this->view->aPath = $aPath;
 }
Exemple #8
0
 public function moveAction()
 {
     $urlReferer = $_SERVER['HTTP_REFERER'];
     //$this->_helper->layout()->disableLayout();
     $r = $this->getRequest();
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $guid = $r->getParam('guid');
     $message = '';
     //check if $guid is an array
     if (is_array($guid)) {
         $sGuid = '';
         $sTitle = '';
         echo "this is array: ";
         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;
         print_r($_POST);
         $guid = $r->getParam('guid');
         $targetNode = $r->getParam('targetNode');
         if (is_array($guid)) {
             foreach ($guid as $folderId) {
                 $row = $tblFolder->find($folderId)->current();
                 $row->move($targetNode);
             }
         } else {
             $guid = $r->getParam('guid');
             $targetNode = $r->getParam('targetNode');
             $row = $tblFolder->find($guid)->current();
             $row->move($targetNode);
         }
         $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;
     echo $this->view->urlReferer;
 }
 public function indexAction()
 {
     //$this->view->render(
     $r = $this->getRequest();
     $folderLegalDb = "lgs4a0ee4ab533b4";
     $guid = $r->getParam('g');
     if (empty($guid)) {
         $this->_forward('index', "index", 'site', $r->getParams());
         return true;
     }
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowset = $tblFolder->find($guid);
     if (count($rowset)) {
         $row = $rowset->current();
         $json = new Zend_Json();
         if (empty($row->cmsParams)) {
             //check if folder is child of folderLegalDb
             if (strpos($row->path, $folderLegalDb) === false) {
                 $this->_forward('list', "pages", 'site', $r->getParams());
             } else {
                 $this->_redirect(KUTU_ROOT_URL . '/dms/' . $row->guid);
             }
             return true;
             //die();
         } else {
             $aData = $json->decode($row->cmsParams);
             if (!empty($aData['a']) && !empty($aData['c']) && !empty($aData['m'])) {
                 $aData['p'] = array_merge($aData['p'], $r->getParams());
                 $this->_forward($aData['a'], $aData['c'], $aData['m'], $aData['p']);
                 return true;
             } else {
                 $aData['p'] = array_merge($aData['p'], $r->getParams());
                 //check if folder is child of folderLegalDb
                 if (strpos($row->path, $folderLegalDb) === false) {
                     $this->_forward('list', "pages", 'site', $aData['p']);
                 } else {
                     $this->_redirect(KUTU_ROOT_URL . '/dms/' . $row->guid);
                 }
                 return true;
             }
         }
     } else {
         $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
         $rowset = $tblCatalog->find($guid);
         if (count($rowset)) {
             $row = $rowset->current();
             //update number of downloads and number of views
             $bpm = new Kutu_Core_Bpm_Catalog();
             $bpm->updateNumberOfViews($row->guid);
             switch ($row->profileGuid) {
                 case 'kutu_peraturan':
                 case 'kutu_putusan':
                     $this->_redirect(KUTU_ROOT_URL . '/dms/catalog/' . $guid);
                     return true;
             }
             $rowsetFolder = $row->findManyToManyRowset('Kutu_Core_Orm_Table_Folder', 'Kutu_Core_Orm_Table_CatalogFolder');
             if (count($rowsetFolder) > 0) {
                 foreach ($rowsetFolder as $rowFolder) {
                     //$rowFolder = $rowsetFolder->current();
                     $folderGuid = $rowFolder->guid;
                     if (strpos($rowFolder->path, $folderLegalDb) !== false) {
                         //do nothing
                     } else {
                         $aParams = $r->getParams();
                         $aParams['node'] = $folderGuid;
                         //Should forward to specific controller based on catalog's profileGuid
                         $this->_forward('generic', "pages_details", 'site', $aParams);
                         return true;
                     }
                 }
                 $this->_redirect(KUTU_ROOT_URL . '/dms/catalog/' . $guid . '/node/' . $folderGuid);
             } else {
                 $this->_redirect(KUTU_ROOT_URL . '/dms/catalog/' . $guid . '/node/' . $folderGuid);
             }
         } else {
         }
     }
 }
 private function _migrateCatalogsInCategory($sourceCategoryId)
 {
     $targetFolderGuid = $this->_guidPrefix . $sourceCategoryId;
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowsetFolder = $tblFolder->find($targetFolderGuid);
     if (!count($rowsetFolder)) {
         throw new Zend_Exception('Target Folder: ' . $targetFolderGuid . ' DOES NOT EXIST!!!');
     }
     //get catalogs from source category
     $this->_dbSource->setFetchMode(Zend_Db::FETCH_OBJ);
     $catalogIds = $this->_dbSource->fetchAll("SELECT DocumentID from tblDms_CategoryRelationship C  \n\t\t\t\tWHERE C.CategoryID = {$sourceCategoryId}");
     echo 'CATALOG: ';
     print_r($catalogIds);
     foreach ($catalogIds as $sourceCatalog) {
         $catalogId = $sourceCatalog->DocumentID;
         //check if catalog has row in tblDms_DocumentProfile
         $rowsetAttribute = $this->_dbSource->fetchAll("SELECT * FROM tblDMS_Document A, tblDMS_DocumentProfile B  \n\t\t\t\t\tWHERE A.DocumentID={$catalogId} AND A.DocumentID=B.DocumentID");
         if (count($rowsetAttribute)) {
             $rowCatalog = $rowsetAttribute[0];
             switch ($rowCatalog->ProfileID) {
                 case 1:
                     $this->_createPeraturan($rowsetAttribute, $targetFolderGuid);
                     //echo "Not processed yet. Profile not ready. Guid: ".$rowCatalog->DocumentID;
                     //echo " KUPRET ";
                     break;
                 case 14:
                     $this->_createDmsMemoranda($rowsetAttribute, $targetFolderGuid);
                     break;
                 default:
                     //$this->_createArticle($rowsetAttribute);
                     echo "<br>Not processed yet. Profile not ready. <br>Guid: " . $rowCatalog->DocumentID . ' PROFILE: ' . $rowCatalog->ProfileID . '<br>';
                     break;
             }
         } else {
             //this means that this catalog doesn't have profile. Thus, we will treat this catalog as a catalog with an article profile
             $rowCatalog = $this->_dbSource->fetchRow("SELECT * FROM tblDMS_Document A WHERE A.DocumentID={$catalogId}");
             $this->_createDmsArticle($rowCatalog, $targetFolderGuid);
             //echo " KUPRET ";
         }
     }
 }