hello everyone,
I'm trying to make a new patch shared calendar by month for the version 5.2.0c of surgar,
I can visualize the calendar but the problem is that all the meetings displayed on the calendar began at 8:00, I realize that the problem is caused by the $time_start value which is always set at 3600s.
In order to get the $time_start value (start meeting), I tried to use the same expression used in shared (by week) ($timedate->to_display_time($act->sugar_bean->time_start, true, false), but it doesn't work because i think that args is not the same used in the new function :Code:function SharedActivity(&$slice,$user){ global $current_user; parent::SugarBean(); //permet de se connecter à la bdd if($slice->view!='day') { sugar_die ("only for day view"); } //on vérifie que l'utisateur en cours à le droit de voir les meetings' if(ACLController::checkAccess('Meetings', 'list', $current_user->id)) { //jour & heure en local $date_local=$slice->start_time->year."-".$slice->start_time->zmonth."-".$slice->start_time->zday." ".$slice->start_time->zhour; //conversion en WET //$date_wet_start=$slice->start_time->convert_local_to_wet(); //$date_wet_end=$slice->end_time->convert_local_to_wet(); //recupération d'info en appelant l'objet Meeting $meetings = new Meeting(); //les noms des tables $table=$meetings->table_name; //meetings $table_rel=$meetings->rel_users_table; //meetings_users //on suppose que la durée d'un RDV est <= à 1 mois $month=$date_wet_start->month-1; //$date_wet_start moins 1 mois if($month<10) $month="0".$month; $start_search_date = $date_wet_start->year."-".$month."-".$date_wet_start->zday; //construction de la requete $where=$table_rel.".user_id='".$user->id."' " . "AND (" . db_convert($table.".date_start",'date_format',array("'%Y-%m-%d'"),array("'YYYY-MM-DD'")). ">='".$start_search_date."' " . "AND ".db_convert($table.".date_start",'date_format',array("'%Y-%m-%d'"),array("'YYYY-MM-DD'"))."<='".$date_wet_end->get_mysql_date()."' ". ")" . "AND ".$table_rel.".accept_status != 'decline'"; $query=$meetings->create_list_query("",$where); $result = $this->db->query($query, false); $i=0; $acts_arr=array(); //calcul date debut et date de fin en format unix (timestamp) en GMT+0 (=WET) $date_day_start=mktime($date_wet_start->hour,$date_wet_start->min,$date_wet_start->sec,$date_wet_start->month,$date_wet_start->day,$date_wet_start->year);//mktime(int heure, int minute, int seconde, int mois, int jour, int année, [int heure_hiver]); $date_day_end=mktime($date_wet_end->hour,$date_wet_end->min,$date_wet_end->sec,$date_wet_end->month,$date_wet_end->day,$date_wet_end->year); while($row = $this->db->fetchByAssoc($result)) { //calcul date debut et date fin en format unix (timestamp) //the problem comes from here, in fact 'time_start' doesn't exist in $row. and $row['date_start'] contains the date and also time in the following form (dd/mm/yyyy hh:mm:00) and as I explained before I want to get just the second part, I mean the time. $date_start=$this->convert_ts($row['date_start'],$row['time_start']); $date_end=$date_start+$row['duration_hours']*60*60+$row['duration_minutes']*60; if($date_end>$date_day_start) { $time_start=$date_start-$date_day_start; if($time_start!=60*60*24) { // l'id $acts_arr[$i]['record']=$row['id']; // le nom du RDV $acts_arr[$i]['name']=$row['name']; // le lieu du RDV $acts_arr[$i]['location']=$row['location']; // l'heure du début de RDV pour ce jour local (en secondes) $acts_arr[$i]['time_start']=$time_start; $acts_arr[$i]['time_end']=$acts_arr[$i]['time_start']+$row['duration_hours']*60*60+$row['duration_minutes']*60; //cas particuliers if($acts_arr[$i]['time_end']>=(24*60*60)) $acts_arr[$i]['time_end']=(24*60*60)-1; if($time_start<0) $acts_arr[$i]['time_start']=0; $i++;} } } } $args['slice']->acts_arr=array(); $slice->acts_arr=$acts_arr; }
any idea to get $time_start ?Code:function template_echo_slice_activities_shared(& $args) { global $app_list_strings; global $image_path; global $shared_user, $timedate; $count = 0; if(empty($args['slice']->acts_arr[$shared_user->id])) { return; } $out = ''; foreach($args['slice']->acts_arr[$shared_user->id] as $act) { $count ++; echo "<div style=\"margin-top: 1px;\"> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"monthCalBodyDayItem\">"; if($act->sugar_bean->object_name == 'Call') { echo "<tr><td class=\"monthCalBodyDayIconTd\">"; get_image($image_path.'Calls','alt=\"'.$app_list_strings['call_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'\"'); echo "</td>"; if(empty($act->sugar_bean->name)) { echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">"; echo $timedate->to_display_time($act->sugar_bean->time_start, true, false); //modifié echo "</td></tr>"; } else { echo "<font color = 'color'>erzerz</font>"; echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\"> <a href=\"index.php?module=Calls&action=DetailView&record=". $act->sugar_bean->id."\" class=\"monthCalBodyDayItemLink\">". $app_list_strings['call_status_dom'][$act->sugar_bean->status].":". $act->sugar_bean->name."(". $timedate->to_display_time($act->sugar_bean->time_start, true, false)." )</a></td></tr>"; //modifié //echo $act->sugar_bean->time_start;//test //echo 'eee'; } } else if($act->sugar_bean->object_name == 'Meeting') { echo "<td class=\"monthCalBodyDayIconTd\">". get_image($image_path.'Meetings','alt=\"'.$app_list_strings['meeting_status_dom'][$act->sugar_bean->status].': '.$act->sugar_bean->name.'\"'); echo "</td>"; if(empty($act->sugar_bean->name)) { echo "<td class=\"monthCalBodyDayItemTd\" width=\"100%\">". $timedate->to_display_time($act->sugar_bean->time_start, true, false); echo "</td></tr>"; } else { .....


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks