[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/DetailView.php,v 1.12 2005/03/17 11:26:49 ray Exp $ 17 * Description: TODO: To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 require_once ('Smarty_setup.php'); 24 require_once ('data/Tracker.php'); 25 require_once ('modules/Calendar/Activity.php'); 26 require_once ('include/CustomFieldUtil.php'); 27 require_once ('include/database/PearDatabase.php'); 28 require_once ('include/utils/utils.php'); 29 require_once ('modules/Calendar/calendarLayout.php'); 30 include_once 'modules/Calendar/header.php'; 31 global $mod_strings, $currentModule; 32 if( $_SESSION['mail_send_error']!="") 33 { 34 echo '<b><font color=red>'. $mod_strings{"LBL_NOTIFICATION_ERROR"}.'</font></b><br>'; 35 } 36 session_unregister('mail_send_error'); 37 $focus = new Activity(); 38 $smarty = new vtigerCRM_Smarty(); 39 $activity_mode = $_REQUEST['activity_mode']; 40 //If activity_mode == null 41 42 if($activity_mode =='' || strlen($activity_mode) < 1) 43 { 44 $query = "select activitytype from vtiger_activity where activityid=".$_REQUEST['record']; 45 $result = $adb->query($query); 46 $actType = $adb->query_result($result,0,'activitytype'); 47 if( $actType == 'Task') 48 { 49 $activity_mode = $actType; 50 } 51 elseif($actType == 'Meeting' || $actType == 'Call') 52 { 53 $activity_mode = 'Events'; 54 } 55 } 56 57 58 59 if($activity_mode == 'Task') 60 { 61 $tab_type = 'Calendar'; 62 $smarty->assign("SINGLE_MOD",$mod_strings['LBL_TODO']); 63 } 64 elseif($activity_mode == 'Events') 65 { 66 $tab_type = 'Events'; 67 $smarty->assign("SINGLE_MOD",$mod_strings['LBL_EVENT']); 68 } 69 $tab_id=getTabid($tab_type); 70 71 72 if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) { 73 $focus->retrieve_entity_info($_REQUEST['record'],$tab_type); 74 $focus->id = $_REQUEST['record']; 75 $focus->name=$focus->column_fields['subject']; 76 } 77 78 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { 79 $focus->id = ""; 80 } 81 82 //needed when creating a new task with default values passed in 83 if (isset($_REQUEST['contactname']) && is_null($focus->contactname)) { 84 $focus->contactname = $_REQUEST['contactname']; 85 } 86 if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) { 87 $focus->contact_id = $_REQUEST['contact_id']; 88 } 89 if (isset($_REQUEST['opportunity_name']) && is_null($focus->parent_name)) { 90 $focus->parent_name = $_REQUEST['opportunity_name']; 91 } 92 if (isset($_REQUEST['opportunity_id']) && is_null($focus->parent_id)) { 93 $focus->parent_id = $_REQUEST['opportunity_id']; 94 } 95 if (isset($_REQUEST['accountname']) && is_null($focus->parent_name)) { 96 $focus->parent_name = $_REQUEST['accountname']; 97 } 98 if (isset($_REQUEST['accountid']) && is_null($focus->parent_id)) { 99 $focus->parent_id = $_REQUEST['accountid']; 100 } 101 102 $act_data = getBlocks($tab_type,"detail_view",'',$focus->column_fields); 103 foreach($act_data as $block=>$entry) 104 { 105 foreach($entry as $key=>$value) 106 { 107 foreach($value as $label=>$field) 108 { 109 $fldlabel[$field['fldname']] = $label; 110 $finaldata[$field['fldname']] = $field['value']; 111 } 112 } 113 } 114 115 //Start 116 //To set user selected hour format 117 if($current_user->hour_format == '') 118 $format = 'am/pm'; 119 else 120 $format = $current_user->hour_format; 121 list($stdate,$sttime) = split(' ',$finaldata['date_start']); 122 list($enddate,$endtime) = split(' ',$finaldata['due_date']); 123 $time_arr = getaddEventPopupTime($sttime,$endtime,$format); 124 $data['starthr'] = $time_arr['starthour']; 125 $data['startmin'] = $time_arr['startmin']; 126 $data['startfmt'] = $time_arr['startfmt']; 127 $data['endhr'] = $time_arr['endhour']; 128 $data['endmin'] = $time_arr['endmin']; 129 $data['endfmt'] = $time_arr['endfmt']; 130 $data['record'] = $focus->id; 131 if(isset($finaldata['sendnotification']) && $finaldata['sendnotification'] == 'yes') 132 $data['sendnotification'] = 'Yes'; 133 else 134 $data['sendnotification'] = 'No'; 135 $data['subject'] = $finaldata['subject']; 136 $data['date_start'] = $stdate; 137 $data['due_date'] = $enddate; 138 $data['assigned_user_id'] = $finaldata['assigned_user_id']; 139 $data['taskpriority'] = $mod_strings[$finaldata['taskpriority']]; 140 $data['modifiedtime'] = $finaldata['modifiedtime']; 141 $data['createdtime'] = $finaldata['createdtime']; 142 $data['parent_name'] = $finaldata['parent_id']; 143 $data['description'] = $finaldata['description']; 144 if($activity_mode == 'Task') 145 { 146 $data['taskstatus'] = $mod_strings[$finaldata['taskstatus']]; 147 $data['activitytype'] = $activity_mode; 148 $data['contact_id'] = $finaldata['contact_id']; 149 } 150 elseif($activity_mode == 'Events') 151 { 152 $data['visibility'] = $finaldata['visibility']; 153 $data['eventstatus'] = $mod_strings[$finaldata['eventstatus']]; 154 $data['activitytype'] = $finaldata['activitytype']; 155 $data['location'] = $finaldata['location']; 156 //Calculating reminder time 157 $rem_days = 0; 158 $rem_hrs = 0; 159 $rem_min = 0; 160 if($focus->column_fields['reminder_time'] != null) 161 { 162 $data['set_reminder'] = 'Yes'; 163 $data['reminder_str'] = $finaldata['reminder_time']; 164 } 165 else 166 $data['set_reminder'] = 'No'; 167 //To set recurring details 168 $query = 'select vtiger_recurringevents.recurringfreq,vtiger_recurringevents.recurringinfo from vtiger_recurringevents where vtiger_recurringevents.activityid = '.$focus->id; 169 $res = $adb->query($query); 170 $rows = $adb->num_rows($res); 171 if($rows != 0) 172 { 173 $data['recurringcheck'] = 'Yes'; 174 $data['repeat_frequency'] = $adb->query_result($res,0,'recurringfreq'); 175 $recurringinfo = explode("::",$adb->query_result($res,0,'recurringinfo')); 176 $data['recurringtype'] = $recurringinfo[0]; 177 if($recurringinfo[0] == 'Weekly') 178 { 179 $weekrpt_str = ''; 180 if(count($recurringinfo) > 1) 181 { 182 $weekrpt_str .= 'on '; 183 for($i=1;$i<count($recurringinfo);$i++) 184 { 185 $label = 'LBL_DAY'.$recurringinfo[$i]; 186 if($i != 1) 187 $weekrpt_str .= ', '; 188 $weekrpt_str .= $mod_strings[$label]; 189 } 190 } 191 $data['repeat_str'] = $weekrpt_str; 192 } 193 elseif($recurringinfo[0] == 'Monthly') 194 { 195 $monthrpt_str = ''; 196 $data['repeatMonth'] = $recurringinfo[1]; 197 if($recurringinfo[1] == 'date') 198 { 199 $data['repeatMonth_date'] = $recurringinfo[2]; 200 $monthrpt_str .= 'on '.$recurringinfo[2].' day of the month'; 201 } 202 else 203 { 204 $data['repeatMonth_daytype'] = $recurringinfo[2]; 205 $data['repeatMonth_day'] = $recurringinfo[3]; 206 switch($data['repeatMonth_day']) 207 { 208 case 0 : 209 $day = $mod_strings['LBL_DAY0']; 210 break; 211 case 1 : 212 $day = $mod_strings['LBL_DAY1']; 213 break; 214 case 2 : 215 $day = $mod_strings['LBL_DAY2']; 216 break; 217 case 3 : 218 $day = $mod_strings['LBL_DAY3']; 219 break; 220 case 4 : 221 $day = $mod_strings['LBL_DAY4']; 222 break; 223 case 5 : 224 $day = $mod_strings['LBL_DAY5']; 225 break; 226 case 6 : 227 $day = $mod_strings['LBL_DAY6']; 228 break; 229 } 230 231 $monthrpt_str .= 'on '.$mod_strings[$recurringinfo[2]].' '.$day; 232 } 233 $data['repeat_str'] = $monthrpt_str; 234 } 235 } 236 else 237 { 238 $data['recurringcheck'] = 'No'; 239 $data['repeat_month_str'] = ''; 240 } 241 $related_array = getRelatedLists("Calendar", $focus); 242 $smarty->assign("INVITEDUSERS",$related_array['Users']['entries']); 243 $smarty->assign("CONTACTS",$related_array['Contacts']['entries']); 244 245 246 } 247 248 global $theme; 249 $theme_path="themes/".$theme."/"; 250 $image_path=$theme_path."images/"; 251 require_once ($theme_path.'layout_utils.php'); 252 253 $log->info("Calendar-Activities detail view"); 254 $category = getParentTab(); 255 $smarty->assign("CATEGORY",$category); 256 257 $smarty->assign("MOD", $mod_strings); 258 $smarty->assign("APP", $app_strings); 259 $smarty->assign("ACTIVITY_MODE", $activity_mode); 260 261 if (isset($focus->name)) 262 $smarty->assign("NAME", $focus->name); 263 else 264 $smarty->assign("NAME", ""); 265 $smarty->assign("UPDATEINFO",updateInfo($focus->id)); 266 if (isset($_REQUEST['return_module'])) 267 $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']); 268 if (isset($_REQUEST['return_action'])) 269 $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']); 270 if (isset($_REQUEST['return_id'])) 271 $smarty->assign("RETURN_ID", $_REQUEST['return_id']); 272 $smarty->assign("THEME", $theme); 273 $smarty->assign("IMAGE_PATH", $image_path); 274 $smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string'].'&activity_mode='.$activity_mode); 275 $smarty->assign("ID", $focus->id); 276 $smarty->assign("NAME", $focus->name); 277 $smarty->assign("BLOCKS", $act_data); 278 $smarty->assign("LABEL", $fldlabel); 279 $smarty->assign("VIEWTYPE", $_REQUEST['viewtype']); 280 $smarty->assign("CUSTOMFIELD", $cust_fld); 281 $smarty->assign("ACTIVITYDATA", $data); 282 $smarty->assign("ID", $_REQUEST['record']); 283 284 //get Description Information 285 if(isPermitted("Calendar","EditView",$_REQUEST['record']) == 'yes') 286 $smarty->assign("EDIT_DUPLICATE","permitted"); 287 288 if(isPermitted("Calendar","Delete",$_REQUEST['record']) == 'yes') 289 $smarty->assign("DELETE","permitted"); 290 291 $check_button = Button_Check($module); 292 $smarty->assign("CHECK", $check_button); 293 294 $tabid = getTabid($tab_type); 295 $validationData = getDBValidationData($focus->tab_name,$tabid); 296 $data2 = split_validationdataArray($validationData); 297 298 $smarty->assign("VALIDATION_DATA_FIELDNAME",$data2['fieldname']); 299 $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data2['datatype']); 300 $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data2['fieldlabel']); 301 302 $smarty->assign("MODULE",$currentModule); 303 $smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST[record])); 304 $smarty->display("ActivityDetailView.tpl"); 305 306 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |