function putusanAction() { $tblFolder = new App_Model_Db_Table_Folder(); if ($this->_getParam('node')) { $parentGuid = $this->_getParam('node'); $rowsetFolder = $tblFolder->fetchAll("parentGuid = '{$parentGuid}' AND NOT parentGuid=guid", "title ASC"); } else { $parentGuid = 'lt49c7077cce4ce'; $rowsetFolder = $tblFolder->fetchAll("parentGuid = '{$parentGuid}' AND NOT parentGuid=guid", "title ASC"); } $columns = 1; $num_rows = count($rowsetFolder); $rows = ceil($num_rows / $columns); if ($num_rows < 3) { $columns = $num_rows; } if ($num_rows == 0) { } $folder = 0; $data = array(); foreach ($rowsetFolder as $rowFolder) { $data[$folder][0] = $rowFolder->title; $data[$folder][1] = $rowFolder->description; $data[$folder][2] = $rowFolder->guid; $folder++; } $this->view->rows = $rows; $this->view->columns = $columns; $this->view->data = $data; $this->view->numberOfFolders = $num_rows; $this->view->node = $parentGuid; }
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; }
public function getchildreninjson2Action() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); // Make sure nothing is cached header("Cache-Control: must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") - 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header('Content-Type: application/json'); sleep(1); $acl = Pandamp_Acl::manager(); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { echo "You aren't login"; } $identity = $auth->getIdentity(); $username = $identity->username; $id = $_REQUEST["id"] == "#" ? "root" : $_REQUEST["id"]; $aJson = array(); $folder = new App_Model_Db_Table_Folder(); $rowset = $folder->fetchChildren($id); $i = 0; foreach ($rowset as $row) { if ($identity->name == "Master" || $identity->name == "Super Admin") { $content = 'all-access'; } else { $content = $row->type; } if ($acl->getPermissionsOnContent('', $identity->name, $content)) { if ($row->title == "Kategori" || $row->title == "Peraturan" || $row->title == "Putusan") { $title = "<font color=red><b>" . $row->title . "</b></font>"; } else { $title = $row->title; } $aJson[$i]['id'] = $row->guid; $aJson[$i]['text'] = $title; $checkLeaf = $folder->fetchAll("path like '%{$row->guid}/%'"); if ($checkLeaf->count() > 0) { $aJson[$i]['children'] = true; } else { $aJson[$i]['children'] = false; } } else { continue; } $i++; } $this->_response->setBody(Zend_Json::encode($aJson)); }