[svn r15371] Course calendar repeated events - first round of features integrated + iCal export for repeats - changed method since last commit

skala
Yannick Warnier 18 years ago
parent 1c4d4262f5
commit 0ce85461b3
  1. 1010
      main/calendar/agenda.inc.php
  2. 29
      main/calendar/agenda.php
  3. 12
      main/calendar/ical_export.php

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
<?php //$Id: agenda.php 15185 2008-04-30 03:55:19Z yannoo $
<?php //$Id: agenda.php 15371 2008-05-23 07:40:03Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -302,7 +302,18 @@ if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') &&
if ($_POST['submit_event'])
{
store_new_agenda_item();
$course_info = api_get_course_info();
$event_start = (int) $_POST['fyear'].'-'.(int) $_POST['fmonth'].'-'.(int) $_POST['fday'].' '.(int) $_POST['fhour'].':'.(int) $_POST['fminute'].':00';
$event_stop = (int) $_POST['end_fyear'].'-'.(int) $_POST['end_fmonth'].'-'.(int) $_POST['end_fday'].' '.(int) $_POST['end_fhour'].':'.(int) $_POST['end_fminute'].':00';
$id = agenda_add_item($course_info,$_POST['title'],$_POST['content'],$event_start,$event_stop,$_POST['selectedform']);
if(!empty($_POST['repeat']))
{
$end_y = intval($_POST['repeat_end_year']);
$end_m = intval($_POST['repeat_end_month']);
$end_d = intval($_POST['repeat_end_day']);
$end = mktime(23, 59, 59, $end_m, $end_d, $end_y);
agenda_add_repeat_item($course_info,$id,$_POST['repeat_type'],$end,$event_start,$event_stop,$_POST['selectedform']);
}
display_agenda_items();
}
else
@ -344,7 +355,6 @@ if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') &&
}
}
// this is for students and whenever the courseaministrator has not chosen any action. It is in fact the default behaviour
if (!$_GET['action'] OR $_GET['action']=="showall" OR $_GET['action']=="showcurrent" OR $_GET['action']=="view")
{
@ -352,10 +362,17 @@ if (!$_GET['action'] OR $_GET['action']=="showall" OR $_GET['action']=="showcur
{
if (!$_SESSION['view'] OR $_SESSION['view'] <> 'month')
{
display_agenda_items();
if(!empty($_GET['agenda_id']))
{
display_one_agenda_item((int)$_GET['agenda_id']);
}
else
{
display_agenda_items();
}
}
else
{
else
{
display_monthcalendar($select_month, $select_year);
}
}

@ -45,7 +45,6 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
$ical->setProperty( 'method', 'PUBLISH' );
$ical->setConfig('url',api_get_path(WEB_PATH));
$vevent = new vevent();
$vevent->setProperty( 'summary', mb_convert_encoding($ai['title'],'UTF-8',$charset));
switch($_GET['class'])
{
case 'public':
@ -67,6 +66,7 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
case 'personal':
require_once (api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php');
$ai = get_personal_agenda_item($_GET['id']);
$vevent->setProperty( 'summary', mb_convert_encoding($ai['title'],'UTF-8',$charset));
if(empty($ai['date'])){header('location:'.$_SERVER['REFERER_URI']);}
list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$ai['date']);
$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
@ -96,7 +96,8 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
require_once (api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php');
$ai = get_agenda_item($_GET['id']);
if(empty($ai['start_date'])){header('location:'.$_SERVER['REFERER_URI']);}
$vevent->setProperty( 'summary', mb_convert_encoding($ai['title'],'UTF-8',$charset));
if(empty($ai['start_date'])){header('location:'.$_SERVER['REFERER_URI']);}
list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$ai['start_date']);
$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
if(empty($ai['end_date']))
@ -116,6 +117,13 @@ if(!empty($_GET['id']) && $_GET['id']==strval(intval($_GET['id'])))
//$vevent->setProperty('attendee',$user['mail']);
$course = api_get_course_info();
$vevent->setProperty('location', $course['name']); // property name - case independent
if($ai['repeat'])
{
$trans = array('daily'=>'DAILY','weekly'=>'WEEKLY','monthlyByDate'=>'MONTHLY','yearly'=>'YEARLY');
$freq = $trans[$ai['repeat_type']];
list($e_y,$e_m,$e_d) = split('/',date('Y/m/d',$ai['repeat_end']));
$vevent->setProperty('rrule',array('FREQ'=>$freq,'UNTIL'=>array('year'=>$e_y,'month'=>$e_m,'day'=>$e_d),'INTERVAL'=>'1'));
}
//$vevent->setProperty( 'rrule', array( 'FREQ' => 'WEEKLY', 'count' => 4));// occurs also four next weeks
$ical->setConfig('filename',$y.$m.$d.$h.$M.$s.'-'.rand(1,1000).'.ics');
$ical->setComponent ($vevent); // add event to calendar

Loading…
Cancel
Save