Removes old calendar. Moving agenda.lib.php inside main/inc/lib

1.10.x
Julio Montoya 10 years ago
parent 04524308c6
commit 5f7d075cc0
  1. 393
      main/admin/calendar.lib.php
  2. 3
      main/admin/calendar.php
  3. 1
      main/calendar/agenda_js.php
  4. 1
      main/calendar/agenda_list.php
  5. 2
      main/calendar/ical_export.php
  6. 211
      main/calendar/myagenda.inc.php
  7. 38
      main/calendar/myagenda.php
  8. 1
      main/inc/ajax/agenda.ajax.php
  9. 0
      main/inc/lib/agenda.lib.php

@ -1151,399 +1151,6 @@ function show_user_group_filter_form()
echo "</select>"; echo "</select>";
} }
function show_add_form($id = '') {
global $MonthsLong;
$htmlHeadXtra[] = to_javascript();
// the default values for the forms
if ($_GET['originalresource'] !== 'no') {
$day = date('d');
$month = date('m');
$year = date('Y');
$hours = 9;
$minutes= '00';
$end_day = date('d');
$end_month = date('m');
$end_year = date('Y');
$end_hours = 17;
$end_minutes= '00';
$repeat = false;
} else {
// we are coming from the resource linker so there might already have been some information in the form.
// When we clicked on the button to add resources we stored every form information into a session and now we
// are doing the opposite thing: getting the information out of the session and putting it into variables to
// display it in the forms.
$form_elements=$_SESSION['formelements'];
$day=$form_elements['day'];
$month=$form_elements['month'];
$year=$form_elements['year'];
$hours=$form_elements['hour'];
$minutes=$form_elements['minutes'];
$end_day=$form_elements['end_day'];
$end_month=$form_elements['end_month'];
$end_year=$form_elements['end_year'];
$end_hours=$form_elements['end_hours'];
$end_minutes=$form_elements['end_minutes'];
$title=$form_elements['title'];
$content=$form_elements['content'];
$id=$form_elements['id'];
$to=$form_elements['to'];
$repeat = $form_elements['repeat'];
}
// switching the send to all/send to groups/send to users
if ($_POST['To']) {
$day = $_POST['fday'];
$month = $_POST['fmonth'];
$year = $_POST['fyear'];
$hours = $_POST['fhour'];
$minutes = $_POST['fminute'];
$end_day = $_POST['end_fday'];
$end_month = $_POST['end_fmonth'];
$end_year = $_POST['end_fyear'];
$end_hours = $_POST['end_fhour'];
$end_minutes = $_POST['end_fminute'];
$title = $_POST['title'];
$content = $_POST['content'];
// the invisible fields
$action = $_POST['action'];
$id = $_POST['id'];
$repeat = !empty($_POST['repeat'])?true:false;
}
// if the id is set then we are editing an agenda item
if (is_int($id)) {
//echo "before get_agenda_item".$_SESSION['allow_individual_calendar'];
$item_2_edit=get_agenda_item($id);
$title = $item_2_edit['title'];
$content= $item_2_edit['content'];
// start date
$item_2_edit['start_date'] = api_get_local_time($item_2_edit['start_date']);
// start date
list($datepart, $timepart) = split(" ", $item_2_edit['start_date']);
list($year, $month, $day) = explode("-", $datepart);
list($hours, $minutes, $seconds) = explode(":", $timepart);
// end date
$item_2_edit['end_date'] = api_get_local_time($item_2_edit['end_date']);
list($datepart, $timepart) = split(" ", $item_2_edit['end_date']);
list($end_year, $end_month, $end_day) = explode("-", $datepart);
list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart);
// attachments
//edit_added_resources("Agenda", $id);
$to=$item_2_edit['to'];
//echo "<br />after get_agenda_item".$_SESSION['allow_individual_calendar'];
}
$content=stripslashes($content);
$title=stripslashes($title);
// we start a completely new item, we do not come from the resource linker
if ($_GET['originalresource']!=="no" and $_GET['action']=="add") {
$_SESSION["formelements"]=null;
}
?>
<!-- START OF THE FORM -->
<form enctype="multipart/form-data" action="<?php echo api_get_self().'?origin='.Security::remove_XSS($_GET['origin']).'&amp;action='.Security::remove_XSS($_GET['action']); ?>" method="post" name="new_calendar_item">
<input type="hidden" name="id" value="<?php if (isset($id)) echo $id; ?>" />
<input type="hidden" name="action" value="<?php if (isset($_GET['action'])) echo Security::remove_XSS($_GET['action']); ?>" />
<input type="hidden" name="sort" value="asc" />
<input type="hidden" name="submit_event" value="ok" />
<?php
echo '<legend>';
echo (isset($id) AND $id<>'')?get_lang('ModifyCalendarItem'):get_lang("AddCalendarItem");
echo '<legend>';
?>
<table border="0" cellpadding="5" cellspacing="0" width="80%" id="newedit_form">
<!-- START date and time -->
<tr>
<div>
<table border="0" width="100%">
<tr><td colspan="4">
<div id="err_date" style="display:none;color:red"></div>
<div id="err_start_date" style="display:none;color:red"></div>
</td></tr>
<td width="10%">
<!-- date: 1 -> 31 -->
<nobr><?php echo get_lang('StartDate').": "; ?></nobr>
</td>
<td width="35%">
<select name="fday" onchange="javascript:document.new_calendar_item.end_fday.value=this.value;">
<?php
// small loop for filling all the dates
// 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
foreach (range(1, 31) as $i) {
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
// the current day is indicated with [] around the date
if ($value==$day)
{
echo " <option value=\"".$value."\" selected> ".$i." </option>";
}
else
{
echo "<option value=\"$value\">$i</option>";
}
}
?>
</select>
<!-- month: january -> december -->
<select name="fmonth" onchange="javascript:document.new_calendar_item.end_fmonth.value=this.value;">
<?php
for ($i=1; $i<=12; $i++) {
// values have to have double digits
if ($i<=9)
{
$value="0".$i;
}
else
{
$value=$i;
}
if ($value==$month)
{
echo " <option value=\"".$value."\" selected>".$MonthsLong[$i-1]."</option>\n";
}
else
{
echo " <option value=\"".$value."\">".$MonthsLong[$i-1]."</option>\n";
}
} ?>
</select>
<select name="fyear" onchange="javascript:document.new_calendar_item.end_fyear.value=this.value;">
<option value="<?php echo ($year-1); ?>"><?php echo ($year-1); ?></option>
<option value="<?php echo $year; ?>" selected="selected"><?php echo $year; ?></option>
<?php
echo "\n";
for ($i=1; $i<=5; $i++)
{
$value=$year+$i;
echo "<option value=\"$value\">$value</option>\n";
} ?>
</select>
<a href="javascript:openCalendar('new_calendar_item','f')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a>
</td>
<td width="10%">
<nobr><?php echo get_lang('StartTime').": \n"; ?></nobr>
</td>
<td>
<select name="fhour" onchange="javascript:document.new_calendar_item.end_fhour.value=this.value;">
<!-- <option value="--">--</option> -->
<?php
echo "\n";
foreach (range(0, 23) as $i)
{
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
// the current hour is indicated with [] around the hour
if ($hours==$value)
{
echo "<option value=\"".$value."\" selected> ".$value." </option>\n";
}
else
{
echo "<option value=\"$value\">$value</option>\n";
}
} ?>
</select>
<select name="fminute" onchange="javascript:document.new_calendar_item.end_fminute.value=this.value;">
<!-- <option value="<?php echo $minutes ?>"><?php echo $minutes; ?></option> -->
<!-- <option value="--">--</option> -->
<?php
foreach (range(0, 59) as $i)
{
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
if ($minutes == $value) {
echo "<option value=\"".$value."\" selected> ".$value." </option>";
} else {
echo "<option value=\"$value\">$value</option>";
}
} ?>
</select>
</td>
</div>
</tr>
<!-- END date and time -->
<tr>
<div>
<tr><td colspan="4"><div id="err_end_date" style="display:none;color:red"></div></td></tr>
<td >
<!-- date: 1 -> 31 -->
<nobr><?php echo get_lang('EndDate').": "; ?></nobr>
</td>
<td >
<select name="end_fday">
<?php
// small loop for filling all the dates
// 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
echo "\n";
foreach (range(1, 31) as $i)
{
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
// the current day is indicated with [] around the date
if ($value==$end_day)
{ echo " <option value=\"".$value."\" selected> ".$i." </option>\n";}
else
{ echo " <option value=\"".$value."\">".$i."</option>\n"; }
}?>
</select>
<!-- month: january -> december -->
<select name="end_fmonth">
<?php
echo "\n";
foreach (range(1, 12) as $i)
{
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
if ($value==$end_month)
{ echo " <option value=\"".$value."\" selected>".$MonthsLong[$i-1]."</option>\n"; }
else
{ echo " <option value=\"".$value."\">".$MonthsLong[$i-1]."</option>\n"; }
}?>
</select>
<select name="end_fyear">
<option value="<?php echo ($end_year-1) ?>"><?php echo ($end_year-1) ?></option>
<option value="<?php echo $end_year ?>" selected> <?php echo $end_year ?> </option>
<?php
echo "\n";
for ($i=1; $i<=5; $i++)
{
$value=$end_year+$i;
echo "<option value=\"$value\">$value</option>\n";
} ?>
</select>
<a href="javascript:openCalendar('new_calendar_item', 'end_f')"><?php Display::display_icon('calendar_select.gif',get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a>
</td>
<td >
<nobr><?php echo get_lang('EndTime').": \n"; ?></nobr>
</td>
<td >
<select name="end_fhour">
<!-- <option value="--">--</option> -->
<?php
echo "\n";
foreach (range(0, 23) as $i)
{
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
// the current hour is indicated with [] around the hour
if ($end_hours==$value)
{ echo "<option value=\"".$value."\" selected> ".$value." </option>\n"; }
else
{ echo "<option value=\"".$value."\"> ".$value." </option>\n"; }
} ?>
</select>
<select name="end_fminute">
<!-- <option value="<?php echo $end_minutes; ?>"><?php echo $end_minutes; ?></option> -->
<!-- <option value="--">--</option> -->
<?php
foreach (range(0, 59) as $i)
{
// values have to have double digits
$value = ($i <= 9 ? '0'.$i : $i );
if ($minutes == $value) {
echo "<option value=\"".$value."\" selected> ".$value." </option>";
} else {
echo "<option value=\"$value\">$value</option>";
}
} ?>
</select>
<br>
</td>
</div>
</tr>
<tr><td colspan="4">
<hr noshade="noshade" color="#cccccc" />
<div id="err_title" style="display:none;color:red"></div>
</td></tr>
<tr class="subtitle">
<td colspan="4" valign="top"><?php echo get_lang('ItemTitle'); ?> :
<!--<div style='margin-left: 80px'><textarea name="title" cols="50" rows="2" wrap="virtual" style="vertical-align:top; width:75%; height:50px;"><?php if (isset($title)) echo $title; ?></textarea></div>-->
<input type="text" size="60" name="title" value="<?php if (isset($title)) echo $title; ?>" />
</td>
</tr>
<tr>
<td colspan="4">
<?php
require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php";
$oFCKeditor = new FCKeditor('content') ;
$oFCKeditor->ToolbarSet = 'GlobalAgenda';
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '175';
$oFCKeditor->Value = $content;
$return = $oFCKeditor->CreateHtml();
echo $return;
?>
</td>
</tr>
<!--<?php /* ADDED BY UGENT, Patrick Cool, march 2004 */ ?>
<tr>
<td colspan="4">
<?php
//onclick="selectAll(this.form.elements[6],true)"
// show_addresource_button('onclick="selectAll(this.form.elements[6],true)"');
?>
</td>
</tr>-->
<?php
//if ($_SESSION['addedresource'])
echo "<tr>\n";
echo "<td colspan=\"4\">\n";
//echo display_resources(0);//--------------------------------------------------------
$test=$_SESSION['addedresource'];
echo "</td>\n</tr>\n";
/* END ADDED BY UGENT, Patrick Cool, march 2004 */
if(empty($id)) //only show repeat fields when adding the first time
{
?>
<tr>
<td colspan="4" />
</tr>
<?php
}//only show repeat fields if adding, not if editing
?>
<tr>
<td colspan="4">
<?php
if ($_GET['action']=='edit'){
$class='save';
$text=get_lang('ModifyEvent');
}else{
$class='add';
$text=get_lang('AddEvent');
}
?>
<button type="button" class="add" value="<?php echo get_lang('Ok'); ?>" onclick="validate_date()" ><?php echo $text; ?></button>
</td>
</tr>
</table>
</form>
<?php
}
function display_upcoming_events() { function display_upcoming_events() {
echo '<br /><b>'.get_lang('UpcomingEvent').'</b><br />'; echo '<br /><b>'.get_lang('UpcomingEvent').'</b><br />';
$number_of_items_to_show = (int)api_get_setting('number_of_upcoming_events'); $number_of_items_to_show = (int)api_get_setting('number_of_upcoming_events');

@ -155,7 +155,8 @@ if (empty($select_year) && empty($select_month)) {
echo '<div class="actions">'; echo '<div class="actions">';
if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) { if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
display_student_links(); display_student_links();
display_courseadmin_links(); // Deprecated since 2014-10-31
//display_courseadmin_links();
} }
echo '</div><br /><br />'; echo '</div><br /><br />';

@ -21,7 +21,6 @@ if ($type == 'personal') {
$cidReset = true; // fixes #5162 $cidReset = true; // fixes #5162
} }
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once 'agenda.lib.php';
require_once 'agenda.inc.php'; require_once 'agenda.inc.php';
$current_course_tool = TOOL_CALENDAR_EVENT; $current_course_tool = TOOL_CALENDAR_EVENT;

@ -8,7 +8,6 @@
$language_file = array('agenda', 'group', 'announcements'); $language_file = array('agenda', 'group', 'announcements');
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
require_once 'agenda.lib.php';
require_once 'agenda.inc.php'; require_once 'agenda.inc.php';
$interbreadcrumb[] = array( $interbreadcrumb[] = array(

@ -14,8 +14,6 @@ $this_section = SECTION_MYAGENDA;
api_block_anonymous_users(); api_block_anonymous_users();
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php';
require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.lib.php';
// setting the name of the tool // setting the name of the tool
$nameTools = get_lang('MyAgenda'); $nameTools = get_lang('MyAgenda');

@ -321,194 +321,6 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) {
echo "</table>"; echo "</table>";
} }
/**
* This function shows all the forms that are needed form adding /editing a new personal agenda item
* when there is no $id passed in the function we are adding a new agenda item, if there is a $id
* we are editing
* attention: we have to check that the student is editing an item that belongs to him/her
*/
function show_new_personal_item_form($id = "") {
global $year, $MonthsLong;
$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
// we construct the default time and date data (used if we are not editing a personal agenda item)
//$today = getdate();
$current_date = api_strtotime(api_get_local_time());
$year = date('Y', $current_date);
$month = date('m', $current_date);
$day = date('d', $current_date);
$hours = date('H', $current_date);
$minutes = date('i', $current_date);
//echo date('Y', $current_date);
/*
$day = $today['mday'];
$month = $today['mon'];
$year = $today['year'];
$hours = $today['hours'];
$minutes = $today['minutes'];*/
$content=stripslashes($content);
$title=stripslashes($title);
// if an $id is passed to this function this means we are editing an item
// we are loading the information here (we do this after everything else
// to overwrite the default information)
if (strlen($id) > 0 && $id != strval(intval($id))) {
return false; //potential SQL injection
}
if ($id != "") {
$sql = "SELECT date, title, text FROM ".$tbl_personal_agenda." WHERE user='".api_get_user_id()."' AND id='".$id."'";
$result = Database::query($sql);
$aantal = Database::num_rows($result);
if ($aantal != 0) {
$row = Database::fetch_array($result);
$row['date'] = api_get_local_time($row['date']);
$year = substr($row['date'], 0, 4);
$month = substr($row['date'], 5, 2);
$day = substr($row['date'], 8, 2);
$hours = substr($row['date'], 11, 2);
$minutes= substr($row['date'], 14, 2);
$title = $row['title'];
$content= $row['text'];
} else {
return false;
}
}
echo '<form method="post" action="myagenda.php?action=add_personal_agenda_item&id='.$id.'" name="newedit_form">';
echo '<div id="newedit_form">';
echo '<h2>';
echo ($_GET['action'] == 'edit_personal_agenda_item') ? get_lang("ModifyPersonalCalendarItem") : get_lang("AddPersonalCalendarItem");
echo '</h2>';
echo '<div>';
echo '<br/>';
echo ''.get_lang("Date").': ';
// ********** The form containing the days (0->31) ********** \\
echo '<select name="frm_day">';
// small loop for filling all the dates
// 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
for ($i = 1; $i <= 31; $i ++) {
// values have to have double digits
if ($i <= 9){
$value = "0".$i;
} else {
$value = $i;
}
// the current day is indicated with [] around the date
if ($value == $day) {
echo '<option value='.$value.' selected>'.$i.'</option>';
} else {
echo '<option value='.$value.'>'.$i.'</option>';
}
}
echo '</select>';
// ********** The form containing the months (jan->dec) ********** \\
echo '<!-- month: january -> december -->';
echo '<select name="frm_month">';
for ($i = 1; $i <= 12; $i ++) {
// values have to have double digits
if ($i <= 9) {
$value = "0".$i;
} else {
$value = $i;
}
// the current month is indicated with [] around the month name
if ($value == $month) {
echo '<option value='.$value.' selected>'.$MonthsLong[$i -1].'</option>';
} else {
echo '<option value='.$value.'>'.$MonthsLong[$i -1].'</option>';
}
}
echo '</select>';
// ********** The form containing the years ********** \\
echo '<!-- year -->';
echo '<select name="frm_year">';
echo '<option value='. ($year -1).'>'. ($year -1).'</option>';
echo '<option value='.$year.' selected>'.$year.'</option>';
for ($i = 1; $i <= 5; $i ++)
{
$value = $year + $i;
echo '<option value='.$value.'>'.$value.'</option>';
}
echo '</select>&nbsp;&nbsp;';
echo "<a title=\"Kalender\" href=\"javascript:openCalendar('newedit_form', 'frm_')\">".Display::return_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;'))."</a>";
echo '&nbsp;&nbsp;';
// ********** The form containing the hours (00->23) ********** \\
echo '<!-- time: hour -->';
echo get_lang("Time").': ';
echo '<select name="frm_hour">';
for ($i = 1; $i <= 24; $i ++) {
// values have to have double digits
if ($i <= 9) {
$value = "0".$i;
} else {
$value = $i;
}
// the current hour is indicated with [] around the hour
if ($hours == $value) {
echo '<option value='.$value.' selected>'.$value.'</option>';
} else {
echo '<option value='.$value.'> '.$value.' </option>';
}
}
echo '</select>';
// ********** The form containing the minutes ********** \\
echo "<select name=\"frm_minute\">";
echo "<option value=\"".$minutes."\">".$minutes."</option>";
echo "<option value=\"00\">00</option>";
echo "<option value=\"05\">05</option>";
echo "<option value=\"10\">10</option>";
echo "<option value=\"15\">15</option>";
echo "<option value=\"20\">20</option>";
echo "<option value=\"25\">25</option>";
echo "<option value=\"30\">30</option>";
echo "<option value=\"35\">35</option>";
echo "<option value=\"40\">40</option>";
echo "<option value=\"45\">45</option>";
echo "<option value=\"50\">50</option>";
echo "<option value=\"55\">55</option>";
echo '</select>';
echo '</div><br/>';
// ********** The title field ********** \\
echo '<div>';
echo ''.get_lang('Title').' : <input type="text" name="frm_title" size="50" value="'.$title.'" />';
echo '</div>';
// ********** The text field ********** \\
echo '<br /><div class="formw">';
require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php";
$oFCKeditor = new FCKeditor('frm_content') ;
$oFCKeditor->Width = '80%';
$oFCKeditor->Height = '200';
if(!api_is_allowed_to_edit(null,true)) {
$oFCKeditor->ToolbarSet = 'AgendaStudent';
} else {
$oFCKeditor->ToolbarSet = 'Agenda';
}
$oFCKeditor->Value = $content;
$return = $oFCKeditor->CreateHtml();
echo $return;
echo '</div>';
// ********** The Submit button********** \\
echo '<div>';
echo '<br /><button type="submit" class="add" name="Submit" value="'.get_lang('AddEvent').'" >'.get_lang('AddEvent').'</button>';
echo '</div>';
echo '</div>';
echo '</form>';
}
/** /**
* This function shows all the forms that are needed form adding/editing a new personal agenda item * This function shows all the forms that are needed form adding/editing a new personal agenda item
* @param date is the time in day * @param date is the time in day
@ -885,30 +697,7 @@ function show_simple_personal_agenda($user_id) {
} }
} }
/**
* This function deletes a personal agenda item
* There is an additional check to make sure that one cannot delete an item that
* does not belong to him/her
*/
function delete_personal_agenda($id) {
$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
if ($id != strval(intval($id))) {
return false; //potential SQL injection
}
if ($id <> '')
{
$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".api_get_user_id()."' AND id='".$id."'";
$result = Database::query($sql);
$aantal = Database::num_rows($result);
if ($aantal <> 0)
{
$sql = "DELETE FROM ".$tbl_personal_agenda." WHERE user='".api_get_user_id()."' AND id='".$id."'";
$result = Database::query($sql);
}
}
}
/** /**
* Get personal agenda items between two dates (=all events from all registered courses) * Get personal agenda items between two dates (=all events from all registered courses)
* @param int user ID of the user * @param int user ID of the user

@ -31,11 +31,11 @@ if (!empty ($course_path)) {
$htmlHeadXtra[] = to_javascript(); $htmlHeadXtra[] = to_javascript();
$htmlHeadXtra[] = "<script src=\"tbl_change.js\" type=\"text/javascript\" language=\"javascript\"></script>"; $htmlHeadXtra[] = "<script src=\"tbl_change.js\" type=\"text/javascript\" language=\"javascript\"></script>";
$htmlHeadXtra[] = "<script> $htmlHeadXtra[] = "<script>
$(function() { $(function() {
$(\".dialog\").dialog(\"destroy\"); $(\".dialog\").dialog(\"destroy\");
$(\".dialog\").dialog({ $(\".dialog\").dialog({
autoOpen: false, autoOpen: false,
show: \"blind\", show: \"blind\",
resizable: false, resizable: false,
height:300, height:300,
width:550, width:550,
@ -141,7 +141,7 @@ if (isset($_user['user_id'])) {
// getting all the courses that this user is subscribed to // getting all the courses that this user is subscribed to
//$courses_dbs = get_all_courses_of_user(); //$courses_dbs = get_all_courses_of_user();
$my_course_list = CourseManager::get_courses_list_by_user_id(api_get_user_id(), true); $my_course_list = CourseManager::get_courses_list_by_user_id(api_get_user_id(), true);
if (!is_array($my_course_list)) { if (!is_array($my_course_list)) {
// this is for the special case if the user has no courses (otherwise you get an error) // this is for the special case if the user has no courses (otherwise you get an error)
$my_course_list = array(); $my_course_list = array();
@ -178,13 +178,13 @@ if (isset($_user['user_id'])) {
} }
echo "</div>"; echo "</div>";
$agendaitems = get_myagendaitems(api_get_user_id(), $my_course_list, $month, $year); $agendaitems = get_myagendaitems(api_get_user_id(), $my_course_list, $month, $year);
$agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "month_view"); $agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "month_view");
if (api_get_setting('allow_personal_agenda') == 'true') { if (api_get_setting('allow_personal_agenda') == 'true') {
$agendaitems = get_personal_agenda_items(api_get_user_id(), $agendaitems, $day, $month, $year, $week, "month_view"); $agendaitems = get_personal_agenda_items(api_get_user_id(), $agendaitems, $day, $month, $year, $week, "month_view");
} }
if ($process != 'month_view') { if ($process != 'month_view') {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>"; echo "<tr>";
@ -196,26 +196,26 @@ if (isset($_user['user_id'])) {
// OlivierB : the image has a white background, which causes trouble if the portal has another background color. Image should be transparent. ----> echo "<td width=\"20\" background=\"../img/verticalruler.gif\">&nbsp;</td>"; // OlivierB : the image has a white background, which causes trouble if the portal has another background color. Image should be transparent. ----> echo "<td width=\"20\" background=\"../img/verticalruler.gif\">&nbsp;</td>";
echo "<td width=\"8\">&nbsp;</td>"; echo "<td width=\"8\">&nbsp;</td>";
// the main area: day, week, month view // the main area: day, week, month view
echo "<td valign=\"top\">"; echo "<td valign=\"top\">";
} }
switch ($process) { switch ($process) {
case 'month_view' : case 'month_view' :
display_mymonthcalendar(api_get_user_id(), $agendaitems, $month, $year, array(), $monthName); display_mymonthcalendar(api_get_user_id(), $agendaitems, $month, $year, array(), $monthName);
break; break;
case 'week_view' : case 'week_view' :
$agendaitems = get_week_agendaitems($my_course_list, $month, $year, $week); $agendaitems = get_week_agendaitems($my_course_list, $month, $year, $week);
$agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "week_view"); $agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "week_view");
if (api_get_setting("allow_personal_agenda") == "true") { if (api_get_setting("allow_personal_agenda") == "true") {
$agendaitems = get_personal_agenda_items(api_get_user_id(), $agendaitems, $day, $month, $year, $week, "week_view"); $agendaitems = get_personal_agenda_items(api_get_user_id(), $agendaitems, $day, $month, $year, $week, "week_view");
} }
display_weekcalendar($agendaitems, $month, $year, array(), $monthName); display_weekcalendar($agendaitems, $month, $year, array(), $monthName);
break; break;
case 'day_view' : case 'day_view' :
$agendaitems = get_day_agendaitems($my_course_list, $month, $year, $day); $agendaitems = get_day_agendaitems($my_course_list, $month, $year, $day);
$agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "day_view"); $agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "day_view");
if (api_get_setting('allow_personal_agenda') == 'true') { if (api_get_setting('allow_personal_agenda') == 'true') {
$agendaitems = get_personal_agenda_items(api_get_user_id(), $agendaitems, $day, $month, $year, $week, "day_view"); $agendaitems = get_personal_agenda_items(api_get_user_id(), $agendaitems, $day, $month, $year, $week, "day_view");
} }
display_daycalendar($agendaitems, $day, $month, $year, array(), $monthName); display_daycalendar($agendaitems, $day, $month, $year, array(), $monthName);
break; break;
@ -223,7 +223,7 @@ if (isset($_user['user_id'])) {
show_personal_agenda(); show_personal_agenda();
break; break;
case 'add_personal_agenda_item' : case 'add_personal_agenda_item' :
show_new_personal_item_form(); //show_new_personal_item_form();
break; break;
case 'store_personal_agenda_item' : case 'store_personal_agenda_item' :
store_personal_item($_POST['frm_day'], $_POST['frm_month'], $_POST['frm_year'], $_POST['frm_hour'], $_POST['frm_minute'], $_POST['frm_title'], $_POST['frm_content'], $_GET['id']); store_personal_item($_POST['frm_day'], $_POST['frm_month'], $_POST['frm_year'], $_POST['frm_hour'], $_POST['frm_minute'], $_POST['frm_title'], $_POST['frm_content'], $_GET['id']);
@ -237,10 +237,10 @@ if (isset($_user['user_id'])) {
show_personal_agenda(); show_personal_agenda();
break; break;
case 'edit_personal_agenda_item' : case 'edit_personal_agenda_item' :
show_new_personal_item_form((int)$_GET['id']); //show_new_personal_item_form($_GET['id']);
break; break;
case 'delete_personal_agenda_item' : case 'delete_personal_agenda_item' :
delete_personal_agenda((int)$_GET['id']); //delete_personal_agenda($_GET['id']);
echo '<br />'; echo '<br />';
Display :: display_normal_message(get_lang('PeronalAgendaItemDeleted')); Display :: display_normal_message(get_lang('PeronalAgendaItemDeleted'));
show_personal_agenda(); show_personal_agenda();
@ -250,4 +250,4 @@ if (isset($_user['user_id'])) {
if ($process != 'month_view') { if ($process != 'month_view') {
echo '</td></tr></table>'; echo '</td></tr></table>';
} }
Display :: display_footer(); Display :: display_footer();

@ -14,7 +14,6 @@ require_once '../global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php'; require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php';
require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php'; require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php';
require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.lib.php';
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null; $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
$group_id = api_get_group_id(); $group_id = api_get_group_id();

Loading…
Cancel
Save