/** * Get a hour drop down list * * @param string $name the name (and html id) for the element * @param int $selected the current selection * @return string html select element populated with hours */ public static function hour_formated_text($name, $selected = null) { $html = <<<HTML \t\t\t<select name="{$name}" id="{$name}"> HTML; for ($i = 0; $i < 24; ++$i) { $slctd = $i == $selected ? ' selected' : ''; $formatted = phpgwapi_datetime::formattime($i); $html .= <<<HTML \t\t\t\t<option value="{$i}" {$slctd}>{$formatted}</option> HTML; } $html .= <<<HTML </select> HTML; return $html; }
$updates = array('no' => lang('Never'), 'add_cancel' => lang('on invitation / cancelation only'), 'time_change_4h' => lang('on time change of more than 4 hours too'), 'time_change' => lang('on any time change too'), 'modifications' => lang('on all modification, but responses'), 'responses' => lang('on participant responses too')); create_select_box('Receive email updates', 'receive_updates', $updates, "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."); $update_formats = array('none' => lang('None'), 'extended' => lang('Extended'), 'ical' => lang('iCal / rfc2445')); create_select_box('Format of event updates', 'update_format', $update_formats, 'Extended updates always include the complete event-details. iCal\'s can be imported by certain other calendar-applications.'); $event_details = array('to-fullname' => lang('Fullname of person to notify'), 'to-firstname' => lang('Firstname of person to notify'), 'to-lastname' => lang('Lastname of person to notify'), 'title' => lang('Title of the event'), 'description' => lang('Description'), 'startdate' => lang('Start Date/Time'), 'enddate' => lang('End Date/Time'), 'olddate' => lang('Old Startdate'), 'category' => lang('Category'), 'location' => lang('Location'), 'priority' => lang('Priority'), 'participants' => lang('Participants'), 'owner' => lang('Owner'), 'repetition' => lang('Repetitiondetails (or empty)'), 'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...')); create_notify('Notification messages for added events ', 'notifyAdded', 5, 50, 'This message is sent to every participant of events you own, who has requested notifcations about new events.<br />You can use certain variables which get substituted with the data of the event. The first line is the subject of the email.', '', $event_details); create_notify('Notification messages for canceled events ', 'notifyCanceled', 5, 50, 'This message is sent for canceled or deleted events.', '', $event_details, False); create_notify('Notification messages for modified events ', 'notifyModified', 5, 50, 'This message is sent for modified or moved events.', '', $event_details, False); create_notify('Notification messages for your responses ', 'notifyResponse', 5, 50, 'This message is sent when you accept, tentative accept or reject an event.', '', $event_details, False); create_notify('Notification messages for your alarms', 'notifyAlarm', 5, 50, 'This message is sent when you set an Alarm for a certain event. Include all information you might need.', '', $event_details, False); create_check_box('Show invitations you rejected', 'show_rejected', 'Should invitations you rejected still be shown in your calendar ?<br />You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar!'); create_check_box('Display status of events', 'display_status', 'Should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ?'); $weekdaystarts = array('Monday' => lang('Monday'), 'Sunday' => lang('Sunday'), 'Saturday' => lang('Saturday')); create_select_box('weekday starts on', 'weekdaystarts', $weekdaystarts, 'This day is shown as first day in the week or month view.'); for ($i = 0; $i < 24; ++$i) { $options[$i] = phpgwapi_datetime::formattime($i, '00'); } create_select_box('work day starts on', 'workdaystarts', $options, 'This defines the start of your dayview. Events before this time, are shown above the dayview.<br />This time is also used as a default starttime for new events.'); create_select_box('work day ends on', 'workdayends', $options, 'This defines the end of your dayview. Events after this time, are shown below the dayview.'); $intervals = array(5 => '5', 10 => '10', 15 => '15', 20 => '20', 30 => '30', 45 => '45', 60 => '60'); create_select_box('Intervals in day view', 'interval', $intervals, 'Defines the size in minutes of the lines in the day view.'); create_input_box('default appointment length (in minutes)', 'defaultlength', 'Default length of newly created events. The length is in minutes, eg. 60 for 1 hour.', '', 3); $groups = $GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']); $options = array(-1 => lang('none')); if (is_array($groups)) { foreach ($groups as $group) { $options[$group->id] = $GLOBALS['phpgw']->common->grab_owner_name($group->id); } } create_select_box('Preselected group for entering the planner', 'planner_start_with_group', $options, 'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.'); $planner_intervals = array(1 => '1', 2 => '2', 3 => '3', 4 => '4');
function print_day($params) { if (!is_array($params)) { $this->index(); } print_debug('in print_day()'); $this->bo->store_to_cache(array('syear' => $params['year'], 'smonth' => $params['month'], 'sday' => $params['day'], 'eyear' => $params['year'], 'emonth' => $params['month'], 'eday' => $params['day'])); $p = CreateObject('phpgwapi.Template', $this->template_dir); $p->set_unknowns('keep'); $templates = array('day_cal' => 'day_cal.tpl'); $p->set_file($templates); $p->set_block('day_cal', 'day', 'day'); $p->set_block('day_cal', 'day_row', 'day_row'); $p->set_block('day_cal', 'day_event_on', 'day_event_on'); $p->set_block('day_cal', 'day_event_off', 'day_event_off'); $p->set_block('day_cal', 'day_event_holiday', 'day_event_holiday'); $p->set_block('day_cal', 'day_time', 'day_time'); $date_to_eval = sprintf("%04d%02d%02d", $params['year'], $params['month'], $params['day']); // $day_start = mktime(intval($this->bo->prefs['calendar']['workdaystarts']),0,0,$params['month'],$params['day'],$params['year']); // $day_end = mktime(intval($this->bo->prefs['calendar']['workdayends']),0,1,$params['month'],$params['day'],$params['year']); $day_start = mktime(intval($this->bo->prefs['calendar']['workdaystarts']), 0, 0, 0, 0, 0); $day_end = mktime(intval($this->bo->prefs['calendar']['workdayends']), 0, 1, 0, 0, 0); $daily = $this->set_week_array(phpgwapi_datetime::get_weekday_start($params['year'], $params['month'], $params['day']), $this->theme['row_on'], True); print_debug('Date to Eval', $date_to_eval); $rows = array(); $last_slot = $this->slot_num($day_end, $day_start, $day_end); if ($daily[$date_to_eval]['appts']) { $events = $this->bo->cached_events[$date_to_eval]; print_debug('Date', $date_to_eval); print_debug('Count', count($events)); $last_slot_end = -1; foreach ($events as $event) { ## by tb: we don't want a user to be able to see a event if he has no permission to read it !!! ## this shoud be in class.bocalendar->get_cached_events() !!! #echo '<br><b>check_perms: |'.$this->bo->check_perms(PHPGW_ACL_READ).'|</b><br>'; if (!$this->bo->check_perms(PHPGW_ACL_READ)) { continue; ## echo '<center>'.lang('You do not have permission to read this record!').'</center>'."\n"; ## $GLOBALS['phpgw']->common->phpgw_exit(True); } ## by tb if ($this->bo->rejected_no_show($event)) { continue; // user does not want to see rejected events } if (isset($event['recur_type']) && $event['recur_type']) { $this->bo->set_recur_date($event, $date_to_eval); } $starttime = $this->bo->maketime($event['start']); $endtime = $this->bo->maketime($event['end']); $slot = $this->slot_num($starttime, mktime(intval($this->bo->prefs['calendar']['workdaystarts']), 0, 0, $event['start']['month'], $event['start']['mday'], $event['start']['year']), mktime(intval($this->bo->prefs['calendar']['workdaystarts']), 0, 0, $event['end']['month'], $event['end']['mday'], $event['end']['year'])); $slot_end = $this->slot_num($endtime - 1); // -1 to no occupy eg. the 18.00 slot for a 17-18h date if ($slot <= $last_slot_end) { $slot = $last_slot; $slot_end = max($last_slot_end, $slot_end); } if (isset($rows[$slot])) { $rows[$slot] .= $this->link_to_entry($event, $params['month'], $params['day'], $params['year']); } else { $rows[$slot] = $this->link_to_entry($event, $params['month'], $params['day'], $params['year']); } ## by tb --> old cat-colors: has problems with overlaying events # $tmp_cats = explode(',',$event['category']); # $tmp_cat = $tmp_cats[0]; # $color[$slot] = ( $this->cat_colors[$tmp_cat]) ? $this->cat_colors[$tmp_cat] : 'noColor'; ## by tb print_debug('slot', $slot); print_debug('row', $rows[$slot]); $row_span[$slot] = 1 + $slot_end - $slot; $last_slot = $slot; $last_slot_end = $slot_end; $user_timezone = phpgwapi_datetime::user_timezone(); print_debug('Time', $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $user_timezone) . ' - ' . $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $user_timezone)); print_debug('Slot', $slot); } //echo "rows=<pre>"; print_r($rows); echo "<br />row_span="; print_r($row_span); echo "</pre>\n"; } $holiday_names = $daily[$date_to_eval]['holidays']; if (!$holiday_names) { $row_to_print = $this->nm_on_off(); } else { $row_to_print = '_holiday'; foreach ($holiday_names as $name) { $rows[0] = '<center>' . $name . '</center>' . $rows[0]; } } $last_slot = $this->slot_num($day_end, $day_start, $day_end); $rowspan = 0; for ($slot = 0; $slot <= $last_slot; ++$slot) { $p->set_var('extras', ''); if ($rowspan > 1) { $p->set_var('item', ''); $rowspan--; } elseif (!isset($rows[$slot])) { $p->set_var('event', ' '); $row_to_print = $this->nm_on_off(); $p->parse('item', 'day_event' . $row_to_print, False); } else { $rowspan = intval($row_span[$slot]); if ($rowspan > 1) { ## by tb --> old catcolors: has problems with overlaying event # $p->set_var('extras',' rowspan="'.$rowspan.'"'.' style="border-left:3px solid '.$color[$slot].';padding:3px;vertical-align:top;" '); $p->set_var('extras', ' rowspan="' . $rowspan . '"' . ' style="vertical-align:top;" '); ## END - by tb } else { # $p->set_var('extras',' style="border-left:3px solid '.$color[$slot].';padding:3px;vertical-align:top;" '); $p->set_var('extras', ' style="border-left:vertical-align:top;" '); } ## END - by tb $p->set_var('event', $rows[$slot]); $row_to_print = $this->nm_on_off(); $p->parse('item', 'day_event' . $row_to_print, False); } $open_link = $close_link = ''; $time = ' '; if (0 < $slot && $slot < $last_slot) { $time = $day_start + ($slot - 1) * 60 * $this->bo->prefs['calendar']['interval']; $hour = date('H', $time); $min = date('i', $time); $time = phpgwapi_datetime::formattime($hour, $min); ## by tb $open_link = $this->week_type != 'new' ? ' - ' : ''; ## by tb if ($this->bo->check_perms(PHPGW_ACL_ADD)) { $open_link .= '<a href="' . $this->page('add', array('date' => $date_to_eval, 'hour' => $hour, 'minute' => $min)) . '">'; $close_link = '</a>'; } } $var = array('open_link' => $open_link, 'time' => $time, 'close_link' => $close_link, 'tr_color' => ''); ## by tb if ($this->week_type != 'new' || $this->week_type == 'new' && $this->bo->prefs['calendar']['show_time_line'] == '1') { $this->output_template_array($p, 'item', 'day_time', $var); } $p->parse('row', 'day_row', True); } $this->time_line_saved = TRUE; ## END - by tb return $p->fp('out', 'day'); }