Fixing my agenda calendar

skala
Julio Montoya 15 years ago
parent fe73632dfe
commit 88422b345e
  1. 9
      main/calendar/agenda.inc.php
  2. 6
      main/calendar/agenda.php
  3. 58
      main/calendar/myagenda.inc.php
  4. 5
      main/calendar/myagenda.php

@ -277,7 +277,6 @@ function get_calendar_items($select_month, $select_year, $select_day = false) {
WHERE user='".api_get_user_id()."' ".$show_all_current_personal;
$result = Database::query($sql);
while ($row = Database::fetch_array($result, 'ASSOC')) {
//$datum_item=intval(substr($row["start_date"],8,2));
$row['calendar_type'] = 'personal';
if (!empty($row['start_date']) && $row['start_date'] != '0000-00-00 00:00:00')
$row['start_date_tms'] = api_strtotime($row['start_date']);
@ -287,8 +286,8 @@ function get_calendar_items($select_month, $select_year, $select_day = false) {
}
}
if (empty($_SESSION['user']) && empty($_SESSION['group'])) {
//Check global agenda events
if (empty($_SESSION['user']) && empty($_SESSION['group'])) {
$table_agenda_system = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
$current_access_url_id = api_get_current_access_url_id();
@ -503,11 +502,12 @@ function display_monthcalendar($month, $year, $agenda_items) {
break;
}
$icon = Display::div($icon, array('style'=>'float:right'));
//Setting a personal event to green
$dayheader.= '<div class="rounded_div_agenda" style="background-color:'.$bg_color.';">';
//Link to bubble
$url = Display::url(cut($value['title'], 40), '#', array('id'=>$value['calendar_type'].'_'.$value['id'],'class'=>'opener'));
$url = Display::url(cut($value['title'], 40), '#', array('id'=>$value['calendar_type'].'_'.$value['id'], 'class'=>'opener'));
$dayheader .= $time.' '.$icon.' '.Display::div($url);
//Hidden content
@ -549,10 +549,7 @@ function display_monthcalendar($month, $year, $agenda_items) {
* @return javascript code
*/
function to_javascript() {
$Send2All=get_lang("Send2All");
return "<script type=\"text/javascript\" language=\"javascript\">
$(function() {
//js used when generating images on the fly see function Tracking::show_course_detail()
$(\".dialog\").dialog(\"destroy\");

@ -359,11 +359,9 @@ if (!$_GET['action'] || $_GET['action']=="view") {
display_one_agenda_item($_GET['agenda_id']);
}
}
echo '&nbsp;</td></tr></table>';
echo '</td></tr></table>';
/*
FOOTER
*/
/* FOOTER */
// The footer is displayed only if we are not in the learnpath
if ($_GET['origin'] != 'learnpath') {
Display::display_footer();

@ -1,44 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
/**
@author: Julio Montoya <gugli100@gmail.com> BeezNest 2011
@author: Julio Montoya <gugli100@gmail.com> BeezNest 2011 Bugfixes
//Original code found in Dok€os
@author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
@author: Toon Van Hoecke <toon.vanhoecke@ugent.be>, Ghent University
@author: Eric Remy (initial version)
@version: 3
@description: this file generates a general agenda of all items of the
courses the user is registered for
version info:
-> version 3: Julio Montoya - removing a lot of useless code, cleaning the UI to
be more intuitive, adding "jquery popups" and showing agenda types, etc.
-> version 2.2 : Patrick Cool, patrick.cool@ugent.be, november 2004
Personal Agenda added. The user can add personal agenda items. The items
are stored in a chamilo_user database because it is not course or platform
based. A personal agenda view was also added. This lists all the personal
agenda items of that user.
-> version 2.1 : Patrick Cool, patrick.cool@ugent.be, , oktober 2004
This is the version that works with the Group based Agenda tool.
-> version 2.0 (alpha): Patrick Cool, patrick.cool@ugent.be, , oktober 2004
The 2.0 version introduces besides the month view also a week- and day view.
In the 2.5 (final) version it will be possible for the student to add his/her
own agenda items. The platform administrator can however decide if the students
are allowed to do this or not.
The alpha version only contains the three views. The personal agenda feature is
not yet completely finished. There are however already some parts of the code
for adding a personal agenda item present.
this code was not released in an official dokeos but was only used in the offical
server of the Ghent University where it underwent serious testing
-> version 1.5: Toon Van Hoecke, toon.vanhoecke@ugent.be, december 2003
-> version 1.0: Eric Remy, eremy@rmwc.edu, 6 Oct 2003
The tool was initially called master-calendar as it collects all the calendar
items of all the courses one is subscribed to. It was very soon integrated in
Dokeos as this was a really basic and very usefull tool.
@todo create a class and merge with the agenda.inc.php
*/
/**
@ -114,7 +84,6 @@ function get_myagendaitems($user_id, $courses_dbs, $month, $year) {
$agendaday = date("j",strtotime($item['start_date']));
$url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
//$url = Display::url($array_course_info["title"], $url);
$item['url'] = $url;
$item['course_name'] = $array_course_info['title'];
@ -188,6 +157,7 @@ function display_mymonthcalendar($user_id, $agendaitems, $month, $year, $weekday
echo '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>';
}
echo '</tr>';
$curday = -1;
$today = getdate();
while ($curday <= $numberofdays[$month]) {
@ -200,10 +170,11 @@ function display_mymonthcalendar($user_id, $agendaitems, $month, $year, $weekday
$bgcolor = $class = 'class="days_week"';
$dayheader = Display::div($curday, array('class'=>'agenda_day'));
if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {
$class = "class=\"days_today\" style=\"width:10%;\"";
}
echo "<td ".$class.">".$dayheader;
if (!empty($agendaitems[$curday])) {
$items = $agendaitems[$curday];
@ -211,6 +182,7 @@ function display_mymonthcalendar($user_id, $agendaitems, $month, $year, $weekday
$value['title'] = Security::remove_XSS($value['title']);
$start_time = api_convert_and_format_date($value['start_date'], TIME_NO_SEC_FORMAT);
$end_time = '';
if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') {
$end_time = '-&nbsp;<i>'.api_convert_and_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
}
@ -246,21 +218,23 @@ function display_mymonthcalendar($user_id, $agendaitems, $month, $year, $weekday
$icon = Display::div($icon, array('style'=>'float:right'));
//Link to bubble
$url = Display::url(cut($value['title'], 40), '#', array('id'=>$value['calendar_type'].'_'.$value['id'],'class'=>'opener'));
$url = Display::url(cut($value['title'], 40), '#', array('id'=>$value['calendar_type'].'_'.$value['id'], 'class'=>'opener'));
$result .= $time.' '.$icon.' '.Display::div($url);
//Hidden content
$content = Display::div($icon.Display::tag('h1', $value['title']).$complete_time.Security::remove_XSS($value['content']));
//Main div
$result .= Display::div($content, array('id'=>'main_'.$value['calendar_type'].'_'.$value['id'], 'class' => 'dialog', 'style' => 'display:none'));
$result .= '</div>';
echo $result;
//Hidden content
$content = Display::div($icon.Display::tag('h1', $value['title']).$complete_time.Security::remove_XSS($value['content']));
//echo Display::div($content, array('id'=>'main_'.$value['calendar_type'].'_'.$value['id'], 'class' => 'dialog'));
} else {
echo $result .= $icon;
}
}
}
echo "</td>";
@ -674,6 +648,7 @@ function get_personal_agenda_items($user_id, $agendaitems, $day = "", $month = "
if ($type == 'month_view') {
$item['calendar_type'] = 'personal';
$item['start_date'] = $item['date'] ;
$agendaitems[$day][] = $item;
continue;
}
@ -1021,4 +996,3 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
}
return $items;
}

@ -28,8 +28,11 @@ if (!empty ($course_path)) {
$interbreadcrumb[] = array ('url' => api_get_path(WEB_COURSE_PATH).urlencode($course_path).'/index.php', 'name' => Security::remove_XSS($_GET['courseCode']));
}
// this loads the javascript that is needed for the date popup selection
$htmlHeadXtra[] = "<script src=\"tbl_change.js\" type=\"text/javascript\" language=\"javascript\"></script>";
$htmlHeadXtra[] = api_get_jquery_ui_js();
$htmlHeadXtra[] = to_javascript();
$htmlHeadXtra[] = "<script src=\"tbl_change.js\" type=\"text/javascript\" language=\"javascript\"></script>";
$htmlHeadXtra[] = "<script>
$(function() {

Loading…
Cancel
Save