[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
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 * Settings Module Model Class 13 */ 14 class Settings_Vtiger_Module_Model extends Vtiger_Base_Model { 15 16 var $baseTable = 'vtiger_settings_field'; 17 var $baseIndex = 'fieldid'; 18 var $listFields = array('name' => 'Name', 'description' => 'Description'); 19 var $nameFields = array('name'); 20 var $name = 'Vtiger'; 21 22 public function getName($includeParentIfExists = false) { 23 if($includeParentIfExists) { 24 return $this->getParentName() .':'. $this->name; 25 } 26 return $this->name; 27 } 28 29 public function getParentName() { 30 return 'Settings'; 31 } 32 33 public function getBaseTable() { 34 return $this->baseTable; 35 } 36 37 public function getBaseIndex() { 38 return $this->baseIndex; 39 } 40 41 public function setListFields($fieldNames) { 42 $this->listFields = $fieldNames; 43 return $this; 44 } 45 46 public function getListFields() { 47 if(!$this->listFieldModels) { 48 $fields = $this->listFields; 49 $fieldObjects = array(); 50 foreach($fields as $fieldName => $fieldLabel) { 51 $fieldObjects[$fieldName] = new Vtiger_Base_Model(array('name' => $fieldName, 'label' => $fieldLabel)); 52 } 53 $this->listFieldModels = $fieldObjects; 54 } 55 return $this->listFieldModels; 56 } 57 58 /** 59 * Function to get name fields of this module 60 * @return <Array> list field names 61 */ 62 public function getNameFields() { 63 return $this->nameFields; 64 } 65 66 /** 67 * Function to get field using field name 68 * @param <String> $fieldName 69 * @return <Field_Model> 70 */ 71 public function getField($fieldName) { 72 return new Vtiger_Base_Model(array('name' => $fieldName, 'label' => $fieldName)); 73 } 74 75 public function hasCreatePermissions() { 76 return true; 77 } 78 79 /** 80 * Function to get all the Settings menus 81 * @return <Array> - List of Settings_Vtiger_Menu_Model instances 82 */ 83 public function getMenus() { 84 return Settings_Vtiger_Menu_Model::getAll(); 85 } 86 87 /** 88 * Function to get all the Settings menu items for the given menu 89 * @return <Array> - List of Settings_Vtiger_MenuItem_Model instances 90 */ 91 public function getMenuItems($menu=false) { 92 $menuModel = false; 93 if($menu) { 94 $menuModel = Settings_Vtiger_Menu_Model::getInstance($menu); 95 } 96 return Settings_Vtiger_MenuItem_Model::getAll($menuModel); 97 } 98 99 public function isPagingSupported(){ 100 return true; 101 } 102 103 /** 104 * Function to get the instance of Settings module model 105 * @return Settings_Vtiger_Module_Model instance 106 */ 107 public static function getInstance($name='Settings:Vtiger') { 108 $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Module', $name); 109 return new $modelClassName(); 110 } 111 112 /** 113 * Function to get Index view Url 114 * @return <String> URL 115 */ 116 public function getIndexViewUrl() { 117 return 'index.php?module='.$this->getName().'&parent='.$this->getParentName().'&view=Index'; 118 } 119 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |