function field_heure($name, $selected, $plage_h = '08:00-18:00', $options = array()) { $tab_heure = explode('-', $plage_h); $heure_deb = intval($tab_heure[0]); $heure_fin = intval($tab_heure[1]); $list_vals = array(); for ($h = $heure_deb; $h <= $heure_fin; $h++) { if (!empty($options['minut_unit'])) { $minutes = 0; while ($minutes < 60) { $val_h = add_zero($h, 2) . ':' . add_zero($minutes, 2); if ($val_h >= $tab_heure[0] && $val_h <= $tab_heure[1]) { $list_vals[$val_h] = $val_h; } $minutes += $options['minut_unit']; } } else { $val_h = add_zero($h, 2) . ':00'; if ($val_h >= $tab_heure[0] && $val_h <= $tab_heure[1]) { $list_vals[$val_h] = $val_h; } } } return field_select($name, $list_vals, $selected, $options); }
{ if ($t < 10) { return "0" . $t; } else { return $t; } } // today adjusted for user's timezone if (empty($date_arr)) { global $timedate; $gmt_today = $timedate->get_gmt_db_datetime(); $user_today = $timedate->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format()); preg_match('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', $user_today, $matches); $date_arr = array('year' => $matches[1], 'month' => $matches[2], 'day' => $matches[3], 'hour' => $matches[4], 'min' => $matches[5]); } else { $gmt_today = $date_arr['year'] . "-" . add_zero($date_arr['month']) . "-" . add_zero($date_arr['day']); $user_today = $timedate->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format()); } $real_today_unix = to_timestamp($timedate->get_gmt_db_date()); $args['calendar'] = new ECalendar($_REQUEST['view'], $date_arr); $show_tasks = $current_user->getPreference('show_tasks'); $rec_enabled = $current_user->getPreference('rec_enabled'); $args['calendar']->show_tasks = $show_tasks; if ($_REQUEST['view'] == 'day' || $_REQUEST['view'] == 'week' || $_REQUEST['view'] == 'month') { global $current_user; $args['calendar']->add_activities($current_user); } if ($_REQUEST['view'] == 'shared') { global $ids; global $current_user; global $mod_strings;
$year_start_unix = $today_unix - $Ts - 60 * $Ti - 60 * 60 * $Th - 60 * 60 * 24 * $Tz; // - $timezone['gmtOffset']*60; $year_end_unix = $month_start_unix + 60 * 60 * 24 * $diy; $Tw = date("w", $year_start_unix - date('Z', $year_start_unix)); $week_start_unix = $year_start_unix - 60 * 60 * 24 * $Tw; if ($startday == "Monday") { $week_start_unix = $week_start_unix + 60 * 60 * 24; } $week_end_unix = $week_start_unix + 60 * 60 * 24 * 7; if ($startday == "Monday") { $week_end_unix = $week_end_unix + 60 * 60 * 24; } echo '<table id="daily_cal_table" cellspacing="1" cellpadding="0" border="0" width="100%">'; $curr_time_g = $year_start_unix; for ($m = 0; $m < 12; $m++) { $gmt_g = $date_arr['year'] . "-" . add_zero($m + 1) . "-" . "01"; $g_parsed = date_parse($gmt_g); $g_unix = gmmktime($g_parsed['hour'], $g_parsed['minute'], $g_parsed['second'], $g_parsed['month'], $g_parsed['day'], $g_parsed['year']); $Tw = date("w", $g_unix - date('Z', $g_unix)); $Ti = date("i", $g_unix - date('Z', $g_unix)); $Ts = date("s", $g_unix - date('Z', $g_unix)); $Th = date("H", $g_unix - date('Z', $g_unix)); $Td = date("d", $g_unix - date('Z', $g_unix)); $Tm = date("m", $g_unix - date('Z', $g_unix)); $Ty = date("Y", $g_unix - date('Z', $g_unix)); $Tt = date("t", $g_unix - date('Z', $g_unix)); $Tz = date("z", $g_unix - date('Z', $g_unix)); $TL = date("L", $g_unix - date('Z', $g_unix)); $timezone = $GLOBALS['timedate']->getUserTimeZone(); $month_start_unix = $g_unix - $Ts - 60 * $Ti - 60 * 60 * $Th - 60 * 60 * 24 * ($Td - 1); // - $timezone['gmtOffset']*60;