calendar's work again with new layout - next step - add acl supp

This commit is contained in:
skeeter 2001-02-07 11:53:44 +00:00
parent ae028712f2
commit 5299bab0f9
2 changed files with 105 additions and 100 deletions

View File

@ -64,7 +64,7 @@
global $phpgw, $phpgw_info;
$owner = $owner==$phpgw_info["user"]["account_id"]?0:$owner;
$groups = substr($phpgw->accounts->sql_search("calendar_entry.cal_group",intval($owner)),4);
$groups = substr($phpgw->common->sql_search("calendar_entry.cal_group",intval($owner)),4);
if (!$groups) {
return "";
} else {
@ -1335,25 +1335,24 @@
if(!$phpgw_info["user"]["apps"]["calendar"]) return false;
$db2 = $phpgw->db;
$cal_id = array();
if(is_long($calid)) {
if(!$calid) return false;
$cal_id[0] = $calid;
} elseif(is_string($calid)) {
$phpgw->db->query("SELECT account_id FROM accounts WHERE account_lid='$calid'",__LINE__,__FILE__);
$phpgw->db->next_record();
$calid = $phpgw->db->f("account_id");
$phpgw->db->query("SELECT cal_id FROM calendar_entry WHERE cal_owner=".$calid,__LINE__,__FILE__);
$calid = $phpgw->account->name2id($calid);
$db2->query("SELECT cal_id FROM calendar_entry WHERE cal_owner=".$calid,__LINE__,__FILE__);
while($phpgw->db->next_record()) {
$cal_id[count($cal_id)] = $phpgw->db->f("cal_id");
$cal_id[] = $db2->f("cal_id");
}
} elseif(is_array($calid)) {
if(is_string($calid[0])) {
for($i=0;$i<count($calid);$i++) {
$phpgw->db->query("SELECT cal_id FROM calendar_entry WHERE cal_owner=".$calid[$i],__LINE__,__FILE__);
while($phpgw->db->next_record()) {
$cal_id[count($cal_id)] = $phpgw->db->f("cal_id");
$db2->query("SELECT cal_id FROM calendar_entry WHERE cal_owner=".$calid[$i],__LINE__,__FILE__);
while($db2->next_record()) {
$cal_id[] = $db2->f("cal_id");
}
}
} elseif(is_long($calid[0])) {
@ -1512,19 +1511,21 @@
if(!$cal_id) return false;
$phpgw->db->lock(array("calendar_entry","calendar_entry_user","calendar_entry_repeats"));
$db2 = $phpgw->db;
$db2->lock(array("calendar_entry","calendar_entry_user","calendar_entry_repeats"));
$calendar = CreateObject('calendar.calendar_item');
for($i=0;$i<count($cal_id);$i++) {
$phpgw->db->query("SELECT * FROM calendar_entry WHERE cal_id=".$cal_id[$i],__LINE__,__FILE__);
$phpgw->db->next_record();
$db2->query("SELECT * FROM calendar_entry WHERE cal_id=".$cal_id[$i],__LINE__,__FILE__);
$db2->next_record();
$calendar->id = (int)$phpgw->db->f("cal_id");
$calendar->owner = $phpgw->db->f("cal_owner");
$calendar->id = (int)$db2->f("cal_id");
$calendar->owner = $db2->f("cal_owner");
$calendar->datetime = $phpgw->db->f("cal_datetime");
$calendar->datetime = $db2->f("cal_datetime");
$date = $this->date_to_epoch($phpgw->common->show_date($calendar->datetime,"Ymd"));
$calendar->day = $date["day"];
$calendar->month = $date["month"];
@ -1542,7 +1543,7 @@
// echo "<br>TEST: minute: " . $calendar->minute;
// echo "<br>TEST: ampm: " . $calendar->ampm;
$calendar->mdatetime = $phpgw->db->f("cal_mdatetime");
$calendar->mdatetime = $db2->f("cal_mdatetime");
$date = $this->date_to_epoch($phpgw->common->show_date($calendar->mdatetime,"Ymd"));
$calendar->mod_day = $date["day"];
$calendar->mod_month = $date["month"];
@ -1554,7 +1555,7 @@
$calendar->mod_second = (int)$time["second"];
$calendar->mod_ampm = $time["ampm"];
$calendar->edatetime = $phpgw->db->f("cal_edatetime");
$calendar->edatetime = $db2->f("cal_edatetime");
$date = $this->date_to_epoch($phpgw->common->show_date($calendar->edatetime,"Ymd"));
$calendar->end_day = $date["day"];
$calendar->end_month = $date["month"];
@ -1566,24 +1567,28 @@
$calendar->end_second = (int)$time["second"];
$calendar->end_ampm = $time["ampm"];
$calendar->priority = $phpgw->db->f("cal_priority");
$calendar->priority = $db2->f("cal_priority");
// not loading webcal_entry.cal_type
$calendar->access = $phpgw->db->f("cal_access");
$calendar->name = htmlspecialchars(stripslashes($phpgw->db->f("cal_name")));
$calendar->description = htmlspecialchars(stripslashes($phpgw->db->f("cal_description")));
if($phpgw->db->f("cal_group"))
$calendar->groups = $phpgw->accounts->string_to_array($phpgw->db->f("cal_group"));
$calendar->access = $db2->f("cal_access");
$calendar->name = htmlspecialchars(stripslashes($db2->f("cal_name")));
$calendar->description = htmlspecialchars(stripslashes($db2->f("cal_description")));
if($db2->f("cal_group")) {
$groups = explode(',',$db2->f("cal_group"));
for($j=1;$j<count($groups);$j++) {
$calendar->groups[] = $groups[$j];
}
}
$phpgw->db->query("SELECT * FROM calendar_entry_repeats WHERE cal_id=".$cal_id[$i],__LINE__,__FILE__);
if($phpgw->db->num_rows()) {
$phpgw->db->next_record();
$db2->query("SELECT * FROM calendar_entry_repeats WHERE cal_id=".$cal_id[$i],__LINE__,__FILE__);
if($db2->num_rows()) {
$db2->next_record();
$rpt_type = strtolower($phpgw->db->f("cal_type"));
$rpt_type = strtolower($db2->f("cal_type"));
$calendar->rpt_type = !$rpt_type?"none":$rpt_type;
$calendar->rpt_use_end = $phpgw->db->f("cal_use_end");
$calendar->rpt_use_end = $db2->f("cal_use_end");
if($calendar->rpt_use_end) {
$calendar->rpt_end = $phpgw->db->f("cal_end");
$rpt_end = $phpgw->common->show_date($phpgw->db->f("cal_end"),"Ymd");
$calendar->rpt_end = $db2->f("cal_end");
$rpt_end = $phpgw->common->show_date($db2->f("cal_end"),"Ymd");
$date = $this->date_to_epoch($rpt_end);
$calendar->rpt_end_day = (int)$date["day"];
$calendar->rpt_end_month = (int)$date["month"];
@ -1594,8 +1599,8 @@
$calendar->rpt_end_month = 0;
$calendar->rpt_end_year = 0;
}
$calendar->rpt_freq = (int)$phpgw->db->f("cal_frequency");
$rpt_days = strtoupper($phpgw->db->f("cal_days"));
$calendar->rpt_freq = (int)$db2->f("cal_frequency");
$rpt_days = strtoupper($db2->f("cal_days"));
$calendar->rpt_days = $rpt_days;
$calendar->rpt_sun = (substr($rpt_days,0,1)=="Y"?1:0);
$calendar->rpt_mon = (substr($rpt_days,1,1)=="Y"?1:0);
@ -1606,16 +1611,16 @@
$calendar->rpt_sat = (substr($rpt_days,6,1)=="Y"?1:0);
}
$phpgw->db->query("SELECT * FROM calendar_entry_user WHERE cal_id=".$cal_id[$i],__LINE__,__FILE__);
if($phpgw->db->num_rows()) {
while($phpgw->db->next_record()) {
$calendar->participants[] = $phpgw->db->f("cal_login");
$calendar->status[] = $phpgw->db->f("cal_status");
$db2->query("SELECT * FROM calendar_entry_user WHERE cal_id=".$cal_id[$i],__LINE__,__FILE__);
if($db2->num_rows()) {
while($db2->next_record()) {
$calendar->participants[] = $db2->f("cal_login");
$calendar->status[] = $db2->f("cal_status");
}
}
$calendar_item[$i] = $calendar;
}
$phpgw->db->unlock();
$db2->unlock();
return $calendar_item;
}

View File

@ -19,7 +19,7 @@
} unset($d1);
$tmp_app_inc = $phpgw_info["server"]["app_inc"];
$phpgw_info["server"]["app_inc"] = $phpgw_info["server"]["server_root"]."/calendar/inc";
$phpgw_info["server"]["app_inc"] = $phpgw->common->get_inc_dir('calendar');
if ($phpgw_info["user"]["preferences"]["calendar"]["mainscreen_showevents"]) {
include($phpgw_info["server"]["app_inc"].'/functions.inc.php');