task #9747: Can show content of external calendar (ical) into agenda

This commit is contained in:
Juanjo Menent 2011-06-01 08:18:52 +00:00
parent a277a6b186
commit 9e0e6e13df

View File

@ -506,10 +506,13 @@ if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0)
$event=new ActionComm($db);
$paramkey='AGENDA_EXT_NAME'.$i;
$namecal = $conf->global->$paramkey;
$paramkey='AGENDA_EXT_COLOR'.$i;
$colorcal = $conf->global->$paramkey;
$event->id=$namecal;
$event->datep=$icalevent[DTSTART];
$event->datef=$icalevent[DTEND];
$event->type_code="ICALEVENT";
$event->type_id = $colorcal;
$event->libelle='<b>'.$icalevent[SUMMARY].'</b><br>'.dol_nl2br($icalevent[DESCRIPTION],1,false);
//$event->fulldayevent=$obj->fulldayevent;
@ -798,8 +801,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$colorindex=0;
if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) $colorindex=1;
if ($event->type_code == 'BIRTHDAY') $colorindex=2;
$color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
if ($event->type_code == 'ICALEVENT') $color=$event->type_id;
else $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
//print "x".$color;
print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px; " width="100%"><tr>';
print '<td nowrap="nowrap">';
if ($event->type_code != 'BIRTHDAY')