[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Settings/PickListDependency/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 Settings_PickListDependency_ListView_Model extends Settings_Vtiger_ListView_Model {
  12  
  13      /**
  14       * Function to get the list view header
  15       * @return <Array> - List of Vtiger_Field_Model instances
  16       */
  17  	public function getListViewHeaders() {
  18          $field = new Vtiger_Base_Model();
  19          $field->set('name', 'sourceLabel');
  20          $field->set('label', 'Module');
  21          $field->set('sort',false);
  22  
  23          $field1 = new Vtiger_Base_Model();
  24          $field1->set('name', 'sourcefieldlabel');
  25          $field1->set('label', 'Source Field');
  26          $field1->set('sort',false);
  27  
  28          $field2 = new Vtiger_Base_Model();
  29          $field2->set('name', 'targetfieldlabel');
  30          $field2->set('label', 'Target Field');
  31          $field2->set('sort',false);
  32  
  33          return array($field, $field1, $field2);
  34      }
  35  
  36      /**
  37       * Function to get the list view entries
  38       * @param Vtiger_Paging_Model $pagingModel
  39       * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  40       */
  41  	public function getListViewEntries($pagingModel) {
  42          $forModule = $this->get('formodule');
  43  
  44          $dependentPicklists = Vtiger_DependencyPicklist::getDependentPicklistFields($forModule);
  45  
  46          $noOfRecords = count($dependentPicklists);
  47          $recordModelClass = Vtiger_Loader::getComponentClassName('Model', 'Record', 'Settings:PickListDependency');
  48  
  49          $listViewRecordModels = array();
  50          for($i=0; $i<$noOfRecords; $i++) {
  51              $record = new $recordModelClass();
  52              $module = $dependentPicklists[$i]['module'];
  53              unset($dependentPicklists[$i]['module']);
  54              $record->setData($dependentPicklists[$i]);
  55              $record->set('sourceModule',$module);
  56              $record->set('sourceLabel', vtranslate($module, $module));
  57              $listViewRecordModels[] = $record;
  58          }
  59          $pagingModel->calculatePageRange($listViewRecordModels);
  60          return $listViewRecordModels;
  61      }
  62  }


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