[ 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 * Events Record Model Class 13 */ 14 class Events_Record_Model extends Calendar_Record_Model { 15 16 /** 17 * Function to get the Edit View url for the record 18 * @return <String> - Record Edit View Url 19 */ 20 public function getEditViewUrl() { 21 $module = $this->getModule(); 22 return 'index.php?module=Calendar&view='.$module->getEditViewName().'&record='.$this->getId(); 23 } 24 25 /** 26 * Function to get the Delete Action url for the record 27 * @return <String> - Record Delete Action Url 28 */ 29 public function getDeleteUrl() { 30 $module = $this->getModule(); 31 return 'index.php?module=Calendar&action='.$module->getDeleteActionName().'&record='.$this->getId(); 32 } 33 34 /** 35 * Funtion to get Duplicate Record Url 36 * @return <String> 37 */ 38 public function getDuplicateRecordUrl(){ 39 $module = $this->getModule(); 40 return 'index.php?module=Calendar&view='.$module->getEditViewName().'&record='.$this->getId().'&isDuplicate=true'; 41 42 } 43 44 public function getRelatedToContactIdList() { 45 $adb = PearDatabase::getInstance(); 46 $query = 'SELECT * from vtiger_cntactivityrel where activityid=?'; 47 $result = $adb->pquery($query, array($this->getId())); 48 $num_rows = $adb->num_rows($result); 49 50 $contactIdList = array(); 51 for($i=0; $i<$num_rows; $i++) { 52 $row = $adb->fetchByAssoc($result, $i); 53 $contactIdList[$i] = $row['contactid']; 54 } 55 return $contactIdList; 56 } 57 58 public function getRelatedContactInfo() { 59 $contactIdList = $this->getRelatedToContactIdList(); 60 $relatedContactInfo = array(); 61 foreach($contactIdList as $contactId) { 62 $relatedContactInfo[] = array('name' => Vtiger_Util_Helper::getRecordName($contactId) ,'id' => $contactId); 63 } 64 return $relatedContactInfo; 65 } 66 67 public function getInvities() { 68 $adb = PearDatabase::getInstance(); 69 $sql = "select vtiger_invitees.* from vtiger_invitees where activityid=?"; 70 $result = $adb->pquery($sql,array($this->getId())); 71 $invitiesId = array(); 72 73 $num_rows = $adb->num_rows($result); 74 75 for($i=0; $i<$num_rows; $i++) { 76 $invitiesId[] = $adb->query_result($result, $i,'inviteeid'); 77 } 78 return $invitiesId; 79 } 80 81 public function getInviteUserMailData() { 82 $adb = PearDatabase::getInstance(); 83 84 $return_id = $this->getId(); 85 $cont_qry = "select * from vtiger_cntactivityrel where activityid=?"; 86 $cont_res = $adb->pquery($cont_qry, array($return_id)); 87 $noofrows = $adb->num_rows($cont_res); 88 $cont_id = array(); 89 if($noofrows > 0) { 90 for($i=0; $i<$noofrows; $i++) { 91 $cont_id[] = $adb->query_result($cont_res,$i,"contactid"); 92 } 93 } 94 $cont_name = ''; 95 foreach($cont_id as $key=>$id) { 96 if($id != '') { 97 $contact_name = Vtiger_Util_Helper::getRecordName($id); 98 $cont_name .= $contact_name .', '; 99 } 100 } 101 102 $parentId = $this->get('parent_id'); 103 $parentName = ''; 104 if($parentId != '') { 105 $parentName = Vtiger_Util_Helper::getRecordName($parentId); 106 } 107 108 $cont_name = trim($cont_name,', '); 109 $mail_data = Array(); 110 $mail_data['user_id'] = $this->get('assigned_user_id'); 111 $mail_data['subject'] = $this->get('subject'); 112 $moduleName = $this->getModuleName(); 113 $mail_data['status'] = (($moduleName=='Calendar')?($this->get('taskstatus')):($this->get('eventstatus'))); 114 $mail_data['activity_mode'] = (($moduleName=='Calendar')?('Task'):('Events')); 115 $mail_data['taskpriority'] = $this->get('taskpriority'); 116 $mail_data['relatedto'] = $parentName; 117 $mail_data['contact_name'] = $cont_name; 118 $mail_data['description'] = $this->get('description'); 119 $mail_data['assign_type'] = $this->get('assigntype'); 120 $mail_data['group_name'] = getGroupName($this->get('assigned_user_id')); 121 $mail_data['mode'] = $this->get('mode'); 122 //TODO : remove dependency on request; 123 $value = getaddEventPopupTime($_REQUEST['time_start'],$_REQUEST['time_end'],'24'); 124 $start_hour = $value['starthour'].':'.$value['startmin'].''.$value['startfmt']; 125 if($_REQUEST['activity_mode']!='Task') 126 $end_hour = $value['endhour'] .':'.$value['endmin'].''.$value['endfmt']; 127 $startDate = new DateTimeField($_REQUEST['date_start']." ".$start_hour); 128 $endDate = new DateTimeField($_REQUEST['due_date']." ".$end_hour); 129 $mail_data['st_date_time'] = $startDate->getDBInsertDateTimeValue(); 130 $mail_data['end_date_time'] = $endDate->getDBInsertDateTimeValue(); 131 $mail_data['location']=$this->get('location'); 132 return $mail_data; 133 } 134 }
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 |