'; $hidden .= ''; $hidden .= ''; $hidden .= ''; $hidden .= ''; $hidden .= ''; $hidden .= ''; $hidden .= ''; $hidden .= ''; return $hidden; } function renderRelatedContacts($query,$id) { global $mod_strings; global $app_strings; $hidden = getHiddenValues($id); echo $hidden; $focus = new Contact(); $button = ''; if(isPermitted("Contacts",3,"") == 'yes') { $button .= ' '; } $returnset = '&return_module=Activities&return_action=DetailView&activity_mode=Events&return_id='.$id; $list = GetRelatedList('Activities','Contacts',$focus,$query,$button,$returnset); echo ''; } function renderRelatedProducts($query,$id) { global $mod_strings; global $app_strings; $hidden = getHiddenValues($id); echo $hidden; $focus = new Product(); $button = ''; if(isPermitted("Products",3,"") == 'yes') { $button .= ' '; } $returnset = '&return_module=Activities&return_action=DetailView&activity_mode=Events&return_id='.$id; $list = GetRelatedList('Activities','Products',$focus,$query,$button,$returnset); echo ''; } // functions added for group calendar -Jaguar function get_duration($time_start,$duration_hours,$duration_minutes) { $time=explode(":",$time_start); $time_mins = $time[1]; $time_hrs = $time[0]; $mins = ($time_mins + $duration_minutes) % 60; $hrs_min = floor(($time_mins + $duration_minutes) / 60); if(!isset($hrs)) $hrs=0; $hrs = $duration_hours + $hrs_min + $time_hrs; if($hrs<10) $hrs=$hrs; if($mins<10) $mins="0".$mins; $end_time = $hrs .$mins; return $end_time; } function time_to_number($time_start) { $start_time_array = explode(":",$time_start); if(ereg("^[0]",$start_time_array[0])) { $time_start_hrs=str_replace('0',"",$start_time_array[0]); } else { $time_start_hrs=$start_time_array[0]; } $start_time= $time_start_hrs .$start_time_array[1]; return $start_time; } function status_availability($owner,$userid,$activity_id,$avail_date,$activity_start_time,$activity_end_time) { global $adb,$image_path,$vtlog; $avail_flag="false"; if( $owner != $userid) { $usr_query="select activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' like date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." group by crmid;"; } else { $usr_query="select activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' like date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." group by crmid;"; } $result_cal=$adb->query($usr_query); $noofrows_cal = $adb->num_rows($result_cal); $avail_flag="false"; if($noofrows_cal!=0) { while($row_cal = $adb->fetch_array($result_cal)) { $usr_date_start=$row_cal['date_start']; $usr_due_date=$row_cal['due_date']; $usr_time_start=$row_cal['time_start']; $usr_hour_dur=$row_cal['duration_hours']; $usr_mins_dur=$row_cal['duration_minutes']; $user_start_time=time_to_number($usr_time_start); $user_end_time=get_duration($usr_time_start,$usr_hour_dur,$usr_mins_dur); if( ( ($user_start_time > $activity_start_time) && ( $user_start_time < $activity_end_time) ) || ( ( $user_end_time > $activity_start_time) && ( $user_end_time < $activity_end_time) ) || ( ( $activity_start_time == $user_start_time ) || ($activity_end_time == $user_end_time) ) ) { $availability= 'busy'; $avail_flag="true"; $vtlog->logthis("user start time-- ".$user_start_time."user end time".$user_end_time,'info'); $vtlog->logthis("Availability ".$availability,'info'); } } } if($avail_flag == "true") { $availability=' '; } else { $availability=' '; } return $availability; } // function renderRelatedUsers($query,$id) { global $theme; $theme_path="themes/".$theme."/"; $image_path=$theme_path."images/"; require_once ($theme_path."layout_utils.php"); $activity_id=$id; global $adb,$vtlog; global $mod_strings; global $app_strings; $result=$adb->query($query); $list .= '

'; $list .= ''; $hidden = getHiddenValues($id); echo $hidden; $list .= '
'; $list .= ' '; $list .= ''; // $list .= ''; // $list .= ''; $list .= ''; $list .= '
'.$app_strings['LBL_USER_TITLE'].'    
'; $list .= ''; $list .= '
'; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; //$list .= ''; $list .= ''; $list .= ''; $i=1; while($row = $adb->fetch_array($result)) { global $current_user; if ($i%2==0) $trowclass = 'evenListRow'; else $trowclass = 'oddListRow'; $list .= ''; $list .= ''; } else { $list .= ''; } $list .= ''; $list .= ''; $list .= ''; $i++; } $list .= ''; $list .= '
'; $list .= ''; $list .= $app_strings['LBL_LIST_NAME'].''; $list .= ''; $list .= $app_strings['LBL_LIST_USER_NAME'].''; $list .= ''; $list .= $app_strings['LBL_EMAIL'].''; $list .= ''; $list .= $app_strings['LBL_PHONE'].''; $list .= ''; $list .= $app_strings['LBL_ACTION'].''; $list .= ''; // $list .= $app_strings['LBL_AVAILABLE'].''; //$list .= ''; // To display the dates for the Group calendar starts -Jaguar $recur_dates_qry='select distinct(recurringdate) from recurringevents where activityid='.$activity_id; $recur_result=$adb->query($recur_dates_qry); $noofrows_recur = $adb->num_rows($recur_result); if($noofrows_recur==0) { $recur_dates_qry='select activity.date_start,recurringevents.* from activity left outer join recurringevents on activity.activityid=recurringevents.activityid where recurringevents.activityid is NULL and activity.activityid='.$activity_id .' group by activity.activityid'; $recur_result=$adb->query($recur_dates_qry); $noofrows_recur = $adb->num_rows($recur_result); } $recur_table=""; if($noofrows_recur !=0) { while($row_recur = $adb->fetch_array($recur_result)) { global $current_user; $dat_fmt = $current_user->date_format; if($dat_fmt == 'yyyy-mm-dd' || $dat_fmt == 'mm-dd-yyyy') { $date_display="m/d"; } else if($dat_fmt == 'dd-mm-yyyy') { $date_display="d/m"; } $recur_dates=$row_recur['recurringdate']; if($recur_dates=="") { $recur_dates=$row_recur['date_start']; } $st=explode("-",$recur_dates); $date_val = date($date_display,mktime(0,0,0,date("$st[1]"),(date("$st[2]")),date("$st[0]"))); $recur_table.=" "; } $recur_table.=""; } $recur_table.="
".$app_strings['LBL_AVAILABLE']."
$date_val
"; $list .= $recur_table; // To display the dates for the Group calendar Ends -Jaguar $list .= '
'; $list .= ''; $list .= '
'; if(is_admin($current_user)) { $list .= ''.$row['last_name'].' '.$row['first_name'].''.$row['last_name'].' '.$row['first_name'].''; $list .= ''; $list .= $row['user_name']; $email = $row['email1']; if($email == '') $email = $row['email2']; if($email == '') $email = $row['yahoo_id']; $list .= ''; $list .= ''; $list .= ''.$email.''; $phone = $row['phone_home']; if($phone == '') $phone = $row['phone_work']; if($phone == '') $phone = $row['phone_other']; if($phone == '') $phone = $row['phone_fax']; $list .= ''; $list .= ''; $list .= $phone; $list .= ''; $list .= ''; if(is_admin($current_user)) { $list .= ''.$app_strings['LNK_EDIT'].' | '; } $list .= ''.$app_strings['LNK_DELETE'].''; //Added for Group Calendar -Jaguar $list .= ''; $list .= ''; //$act_date_start=$row['date_start']; //$act_due_date=$row['due_date']; $act_date_start= getDBInsertDateValue($row['date_start']); //getting the Date format - Jaguar $act_due_date= getDBInsertDateValue($row['due_date']); $act_time_start=$row['time_start']; $act_hour_dur=$row['duration_hours']; $act_mins_dur=$row['duration_minutes']; $activity_start_time=time_to_number($act_time_start); $activity_end_time=get_duration($act_time_start,$act_hour_dur,$act_mins_dur); $activity_owner_qry='select users.user_name,users.id userid from users,crmentity where users.id=crmentity.smownerid and crmentity.crmid='.$id; $result_owner=$adb->query($activity_owner_qry); while($row_owner = $adb->fetch_array($result_owner)) { $owner=$row_owner['userid']; } $recur_dates_qry='select recurringdate from recurringevents where activityid ='.$activity_id; $recur_result=$adb->query($recur_dates_qry); $noofrows_recur = $adb->num_rows($recur_result); $userid=$row['id']; if($noofrows_recur !=0) { $avail_table=""; $avail_table.=""; while($row_recur = $adb->fetch_array($recur_result)) { $recur_dates=$row_recur['recurringdate']; $availability=status_availability($owner,$userid,$activity_id,$recur_dates,$activity_start_time,$activity_end_time); $vtlog->logthis("activity start time ".$activity_start_time."activity end time".$activity_end_time."Available date".$recur_dates,'info'); $avail_table.=""; //$list .= $availability; } $avail_table.=""; $avail_table.="
$availability
"; $list .= $avail_table; } else { $recur_dates=$act_date_start; $availability=status_availability($owner,$userid,$activity_id,$recur_dates,$activity_start_time,$activity_end_time); $vtlog->logthis("activity start time ".$activity_start_time."activity end time".$activity_end_time."Available date".$recur_dates,'info'); $list .= $availability; } // Group Calendar coding $list .= '
'; $list .= '
'; echo $list; echo "
\n"; } echo get_form_footer(); ?>