first version of a yearly planner

This commit is contained in:
Ralf Becker 2010-01-15 03:53:12 +00:00
parent 369161d91f
commit fad791eabd
5 changed files with 115 additions and 30 deletions

View File

@ -628,6 +628,11 @@ class calendar_ui
($planner_days_for_view !== false ? '&planner_days='.$planner_days_for_view : ''),
'selected' => $this->view == 'planner' && $this->sortby == 'user',
),
array(
'text' => lang('yearly planner'),
'value' => 'menuaction=calendar.calendar_uiviews.planner&sortby=month',
'selected' => $this->view == 'planner' && $this->sortby == 'month',
),
array(
'text' => lang('listview'),
'value' => 'menuaction=calendar.calendar_uilist.listview',

View File

@ -238,7 +238,19 @@ class calendar_uiviews extends calendar_ui
*/
function &planner($home=false)
{
if (!$this->planner_days) // planner monthview
if ($this->sortby == 'month') // yearly planner with month rows
{
$this->first = $this->bo->date2array($this->date);
$this->first['day'] = 1;
unset($this->first['raw']);
$this->last = $this->first;
$this->last['year']++;
$this->last = $this->bo->date2ts($this->last)-1;
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('yearly planner').' '.
lang(egw_time::to($this->first,'F')).' '.egw_time::to($this->first,'Y').' - '.
lang(egw_time::to($this->last,'F')).' '.egw_time::to($this->last,'Y');
}
elseif (!$this->planner_days) // planner monthview
{
if ($this->day < 15) // show one complete month
{
@ -278,11 +290,11 @@ class calendar_uiviews extends calendar_ui
$search_params['start'] = $this->first;
$search_params['end'] = $this->last;
$search_params['enum_groups'] = $this->sortby == 'user';
$events = $this->bo->search($search_params);
$events =& $this->bo->search($search_params);
if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last));
$content =& $this->plannerWidget($events,$this->first,$this->last,$this->sortby == 'user' ? false : (int) $this->cat_id);
$content =& $this->plannerWidget($events,$this->first,$this->last,$this->sortby != 'category' ? $this->sortby : (int) $this->cat_id);
if (!$home)
{
@ -1441,18 +1453,39 @@ class calendar_uiviews extends calendar_ui
* @param array $events events to show
* @param mixed $start start-time of the grid
* @param mixed $end end-time of the grid
* @param boolean/int $by_cat rows by sub-categories of $by_cat (cat_id or 0 for upmost level) or by users (false)
* @param string|int $by_cat rows by sub-categories of $by_cat (cat_id or 0 for upmost level) or by 'user' or 'month'
* @param string $indent='' string for correct indention
* @return string with widget
*/
function &plannerWidget($events,$start,$end,$by_cat=0,$indent='')
function &plannerWidget(&$events,$start,$end,$by_cat=0,$indent='')
{
$content = $indent.'<div class="plannerWidget">'."\n";
// display the header, containing a headerTitle and multiple headerRows with the scales
$content .= $indent."\t".'<div class="plannerHeader">'."\n";
// display the headerTitle
$title = $by_cat === false ? lang('User') : lang('Category');
// display the headerTitle, and get sort2labels
switch($by_cat)
{
case 'user':
$title = lang('User');
$sort2label = $this->_get_planner_users();
break;
case 'month':
$title = lang('Month');
$sort2label = array();
$time = new egw_time($start);
for($n = 0; $n < 12; ++$n)
{
$sort2label[$time->format('Y-m')] = lang($time->format('F')).' '.$time->format('Y');
$time->modify('+1 month');
}
break;
default:
$title = lang('Category');
$sort2label = array();
break;
}
$content .= $indent."\t\t".'<div class="plannerHeaderTitle th">'.$title."</div>\n";
// display the headerRows with the scales
@ -1467,34 +1500,37 @@ class calendar_uiviews extends calendar_ui
${$v}['minute'] = ${$v}['second'] = 0;
${$v} = $this->bo->date2ts($$v);
}
$days = 1 + (int) round(($last - $first) / DAY_s); // we have to use round to get the right number if daylight saving changes
if ($days >= 28) // display the month scale
if ($by_cat === 'month')
{
$content .= $this->plannerMonthScale($first,$days,$indent."\t\t\t");
$content .= $this->plannerDayOfMonthScale($indent."\t\t\t");
}
if ($days >= 5) // display the week scale
else
{
$content .= $this->plannerWeekScale($first,$days,$indent."\t\t\t");
}
$content .= $this->plannerDayScale($first,$days,$indent."\t\t\t"); // day-scale, always displayed
if ($days <= 7) // display the hour scale
{
$content .= $this->plannerHourScale($start,$days,$indent."\t\t\t");
$days = 1 + (int) round(($last - $first) / DAY_s); // we have to use round to get the right number if daylight saving changes
if ($days >= 28) // display the month scale
{
$content .= $this->plannerMonthScale($first,$days,$indent."\t\t\t");
}
if ($days >= 5) // display the week scale
{
$content .= $this->plannerWeekScale($first,$days,$indent."\t\t\t");
}
$content .= $this->plannerDayScale($first,$days,$indent."\t\t\t"); // day-scale, always displayed
if ($days <= 7) // display the hour scale
{
$content .= $this->plannerHourScale($start,$days,$indent."\t\t\t");
}
}
$content .= $indent."\t\t</div>\n"; // end of the plannerHeaderRows
$content .= $indent."\t</div>\n"; // end of the plannerHeader
// sort the events after user or category
$rows = $sort2label = array();
if ($by_cat === false) // planner by user
{
$sort2label = $this->_get_planner_users();
}
$rows = array();
if (!is_array($events)) $events = array();
foreach($events as $key => $event)
{
if ($by_cat === false) // planner by user
if ($by_cat === 'user') // planner by user
{
foreach($event['participants'] as $sort => $status)
{
@ -1505,6 +1541,16 @@ class calendar_uiviews extends calendar_ui
}
}
}
elseif ($by_cat === 'month') // planner by month / yearly planner
{
$sort = date('Y-m',$event['start']);
$rows[$sort][] =& $events[$key];
// end in a different month?
if ($sort != ($end_sort = date('Y-m',$event['end'])))
{
$rows[$end_sort][] =& $events[$key];
}
}
else // planner by cat
{
foreach($this->_get_planner_cats($event['category'],$sort2label,$sort2color) as $sort)
@ -1519,12 +1565,20 @@ class calendar_uiviews extends calendar_ui
foreach($sort2label as $sort => $label)
{
if (!isset($rows[$sort]) && (!$this->cal_prefs['planner_show_empty_rows'] ||
$by_cat === false && $this->cal_prefs['planner_show_empty_rows'] == 'cat' ||
$by_cat !== false && $this->cal_prefs['planner_show_empty_rows'] == 'user'))
$by_cat === 'user' && $this->cal_prefs['planner_show_empty_rows'] == 'cat' ||
is_int($by_cat) && $this->cal_prefs['planner_show_empty_rows'] == 'user'))
{
continue; // dont show empty categories or user rows
}
$class = $class == 'row_on' ? 'row_off' : 'row_on';
if ($by_cat === 'month')
{
$time = new egw_time($sort.'-01');
$start = $time->format('ts');
$time->modify('+1month -1second');
$end = $time->format('ts');
if ($sort == date('Y-m')) $class = 'calToday';
}
$content .= $this->plannerRowWidget(isset($rows[$sort]) ? $rows[$sort] : array(),$start,$end,$label,$class,$indent."\t");
}
$content .= $indent."</div>\n"; // end of the plannerWidget
@ -1811,6 +1865,29 @@ class calendar_uiviews extends calendar_ui
return $content;
}
/**
* Creates DayOfMonth scale for planner by month
*
* @param string $indent
* @return string
*/
function plannerDayOfMonthScale($indent)
{
$day_width = round(100 / 31,2);
$content .= $indent.'<div class="plannerScale">'."\n";
$today = egw_time::to('now','d');
for($left = 0,$i = 0; $i < 31; $left += $day_width,++$i)
{
$class = 1+$i == $today ? 'calToday' : ($i & 1 ? 'row_on' : 'row_off');
$content .= $indent."\t".'<div class="plannerDayOfMonthScale '.$class.'" style="left: '.$left.'%; width: '.$day_width.'%;">'.
(1+$i)."</div>\n";
}
$content .= $indent."</div>\n"; // end of plannerScale
return $content;
}
/**
* Creates hour scale for the planner
@ -1935,7 +2012,7 @@ class calendar_uiviews extends calendar_ui
if ($time <= $start) return 0; // we are left of our scale
if ($time >= $end) return 100; // we are right of our scale
if ($this->planner_days)
if ($this->planner_days || $this->sortby == 'month')
{
$percent = ($time - $start) / ($end - $start);
}

View File

@ -99,7 +99,6 @@ displayed view calendar de Ansicht
displays your default calendar view on the startpage (page you get when you enter egroupware or click on the homepage icon)? calendar de Soll Ihre Standard-Kalender-Ansicht auf der Startseite angezeigt werden (die Seite die sich nach dem Login öffnet oder wenn Sie auf Home klicken)?
do not include events of group members calendar de Zeige nicht die Termine der Gruppenmitglieder
do you want a weekview with or without weekend? calendar de Wollen Sie eine Wochenansicht mit oder ohne Wochenende?
do you want to be notified about new or changed appointments? you be notified about changes you make yourself.<br>you can limit the notifications to certain changes only. each item includes all the notification listed above it. all modifications include changes of title, description, participants, but no participant responses. if the owner of an event requested any notifcations, he will always get the participant responses like acceptions and rejections too. calendar de Wollen Sie über neue oder geänderte Termine benachrichtigt werden? Sie werden nie über eigene Änderungen benachrichtigt.<br>Sie können die Benachrichtigungen auf verschiedene Änderungen begrenzen. Jede Zeile enthält die Benachrichtigungen der darüber liegenden. Alle Änderungen umfasst den Titel, die Beschreibung, Teilnehmer, aber keine Antworten der Teilnehmer. Wenn der Ersteller eines Termins irgendeine Benachrichtigung will, erhält er automatisch auch die Antworten der Teilnehmer, wie Zusagen oder Absagen.
do you want to edit serialevent als exception? - ok = edit exception, abort = edit serial calendar de Möchten Sie den Termin der Serie als Ausnahme bearbeiten? Klicken Sie OK um den Termin als Einzeltermin (Ausnahme) zu bearbeiten, Abbrechen um die Terminserie zu verändern.
do you want to receive a regulary summary of your appointsments via email?<br>the summary is sent to your standard email-address on the morning of that day or on monday for weekly summarys.<br>it is only sent when you have any appointments on that day or week. calendar de Möchten Sie eine regelmäßige Zusammenfassung Ihrer Termine via E-Mail erhalten?<br>Die Zusammenfassung wird täglich (jeden Morgen), oder für eine wöchentliche Zusammenfassung Montags an Ihre standard E-Mail Adresse gesendet.<br> Die Benachrichtigung wird nur versendet wenn Sie am nächsten Tag oder in der nächsten Woche auch einen Termin haben.
do you wish to autoload calendar holidays files dynamically? admin de Sollen die Feiertage automatisch geladen werden?
@ -207,6 +206,7 @@ make freebusy information available to not loged in persons? calendar de Die Bel
minutes calendar de Minuten
modified calendar de Geändert
mon calendar de Mo
month calendar de Monat
monthly calendar de Monatlich
monthly (by date) calendar de Monatlich (nach Datum)
monthly (by day) calendar de Monatlich (nach Wochentag)
@ -393,6 +393,7 @@ work day starts on calendar de Arbeitstag beginnt um
workday calendar de Arbeitstag
workdays calendar de Arbeitstage
yearly calendar de Jährlich
yearly planner calendar de Jahresplaner
yearview calendar de Jahresansicht
you are not allowed to book the resource selected: calendar de Sie sind nicht berechtigt die ausgewählte Ressource zu buchen.
you can either set a year or a occurence, not both !!! calendar de Sie können nur entweder das Jahr oder die Wiederholung angeben, nicht beides!

View File

@ -207,6 +207,7 @@ make freebusy information available to not loged in persons? calendar en Make Fr
minutes calendar en Minutes
modified calendar en Modified
mon calendar en Mon
month calendar en Month
monthly calendar en Monthly
monthly (by date) calendar en Monthly (by date)
monthly (by day) calendar en Monthly (by day)
@ -393,6 +394,7 @@ work day starts on calendar en Work day starts on
workday calendar en Work day
workdays calendar en Work days
yearly calendar en Yearly
yearly planner calendar en Yearly planner
yearview calendar en Year view
you are not allowed to book the resource selected: calendar en You are not allowed to book the resource selected:
you can either set a year or a occurence, not both !!! calendar en You can either set a Year or a Occurrence, not both !!!

View File

@ -367,7 +367,7 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
/* plannerScale represents a scale-row of the plannerHeader, containing multiple planner{Day|Week|Month}Scales
*/
.plannerScale,.plannerScaleDay{
.plannerScale,.plannerScaleDay {
position: relative;
top: 0px;
left: 0%;
@ -379,7 +379,7 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
height: 28px;
line-height: 14px;
}
.plannerDayScale,.plannerMonthScale,.plannerWeekScale,.plannerHourScale {
.plannerDayScale,.plannerMonthScale,.plannerWeekScale,.plannerHourScale,.plannerDayOfMonthScale {
position: absolute;
top: 0px;
/* left+width: is set by the code on runtime */
@ -403,7 +403,7 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
.plannerMonthScale {
font-weight: bold;
}
.plannerDayScale img,.plannerWeekScale img,.plannerMonthScale img {
.plannerDayScale img,.plannerWeekScale img,.plannerMonthScale img,.plannerDayOfMonthScale img {
vertical-align: middle;
}