* * http://www.radix.net/~cknudsen * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ /* $Id$ */ $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True); include("../header.inc.php"); $cal_info = new calendar_item; if ($id > 0) { $cal = $phpgw->calendar->getevent((int)$id); $cal_info = $cal[0]; $can_edit = false; if($cal_info->owner == $phpgw_info["user"]["account_id"]) $can_edit = true; if(!$cal_info->rpt_end_use) { $rpt_date = $phpgw->calendar->splitdate(mktime(0,0,0,$cal_info->month,$cal_info->day + 1,$cal_info->year)); $cal_info->rpt_year = $rpt_date["year"]; $cal_info->rpt_month = $rpt_date["month"]; $cal_info->rpt_day = $rpt_date["day"]; } } else { $can_edit = true; if (!isset($day) || !$day) $thisday = (int)$phpgw->calendar->today["day"]; else $thisday = $day; if (!isset($month) || !$month) $thismonth = (int)$phpgw->calendar->today["month"]; else $thismonth = $month; if (!isset($year) || !$year) $thisyear = (int)$phpgw->calendar->today["year"]; else $thisyear = $year; if (!isset($hour)) $thishour = 0; else $thishour = (int)$hour; if (!isset($minute)) $thisminute = 00; else $thisminute = (int)$minute; $time = $phpgw->calendar->splittime($phpgw->calendar->fixtime($thishour,$thisminute)); $cal_info->name = ""; $cal_info->description = ""; $cal_info->day = $thisday; $cal_info->month = $thismonth; $cal_info->year = $thisyear; $cal_info->rpt_day = $thisday + 1; $cal_info->rpt_month = $thismonth; $cal_info->rpt_year = $thisyear; $cal_info->hour = (int)$time["hour"]; $cal_info->minute = (!(int)$time["minute"]?"00":(int)$time["minute"]); $cal_info->ampm = "am"; if($cal_info->hour > 12 && $phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { $cal_info["hour"] = $cal_info["hour"] - 12; $cal_info["ampm"] = "pm"; } } $phpgw->template->set_file(array("edit_entry_begin" => "edit.tpl", "list" => "list.tpl", "edit_entry_end" => "edit.tpl", "form_button" => "form_button_script.tpl")); $phpgw->template->set_block("edit_entry_begin","list","edit_entry_end","form_button"); $phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_text"]); $phpgw->template->set_var("name_error",lang("You have not entered a\\nBrief Description")."."); $phpgw->template->set_var("time_error",lang("You have not entered a\\nvalid time of day.")); if($id) $phpgw->template->set_var("calendar_action",lang("Calendar - Edit")); else $phpgw->template->set_var("calendar_action",lang("Calendar - Add")); if($can_edit) { $phpgw->template->set_var("action_url",$phpgw->link("edit_entry_handler.php")); $common_hidden = "\n"; $phpgw->template->set_var("common_hidden",$common_hidden); $phpgw->template->parse("out","edit_entry_begin"); $phpgw->template->set_var("field",lang("Brief Description")); $phpgw->template->set_var("data","name."\">"); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Full Description")); $phpgw->template->set_var("data",""); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Date")); $day_html = ""; $month_html = ""; $year_html = ""; $phpgw->template->set_var("data",$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Time")); $amsel = "checked"; $pmsel = ""; if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { if ($cal_info->ampm == "pm") { $amsel = ""; $pmsel = "checked"; } else { $amsel = "checked"; $pmsel = ""; } } $str = "hour."\" maxlength=\"2\">:minute>=0 && (int)$cal_info->minute<=9?"0".(int)$cal_info->minute:$cal_info->minute)."\" maxlength=\"2\">"; if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { $str .= "am"; $str .= "pm"; } $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Duration")); $phpgw->template->set_var("data","duration?0:$cal_info->duration)."\"> ".lang("minutes")); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Priority")); $str = ""; $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Access")); $str = ""; $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Access")); $str = ""; $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Participants")); $phpgw->db->query("select account_id,account_lastname,account_firstname,account_lid " . "from accounts where account_status !='L' and " . "account_id != ".$phpgw_info["user"]["account_id"]." " . "and account_permissions like '%:calendar:%' " . "order by account_lastname,account_firstname,account_lid"); if ($phpgw->db->num_rows() > 50) $size = 15; else if ($phpgw->db->num_rows() > 5) $size = 5; else $size = $phpgw->db->num_rows(); $str = ""; $str .= ""; $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Repeat Type")); $str = ""; $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Repeat End Date")); $str = "rpt_end_use) $str .= " checked"; $str .= ">".lang("Use End Date")." "; $day_html = ""; $month_html = ""; $year_html = ""; $str .= $phpgw->common->dateformatorder($year_html,$month_html,$day_html); $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Repeat Day")."
".lang("for weekly")); $str = "rpt_sun?"checked":"")."> ".lang("Sunday")." "; $str .= "rpt_mon?"checked":"")."> ".lang("Monday")." "; $str .= "rpt_tue?"checked":"")."> ".lang("Tuesday")." "; $str .= "rpt_wed?"checked":"")."> ".lang("Wednesday")." "; $str .= "rpt_thu?"checked":"")."> ".lang("Thursday")." "; $str .= "rpt_fri?"checked":"")."> ".lang("Friday")." "; $str .= "rpt_sat?"checked":"")."> ".lang("Saturday")." "; $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Frequency")); $phpgw->template->set_var("data","rpt_freq."\">"); $phpgw->template->parse("output","list",True); $phpgw->template->set_var("submit_button",lang("Submit")); if ($id > 0) { $phpgw->template->set_var("action_url_button",$phpgw->link("delete.php","id=$id")); $phpgw->template->set_var("action_text_button",lang("Delete")); $phpgw->template->set_var("action_confirm_button","onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\""); $phpgw->template->parse("delete_button","form_button"); $phpgw->template->pparse("out","edit_entry_end"); } else { $phpgw->template->set_var("delete_button",""); $phpgw->template->pparse("out","edit_entry_end"); } $phpgw->common->phpgw_footer(); } ?>