split of calendar_item class and fix for footer links

This commit is contained in:
skeeter 2001-01-13 21:15:11 +00:00
parent 4335b02e7a
commit 21c325ceb2
7 changed files with 100 additions and 90 deletions

View File

@ -19,7 +19,7 @@
$sb = CreateObject("phpgwapi.sbox");
$cal_info = new calendar_item;
$cal_info = CreateObject('calendar.calendar_item');
function display_item($field,$data) {
global $phpgw;

View File

@ -16,7 +16,7 @@
$phpgw_info["flags"] = array("currentapp" => "calendar", "noheader" => True, "nonavbar" => True, "enable_nextmatchs_class" => True, "noappheader" => True, "noappfooter" => True);
include("../header.inc.php");
$cal_info = new calendar_item;
$cal_info = CreateObject('calendar.calendar_item');
function validate($cal_info) {
$error = 0;

View File

@ -11,60 +11,6 @@
/* $Id$ */
class calendar_item {
var $owner;
var $id = 0;
var $name = "Unnamed Event";
var $description = "Unnamed Event";
var $datetime = 0;
var $day = 0;
var $month = 0;
var $year = 0;
var $hour = 0;
var $minute = 0;
var $ampm = "";
var $mdatetime = 0;
var $mod_day = 0;
var $mod_month = 0;
var $mod_year = 0;
var $mod_hour = 0;
var $mod_minute = 0;
var $mod_second = 0;
var $mod_ampm = "";
var $edatetime = 0;
var $end_day = 0;
var $end_month = 0;
var $end_year = 0;
var $end_hour = 0;
var $end_minute = 0;
var $end_second = 0;
var $end_ampm = "";
var $priority = 0;
var $access = "private";
var $groups = array();
var $participants = array();
var $status = array();
var $rpt_type = "none";
var $rpt_end_use = 0;
var $rpt_end = 0;
var $rpt_end_day = 0;
var $rpt_end_month = 0;
var $rpt_end_year = 0;
var $rpt_days = "nnnnnnn";
var $rpt_sun = 0;
var $rpt_mon = 0;
var $rpt_tue = 0;
var $rpt_wed = 0;
var $rpt_thu = 0;
var $rpt_fri = 0;
var $rpt_sat = 0;
var $rpt_freq = 0;
function set($var,$val="") {
$this->$var = $val;
}
}
class calendar
{
var $today = array("full","month","day","year");
@ -83,6 +29,9 @@
var $weekstarttime;
var $daysinweek;
var $filter;
var $tempyear;
var $tempmonth;
var $tempday;
function calendar_($p_friendly=False) {
global $phpgw;
@ -682,11 +631,11 @@
}
$events = $this->getevent($rep_events);
} else
$events = Array(new calendar_item);
$events = Array(CreateObject('calendar.calendar_item'));
if(!$this->checked_re && !$this->sorted_re) return False;
$e = new calendar_item;
$e = CreateObject('calendar.calendar_item');
for ($j=0;$j<$this->checked_re;$j++) {
$e = $this->repeated_events[$rep_event[$j]];
$events[$this->sorted_re++] = $e;
@ -738,8 +687,8 @@
global $phpgw_info;
$str = "";
$gr_events = new calendar_item;
$lr_events = new calendar_item;
$gr_events = CreateObject('calendar.calendar_item');
$lr_events = CreateObject('calendar.calendar_item');
if($display_name) {
$str .= "<td valign=\"top\" width=\"75\" height=\"75\">".$phpgw->common->grab_owner_name($owner)."</td>";
}
@ -766,7 +715,7 @@
$rep_events = $this->get_sorted_by_date($date["raw"],$owner);
if ($this->sorted_re) {
$lr_events = new calendar_item;
$lr_events = CreateObject('calendar.calendar_item');
for ($k=0;$k<$this->sorted_re;$k++) {
$lr_events = $rep_events[$k];
$str .= "<nobr>";
@ -1203,13 +1152,13 @@
$this->first_hour = (int)$phpgw_info["user"]["preferences"]["calendar"]["workdaystarts"] + 1;
$this->last_hour = (int)$phpgw_info["user"]["preferences"]["calendar"]["workdayends"] + 1;
$events = array(new calendar_item);
$events = array(CreateObject('calendar.calendar_item'));
$events = $this->get_sorted_by_date($date["raw"]);
if(!$events) {
} else {
$event = new calendar_item;
$event = CreateObject('calendar.calendar_item');
for($i=0;$i<count($events);$i++) {
$event = $events[$i];
if($event) $this->html_for_event_day_at_a_glance($event);
@ -1493,7 +1442,7 @@
$phpgw->db->lock(array("calendar_entry","calendar_entry_user","calendar_entry_repeats"));
$calendar = new calendar_item;
$calendar = CreateObject('calendar.calendar_item');
for($i=0;$i<count($cal_id);$i++) {

View File

@ -0,0 +1,68 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
class calendar_item {
var $owner;
var $id = 0;
var $name = "Unnamed Event";
var $description = "Unnamed Event";
var $datetime = 0;
var $day = 0;
var $month = 0;
var $year = 0;
var $hour = 0;
var $minute = 0;
var $ampm = "";
var $mdatetime = 0;
var $mod_day = 0;
var $mod_month = 0;
var $mod_year = 0;
var $mod_hour = 0;
var $mod_minute = 0;
var $mod_second = 0;
var $mod_ampm = "";
var $edatetime = 0;
var $end_day = 0;
var $end_month = 0;
var $end_year = 0;
var $end_hour = 0;
var $end_minute = 0;
var $end_second = 0;
var $end_ampm = "";
var $priority = 0;
var $access = "private";
var $groups = array();
var $participants = array();
var $status = array();
var $rpt_type = "none";
var $rpt_end_use = 0;
var $rpt_end = 0;
var $rpt_end_day = 0;
var $rpt_end_month = 0;
var $rpt_end_year = 0;
var $rpt_days = "nnnnnnn";
var $rpt_sun = 0;
var $rpt_mon = 0;
var $rpt_tue = 0;
var $rpt_wed = 0;
var $rpt_thu = 0;
var $rpt_fri = 0;
var $rpt_sat = 0;
var $rpt_freq = 0;
function set($var,$val="") {
$this->$var = $val;
}
}
?>

View File

@ -17,10 +17,7 @@
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
if (!isset($phpgw_info["flags"]["nocalendarheader"]) ||
!$phpgw_info["flags"]["nocalendarheader"]) {
?>
?>
<BR CLEAR="all">
<HR CLEAR="all">
<FONT SIZE="-1">
@ -32,9 +29,9 @@
<B><?php echo lang("Month"); ?>:</B>
<SELECT NAME="date" ONCHANGE="document.SelectMonth.submit()">
<?php
if ($thisyear && $thismonth) {
$m = $thismonth;
$y = $thisyear;
if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth) {
$m = $phpgw->calendar->tempmonth;
$y = $phpgw->calendar->tempyear;
} else {
$m = date("m");
$y = date("Y");
@ -49,7 +46,7 @@
$y++;
}
$d = mktime(0,0,0,$m,1,$y);
echo "<OPTION VALUE=\"" . date("Ymd", $d) . "\"";
echo'"<option value="' . date("Ymd", $d) . '"';
if (date("Ymd", $d) == $thisdate)
echo " SELECTED";
echo ">" . lang(date("F", $d)) . strftime(" %Y", $d) . "</option>\n";
@ -64,9 +61,9 @@
<SELECT NAME="date" ONCHANGE="document.SelectWeek.submit()">
<?php
if ($thisyear && $thismonth) {
$m = $thismonth;
$y = $thisyear;
if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth) {
$m = $phpgw->calendar->tempmonth;
$y = $phpgw->calendar->tempyear;
} else {
$m = date("m");
$y = date("Y");
@ -107,8 +104,8 @@
<SELECT NAME="year" ONCHANGE="document.SelectYear.submit()">
<?php
if ($thisyear) {
$y = $thisyear;
if ($phpgw->calendar->tempyear) {
$y = $phpgw->calendar->tempyear;
} else {
$y = date("Y");
}
@ -127,7 +124,3 @@
</TR>
</TABLE>
<?php
}
?>

View File

@ -12,9 +12,9 @@
if(!isset($filter) || !$filter)
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
if (isset($date) && strlen($date) > 0) {
$thisyear = substr($date, 0, 4);
$thismonth = substr($date, 4, 2);
$thisday = substr($date, 6, 2);
$thisyear = intval(substr($date, 0, 4));
$thismonth = intval(substr($date, 4, 2));
$thisday = intval(substr($date, 6, 2));
} else {
if (!isset($day) || !$day)
$thisday = $phpgw->calendar->today["day"];
@ -30,8 +30,9 @@
$thisyear = $year;
}
if (!isset($phpgw_info["flags"]["nocalendarheader"]) ||
!$phpgw_info["flags"]["nocalendarheader"]) {
$phpgw->calendar->tempyear = $thisyear;
$phpgw->calendar->tempmonth = $thismonth;
$phpgw->calendar->tempday = $thisday;
?>
<table border="0" width="100%" cols="8" cellpadding="0" cellspacing="0">
@ -118,5 +119,4 @@
</table>
<?php
flush();
}
?>

View File

@ -32,9 +32,9 @@
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
if (isset($date) && strlen($date) > 0) {
$thisyear = substr($date, 0, 4);
$thismonth = substr($date, 4, 2);
$thisday = substr($date, 6, 2);
$thisyear = intval(substr($date, 0, 4));
$thismonth = intval(substr($date, 4, 2));
$thisday = intval(substr($date, 6, 2));
} else {
if (!isset($day) || !$day)
$thisday = $phpgw->calendar->today["day"];