[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Vtiger/models/ -> EditView.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   * Vtiger EditView Model Class
  13   */
  14  class Vtiger_EditView_Model extends Vtiger_Base_Model {
  15  
  16      /**
  17       * Function to get the Module Model
  18       * @return Vtiger_Module_Model instance
  19       */
  20  	public function getModule() {
  21          return $this->get('module');
  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 getEditViewLinks($linkParams) {
  30          $currentUserModel = Users_Record_Model::getCurrentUserModel();
  31          $linkTypes = array('LISTVIEWQUICK', 'LISTVIEWQUICKWIDGET', 'LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
  32          $links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), $linkTypes, $linkParams);
  33  
  34          $quickLinks = array(
  35              array(
  36                  'linktype' => 'LISTVIEWQUICK',
  37                  'linklabel' => 'Dashboard',
  38                  'linkurl' => $this->getModule()->getDefaultUrl(),
  39                  'linkicon' => ''
  40              ),
  41              array(
  42                  'linktype' => 'LISTVIEWQUICK',
  43                  'linklabel' => $this->getModule()->get('label').' List',
  44                  'linkurl' => $this->getModule()->getDefaultUrl(),
  45                  'linkicon' => ''
  46              ),
  47          );
  48          foreach($quickLinks as $quickLink) {
  49              $links['LISTVIEWQUICK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
  50          }
  51  
  52          $quickWidgets = array(
  53              array(
  54                  'linktype' => 'LISTVIEWQUICKWIDGET',
  55                  'linklabel' => 'Active '.$this->getModule()->get('label'),
  56                  'linkurl' => 'module='.$this->getModule()->get('name').'&view=List&mode=showActiveRecords',
  57                  'linkicon' => ''
  58              )
  59          );
  60          foreach($quickWidgets as $quickWidget) {
  61              $links['LISTVIEWQUICKWIDGET'][] = Vtiger_Link_Model::getInstanceFromValues($quickWidget);
  62          }
  63  
  64          $basicLinks = array(
  65              array(
  66                  'linktype' => 'LISTVIEWBASIC',
  67                  'linklabel' => 'Add '.$this->getModule()->get('name'),
  68                  'linkurl' => $this->getModule()->getCreateRecordUrl(),
  69                  'linkicon' => ''
  70              )
  71          );
  72          foreach($basicLinks as $basicLink) {
  73              $links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
  74          }
  75  
  76          $advancedLinks = array(
  77              array(
  78                  'linktype' => 'LISTVIEW',
  79                  'linklabel' => 'Import',
  80                  'linkurl' => $this->getModule()->getImportUrl(),
  81                  'linkicon' => ''
  82              ),
  83              array(
  84                  'linktype' => 'LISTVIEW',
  85                  'linklabel' => 'Export',
  86                  'linkurl' => $this->getModule()->getExportUrl(),
  87                  'linkicon' => ''
  88              ),
  89              array(
  90                  'linktype' => 'LISTVIEW',
  91                  'linklabel' => 'Find Duplicates',
  92                  'linkurl' => $this->getModule()->getFindDuplicatesUrl(),
  93                  'linkicon' => ''
  94              )
  95          );
  96          foreach($advancedLinks as $advancedLink) {
  97              $links['LISTVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($advancedLink);
  98          }
  99  
 100          if($currentUserModel->isAdminUser()) {
 101  
 102              $settingsLinks = array(
 103                  array(
 104                      'linktype' => 'LISTVIEWSETTING',
 105                      'linklabel' => 'Edit Fields',
 106                      'linkurl' => $this->getModule()->getSettingsUrl('LayoutEditor'),
 107                      'linkicon' => ''
 108                  ),
 109                  array(
 110                      'linktype' => 'LISTVIEWSETTING',
 111                      'linklabel' => 'Edit Workflows',
 112                      'linkurl' => $this->getModule()->getSettingsUrl('EditWorkflows'),
 113                      'linkicon' => ''
 114                  ),
 115                  array(
 116                      'linktype' => 'LISTVIEWSETTING',
 117                      'linklabel' => 'Edit Picklist Values',
 118                      'linkurl' => $this->getModule()->getSettingsUrl('PicklistEditor'),
 119                      'linkicon' => ''
 120                  )
 121              );
 122              foreach($settingsLinks as $settingsLink) {
 123                  $links['LISTVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
 124              }
 125          }
 126  
 127          return $links;
 128      }
 129  }


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