예제 #1
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('layout-pusatdata');
     $auth = Zend_Auth::getInstance();
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     /*
     $multidb = Pandamp_Application::getResource('multidb');
     $multidb->init();
     
     $db = $multidb->getDb('db2');
     */
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     //$sso = new Pandamp_Session_Remote();
     //$user = $sso->getInfo();
     if (!$auth->hasIdentity()) {
         //$this->_forward('login','account','admin');
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $zl = Zend_Registry::get("Zend_Locale");
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             //$this->_redirect(ROOT_URL.'/'.$zl->getLanguage().'/error/restricted');
             $this->_forward('restricted', 'error', 'admin', array('lang' => $zl->getLanguage()));
         }
         // [TODO] else: check if user has access to admin page and status website is online
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1 && $zl->getLanguage() == 'id' || $rowset->status == 2 && $zl->getLanguage() == 'en' || $rowset->status == 3) {
                 // it means that user offline other than admin
                 $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($this->_user->packageId);
                 if (isset($aReturn['name'])) {
                     //if (($aReturn[1] !== "admin"))
                     if ($aReturn['name'] !== "Master" && $aReturn['name'] !== "Super Admin") {
                         $this->_forward('temporary', 'error', 'admin');
                     }
                 }
             }
         }
         // check session expire
         /*
         $timeLeftTillSessionExpires = $_SESSION['__ZF']['Zend_Auth']['ENT'] - time();
         
         if (Pandamp_Lib_Formater::diff('now', $this->_user->dtime) > $timeLeftTillSessionExpires) {
         	$db->update('KutuUser',array('ses'=>'*'),"ses='".Zend_Session::getId()."'");
         	$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
         		        $flashMessenger->addMessage('Session Expired');
         		        $auth->clearIdentity();
         		        
         		        $this->_redirect($loginUrl.'?returnUrl='.$sReturn);     
         }
         
         $dat = Pandamp_Lib_Formater::now();
         $db->update('KutuUser',array('dtime'=>$dat),"ses='".Zend_Session::getId()."'");
         */
     }
 }
예제 #2
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;
 }
예제 #3
0
 function preDispatch()
 {
     $this->_helper->layout->setLayout('new/layout-pusatdata');
     $identity = Pandamp_Application::getResource('identity');
     $loginUrl = $identity->loginUrl;
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect($loginUrl . '?returnUrl=' . $sReturn);
     } else {
         $this->_user = $auth->getIdentity();
         $zl = Zend_Registry::get("Zend_Locale");
         $acl = Pandamp_Acl::manager();
         if (!$acl->checkAcl("site", 'all', 'user', $this->_user->username, false, false)) {
             $this->_forward('restricted', 'error', 'admin', array('lang' => $zl->getLanguage()));
         }
         $tblSetting = new App_Model_Db_Table_Setting();
         $rowset = $tblSetting->find(1)->current();
         if ($rowset) {
             if ($rowset->status == 1 && $zl->getLanguage() == 'id' || $rowset->status == 2 && $zl->getLanguage() == 'en' || $rowset->status == 3) {
                 $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($this->_user->packageId);
                 if (isset($aReturn['name'])) {
                     if ($aReturn['name'] !== "Master" && $aReturn['name'] !== "Super Admin") {
                         $this->_forward('temporary', 'error', 'admin');
                     }
                 }
             }
         }
     }
 }
예제 #4
0
 /**
  * @return obj
  */
 public function show()
 {
     if (!isset(self::$_instance)) {
         $show = __CLASS__;
         self::$_instance = new $show();
     }
     return self::$_instance;
 }
예제 #5
0
 public function userGroup($packageId)
 {
     $acl = App_Model_Show_AroGroup::show()->getUserGroup($packageId);
     if (isset($acl['name'])) {
         return $acl['name'];
     } else {
         return;
     }
 }
예제 #6
0
 public function isAllowed($itemGuid, $action, $section = 'content')
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         return false;
     }
     $identity = $auth->getIdentity();
     $username = $identity->username;
     $front = Zend_Controller_Front::getInstance();
     $aclMan = $front->getParam('bootstrap')->getResource('acl');
     $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($identity->packageId);
     if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") {
         $content = 'all-access';
     } else {
         $content = $itemGuid;
     }
     return $aclMan->isAllowed($username, $content, $action, $section);
 }
예제 #7
0
 public function profile($profile = null)
 {
     $auth = Zend_Auth::getInstance();
     $packageId = $auth->getIdentity()->packageId;
     $zl = Zend_Registry::get("Zend_Locale");
     $lang = $zl->getLanguage();
     $acl = Pandamp_Acl::manager();
     $modelAroGroup = App_Model_Show_AroGroup::show();
     $tblProfile = new App_Model_Db_Table_Profile();
     $row = $tblProfile->fetchAll();
     $select_profile = "<select name=\"pg\" id=\"pg\" class=\"form-control\" style=\"width: 60%;\">\n";
     if ($profile) {
         $rowProfile = $tblProfile->find($profile)->current();
         $select_profile .= "<option value='{$rowProfile->guid}' selected>{$rowProfile->title}</option>";
         $select_profile .= "<option value =''>Choose:</option>";
     } else {
         $select_profile .= "<option value ='' selected>Choose:</option>";
     }
     foreach ($row as $rowset) {
         $aReturn = $modelAroGroup->getUserGroup($packageId);
         if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") {
             $content = 'all-access';
         } else {
             $content = $rowset->profileType;
         }
         if ($profile and $rowset->guid == $rowProfile->guid) {
             continue;
         } else {
             if ($lang == 'en') {
                 $select_profile .= "<option value='{$rowset->guid}'>{$rowset->title}</option>";
             } else {
                 if ($acl->getPermissionsOnContent('', $aReturn['name'], $content)) {
                     $select_profile .= "<option value='{$rowset->guid}'>{$rowset->title}</option>";
                 } else {
                     continue;
                 }
             }
         }
     }
     $select_profile .= "</select>\n\n";
     return $select_profile;
 }
예제 #8
0
 public function payconfirmyesAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     //print_r($this->_request->getParams());
     $id = $this->_request->getParam('orderId');
     $tblOrder = new App_Model_Db_Table_Order();
     $tblHistory = new App_Model_Db_Table_OrderHistory();
     $tblConfirm = new App_Model_Db_Table_PaymentConfirmation();
     $rowOrder = $tblOrder->find($id)->current();
     if ($rowOrder->paymentMethodNote == 'membership') {
         $oldUser = App_Model_Show_User::show()->getUserById($rowOrder->userId);
         $oldpackage = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']);
         $newGroup = App_Model_Show_AroGroup::show()->getUserGroup($rowOrder->note);
         $notes = date("Y-m-d h:i:s") . " - Changed package " . $oldpackage['name'] . " TO " . $newGroup['name'];
         $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes;
         $dataUser = array('packageId' => $rowOrder->note, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username);
         $modelUser = new App_Model_Db_Table_User();
         $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']);
         $modelUserDetail = new App_Model_Db_Table_UserDetail();
         $modelUserDetail->insert($dataUserDetail);
         $acl = Pandamp_Acl::manager();
         $acl->deleteUser($oldUser['username']);
         $acl->addUser($oldUser['username'], $newGroup['name']);
         $tblInvoice = new App_Model_Db_Table_Invoice();
         $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $rowOrder->userId);
         $rowInvoice = $tblInvoice->fetchRow($where);
         if ($rowInvoice) {
             $rowInvoice->invoiceConfirmDate = date("Y-m-d");
             $rowInvoice->isPaid = 'Y';
             // get expiration date
             $temptime = time();
             $temptime = Pandamp_Lib_Formater::DateAdd('m', $oldUser['paymentId'], $temptime);
             $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
             $rowInvoice->save();
             $dataUser['periodeId'] = 3;
         }
         $modelUser->update($dataUser, "kopel='" . $rowOrder->userId . "'");
     }
     //select payment date from paymentconfirmation
     $date = $tblConfirm->fetchAll("orderId = " . $id . " AND confirmed = 0");
     $data['paymentDate'] = $date[0]->paymentDate;
     //update order
     $data['orderStatus'] = 3;
     $tblOrder->update($data, "orderId = " . $id);
     //update paymentconfirmation
     $dataConfirm['confirmed'] = 1;
     $tblConfirm->update($dataConfirm, "orderId = " . $id);
     //add history
     $dataHistory = $tblHistory->fetchNew();
     //history data
     $dataHistory['orderId'] = $id;
     $dataHistory['orderStatusId'] = 3;
     $dataHistory['dateCreated'] = date('Y-m-d');
     $dataHistory['userNotified'] = 1;
     $dataHistory['note'] = 'confirmed';
     $dataHistory->save();
     //mailer
     //$this->Mailer($id, 'user-confirm', 'user');
     $mod = new App_Model_Store_Mailer();
     $mod->sendReceiptToUser($id, ucwords($date[0]->paymentMethod));
     //redirect to confirmation page
     $this->_redirect($this->view->serverUrl() . '/' . $this->view->getLanguage() . '/store/confirm');
 }
예제 #9
0
파일: User.php 프로젝트: hukumonline/admin
 /**
  * _writeConfirmCorporateEmail
  * @return JSON
  */
 function _writeConfirmCorporateEmail($mailcontent, $package, $fullname, $company, $payment, $disc, $total, $username, $guid, $email)
 {
     $obj = new Pandamp_Crypt_Password();
     $mailcontent = str_replace('$fullname', $fullname, $mailcontent);
     $mailcontent = str_replace('$company', $company, $mailcontent);
     $pn = App_Model_Show_AroGroup::show()->getUserGroup($package);
     $mailcontent = str_replace('$packagename', $pn['name'], $mailcontent);
     $mailcontent = str_replace('$timeline', $payment, $mailcontent);
     $mailcontent = str_replace('$disc', $disc, $mailcontent);
     $tblPackage = new App_Model_Db_Table_Package();
     $rowPackage = $tblPackage->fetchRow("packageId={$package}");
     $mailcontent = str_replace('$packageprice', number_format($rowPackage->charge), $mailcontent);
     $mailcontent = str_replace('$price', number_format($total), $mailcontent);
     $mailcontent = str_replace('$username1', $username, $mailcontent);
     $mailcontent = str_replace('$guid', $guid, $mailcontent);
     // table User
     $tblUser = new App_Model_Db_Table_User();
     $where = $tblUser->getAdapter()->quoteInto('company=?', $company);
     $rowUser = $tblUser->fetchAll($where, 'username ASC');
     $tag = '<table>';
     $tag .= '<tr><td><b>Username</b></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td><b>Password</b></td></tr>';
     foreach ($rowUser as $rowsetUser) {
         $tag .= '<tr><td>' . $rowsetUser->username . '</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>' . $obj->decryptPassword($rowsetUser->password) . '</td></tr>';
     }
     $tag .= '</table>';
     $mailcontent = str_replace('$tag', $tag, $mailcontent);
     $mail_body = $mailcontent;
     // parse ini_file
     $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail');
     $mailAttempt = $this->add_mail($config->mail->sender->support->email, $email, $username, $config->mail->sender->support->name, $mail_body);
     // try to save mail before send
     if ($mailAttempt) {
         $sendAttempt = $this->send_mail();
         if ($sendAttempt) {
             $message = "Please check your email at {$email}!";
             // update user
             $rowUser = $tblUser->find($obj->decryptPassword($guid))->current();
             if ($rowUser) {
                 $rowUser->isEmailSent = 'Y';
                 $rowUser->save();
             }
         } else {
             $message = "Error send mail but register user successfully!<br>Please contact our customer service for more information";
         }
     } else {
         $message = "Error saving mail!";
     }
     return $message;
 }
예제 #10
0
 function associateAction()
 {
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) {
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted');
     }
     $this->_helper->layout->setLayout('layout-customer-credential');
     $r = $this->getRequest();
     if ($r->isPost()) {
         $newGroup = $r->getParam('aro_groups');
         $id = $r->getParam('id');
         $oldUser = App_Model_Show_User::show()->getUserById($id);
         $groupName = App_Model_Show_AroGroup::show()->getUserGroup($newGroup);
         $package = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']);
         $notes = date("Y-m-d h:i:s") . " - Changed package " . $package['name'] . " TO " . $groupName['name'];
         $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes;
         $data = array('packageId' => $newGroup, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username);
         $modelUser = new App_Model_Db_Table_User();
         $modelUser->update($data, "kopel='" . $id . "'");
         $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']);
         $modelUserDetail = new App_Model_Db_Table_UserDetail();
         $modelUserDetail->insert($dataUserDetail);
         $username = $r->getParam('username');
         $acl = Pandamp_Acl::manager();
         $acl->deleteUser($username);
         //$acl->removeUserFromGroup($username, $oldUser['packageId']);
         $acl->addUser($username, $groupName['name']);
         //$acl->addUserToGroup($username, $groupName['name']);
         $this->view->message = "Package was sucessfully changed.";
     }
     $id = $this->_getParam("id");
     $user = App_Model_Show_User::show()->getUserById($id);
     if ($user) {
         $acl = Pandamp_Acl::manager();
         $role = $acl->getUserGroupIds($user['username']);
         //print_r($role);
         $this->view->UserRoles = $role;
         $this->view->user = $user;
     }
 }
예제 #11
0
 public function userGroup($packageId)
 {
     $acl = App_Model_Show_AroGroup::show()->getUserGroup($packageId);
     return $acl['name'];
 }
예제 #12
0
 function registerAction()
 {
     if ($this->getRequest()->getPost()) {
         $value = $this->getRequest()->getPost();
         $this->view->value = $value;
         /*
         list($ret, $body) = Pandamp_Lib_Remote::serverCmd('register', $value);
         
         switch ($ret)
         {
             case 200:
                 $this->view->message = "User&nbsp;:&nbsp;<abbr>".$value['username']."</abbr> data has been successfully saved.";
                 break;
             default:
                 $this->view->error_message = "failure";
         }
         */
         $data = $this->transformRegister($value);
         $modelUser = new App_Model_Db_Table_User();
         $id = $modelUser->insert($data);
         $this->updateKopel();
         /**
          * SELECT id, parent_id, value, name, lft, rgt
          * eg. $aReturn = $acl->getGroupData(15)
          * print_r($aReturn);
          * output: Array ( [0] => 15 [1] => 10 [2] => Super Administrator [3] => super_admin [4] => 10 [5] => 11 ) 
          */
         $acl = Pandamp_Acl::manager();
         //$aReturn = $acl->getGroupData($value['aro_groups']);
         $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($value['aro_groups']);
         //echo '<pre>';
         //print_r($aReturn);
         //echo '</pre>';
         //$acl->addUser($value['username'],$aReturn[3]);
         $acl->addUserToGroup($value['username'], $aReturn['name']);
         $formater = new Pandamp_Core_Hol_User();
         // Do you want Email Confirmation send?
         if (isset($value['ec']) == 1) {
             //echo 'y';
             $payment = $value['payment'] ? $value['payment'] : 0;
             $promotionCode = $value['promotioncode'] ? $value['promotioncode'] : '';
             switch ($value['aro_groups']) {
                 /**
                  * @modifiedDate: December 07, 2012
                  * @modifiedDate-2: January 29, 2013
                  */
                 case 14:
                     // individual
                     $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
                     //$disc = $formater->checkPromoValidation('Disc',$value['aro_groups'],$promotionCode,$payment);
                     //$total = $formater->checkPromoValidation('Total',$value['aro_groups'],$promotionCode,$payment);
                     $total = $formater->checkPromoValidation('Total', $value['aro_groups'], $payment);
                     $disc = $formater->checkPromoValidation('Disc', $value['aro_groups'], $payment);
                     //$m = $formater->_writeConfirmIndividualEmail($mailcontent,$value['fullname'],$value['username'],$value['password'],$payment,$disc,$total,base64_encode($id),$value['email']);
                     $m = $formater->_writeConfirmIndividualEmail($mailcontent, $value['aro_groups'], $value['fullname'], $value['username'], $value['password'], $payment, $disc, $total, base64_encode($id), $value['email']);
                     break;
                 case 15:
                     // corporate/basic
                 // corporate/basic
                 case 16:
                     // standard
                 // standard
                 case 18:
                     // professional
                     $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
                     //$disc = $formater->checkPromoValidation('Disc',$value['aro_groups'],$promotionCode,$payment);
                     //$total = $formater->checkPromoValidation('Total',$value['aro_groups'],$promotionCode,$payment);
                     $total = $formater->checkPromoValidation('Total', $value['aro_groups'], $payment);
                     $disc = $formater->checkPromoValidation('Disc', $value['aro_groups'], $payment);
                     //$m = $formater->_writeConfirmCorporateEmail($mailcontent,$value['fullname'],$value['company'],$payment,$disc,$total,$value['username'],base64_encode($id),$value['email']);
                     $m = $formater->_writeConfirmCorporateEmail($mailcontent, $value['aro_groups'], $value['fullname'], $value['company'], $payment, $disc, $total, $value['username'], base64_encode($id), $value['email']);
                     break;
                 default:
                     $mailcontent = $formater->getMailContent('konfirmasi email gratis');
                     $m = $formater->_writeConfirmFreeEmail($mailcontent, $value['fullname'], $value['username'], $value['password'], base64_encode($id), $value['email'], $aReturn['name']);
                     break;
             }
             $this->view->message = $m;
         } else {
             //echo 't';
         }
     }
 }
예제 #13
0
 public function getchildreninjsonAction()
 {
     // 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");
     // So that the loading indicator is visible
     sleep(1);
     $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);
     // The id of the node being opened
     $id = $_REQUEST["id"];
     if ($id == "0") {
         $rowset = App_Model_Show_Folder::show()->fetchChildren('root');
         echo '[' . "\n";
         for ($i = 0; $i < count($rowset); $i++) {
             if ($aReturn['name'] == "Master" || $aReturn['name'] == "Super Admin") {
                 $content = 'all-access';
             } else {
                 $content = $rowset[$i]['type'];
             }
             if ($acl->getPermissionsOnContent('', $aReturn['name'], $content)) {
                 if ($rowset[$i]['title'] == "Kategori" || $rowset[$i]['title'] == "Peraturan" || $rowset[$i]['title'] == "Putusan") {
                     $title = "<font color=red><b>" . $rowset[$i]['title'] . "</b></font>";
                 } else {
                     $title = $rowset[$i]['title'];
                 }
                 if ($i == count($rowset) - 1) {
                     $tree = "\t" . '{ attributes: { id : "' . $rowset[$i]['guid'] . '" }, state: "closed", data: "' . $title . '" }' . "\n";
                 } else {
                     $tree = "\t" . '{ attributes: { id : "' . $rowset[$i]['guid'] . '" }, state: "closed", data: "' . $title . '" },' . "\n";
                 }
                 echo $tree;
             } else {
                 continue;
             }
         }
         echo ']' . "\n";
     } else {
         $rowset = App_Model_Show_Folder::show()->fetchChildren($id);
         echo '[' . "\n";
         for ($i = 0; $i < count($rowset); $i++) {
             if ($i == count($rowset) - 1) {
                 echo "\t" . '{ attributes: { id : "' . $rowset[$i]['guid'] . '" }, state: "closed", data: "' . $rowset[$i]['title'] . '" }' . "\n";
             } else {
                 echo "\t" . '{ attributes: { id : "' . $rowset[$i]['guid'] . '" }, state: "closed", data: "' . $rowset[$i]['title'] . '" },' . "\n";
             }
         }
         echo ']' . "\n";
     }
     exit;
 }