[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Inventory/models/ -> ListView.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   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  /**
  12   * Inventory ListView Model Class
  13   */
  14  class Inventory_ListView_Model extends Vtiger_ListView_Model {
  15  
  16      /*
  17       * Function to give advance links of a module
  18       *    @RETURN array of advanced links
  19       */
  20  	public function getAdvancedLinks(){
  21          return parent::getAdvancedLinks();
  22      }
  23  
  24      /**
  25       * Function to get the list of listview links for the module
  26       * @param <Array> $linkParams
  27       * @return <Array> - Associate array of Link Type to List of Vtiger_Link_Model instances
  28       */
  29  	public function getListViewLinks($linkParams) {
  30          $currentUserModel = Users_Record_Model::getCurrentUserModel();
  31          $moduleModel = $this->getModule();
  32  
  33          $linkTypes = array('LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
  34          $links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
  35  
  36          $basicLinks = array();
  37  
  38          $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView');
  39          if($createPermission) {
  40              $basicLinks[] = array(
  41                      'linktype' => 'LISTVIEWBASIC',
  42                      'linklabel' => 'LBL_ADD_RECORD',
  43                      'linkurl' => $moduleModel->getCreateRecordUrl(),
  44                      'linkicon' => ''
  45              );
  46          }
  47  
  48          $exportPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'Export');
  49          if($exportPermission) {
  50              $advancedLinks[] = array(
  51                      'linktype' => 'LISTVIEW',
  52                      'linklabel' => 'LBL_EXPORT',
  53                      'linkurl' => 'javascript:Vtiger_List_Js.triggerExportAction("'.$this->getModule()->getExportUrl().'")',
  54                      'linkicon' => ''
  55                  );
  56          }
  57  
  58          foreach($basicLinks as $basicLink) {
  59              $links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
  60          }
  61  
  62          $advancedLinks = $this->getAdvancedLinks();
  63          foreach($advancedLinks as $advancedLink) {
  64              $links['LISTVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($advancedLink);
  65          }
  66  
  67          if($currentUserModel->isAdminUser()) {
  68              $settingsLinks = $this->getSettingLinks();
  69              foreach($settingsLinks as $settingsLink) {
  70                  $links['LISTVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
  71              }
  72          }
  73          return $links;
  74      }
  75  }


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