[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Events/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  /**

  12   * Calendar Module Model Class

  13   */
  14  class Events_Module_Model extends Calendar_Module_Model {
  15  
  16      /**

  17       * Function to get the url for list view of the module

  18       * @return <string> - url

  19       */
  20  	public function getListViewUrl() {
  21          return 'index.php?module=Calendar&view='.$this->getListViewName();
  22      }
  23  
  24     /**

  25       * Function to save a given record model of the current module

  26       * @param Vtiger_Record_Model $recordModel

  27       */
  28  	public function saveRecord($recordModel) {
  29          $recordModel = parent::saveRecord($recordModel);
  30          
  31          //code added to send mail to the vtiger_invitees

  32          $selectUsers = $recordModel->get('selectedusers');
  33          if(!empty($selectUsers))
  34          {
  35              $invities = implode(';',$selectUsers);
  36              $mail_contents = $recordModel->getInviteUserMailData();
  37              $activityMode = ($recordModel->getModuleName()=='Calendar') ? 'Task' : 'Events';
  38              sendInvitation($invities,$activityMode,$recordModel->get('subject'),$mail_contents);
  39          }
  40      }
  41  
  42      /**

  43       * Function to retrieve name fields of a module

  44       * @return <array> - array which contains fields which together construct name fields

  45       */
  46  	public function getNameFields(){
  47          $nameFieldObject = Vtiger_Cache::get('EntityField',$this->getName());
  48          $moduleName = $this->getName();
  49          if($nameFieldObject && $nameFieldObject->fieldname) {
  50              $this->nameFields = explode(',', $nameFieldObject->fieldname);
  51          } else {
  52              $adb = PearDatabase::getInstance();
  53  
  54              $query = "SELECT fieldname, tablename, entityidfield FROM vtiger_entityname WHERE tabid = ?";
  55              $result = $adb->pquery($query, array(getTabid('Calendar')));
  56              $this->nameFields = array();
  57              if($result){
  58                  $rowCount = $adb->num_rows($result);
  59                  if($rowCount > 0){
  60                      $fieldNames = $adb->query_result($result,0,'fieldname');
  61                      $this->nameFields = explode(',', $fieldNames);
  62                  }
  63              }
  64              
  65              $entiyObj = new stdClass();
  66              $entiyObj->basetable = $adb->query_result($result, 0, 'tablename');
  67              $entiyObj->basetableid =  $adb->query_result($result, 0, 'entityidfield');
  68              $entiyObj->fieldname =  $fieldNames;
  69              Vtiger_Cache::set('EntityField',$this->getName(), $entiyObj);
  70          }
  71          return $this->nameFields;
  72      }
  73      
  74  }


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