[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/pkg/vtiger/modules/SMSNotifier/settings/models/ -> Module.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_SMSNotifier_Module_Model extends Settings_Vtiger_Module_Model {
  12  
  13      var $baseTable = 'vtiger_smsnotifier_servers';
  14      var $nameFields = array();
  15      var $listFields = array('providertype' => 'Provider', 'username' => 'User Name', 'isactive' => 'Active');
  16      var $name = 'SMSNotifier';
  17  
  18      /**
  19       * Function to get editable fields from this module
  20       * @return <Array> list of editable fields
  21       */
  22  	public function getEditableFields() {
  23          $fieldsList = array(
  24                  array('name' => 'providertype', 'label' => 'Provider',    'type' => 'picklist'),
  25                  array('name' => 'isactive',        'label' => 'Active',    'type' => 'radio'),
  26                  array('name' => 'username',        'label' => 'User Name',    'type' => 'text'),
  27                  array('name' => 'password',        'label' => 'Password',    'type' => 'password')
  28          );
  29  
  30          $fieldModelsList = array();
  31          foreach ($fieldsList as $fieldInfo) {
  32              $fieldModelsList[$fieldInfo['name']] = Settings_SMSNotifier_Field_Model::getInstanceByRow($fieldInfo);
  33          }
  34          return $fieldModelsList;
  35      }
  36  
  37      /**
  38       * Function to get Create view url
  39       * @return <String> Url
  40       */
  41  	public function getCreateRecordUrl() {
  42          return 'javascript:Settings_SMSNotifier_List_Js.triggerEdit(event, "index.php?module='.$this->getName().'&parent='.$this->getParentName().'&view=Edit")';
  43      }
  44  
  45      /**
  46       * Function to get List view url
  47       * @return <String> Url
  48       */
  49  	public function getListViewUrl() {
  50          return "index.php?module=".$this->getName()."&parent=".$this->getParentName()."&view=List";
  51      }
  52  
  53      /**
  54       * Function to get list of all providers
  55       * @return <Array> list of all providers <SMSNotifier_Provider_Model>
  56       */
  57  	public function getAllProviders() {
  58          if (!$this->allProviders) {
  59              $this->allProviders = SMSNotifier_Provider_Model::getAll();
  60          }
  61          return $this->allProviders;
  62      }
  63  
  64      /**
  65       * Function to delete records
  66       * @param <Array> $recordIdsList
  67       * @return <Boolean> true/false
  68       */
  69  	public static function deleteRecords($recordIdsList = array()) {
  70          if ($recordIdsList) {
  71              $db = PearDatabase::getInstance();
  72              $query = 'DELETE FROM vtiger_smsnotifier_servers WHERE id IN (' . generateQuestionMarks($recordIdsList). ')';
  73              $db->pquery($query, $recordIdsList);
  74              return true;
  75          }
  76          return false;
  77      }
  78  }


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