[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Users/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  class Users_ListView_Model extends Vtiger_ListView_Model {
  12  
  13      /**
  14       * Function to get the list of listview links for the module
  15       * @param <Array> $linkParams
  16       * @return <Array> - Associate array of Link Type to List of Vtiger_Link_Model instances
  17       */
  18  	public function getListViewLinks($linkParams) {
  19          $linkTypes = array('LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
  20          $links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), $linkTypes, $linkParams);
  21  
  22          $basicLinks = array(
  23              array(
  24                  'linktype' => 'LISTVIEWBASIC',
  25                  'linklabel' => 'LBL_ADD_RECORD',
  26                  'linkurl' => $this->getModule()->getCreateRecordUrl(),
  27                  'linkicon' => ''
  28              )
  29          );
  30          foreach($basicLinks as $basicLink) {
  31              $links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
  32          }
  33  
  34          return $links;
  35      }
  36  
  37      /**
  38       * Function to get the list of Mass actions for the module
  39       * @param <Array> $linkParams
  40       * @return <Array> - Associative array of Link type to List of  Vtiger_Link_Model instances for Mass Actions
  41       */
  42  	public function getListViewMassActions($linkParams) {
  43          return array();
  44      }
  45  
  46      /**
  47       * Functions returns the query
  48       * @return string
  49       */
  50      public function getQuery() {
  51              $listQuery = parent::getQuery();
  52          //remove the status active condition since in users list view we need to consider inactive users as well
  53          $listQueryComponents = explode(" WHERE vtiger_users.status='Active' AND",$listQuery);
  54                  $listQuery = implode(' WHERE ', $listQueryComponents);
  55              return $listQuery;
  56      }
  57  
  58      /**
  59       * Function to get the list view entries
  60       * @param Vtiger_Paging_Model $pagingModel, $status (Active or Inactive User). Default false
  61       * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  62       */
  63  	public function getListViewEntries($pagingModel) {
  64          $queryGenerator = $this->get('query_generator');
  65                  
  66          // Added as Users module do not have custom filters and id column is added by querygenerator.
  67          $fields = $queryGenerator->getFields();
  68          $fields[] = 'id';
  69          $queryGenerator->setFields($fields);
  70          
  71          return parent::getListViewEntries($pagingModel);
  72      }
  73  }


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