[ 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 class Settings_Webforms_Module_Model extends Settings_Vtiger_Module_Model { 12 13 var $baseTable = 'vtiger_webforms'; 14 var $baseIndex = 'id'; 15 var $nameFields = array('name'); 16 var $listFields = array('name'=>'WebForm Name', 'targetmodule' => 'Module', 'publicid'=>'Public Id', 'returnurl' => 'Return Url', 'enabled' => 'Status'); 17 var $name = 'Webforms'; 18 19 public static function getSupportedModulesList() { 20 $webformModules = array('Contacts','Accounts','Leads','Potentials','HelpDesk'); 21 $sourceModule = array(); 22 foreach ($webformModules as $key => $moduleName) { 23 $moduleModel = Vtiger_Module_Model::getInstance($moduleName); 24 $presenceValues = array(0,2); 25 if(in_array($moduleModel->presence, $presenceValues)){ 26 $sourceModule[$moduleName] = vtranslate($moduleName, $moduleName); 27 } 28 } 29 return $sourceModule; 30 } 31 32 /** 33 * Function to get Create view url 34 * @return <String> Url 35 */ 36 public function getCreateRecordUrl() { 37 return "index.php?module=".$this->getName()."&parent=".$this->getParentName()."&view=Edit"; 38 } 39 40 /** 41 * Function to get List view url 42 * @return <String> Url 43 */ 44 public function getListViewUrl() { 45 return "index.php?module=".$this->getName()."&parent=".$this->getParentName()."&view=List"; 46 } 47 48 /** 49 * Function to get list of Blocks 50 * @return <Array> list of Block models <Settings_Webforms_Block_Model> 51 */ 52 public function getBlocks() { 53 if(empty($this->blocks)) { 54 $this->blocks = Settings_Webforms_Block_Model::getAllForModule($this); 55 } 56 return $this->blocks; 57 } 58 59 /** 60 * Function to get list of fields 61 * @return <Array> list of Field models <Settings_Webforms_Field_Model> 62 */ 63 public function getFields() { 64 if (!$this->fields) { 65 $fieldsList = array(); 66 $blocks = $this->getBlocks(); 67 foreach ($blocks as $blockModel) { 68 $fieldsList = array_merge($fieldsList, $blockModel->getFields()); 69 } 70 $this->fields = $fieldsList; 71 } 72 return $this->fields; 73 } 74 75 /** 76 * Function to get field using field name 77 * @param <String> $fieldName 78 * @return <Settings_Webforms_Field_Model> 79 */ 80 public function getField($fieldName) { 81 $fields = $this->getFields(); 82 return $fields[$fieldName]; 83 } 84 85 /** 86 * Function to delete record 87 * @param <Settings_Webforms_Record_Model> $recordModel 88 * @return <boolean> true 89 */ 90 public function deleteRecord($recordModel) { 91 $recordId = $recordModel->getId(); 92 $db = PearDatabase::getInstance(); 93 94 $db->pquery("DELETE from vtiger_webforms_field WHERE webformid = ?", array($recordId)); 95 $db->pquery("DELETE from vtiger_webforms WHERE id = ?", array($recordId)); 96 return true; 97 } 98 }
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 |