[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Vtiger/views/ -> Index.php (source)

   1  <?php
   2  /*+**********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.1
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   ************************************************************************************/
  10  
  11  class Vtiger_Index_View extends Vtiger_Basic_View {
  12  
  13  	function __construct() {
  14          parent::__construct();
  15      }
  16  
  17  	function checkPermission(Vtiger_Request $request) {
  18          //Return true as WebUI.php is already checking for module permission
  19          return true;
  20      }
  21  
  22  	public function preProcess (Vtiger_Request $request, $display=true) {
  23          parent::preProcess($request, false);
  24  
  25                  $viewer = $this->getViewer($request);
  26  
  27          $moduleName = $request->getModule();
  28          if(!empty($moduleName)) {
  29              $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
  30              $currentUser = Users_Record_Model::getCurrentUserModel();
  31              $userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
  32              $permission = $userPrivilegesModel->hasModulePermission($moduleModel->getId());
  33              $viewer->assign('MODULE', $moduleName);
  34  
  35              if(!$permission) {
  36                  $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
  37                  $viewer->view('OperationNotPermitted.tpl', $moduleName);
  38                  exit;
  39              }
  40  
  41              $linkParams = array('MODULE'=>$moduleName, 'ACTION'=>$request->get('view'));
  42              $linkModels = $moduleModel->getSideBarLinks($linkParams);
  43  
  44              $viewer->assign('QUICK_LINKS', $linkModels);
  45          }
  46          
  47          $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
  48          $viewer->assign('CURRENT_VIEW', $request->get('view'));
  49          if($display) {
  50              $this->preProcessDisplay($request);
  51          }
  52      }
  53  
  54  	protected function preProcessTplName(Vtiger_Request $request) {
  55          return 'IndexViewPreProcess.tpl';
  56      }
  57  
  58      //Note : To get the right hook for immediate parent in PHP,
  59      // specially in case of deep hierarchy
  60      /*function preProcessParentTplName(Vtiger_Request $request) {
  61          return parent::preProcessTplName($request);
  62      }*/
  63  
  64  	public function postProcess(Vtiger_Request $request) {
  65          $moduleName = $request->getModule();
  66          $viewer = $this->getViewer($request);
  67          $viewer->view('IndexPostProcess.tpl', $moduleName);
  68  
  69          parent::postProcess($request);
  70      }
  71  
  72  	public function process(Vtiger_Request $request) {
  73          $moduleName = $request->getModule();
  74          $viewer = $this->getViewer($request);
  75          $viewer->view('Index.tpl', $moduleName);
  76      }
  77  
  78      /**
  79       * Function to get the list of Script models to be included
  80       * @param Vtiger_Request $request
  81       * @return <Array> - List of Vtiger_JsScript_Model instances
  82       */
  83  	function getHeaderScripts(Vtiger_Request $request) {
  84          $headerScriptInstances = parent::getHeaderScripts($request);
  85          $moduleName = $request->getModule();
  86  
  87          $jsFileNames = array(
  88              'modules.Vtiger.resources.Vtiger',
  89              "modules.$moduleName.resources.$moduleName",
  90          );
  91  
  92          $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
  93          $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
  94          return $headerScriptInstances;
  95      }
  96          
  97          public function validateRequest(Vtiger_Request $request) { 
  98              $request->validateReadAccess(); 
  99          } 
 100  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1