From 547443c4b64c4c60a38be2b24497d8e3b25a94c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 May 2011 17:27:20 +0000 Subject: [PATCH] New: now use tabs for agenda --- htdocs/comm/action/index.php | 51 ++++++++++++++++++++++-------- htdocs/comm/action/listactions.php | 31 ++++++++++++++---- htdocs/lib/agenda.lib.php | 28 +++++++++++++++- 3 files changed, 90 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 1c9d1366baa..198446072e6 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -39,7 +39,7 @@ $filter=GETPOST("filter"); $filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int"); $filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int"); $filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int"); -$showbirthday = GETPOST("showbirthday","int")?GETPOST("showbirthday","int"):0; +$showbirthday = GETPOST("showbirthday","int"); $sortfield = GETPOST("sortfield"); $sortorder = GETPOST("sortorder"); @@ -231,9 +231,32 @@ if ($action=='show_day') $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:''); //print 'x'.$param; -print_fiche_titre($title,$nav); + + + + +$head = calendars_prepare_head(''); + +dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'action'); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showborthday,$filtera,$filtert,$filterd,$pid,$socid); +dol_fiche_end(); + +// Add link to show birthdays +$newparam=$param; // newparam is for birthday links +$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); +if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1'; +$link=''; +if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents"); +else $link.=$langs->trans("AgendaHideBirthdayEvents"); +$link.=''; + +print_fiche_titre($title,$link.'     '.$nav); +//print '
'; + +//print_fiche_titre($link,'',''); // Get event in an array @@ -470,17 +493,6 @@ if (is_readable($color_file)) } if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220)); -// Add link to show birthdays -$newparam=$param; // newparam is for birthday links -$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); -if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1'; -$link=''; -if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents"); -else $link.=$langs->trans("AgendaHideBirthdayEvents"); -$link.=''; -print_fiche_titre('',$link); if (empty($action) || $action == 'show_month') // View by month { @@ -626,6 +638,19 @@ else // View by day $db->close(); +/* TODO Add RSS Links +print ' + + + + + +'; +*/ llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 12c255c3223..23107ef3d13 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -44,9 +44,11 @@ $day=GETPOST("day",'int'); $pid=GETPOST("projectid",'int'); $status=GETPOST("status",'alpha'); +$filter=GETPOST("filter"); $filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int"); $filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int"); $filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int"); +$showbirthday = GETPOST("showbirthday","int"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -117,6 +119,7 @@ if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; if ($filterd) $param.="&filterd=".$filterd; if ($socid) $param.="&socid=".$socid; +if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($_GET["type"]) $param.="&type=".$_REQUEST["type"]; @@ -176,17 +179,33 @@ if ($resql) { $societe = new Societe($db); $societe->fetch($socid); - - print_barre_liste($langs->trans($title).' '.$langs->trans("For").' '.$societe->nom, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,'',$num); + $newtitle=$langs->trans($title).' '.$langs->trans("For").' '.$societe->nom; } else { - print_barre_liste($langs->trans($title), $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,'',$num); + $newtitle=$langs->trans($title); } - //print '
'; - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showborthday,$filtera,$filtert,$filterd,$pid,$socid); + $head = calendars_prepare_head(''); + + dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'action'); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showborthday,$filtera,$filtert,$filterd,$pid,$socid); + dol_fiche_end(); + + // Add link to show birthdays + $newparam=$param; // newparam is for birthday links + $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); + if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1'; + $link=''; + if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents"); + else $link.=$langs->trans("AgendaHideBirthdayEvents"); + $link.=''; + + print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0); + //print '
'; $i = 0; print ""; @@ -204,7 +223,7 @@ if ($resql) print "\n"; $contactstatic = new Contact($db); - $now=gmmktime(); + $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; $var=true; diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php index 13239d06e8f..4f79639b6c6 100644 --- a/htdocs/lib/agenda.lib.php +++ b/htdocs/lib/agenda.lib.php @@ -113,7 +113,7 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbort print ''; } print '
'; - print '
'; + print ''; } } @@ -353,4 +353,30 @@ function actions_prepare_head($action) return $head; } + +/** + * Define head array for tabs of agenda setup pages + * @return Array of head + */ +function calendars_prepare_head($param) +{ + global $langs, $conf, $user; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php'.($param?'?'.$param:''); + $head[$h][1] = $langs->trans("Agenda"); + $head[$h][2] = 'card'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda'); + + return $head; +} + ?> \ No newline at end of file