예제 #1
0
 public function forcedeleteOldAction()
 {
     $r = $this->getRequest();
     $folderGuid = $r->getParam('guid');
     $bpm = new Pandamp_Core_Hol_Folder();
     if (is_array($folderGuid)) {
         foreach ($folderGuid as $guid) {
             try {
                 $bpm->forceDelete($folderGuid);
             } catch (Exception $e) {
                 throw new Zend_Exception($e->getMessage());
             }
         }
     } else {
         try {
             $bpm->forceDelete($folderGuid);
         } catch (Exception $e) {
             throw new Zend_Exception($e->getMessage());
         }
     }
     $this->view->message = "Folder(s) have been deleted.";
 }
 function forcedeleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $sReturn = base64_encode($sReturn);
         $identity = Pandamp_Application::getResource('identity');
         $loginUrl = $identity->loginUrl;
         $this->_redirect($loginUrl . '?returnTo=' . $sReturn);
         //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn);
     } else {
         // [TODO] else: check if user has access to admin page
         $username = $auth->getIdentity()->username;
         // get group information
         $acl = Pandamp_Acl::manager();
         $aReturn = $acl->getUserGroupIds($username);
         if (isset($aReturn[1])) {
             //if (($aReturn[1] !== "admin"))
             if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") {
                 echo "{success:false, error:'Dont have enough permission. Please contact Administrator.'}";
                 die;
             }
         }
     }
     $r = $this->getRequest();
     $folderGuid = $r->getParam('node');
     $hol = new Pandamp_Core_Hol_Folder();
     try {
         $hol->forceDelete($folderGuid);
         $response['success'] = true;
         $response['message'] = "Folder and Sub Folders, with catalog and Sub Catalog has been deleted!";
     } catch (Exception $e) {
         $response['failure'] = true;
         $response['error'] = $e->getMessage();
     }
     echo Zend_Json::encode($response);
 }