Esempio n. 1
0
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $folderId = $request->get('folderid');
     if ($folderId) {
         $folderModel = Reports_Folder_Model::getInstanceById($folderId);
     } else {
         $folderModel = Reports_Folder_Model::getInstance();
     }
     $viewer->assign('FOLDER_MODEL', $folderModel);
     $viewer->assign('MODULE', $moduleName);
     $viewer->view('EditFolder.tpl', $moduleName);
 }
Esempio n. 2
0
 /**
  * Function that deletes the Folder
  * @param Vtiger_Request $request
  */
 function delete(Vtiger_Request $request)
 {
     $folderId = $request->get('folderid');
     $moduleName = $request->getModule();
     if ($folderId) {
         $folderModel = Reports_Folder_Model::getInstanceById($folderId);
         if ($folderModel->isDefault()) {
             throw new AppException(vtranslate('LBL_FOLDER_CAN_NOT_BE_DELETED', $moduleName));
         } else {
             if ($folderModel->hasReports()) {
                 throw new AppException(vtranslate('LBL_FOLDER_NOT_EMPTY', $moduleName));
             }
         }
         $folderModel->delete();
         $result = array('success' => true, 'message' => vtranslate('LBL_FOLDER_DELETED', $moduleName));
         $response = new Vtiger_Response();
         $response->setResult($result);
         $response->emit();
     }
 }