diff --git a/main/admin/access_url_edit_courses_to_url.php b/main/admin/access_url_edit_courses_to_url.php index b646ace69f..5345ecf62c 100755 --- a/main/admin/access_url_edit_courses_to_url.php +++ b/main/admin/access_url_edit_courses_to_url.php @@ -17,7 +17,6 @@ require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php'); require_once (api_get_path(LIBRARY_PATH).'access_url_edit_courses_to_url_functions.lib.php'); $xajax = new xajax(); -//$xajax->debugOn(); $xajax -> registerFunction (array('search_courses', 'Accessurleditcoursestourl', 'search_courses')); diff --git a/main/admin/access_url_edit_sessions_to_url.php b/main/admin/access_url_edit_sessions_to_url.php index c5fbac3397..776611444c 100755 --- a/main/admin/access_url_edit_sessions_to_url.php +++ b/main/admin/access_url_edit_sessions_to_url.php @@ -18,7 +18,7 @@ require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'access_url_edit_sessions_to_url_functions.lib.php'; $xajax = new xajax(); -//$xajax->debugOn(); + $xajax -> registerFunction (array('search_sessions', 'Accessurleditsessionstourl', 'search_sessions')); diff --git a/main/admin/calendar.lib.php b/main/admin/calendar.lib.php index d890c52042..ba2bd8eea5 100755 --- a/main/admin/calendar.lib.php +++ b/main/admin/calendar.lib.php @@ -4,6 +4,8 @@ * @package chamilo.admin * @author Carlos Vargas * This file is the calendar/agenda.inc.php +* +* @todo This file should not exist since redeclares many of the functions in calendar/agenda.inc.php J.M */ /* @@ -40,8 +42,7 @@ $MonthsLong = api_get_months_long(); * @return html code * @todo refactor this so that $monthName is no longer needed as a parameter */ -function display_minimonthcalendar($agendaitems, $month, $year, $monthName) -{ +function display_minimonthcalendar($agendaitems, $month, $year, $monthName) { global $DaysShort; //Handle leap year $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); @@ -54,22 +55,22 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName) $backwardsURL = api_get_self()."?".api_get_cidreq()."&coursePath=".(empty($_GET['coursePath'])?'':$_GET['coursePath'])."&courseCode=".(empty($_GET['courseCode'])?'':$_GET['courseCode'])."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); $forewardsURL = api_get_self()."?".api_get_cidreq()."&coursePath=".(empty($_GET['coursePath'])?'':$_GET['coursePath'])."&courseCode=".(empty($_GET['courseCode'])?'':$_GET['courseCode'])."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); - echo "\n", - "\n", - "\n", - "\n", - "\n", "\n"; - echo "\n"; + echo "
".Display::return_icon('action_prev.png',get_lang('Previous'))." ", $monthName, " ", $year, " ".Display::return_icon('action_next.png',get_lang('Next'))."
", + "", + "", + "", + "", ""; + echo ""; for ($ii = 1; $ii < 8; $ii ++) { - echo "\n"; + echo ""; } - echo "\n"; + echo ""; $curday = -1; $today = getdate(); while ($curday <= $numberofdays[$month]) { - echo "\n"; + echo ""; for ($ii = 0; $ii < 7; $ii ++) { if (($curday == -1) && ($ii == $startdayofweek)) @@ -85,7 +86,7 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName) $dayheader = "$curday"; $class = "class=\"days_today\""; } - echo "\t\n"; + // "a".$dayheader." ".$agendaitems[$curday].""; + echo ""; $curday ++; } else { - echo "\n"; + echo ""; } } - echo "\n"; + echo ""; } - echo "
".Display::return_icon('action_prev.png',get_lang('Previous'))." ", $monthName, " ", $year, " ".Display::return_icon('action_next.png',get_lang('Next'))."
", $DaysShort[$ii % 7], "", $DaysShort[$ii % 7], "
"; + echo ""; if (!empty($agendaitems[$curday])) { echo "".$dayheader.""; @@ -94,18 +95,18 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName) { echo $dayheader; } - // "a".$dayheader." ".$agendaitems[$curday]."\n"; - echo "  
\n"; + echo ""; } /** * show the calender of the given month @@ -119,10 +120,9 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName) * @author: Patrick Cool , Ghent University * @return javascript code */ -function to_javascript() -{ -$Send2All=get_lang("Send2All"); -return " -"; +function user_group_filter_javascript() { + return " + "; } -function display_monthcalendar($month, $year) -{ +function display_monthcalendar($month, $year) { global $MonthsLong; global $DaysShort; global $origin; @@ -324,26 +322,24 @@ function display_monthcalendar($month, $year) $maand_array_maandnummer=$month-1; - echo "\n", - "\n", - "\n", - "\n", - "\n", - "\n"; + echo "
".Display::return_icon('action_prev.png',get_lang('Previous'))."",$MonthsLong[$maand_array_maandnummer]," ",$year," ".Display::return_icon('action_next.png',get_lang('Next'))."
", + "", + "", + "", + "", + ""; - echo "\n"; + echo ""; - for ($ii=1;$ii<8; $ii++) - { - echo "\n"; - } + for ($ii=1;$ii<8; $ii++) { + echo ""; + } - echo "\n"; + echo ""; $curday = -1; $today = getdate(); - while ($curday <=$numberofdays[$month]) - { - echo "\n"; + while ($curday <=$numberofdays[$month]) { + echo ""; for ($ii=0; $ii<7; $ii++) { if (($curday == -1)&&($ii==$startdayofweek)) @@ -371,13 +367,13 @@ function display_monthcalendar($month, $year) if (($curday==$today['mday'])&&($year ==$today['year'])&&($month == $today['mon'])) { - echo "\n"; + echo ""; $curday++; } @@ -401,9 +397,7 @@ echo "
".Display::return_icon('action_prev.png',get_lang('Previous'))."",$MonthsLong[$maand_array_maandnummer]," ",$year," ".Display::return_icon('action_next.png',get_lang('Next'))."
",$DaysShort[$ii%7],"",$DaysShort[$ii%7],"
".$dayheader." \n"; + echo "".$dayheader." "; } else { - echo "".$dayheader." \n"; + echo "".$dayheader." "; } - echo "
"; * @author: Patrick Cool , Ghent University * @return integer the id of the last added agenda item */ -function store_new_agenda_item() -{ - global $_user /*, $_course*/; +function store_new_agenda_item() { $TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR); //$t_agenda_repeat = Database::get_course_Table(TABLE_AGENDA_REPEAT); @@ -486,24 +480,17 @@ function display_courseadmin_links() { echo "".Display::return_icon('calendar_personal_add.gif', get_lang('AgendaAdd'))." ".get_lang('AgendaAdd').""; } -function display_student_links() -{ - global $show; - if ($_SESSION['sort'] == 'DESC') - { - echo "".Display::return_icon('calendar_up.gif',get_lang('AgendaSortChronologicallyUp')).' '.get_lang("AgendaSortChronologicallyUp").""; - } - else - { - echo "".Display::return_icon('calendar_down.gif',get_lang('AgendaSortChronologicallyDown')).' '.get_lang("AgendaSortChronologicallyDown").""; - } - if ($_SESSION['view'] <> 'month') - { - echo "\t\"".get_lang('MonthView')."\" ".get_lang('MonthView')."\n"; + +function display_student_links() { + if ($_SESSION['sort'] == 'DESC') { + echo "".Display::return_icon('calendar_up.gif',get_lang('AgendaSortChronologicallyUp')).' '.get_lang("AgendaSortChronologicallyUp").""; + } else { + echo "".Display::return_icon('calendar_down.gif',get_lang('AgendaSortChronologicallyDown')).' '.get_lang("AgendaSortChronologicallyDown").""; } - else - { - echo "\t\"".get_lang('ListView')."\" ".get_lang('ListView')."\n"; + if ($_SESSION['view'] <> 'month') { + echo "\"".get_lang('MonthView')."\" ".get_lang('MonthView').""; + } else { + echo "\"".get_lang('ListView')."\" ".get_lang('ListView').""; } } /** @@ -512,8 +499,7 @@ function display_student_links() * @param integer the id of the agenda item we are getting all the information of * @return an associative array that contains all the information of the agenda item. The keys are the database fields */ -function get_agenda_item($id) -{ +function get_agenda_item($id) { $TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR); //$t_agenda_repeat = Database::get_course_table(TABLE_AGENDA_REPEAT); $item = array(); @@ -532,12 +518,9 @@ function get_agenda_item($id) $item['end_date'] = $entry_to_edit["end_date"]; $item['to'] == "everyone"; // if the item has been sent to everybody then we show the compact to form - if ($item['to']=="everyone") - { + if ($item['to']=="everyone") { $_SESSION['allow_individual_calendar']="hide"; - } - else - { + } else { $_SESSION['allow_individual_calendar']="show"; } @@ -550,8 +533,7 @@ function get_agenda_item($id) * 3. modify the attachments (if needed) * @author Patrick Cool , Ghent University */ -function store_edited_agenda_item() -{ +function store_edited_agenda_item() { // STEP 1: editing the calendar_event table // 1.a. some filtering of the input data @@ -626,8 +608,7 @@ function delete_agenda_item($id) * @author Patrick Cool , Ghent University * @param integer id the id of the agenda item we are changing the visibility of */ -function showhide_agenda_item($id) -{ +function showhide_agenda_item($id) { global $nameTools; /*================================================== SHOW / HIDE A CALENDAR ITEM @@ -672,7 +653,7 @@ function display_agenda_items() $stop = 0; // this is to make a difference between showing everything (all months) or only the current month) // $show_all_current is a part of the sql statement - if ($_SESSION['show']!=="showall") + if ($_SESSION['show_all_admin']!=="showall") { $show_all_current=" AND MONTH(start_date)=$select_month AND year(start_date)=$select_year"; $start = mktime(0,0,0,$select_month,1,$select_year); @@ -731,7 +712,7 @@ function display_agenda_items() while($myrow=Database::fetch_array($result)) { $is_repeated = !empty($myrow['parent_event_id']); - echo '',"\n"; + echo '
',""; /*-------------------------------------------------- display: the month bar --------------------------------------------------*/ @@ -740,9 +721,9 @@ function display_agenda_items() if ($month_bar != api_format_date($myrow["start_date"], "%m%Y")) { $month_bar = api_format_date($myrow["start_date"], "%m%Y"); - echo "\t\n\t\t\n\t\n"; + ""; } /*-------------------------------------------------- @@ -775,22 +756,21 @@ function display_agenda_items() $text_style="textnow"; } - echo "\t\t\n"; + }*/ + echo " ".$myrow['title'].""; + echo ""; // the message has been sent to - echo "\t\t"; - echo "\t\t\n"; - echo "\t\t"; + echo "\n"; + echo ""; // attachment list //$attachment_list=get_attachment($myrow['id']); @@ -995,12 +975,12 @@ function display_one_agenda_item($agenda_id) /*-------------------------------------------------- DISPLAY: THE ITEMS --------------------------------------------------*/ - echo "
". + echo "
". api_format_date($myrow["start_date"], "%B %Y"). - "
\n"; + echo ""; // adding an internal anchor - echo "\t\t\t"; + echo ""; // the icons. If the message is sent to one or more specific users/groups // we add the groups icon // 2do: if it is sent to groups we display the group icon, if it is sent to a user we show the user icon - Display::display_icon('agenda.gif', get_lang('Agenda')); - if ($myrow['to_group_id']!=='0') - { + Display::display_icon('calendar_global.png', get_lang('Agenda')); + /*if ($myrow['to_group_id']!=='0') { echo Display::return_icon('group.gif', get_lang('AllUsersOfThePlatform')); - } - echo " ".$myrow['title']."\n"; - echo "\t\t".get_lang("SentTo").": ".get_lang('AllUsersOfThePlatform'); + echo "".get_lang("SentTo").": ".get_lang('AllUsersOfThePlatform'); //$sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]); //$sent_to_form=sent_to_form($sent_to); // echo $sent_to_form; @@ -809,16 +789,16 @@ function display_agenda_items() display: the title --------------------------------------------------*/ echo "
".get_lang("StartTimeWindow").": "; + echo "".get_lang("StartTimeWindow").": "; echo api_format_date($myrow["start_date"]); - echo ""; + echo ""; if ($myrow["end_date"]<>"0000-00-00 00:00:00") { echo get_lang("EndTimeWindow").": "; echo api_convert_and_format_date($myrow["end_date"], null, date_default_timezone_get()); } - echo "
\n"; + echo "
"; /*-------------------------------------------------- DISPLAY : the icon, title, destinees of the item --------------------------------------------------*/ - echo "\t\n"; + echo ""; // highlight: if a date in the small calendar is clicked we highlight the relevant items $myrow["start_date"] = api_get_local_time($myrow["start_date"], null, date_default_timezone_get()); @@ -1028,10 +1008,10 @@ function display_one_agenda_item($agenda_id) } - echo "\t\t\n"; + echo " ".$myrow['title'].""; + echo ""; // the message has been sent to - echo "\t\t\n\t\n"; + echo ""; /*-------------------------------------------------- DISPLAY: the title --------------------------------------------------*/ - echo "\t\n"; - echo "\t\t"; + echo "\n"; - echo "\t\t"; + echo "\n"; - echo "\n\t\n"; + echo ""; + echo ""; /*-------------------------------------------------- DISPLAY: the content @@ -1073,7 +1053,7 @@ function display_one_agenda_item($agenda_id) $content = $myrow['content']; $content = make_clickable($content); $content = text_filter($content); - //echo "\t\n\t\t"; echo ""; @@ -1181,32 +1161,32 @@ echo ""; function show_user_group_filter_form() { /** @todo this select missing to implement */ - echo "\n"; + echo ""; // Groups - echo "\n\t"; + echo ""; //$group_list=get_course_groups(); /* foreach($group_list as $this_group) { // echo ""; - echo "\n\t\t"; }*/ - echo "\n\t"; + echo ""; // Users - echo "\n\t"; + echo ""; //$user_list=get_course_users(); /* foreach($user_list as $this_user) { // echo ""; - echo "\n\t\t"; }*/ - echo "\n\t"; + echo ""; echo ""; } @@ -1332,14 +1312,13 @@ function show_add_form($id = '') @@ -1453,9 +1431,9 @@ function show_add_form($id = '') $value = ($i <= 9 ? '0'.$i : $i ); // the current day is indicated with [] around the date if ($value==$end_day) - { echo "\t\t\t\t \n";} + { echo " \n";} else - { echo "\t\t\t\t \n"; } + { echo " \n"; } }?> @@ -1467,9 +1445,9 @@ function show_add_form($id = '') // values have to have double digits $value = ($i <= 9 ? '0'.$i : $i ); if ($value==$end_month) - { echo "\t\t\t\t \n"; } + { echo " \n"; } else - { echo "\t\t\t\t \n"; } + { echo " \n"; } }?> 'vertical-align: middle;')); ?> @@ -1499,9 +1477,9 @@ function show_add_form($id = '') $value = ($i <= 9 ? '0'.$i : $i ); // the current hour is indicated with [] around the hour if ($end_hours==$value) - { echo "\t\t\t\t\n"; } + { echo "\n"; } else - { echo "\t\t\t\t\n"; } + { echo "\n"; } } ?> @@ -1513,7 +1491,7 @@ function show_add_form($id = '') { // values have to have double digits $value = ($i <= 9 ? '0'.$i : $i ); - echo "\t\t\t\t\n"; + echo "\n"; } ?>
@@ -1564,11 +1542,11 @@ function show_add_form($id = '') --> \n"; - echo "\t\t\n"; + echo "\n\t\n"; + echo "\n\n"; /* END ADDED BY UGENT, Patrick Cool, march 2004 */ if(empty($id)) //only show repeat fields when adding the first time { @@ -1687,9 +1665,8 @@ function get_agendaitems($month, $year) return $agendaitems; } -function display_upcoming_events() -{ - echo ''.get_lang('UpcomingEvent').'
'; +function display_upcoming_events() { + echo '
'.get_lang('UpcomingEvent').'
'; $number_of_items_to_show = (int)api_get_setting('number_of_upcoming_events'); //databases of the courses @@ -1804,7 +1781,7 @@ function display_daycalendar($agendaitems, $day, $month, $year, $weekdaynames, $ $class = "class=\"row_odd\""; } echo "\n"; - echo "\t"; + echo ""; if ($i % 2 == 0) { echo ("\n"); @@ -1813,7 +1790,7 @@ function display_daycalendar($agendaitems, $day, $month, $year, $weekdaynames, $ { echo ("\n"); } - echo "\t\n"; + echo "\n"; echo "\n"; } echo "
\n"; + echo ""; // adding an internal anchor - echo "\t\t\t"; + echo ""; // the icons. If the message is sent to one or more specific users/groups // we add the groups icon @@ -1041,27 +1021,27 @@ function display_one_agenda_item($agenda_id) { echo Display::return_icon('group.gif'); } - echo " ".$myrow['title']."\n"; - echo "\t\t".get_lang("SentTo").": ".get_lang('AllUsersOfThePlatform'); + echo "".get_lang("SentTo").": ".get_lang('AllUsersOfThePlatform'); //$sent_to = sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]); //sent_to_form=sent_to_form($sent_to); //echo $sent_to_form; - echo "
".get_lang("StartTime").": "; + echo "
".get_lang("StartTime").": "; echo api_format_date($myrow["start_date"]); - echo "".get_lang("EndTime").": "; + echo "".get_lang("EndTime").": "; echo api_convert_and_format_date($myrow["end_date"], null, date_default_timezone_get()); - echo "
"; + //echo "
"; //echo $content; //echo "
- + ".$MonthsLong[$i-1]."\n"; + echo " \n"; } else { - echo "\t\t\t\t \n"; + echo " \n"; } } ?> @@ -1389,7 +1367,7 @@ function show_add_form($id = '') for ($i=1; $i<=5; $i++) { $value=$year+$i; - echo "\t\t\t\t\n"; + echo "\n"; } ?> 'vertical-align: middle;')); ?> @@ -1409,11 +1387,11 @@ function show_add_form($id = '') // the current hour is indicated with [] around the hour if ($hours==$value) { - echo "\t\t\t\t\n"; + echo "\n"; } else { - echo "\t\t\t\t\n"; + echo "\n"; } } ?> @@ -1426,7 +1404,7 @@ function show_add_form($id = '') { // values have to have double digits $value = ($i <= 9 ? '0'.$i : $i ); - echo "\t\t\t\t\n"; + echo "\n"; } ?>
\n"; + echo "
\n"; //echo display_resources(0);//-------------------------------------------------------- $test=$_SESSION['addedresource']; - echo "\t\t
". (($i) / 2)." ".get_lang("HourShort")." 00". ((($i) / 2) - (1 / 2))." ".get_lang("HourShort")." 30\n"; + echo "\n"; if (is_array($agendaitems[$i])) { foreach ($agendaitems[$i] as $key => $value) @@ -1825,7 +1802,7 @@ function display_daycalendar($agendaitems, $day, $month, $year, $weekdaynames, $ { echo $agendaitems[$i]; } - echo "\t
\n"; @@ -1875,7 +1852,7 @@ function display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $month for ($ii = 1; $ii < 8; $ii ++) { $is_today = ($ii == $thisday_of_the_week AND (!isset($_GET['week']) OR $_GET['week']==$thisweek_number)); - echo "\t"; + echo ""; if ($is_today) { echo ""; @@ -1909,7 +1886,7 @@ function display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $month $class = "class=\"days_today\""; } - echo "\t"; + echo ""; echo "".$agendaitems[date('j', $value)]."  "; echo "\n"; $counter ++; diff --git a/main/admin/calendar.php b/main/admin/calendar.php index b00802c556..bf48c1632a 100755 --- a/main/admin/calendar.php +++ b/main/admin/calendar.php @@ -23,14 +23,6 @@ api_protect_admin_script(true); // setting breadcrumbs $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); -//$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); - -// Database Table Definitions -// $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); -// $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); -// $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); -// $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); -// $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); // setting the name of the tool $tool_name= get_lang('SubscribeCoursesToSession'); @@ -47,37 +39,30 @@ if(!api_is_platform_admin()) } } /* ------------------------------------------------------------ Libraries ------------------------------------------------------------ */ // containing the functions for the agenda tool -include "calendar.lib.php"; -// some debug functions -include($includePath."/lib/debug.lib.inc.php"); - +require_once 'calendar.lib.php'; -/*============================================================================== +/* TREATING THE PARAMETERS 1. viewing month only or everything 2. sort ascending or descending 3. showing or hiding the send-to-specific-groups-or-users form 4. filter user or group - ============================================================================== */ + */ // 1. show all or show current month? -if (!$_SESSION['show']) -{ - $_SESSION['show']="showall"; +if (!$_SESSION['show_all_admin']) { + $_SESSION['show_all_admin']="showall"; } if (!empty($_GET['action']) and $_GET['action']=="showcurrent") { - $_SESSION['show']="showcurrent"; + $_SESSION['show_all_admin']='showcurrent'; } if (!empty($_GET['action']) and $_GET['action']=="showall") { - $_SESSION['show']="showall"; + $_SESSION['show_all_admin']='showall'; } -//echo $_SESSION['show']; // 2. sorting order (ASC or DESC) if (empty($_GET['sort']) and empty($_SESSION['sort'])) @@ -133,9 +118,9 @@ else echo ""; }*/ -/* ============================================================================== +/* SETTING SOME VARIABLES -============================================================================== */ +*/ // Variable definitions // Defining the shorts for the days. We use camelcase because these are arrays of language variables $DaysShort = api_get_week_days_short(); @@ -151,29 +136,18 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER); $tbl_group = Database::get_course_table(TABLE_GROUP); $tbl_groupUser = Database::get_course_table(TABLE_GROUP_USER); -$tbl_session_course_user= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); - - -/* ============================================================================== +/* ACCESS RIGHTS -============================================================================== */ +*/ // permission stuff - also used by loading from global in agenda.inc.php $is_allowed_to_edit = is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()); -// Displaying the title of the tool -// api_display_tool_title($nameTools); - -// tool introduction -//Display::display_introduction_section(TOOL_CALENDAR_EVENT); - // insert an anchor (top) so one can jump back to the top of the page echo ""; /* -============================================================================== MAIN SECTION -============================================================================== */ //setting the default year and month @@ -207,21 +181,18 @@ echo '

'; echo '' . ''; - // THE LEFT PART -if (empty($_GET['origin']) or $_GET['origin']!='learnpath') -{ +if (empty($_GET['origin']) or $_GET['origin']!='learnpath') { echo ''; echo ''; } @@ -232,17 +203,13 @@ echo '
'; // the small calendar $MonthName = $MonthsLong[$select_month -1]; $agenda_items=get_calendar_items($select_month,$select_year); - if (api_get_setting('display_mini_month_calendar') == 'true') - { + if (api_get_setting('display_mini_month_calendar') == 'true') { display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName); } - /*if (api_get_setting('display_upcoming_events') == 'true') { + if (api_get_setting('display_upcoming_events') == 'true') { display_upcoming_events(); - }*/ + } echo ' '; echo '
'; echo '
'; -if (api_is_allowed_to_edit(false,true)) -{ +if (api_is_allowed_to_edit(false,true)) { switch ($_GET['action']) { case "add": if(!empty($_POST['ical_submit'])) { $course_info = api_get_course_info(); - agenda_import_ical($course_info,$_FILES['ical_import']); - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } + agenda_import_ical($course_info,$_FILES['ical_import']); display_agenda_items(); } elseif ($_POST['submit_event']) { @@ -258,10 +225,7 @@ if (api_is_allowed_to_edit(false,true)) $end_d = intval($_POST['repeat_end_day']); $end = mktime(23, 59, 59, $end_m, $end_d, $end_y); $res = agenda_add_repeat_item($course_info,$id,$_POST['repeat_type'],$end,null,$_POST['file_comment']); - } - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } + } display_agenda_items(); } else { show_add_form(); @@ -275,22 +239,12 @@ if (api_is_allowed_to_edit(false,true)) { $my_id_attach = (int)$_REQUEST['id_attach']; $my_file_comment = Database::escape_string($_REQUEST['file_comment']); store_edited_agenda_item($my_id_attach,$my_file_comment); - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } display_agenda_items(); - } - else - { + } else { $id=(int)$_GET['id']; show_add_form($id); } - } - else - { - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } + } else { display_agenda_items(); } break; @@ -308,10 +262,7 @@ if (api_is_allowed_to_edit(false,true)) } } } - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } - display_agenda_items(); + display_agenda_items(); break; case "showhide": @@ -320,9 +271,6 @@ if (api_is_allowed_to_edit(false,true)) { // a coach can only delete an element belonging to his session showhide_agenda_item($id); } - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } display_agenda_items(); break; case "announce": //copying the agenda item into an announcement @@ -334,9 +282,6 @@ if (api_is_allowed_to_edit(false,true)) echo '
'; Display::display_normal_message(get_lang('CopiedAsAnnouncement').''.get_lang('NewAnnouncement').'', false); } - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } display_agenda_items(); break; case "delete_attach": //delete attachment file @@ -344,9 +289,6 @@ if (api_is_allowed_to_edit(false,true)) if (!empty($id_attach)) { delete_attachment_file($id_attach); } - if (api_get_setting('display_upcoming_events') == 'true') { - display_upcoming_events(); - } display_agenda_items(); break; @@ -382,15 +324,10 @@ if (!$_GET['action'] OR $_GET['action']=="showall" OR $_GET['action']=="showcur echo " 
"; /* -============================================================================== FOOTER -============================================================================== */ // The footer is displayed only if we are not in the learnpath -if ($_GET['origin'] != 'learnpath') -{ - +if ($_GET['origin'] != 'learnpath') { Display::display_footer(); - } -?> +?> \ No newline at end of file diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php index 4780410a70..12103bf062 100755 --- a/main/admin/user_edit.php +++ b/main/admin/user_edit.php @@ -1,9 +1,7 @@ -$_user['user_id'] && $user_is_anonymous == false) { + // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. $result .= ''.Display::return_icon('delete.gif', get_lang('Delete')).''; + } else { $result .= Display::return_icon('delete_na.gif', get_lang('Delete')); } @@ -550,20 +589,25 @@ function active_filter($active, $url_params, $row) { global $_user; if ($active=='1') { - $action='lock'; + $action='Lock'; $image='right'; } elseif ($active=='-1') { $action='edit'; $image='expired'; } elseif ($active=='0') { - $action='unlock'; + $action='Unlock'; $image='wrong'; + } if ($action=='edit') { $result = Display::return_icon($image.'.gif', get_lang('AccountExpired')); - }elseif ($row['0']<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. - $result = ''.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).''; + } elseif ($row['0']<>$_user['user_id']) { + // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. + //$result = ''.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).''; + //$result = ''; + $result .=Display::return_icon($image.'.gif', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0'])).''; + //$result .= '
'; } return $result; } diff --git a/main/announcements/announcements.inc.php b/main/announcements/announcements.inc.php index 1c13a7e918..bd5928cdd2 100755 --- a/main/announcements/announcements.inc.php +++ b/main/announcements/announcements.inc.php @@ -1,152 +1,469 @@ -0) { + $list = array(); + while ($row = Database::fetch_array($rs)) { + $list[] = $row; + } + return $list; + } + return false; + } + + + /** + * This functions swithes the visibility a course resource + * using the visibility field in 'item_property' + * @param array the course array + * @param int ID of the element of the corresponding type + * @return bool False on failure, True on success + */ + public static function change_visibility_announcement($_course, $id) { + $item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $id); + if ($item_visibility == '1') { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, 'invisible', api_get_user_id()); + } else { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, 'visible', api_get_user_id()); + } + return true; + } + + /** + * Deletes an announcement + * @param array the course array + * @param int the announcement id + */ + public static function delete_announcement($_course, $id) { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, 'delete', api_get_user_id()); + } + + /** + * Deletes all announcements by course + * @param array the course array + */ + public static function delete_all_announcements($_course) { + $announcements = self::get_all_annoucement_by_course($_course, api_get_session_id()); + + foreach ($announcements as $annon) { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $annon['id'], 'delete', api_get_user_id()); + } + } + + /** + * Displays one specific announcement + * @param $announcement_id, the id of the announcement you want to display + */ + public static function display_announcement($announcement_id) { + if ($announcement_id != strval(intval($announcement_id))) { return false; } // potencial sql injection + + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); + + if (api_get_user_id() != 0) { + $sql_query = " SELECT announcement.*, toolitemproperties.* + FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties + WHERE announcement.id = toolitemproperties.ref + AND announcement.id = '$announcement_id' + AND toolitemproperties.tool='announcement' + AND (toolitemproperties.to_user_id='".api_get_user_id()."' OR toolitemproperties.to_group_id='0') + AND toolitemproperties.visibility='1' + ORDER BY display_order DESC"; + + } else { + $sql_query = " SELECT announcement.*, toolitemproperties.* + FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties + WHERE announcement.id = toolitemproperties.ref + AND announcement.id = '$announcement_id' + AND toolitemproperties.tool='announcement' + AND toolitemproperties.to_group_id='0' + AND toolitemproperties.visibility='1'"; + } + $sql_result = Database::query($sql_query); + $result = Database::fetch_array($sql_result); + + if ($result !== false) { // A sanity check. + $title = $result['title']; + $content = $result['content']; + $content = make_clickable($content); + $content = text_filter($content); + $last_post_datetime = $result['insert_date'];// post time format datetime de mysql + list($last_post_date, $last_post_time) = split(" ", $last_post_datetime); + } + + echo ""; + echo ""; + echo ""; + echo ""; + echo "
" . $title . "
" . get_lang('AnnouncementPublishedOn') . " : " . api_convert_and_format_date($last_post_datetime, null, date_default_timezone_get()) . "
$content
"; + } +} + +/** + * Store an announcement in the database (including its attached file if any) + * @param string Announcement title (pure text) + * @param string Content of the announcement (can be HTML) + * @param int Display order in the list of announcements + * @param array Array of users and groups to send the announcement to + * @param array uploaded file $_FILES + * @param string Comment describing the attachment + * @return int false on failure, ID of the announcement on success + */ +function store_advalvas_item($emailTitle, $newContent, $order, $to, $file = array(), $file_comment='') { + global $_course; + + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); + + // filter data + $emailTitle = Database::escape_string($emailTitle); + $newContent = Database::escape_string($newContent); + $order = intval($order); + + // store in the table announcement + $sql = "INSERT INTO $tbl_announcement SET content = '$newContent', title = '$emailTitle', end_date = NOW(), display_order ='$order', session_id=".api_get_session_id(); + $result = Database::query($sql); + if ($result === false) { + return false; + } else { + //Store the attach file + $last_id = Database::insert_id(); + if (!empty($file)) { + $save_attachment = add_announcement_attachment_file($last_id, $file_comment, $_FILES['user_upload']); + } + + // store in item_property (first the groups, then the users + + if (!is_null($to)) { + // !is_null($to): when no user is selected we send it to everyone + $send_to = separate_users_groups($to); + // storing the selected groups + if (is_array($send_to['groups'])) { + foreach ($send_to['groups'] as $group) { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), $group); + } + } + + // storing the selected users + if (is_array($send_to['users'])) { + foreach ($send_to['users'] as $user) { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '', $user); + } + } + } else { + // the message is sent to everyone, so we set the group to 0 + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '0'); + } + return $last_id; + } +} + +/* + STORE ANNOUNCEMENT GROUP ITEM */ +function store_advalvas_group_item($emailTitle,$newContent, $order, $to, $to_users, $file = array(), $file_comment='') { + global $_course; + + // database definitions + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); + + $emailTitle = Database::escape_string($emailTitle); + $newContent = Database::escape_string($newContent); + $order = intval($order); + + // store in the table announcement + $sql = "INSERT INTO $tbl_announcement SET content = '$newContent', title = '$emailTitle', end_date = NOW(), display_order ='$order', session_id=".api_get_session_id(); + $result = Database::query($sql); + if ($result === false) { + return false; + } + + //store the attach file + $last_id = Database::insert_id(); + if (empty($file)) { + $save_attachment = add_announcement_attachment_file($last_id, $file_comment, $file); + } + + // store in item_property (first the groups, then the users + if (!isset($to_users)) // !isset($to): when no user is selected we send it to everyone + { + $send_to=separate_users_groups($to); + // storing the selected groups + if (is_array($send_to['groups'])) + { + foreach ($send_to['groups'] as $group) + { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), $group); + } + } + } + else // the message is sent to everyone, so we set the group to 0 + { + // storing the selected users + if (is_array($to_users)) + { + foreach ($to_users as $user) + { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '', $user); + } + } + } + return $last_id; +} -$tbl_announcement_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT); /* -============================================================================== - DISPLAY FUNCTIONS -============================================================================== + EDIT ANNOUNCEMENT */ /** -* displays one specific announcement -* @param $announcement_id, the id of the announcement you want to display -* @todo remove globals -* @todo more security checking +* This function stores the announcement item in the announcement table +* and updates the item_property table +* +* @param int id of the announcement +* @param string email +* @param string content +* @param array users that will receive the announcement +* @param mixed attachment +* @param string file comment +* */ -function display_announcement($announcement_id) -{ - global $_user, $dateFormatLong; +function edit_advalvas_item($id, $emailTitle, $newContent, $to, $file = array(), $file_comment='') { + global $_course; + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); - if ($announcement_id != strval(intval($announcement_id))) { return false; } // potencial sql injection + $emailTitle = Database::escape_string($emailTitle); + $newContent = Database::escape_string($newContent); + $id = intval($id); + + // store the modifications in the table announcement + $sql = "UPDATE $tbl_announcement SET content='$newContent', title = '$emailTitle' WHERE id='$id'"; + $result = Database::query($sql); - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); - $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); + // save attachment file + $row_attach = get_attachment($id); + $id_attach = intval($row_attach['id']); - if ($_user['user_id']) - { - $sql_query = " SELECT announcement.*, toolitemproperties.* - FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties - WHERE announcement.id = toolitemproperties.ref - AND announcement.id = '$announcement_id' - AND toolitemproperties.tool='announcement' - AND (toolitemproperties.to_user_id='".intval($_user['user_id'])."' OR toolitemproperties.to_group_id='0') - AND toolitemproperties.visibility='1' - ORDER BY display_order DESC"; + if (!empty($file)) { + if (empty($id_attach)) { + add_announcement_attachment_file($id,$file_comment,$file); + } else { + edit_announcement_attachment_file($id_attach,$file,$file_comment); + } + } + + // we remove everything from item_property for this + $sql_delete="DELETE FROM $tbl_item_property WHERE ref='$id' AND tool='announcement'"; + $result = Database::query($sql_delete); + // store in item_property (first the groups, then the users + + if (!is_null($to)) { + // !is_null($to): when no user is selected we send it to everyone + + $send_to = separate_users_groups($to); + + // storing the selected groups + if (is_array($send_to['groups'])) { + foreach ($send_to['groups'] as $group) { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, "AnnouncementUpdated", api_get_user_id(), $group); + } + } + // storing the selected users + if (is_array($send_to['users'])) { + foreach ($send_to['users'] as $user) { + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, "AnnouncementUpdated", api_get_user_id(), 0, $user); + } + } } else { - $sql_query = " SELECT announcement.*, toolitemproperties.* + // the message is sent to everyone, so we set the group to 0 + api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, "AnnouncementUpdated", api_get_user_id(), '0'); + } +} + + +/* + MAIL FUNCTIONS +*/ + +/** +* Sends an announcement by email to a list of users. +* Emails are sent one by one to try to avoid antispam. +*/ +function send_announcement_email($user_list, $course_code, $_course, $mail_title, $mail_content) { + global $_user; + foreach ($user_list as $this_user) { + + $mail_subject = get_lang('professorMessage').' - '.$_course['official_code'].' - '.$mail_title; + $mail_body = '['.$_course['official_code'].'] - ['.$_course['name']."]\n"; + $mail_body .= api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).' <'.$this_user["email"]."> \n\n".stripslashes($mail_title)."\n\n".trim(stripslashes(api_html_entity_decode(strip_tags(str_replace(array('

','

','
'),array('',"\n","\n"),$mail_content)), ENT_QUOTES, api_get_system_encoding())))." \n\n-- \n"; + $mail_body .= api_get_person_name($_user['firstname'], $_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).' '; + $mail_body .= '<'.$_user['mail'].">\n"; + $mail_body .= $_course['official_code'].' '.$_course['name']; + + @api_mail(api_get_person_name($this_user['firstname'], $this_user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $this_user['email'], $mail_subject, $mail_body, api_get_person_name($_SESSION['_user']['firstname'], $_SESSION['_user']['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']); + } +} + +function update_mail_sent($insert_id) { + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); + if ($insert_id != strval(intval($insert_id))) { return false; } + $insert_id = Database::escape_string($insert_id); + // store the modifications in the table tbl_annoucement + $sql = "UPDATE $tbl_announcement SET email_sent='1' WHERE id='$insert_id'"; + Database::query($sql); +} + +/** + * Gets all announcements from a user by course + * @param string course db + * @param int user id + * @return array html with the content and count of announcements or false otherwise + */ +function get_all_annoucement_by_user_course($course_db, $user_id) { + if (empty($course_db) || empty($user_id)) { + return false; + } + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT, $course_db); + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db); + if (!empty($user_id) && is_numeric($user_id)) { + $user_id = intval($user_id); + $sql="SELECT DISTINCT announcement.title, announcement.content FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties WHERE announcement.id = toolitemproperties.ref - AND announcement.id = '$announcement_id' AND toolitemproperties.tool='announcement' - AND toolitemproperties.to_group_id='0' - AND toolitemproperties.visibility='1'"; - } - $sql_result = Database::query($sql_query); - $result = Database::fetch_array($sql_result); - - if ($result !== false) { // A sanity check. - $title = $result['title']; - $content = $result['content']; - $content = make_clickable($content); - $content = text_filter($content); - $last_post_datetime = $result['insert_date'];// post time format datetime de mysql - list($last_post_date, $last_post_time) = split(" ", $last_post_datetime); + AND (toolitemproperties.insert_user_id='$user_id' AND (toolitemproperties.to_group_id='0' OR toolitemproperties.to_group_id is null)) + AND toolitemproperties.visibility='1' + AND announcement.session_id = 0 + ORDER BY display_order DESC"; + $rs = Database::query($sql); + $num_rows = Database::num_rows($rs); + $content = ''; + $i=0; + $result = array(); + if ($num_rows>0) { + while ($myrow = Database::fetch_array($rs)) { + $content.= ''.$myrow['title'].'

'; + $content.= $myrow['content']; + $i++; + } + $result['content'] = $content; + $result['count'] = $i; + return $result; + } + return false; } - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
" . $title . "
" . get_lang('AnnouncementPublishedOn') . " : " . api_convert_and_format_date($last_post_datetime, null, date_default_timezone_get()) . "
$content
"; + return false; } -/*====================================== - SHOW_TO_FORM -======================================*/ + +/* + SHOW_TO_FORM +*/ /** * this function shows the form for sending a message to a specific group or user. */ -function show_to_form($to_already_selected) -{ - $user_list=get_course_users(); - $group_list=get_course_groups(); +function show_to_form($to_already_selected) { + + $user_list = get_course_users(); + $group_list = get_course_groups(); - if ($to_already_selected == "") - $to_already_selected = array(); + if ($to_already_selected == '' || $to_already_selected == 'everyone') { + $to_already_selected = array(); + } - echo "\n\n"; - echo "\t\n"; + echo "
"; + echo ''; // the form containing all the groups and all the users of the course - echo "\t\t\n"; + echo ""; // the buttons for adding or removing groups/users - echo "\n\t\t\n"; - echo "\t\n"; + echo ""; + echo ""; echo "
\n"; + echo ''; echo "".get_lang('Users')."
"; construct_not_selected_select_form($group_list,$user_list,$to_already_selected); - echo "\t\t
\n"; - /*echo "\t\t> \">", - - "\n\t\t

 

", - - "\n\t\t";*/ - -?> - -

- -\n"; - echo "\n\t\t
\n"; + echo ""; + ?> + +

+ + "; + echo "
"; // the form containing the selected groups and users echo "".get_lang('DestinationUsers')."
"; construct_selected_select_form($group_list,$user_list,$to_already_selected); - echo "\t\t
"; } -/*=========================================== +/* CONSTRUCT_NOT_SELECT_SELECT_FORM -===========================================*/ +*/ /** * this function shows the form for sending a message to a specific group or user. */ -function construct_not_selected_select_form($group_list=null, $user_list=null,$to_already_selected) -{ +function construct_not_selected_select_form($group_list=null, $user_list=null,$to_already_selected) { - echo "\t\t"; // adding the groups to the select form - if ($group_list) - { - foreach($group_list as $this_group) - { + if ($group_list){ + foreach($group_list as $this_group) { if (is_array($to_already_selected)) { if (!in_array("GROUP:".$this_group['id'],$to_already_selected)) // $to_already_selected is the array containing the groups (and users) that are already selected { - echo "\t\t\n"; + ""; } } } // a divider - echo "\t\t\n"; + echo ""; } // adding the individual users to the select form if ($user_list) { @@ -155,31 +472,29 @@ function construct_not_selected_select_form($group_list=null, $user_list=null,$t if (is_array($to_already_selected)) { if (!in_array("USER:".$this_user['user_id'],$to_already_selected)) // $to_already_selected is the array containing the users (and groups) that are already selected { - echo "\t\t\n"; + ""; } } } } - echo "\t\t\n"; + echo ""; } -/*========================================== +/* CONSTRUCT_SELECTED_SELECT_FORM -==========================================*/ +*/ /** * this function shows the form for sending a message to a specific group or user. */ -function construct_selected_select_form($group_list=null, $user_list=null,$to_already_selected) -{ +function construct_selected_select_form($group_list=null, $user_list=null,$to_already_selected) { // we separate the $to_already_selected array (containing groups AND users into // two separate arrays $groupuser = array(); - if (is_array($to_already_selected)) - { + if (is_array($to_already_selected)) { $groupuser=separate_users_groups($to_already_selected); } $groups_to_already_selected=$groupuser['groups']; @@ -190,20 +505,20 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al $ref_array_users=get_course_users(); // we construct the form of the already selected groups / users - echo "\t\t"; if (is_array($to_already_selected)) { foreach($to_already_selected as $groupuser) { list($type,$id)=explode(":",$groupuser); if ($type=="GROUP") { - echo "\t\t"; + echo ""; } else { foreach($ref_array_users as $key=>$value){ if($value['user_id']==$id){ - echo "\t\t"; + echo ""; break; } } @@ -219,9 +534,9 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al //api_display_normal_message("group " . $thisGroup[id] . $thisGroup[name]); if (!is_array($to_already_selected) || !in_array("GROUP:".$this_group['id'],$to_already_selected)) // $to_already_selected is the array containing the groups (and users) that are already selected { - echo "\t\t\n"; + ""; } } } @@ -230,46 +545,42 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al { if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) // $to_already_selected is the array containing the users (and groups) that are already selected { - echo "\t\t\n"; + ""; } } } } - echo "\n"; + echo ""; } /** * this function shows the form for sending a message to a specific group or user. */ -function show_to_form_group($group_id) -{ - - echo "\n\n"; - echo "\t\n"; - - echo "\t\t
\n"; - - echo "\t\t"; + echo ""; + echo "\n"; + echo ""; // the buttons for adding or removing groups/users - echo "\n\t\t"; + echo "\n"; - echo "\t\n"; + echo ""; + echo ""; echo "
"; + echo "'; - echo "\t\t\n"; - /*echo "\t\t"; + /*echo "> \">", - "\n\t\t

 

", + "

 

", - "\n\t\t";*/ @@ -278,30 +589,27 @@ function show_to_form_group($group_id)

\n"; - echo "\n\t\t
\n"; + echo ""; - echo "\t\t"; echo ''; - echo "\t\t
"; } /* -============================================================================== DATA FUNCTIONS -============================================================================== */ /** * this function gets all the users of the course, * including users from linked courses */ -function get_course_users() -{ +function get_course_users() { //this would return only the users from real courses: //$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id()); $session_id = api_get_session_id(); @@ -319,10 +627,8 @@ function get_course_users() * this function gets all the groups of the course, * not including linked courses */ -function get_course_groups() -{ - $session_id = api_get_session_id(); - +function get_course_groups() { + $session_id = api_get_session_id(); if ($session_id != 0) { $new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($session_id)); } else { @@ -331,28 +637,25 @@ function get_course_groups() return $new_group_list; } -/*====================================== +/* + * LOAD_EDIT_USERS -======================================*/ +*/ /** * This tools loads all the users and all the groups who have received * a specific item (in this case an announcement item) */ -function load_edit_users($tool, $id) -{ - global $_course; - global $tbl_item_property; +function load_edit_users($tool, $id) { + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); $tool = Database::escape_string($tool); $id = Database::escape_string($id); $sql = "SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'"; - $result = Database::query($sql) or die(Database::error()); - while ($row = Database::fetch_array($result)) - { + $result = Database::query($sql); + while ($row = Database::fetch_array($result)) { $to_group=$row['to_group_id']; - switch ($to_group) - { + switch ($to_group) { // it was send to one specific user case null: $to[]="USER:".$row['to_user_id']; @@ -371,15 +674,14 @@ function load_edit_users($tool, $id) -/*====================================== +/* USER_GROUP_FILTER_JAVASCRIPT -======================================*/ +*/ /** * returns the javascript for setting a filter * this goes into the $htmlHeadXtra[] array */ -function user_group_filter_javascript() -{ +function user_group_filter_javascript() { return " -"; +function user_group_filter_javascript() { + return " + "; } @@ -970,21 +1014,18 @@ function store_new_agenda_item() { $content=trim($_POST['content']); $start_date=(int)$_POST['fyear']."-".(int)$_POST['fmonth']."-".(int)$_POST['fday']." ".(int)$_POST['fhour'].":".(int)$_POST['fminute'].":00"; $end_date=(int)$_POST['end_fyear']."-".(int)$_POST['end_fmonth']."-".(int)$_POST['end_fday']." ".(int)$_POST['end_fhour'].":".(int)$_POST['end_fminute'].":00"; - - $content=stripslashes($content); - $title=Database::escape_string(Security::remove_XSS($title)); - $content = Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY)); - $start_date=Database::escape_string($start_date); - $end_date=Database::escape_string($end_date); + + $title = Database::escape_string($title); + $content = Database::escape_string($content); + $start_date = Database::escape_string($start_date); + $end_date = Database::escape_string($end_date); // store in the table calendar_event - $sql = "INSERT INTO ".$TABLEAGENDA." - (title,content, start_date, end_date) - VALUES - ('".$title."','".$content."', '".$start_date."','".$end_date."')"; - $result = Database::query($sql); - $last_id = Database::insert_id(); + $sql = "INSERT INTO ".$TABLEAGENDA." (title,content, start_date, end_date) + VALUES ('".$title."','".$content."', '".$start_date."','".$end_date."')"; + $result = Database::query($sql); + $last_id = Database::insert_id(); // store in last_tooledit (first the groups, then the users $to=$_POST['selectedform']; @@ -1054,26 +1095,23 @@ function store_agenda_item_as_announcement($item_id){ $sql_max = "SELECT MAX(display_order) FROM $table_ann"; $res_max = Database::query($sql_max); $row_max = Database::fetch_array($res_max); - $max = $row_max[0]+1; + $max = intval($row_max[0])+1; //build the announcement text $content = $row['start_date']." - ".$row['end_date']."\n".$row['content']; //insert announcement - $session_id = api_get_session_id(); + $session_id = api_get_session_id(); $sql_ins = "INSERT INTO $table_ann (title,content,end_date,display_order,session_id) " . - "VALUES ('".Security::remove_XSS($row['title'])."','".$content."','".$row['end_date']."','$max','$session_id')"; + "VALUES ('".Database::escape_string($row['title'])."','".Database::escape_string($content)."','".Database::escape_string($row['end_date'])."','$max','$session_id')"; $res_ins = Database::query($sql_ins); - if($res > 0) - { + if($res > 0) { $ann_id = Database::insert_id(); //Now also get the list of item_properties rows for this agenda_item (calendar_event) //and copy them into announcement item_properties $table_props = Database::get_course_table(TABLE_ITEM_PROPERTY); $sql_props = "SELECT * FROM $table_props WHERE tool = 'calendar_event' AND ref='$item_id'"; $res_props = Database::query($sql_props); - if(Database::num_rows($res_props)>0) - { - while($row_props = Database::fetch_array($res_props)) - { + if(Database::num_rows($res_props)>0) { + while($row_props = Database::fetch_array($res_props)) { //insert into announcement item_property $time = date("Y-m-d H:i:s", time()); $sql_ins_props = "INSERT INTO $table_props " . @@ -1088,14 +1126,14 @@ function store_agenda_item_as_announcement($item_id){ "'".$row_props['visibility']."','".$row_props['start_visible']."','".$row_props['end_visible']."')"; $res_ins_props = Database::query($sql_ins_props); if($res_ins_props <= 0){ - error_log('SQL Error in '.__FILE__.' at line '.__LINE__.': '.$sql_ins_props); - }else{ + return -1; + } else { //copy was a success return $ann_id; } } } - }else{ + } else { return -1; } } @@ -1109,8 +1147,7 @@ function store_agenda_item_as_announcement($item_id){ * @author: Patrick Cool , Ghent University * @return array */ -function separate_users_groups($to) -{ +function separate_users_groups($to) { $grouplist = array(); $userlist = array(); $send_to = null; @@ -1438,10 +1475,9 @@ function change_visibility($tool,$id,$visibility) function display_courseadmin_links() { //echo "".Display::return_icon('calendar_add.gif', get_lang('AgendaAdd'))." ".get_lang('AgendaAdd').""; echo "".Display::return_icon('calendar_add.gif', get_lang('AgendaAdd'))." ".get_lang('AgendaAdd').""; - if (empty ($_SESSION['toolgroup'])) - { + if (empty ($_SESSION['toolgroup'])) { echo get_lang('UserGroupFilter'); - echo "
"; + echo "  "; show_user_group_filter_form(); echo "
"; } @@ -1618,12 +1654,11 @@ function store_edited_agenda_item($id_attach,$file_comment) * This function stores the Agenda Item in the table calendar_event and updates the item_property table also (after an edit) * @author: Patrick Cool , Ghent University */ -function save_edit_agenda_item($id,$title,$content,$start_date,$end_date) -{ +function save_edit_agenda_item($id,$title,$content,$start_date,$end_date) { $TABLEAGENDA= Database::get_course_table(TABLE_AGENDA); $id = Database::escape_string($id); - $title = Database::escape_string(Security::remove_XSS($title)); - $content = Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY)); + $title = Database::escape_string($title); + $content = Database::escape_string($content); $start_date = Database::escape_string($start_date); $end_date = Database::escape_string($end_date); @@ -1647,8 +1682,7 @@ function save_edit_agenda_item($id,$title,$content,$start_date,$end_date) * @author Patrick Cool , Ghent University * @param integer the id of the agenda item wa are deleting */ -function delete_agenda_item($id) -{ +function delete_agenda_item($id) { global $_course; $id=Database::escape_string($id); if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) @@ -1698,18 +1732,15 @@ function delete_agenda_item($id) * @author Patrick Cool , Ghent University * @param integer id the id of the agenda item we are changing the visibility of */ -function showhide_agenda_item($id) -{ +function showhide_agenda_item($id) { global $nameTools; - /*================================================== + /* SHOW / HIDE A CALENDAR ITEM - ==================================================*/ + */ // and $_GET['isStudentView']<>"false" is added to prevent that the visibility is changed after you do the following: // change visibility -> studentview -> course manager view - if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) and $_GET['isStudentView']<>"false") - { - if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action']=="showhide") - { + if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) and $_GET['isStudentView']<>"false") { + if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action']=="showhide") { $id=(int)addslashes($_GET['id']); if (isset($_GET['next_action']) && $_GET['next_action'] == strval(intval($_GET['next_action']))) { $visibility = $_GET['next_action']; @@ -1723,65 +1754,59 @@ function showhide_agenda_item($id) * Displays all the agenda items * @author Patrick Cool , Ghent University * @author Yannick Warnier - cleanup +* @author Julio Montoya - More cleanup */ -function display_agenda_items() -{ - global $TABLEAGENDA; - global $TABLE_ITEM_PROPERTY; - global $select_month, $select_year; - global $DaysShort, $DaysLong, $MonthsLong; - global $is_courseAdmin; - global $dateFormatLong, $timeNoSecFormat,$charset, $_user, $_course; +function display_agenda_items($select_month, $select_year) { + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); + $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY); + //not used in the function + //global $DaysShort, $DaysLong, $MonthsLong; + //global $is_courseAdmin; + //global $dateFormatLong, $timeNoSecFormat,$charset, $_user, $_course; + global $charset, $_user, $_course; // getting the group memberships - $group_memberships = GroupManager::get_group_ids($_course['dbName'],$_user['user_id']); + $group_memberships = GroupManager::get_group_ids($_course['dbName'],api_get_user_id()); // getting the name of the groups $group_names = get_course_groups(); - - /*-------------------------------------------------- - CONSTRUCT THE SQL STATEMENT - --------------------------------------------------*/ + /* CONSTRUCT THE SQL STATEMENT */ $start = 0; $stop = 0; + $select_month = intval($select_month); + $select_year = intval($select_year); // this is to make a difference between showing everything (all months) or only the current month) // $show_all_current is a part of the sql statement - if ($_SESSION['show']!=="showall") - { - $show_all_current=" AND MONTH(start_date)=$select_month AND year(start_date)=$select_year"; + if ($_SESSION['show']!=='showall') { + $show_all_current =" AND MONTH(start_date)=$select_month AND year(start_date)=$select_year"; + $show_all_current_personal =" AND MONTH(date)=$select_month AND year(date)=$select_year"; + $start = mktime(0,0,0,$select_month,1,$select_year); $stop = 0; - if(empty($select_year)){$select_year = date('Y');} - if(empty($select_month)){$select_month = date('m');} - if($select_month==12) - { + if (empty($select_year)) { $select_year = date('Y');} + if (empty($select_month)) { $select_month = date('m');} + if ($select_month==12) { $stop = mktime(0,0,0,1,1,$select_year+1)-1; - } - else - { + } else { $stop = mktime(0,0,0,$select_month+1,1,$select_year)-1; } - } - else - { - $show_all_current=""; + } else { + $show_all_current=''; + $show_all_current_personal = ''; $start = time(); $stop = mktime(0,0,0,1,1,2038);//by default, set year to maximum for mktime() } // by default we use the id of the current user. The course administrator can see the agenda of other users by using the user / group filter $user_id=$_user['user_id']; - if ($_SESSION['user']!==null) - { + if ($_SESSION['user']!==null) { $user_id=intval($_SESSION['user']); } - if ($_SESSION['group']!==null) - { + if ($_SESSION['group']!==null) { $group_id=intval($_SESSION['group']); } - if ($_SESSION['toolgroup']!==null) - { + if ($_SESSION['toolgroup']!==null) { $group_id=intval($_SESSION['toolgroup']); } @@ -1795,31 +1820,25 @@ function display_agenda_items() $session_id = api_get_session_id(); $session_condition = api_get_session_condition($session_id); - 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())) { // A.1. you are a course admin with a USER filter // => see only the messages of this specific user + the messages of the group (s)he is member of. - if (!empty($_SESSION['user'])) - { + if (!empty($_SESSION['user'])) { $group_memberships=GroupManager::get_group_ids($_course['dbName'],$_SESSION['user']); $show_user =true; $new_group_memberships=array(); - foreach($group_memberships as $id) - { + foreach($group_memberships as $id) { // did i have access to the same $has_access = GroupManager::user_has_access(api_get_user_id(),$id,GROUP_TOOL_CALENDAR); $result = GroupManager::get_group_properties($id); - - if ($has_access && $result['calendar_state']!='0' ) - { + if ($has_access && $result['calendar_state']!='0' ) { $new_group_memberships[]=$id; } } $group_memberships = $new_group_memberships; - if (is_array($group_memberships) && count($group_memberships)>0) - { + if (is_array($group_memberships) && count($group_memberships)>0) { $sql="SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip @@ -1829,9 +1848,7 @@ function display_agenda_items() AND ip.visibility='1' $session_condition ORDER BY start_date ".$_SESSION['sort']; - } - else - { + } else { $sql="SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip @@ -1845,23 +1862,19 @@ function display_agenda_items() } // A.2. you are a course admin with a GROUP filter // => see only the messages of this specific group - elseif (!empty($_SESSION['group'])) - { - + elseif (!empty($_SESSION['group'])) { if (!empty($group_id)) { $result = GroupManager::get_group_properties($group_id); $has_access = GroupManager::user_has_access(api_get_user_id(),$group_id,GROUP_TOOL_CALENDAR); //echo '
';print_R($result);
 
 				// lastedit
-				if (!$has_access || $result['calendar_state']=='0' )
-				{
+				if (!$has_access || $result['calendar_state']=='0' ) {
 					$group_id=0;
 				}
 			}
 
-			$sql="SELECT
-				agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
+			$sql="SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 				FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip
 				WHERE agenda.id = ip.ref  ".$show_all_current."
 				AND ip.tool='".TOOL_CALENDAR_EVENT."'
@@ -1873,13 +1886,10 @@ function display_agenda_items()
 				//removed 	- > AND toolitemproperties.visibility='1'
 		}
 		// A.3 you are a course admin without any group or user filter
-		else
-		{
-
+		else {
 			// A.3.a you are a course admin without user or group filter but WITH studentview
 			// => see all the messages of all the users and groups without editing possibilities
-			if ($_GET['isStudentView']=='true')
-			{
+			if ($_GET['isStudentView']=='true') {
 				$sql="SELECT
 					agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 					FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip
@@ -1892,13 +1902,11 @@ function display_agenda_items()
 
 			}
 			// A.3.b you are a course admin or a student
-			else
-			{
+			else {
 				// A.3.b.1 you are a course admin without user or group filter and WITHOUT studentview (= the normal course admin view)
 				// 	=> see all the messages of all the users and groups with editing possibilities
 
-				 if (api_is_course_admin())
-				 {
+				 if (api_is_course_admin()) {
 					 $sql="SELECT
 						agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 						FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip
@@ -1908,9 +1916,7 @@ function display_agenda_items()
 						$session_condition
 						GROUP BY ip.ref
 						ORDER BY start_date ".$_SESSION['sort'];
-				 }
-				 else
-				 {
+				 } else {
 				 	// A.3.b.2 you are a student with no group filter possibly showall
 				 	//when showing all the events we do not show the group events
 				 	//todo showing ALL events including the groups events that are available
@@ -1924,7 +1930,6 @@ function display_agenda_items()
 						GROUP BY ip.ref
 						ORDER BY start_date ".$_SESSION['sort'];
 
-
 					/*
 				 	if (is_array($group_memberships) && count($group_memberships)>0)
 				 	{
@@ -1951,18 +1956,13 @@ function display_agenda_items()
 						ORDER BY start_date ".$_SESSION['sort'];
 				 	}
 				 	*/
-
 				 }
 			}
 		}
-
 	} //if (is_allowed_to_edit() OR( api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
-
 	// B. you are a student
-	else
-	{
-		if (is_array($group_memberships) and count($group_memberships)>0)
-		{
+	else {
+		if (is_array($group_memberships) and count($group_memberships)>0) {
 			$sql="SELECT
 				agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 				FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip
@@ -1972,11 +1972,8 @@ function display_agenda_items()
 				AND ip.visibility='1'
 				$session_condition
 				ORDER BY start_date ".$_SESSION['sort'];
-		}
-		else
-		{
-			if ($_user['user_id'])
-			{
+		} else {
+			if ($_user['user_id']) {
 				$sql="SELECT
 					agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 					FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip
@@ -1986,9 +1983,7 @@ function display_agenda_items()
 					AND ip.visibility='1'
 					$session_condition
 					ORDER BY start_date ".$_SESSION['sort'];
-			}
-			else
-			{
+			} else {
 				$sql="SELECT
 					agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 					FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." ip
@@ -2003,69 +1998,90 @@ function display_agenda_items()
 	} // you are a student
 
 	//echo "
".$sql."
"; - $result=Database::query($sql) or die(Database::error()); - $number_items=Database::num_rows($result); - - /*-------------------------------------------------- - DISPLAY: NO ITEMS - --------------------------------------------------*/ - if ($number_items==0) - { - echo "
".get_lang("NoAgendaItems")."
"; + $result = Database::query($sql); + $number_items = Database::num_rows($result); + + /* DISPLAY: NO ITEMS */ + + if ($number_items==0) { + echo "
".get_lang('NoAgendaItems')."
"; } - /*-------------------------------------------------- - DISPLAY: THE ITEMS - --------------------------------------------------*/ + /* DISPLAY: THE ITEMS */ $month_bar=""; $event_list=""; $counter=0; - $export_icon = 'export.png'; - $export_icon_low = 'export_low_fade.png'; + $export_icon = 'export.png'; + $export_icon_low = 'export_low_fade.png'; $export_icon_high = 'export_high_fade.png'; + + $my_events = array(); + while($myrow = Database::fetch_array($result)) { + $myrow['calendar_type'] = 'course'; + $my_events[] = $myrow; + } - while($myrow=Database::fetch_array($result)) { + //Check my personal calendar items + if (api_get_setting('allow_personal_agenda') == 'true') { + $tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA); + // 1. creating the SQL statement for getting the personal agenda items in MONTH view + $sql = "SELECT id, title, text as content , date as start_date, enddate as end_date, parent_event_id FROM ".$tbl_personal_agenda." + WHERE user='".api_get_user_id()."' ".$show_all_current_personal." ORDER BY date ASC"; + $result = Database::query($sql); + while ($row = Database::fetch_array($result, 'ASSOC')) { + $row['calendar_type'] = 'personal'; + $my_events[] = $row; + } + } + + + + //Check global agenda events */ + $table_agenda_system = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR); + $sql = "SELECT DISTINCT id, title, content , start_date, end_date FROM ".$table_agenda_system." + WHERE 1=1 ".$show_all_current." + ORDER BY start_date "; + $result=Database::query($sql); + while ($row = Database::fetch_array($result, 'ASSOC')) { + $row['calendar_type'] = 'global'; + $my_events[] = $row; + } + + + //while($myrow = Database::fetch_array($result)) { + foreach ($my_events as $myrow) { $is_repeated = !empty($myrow['parent_event_id']); echo ''; - /*-------------------------------------------------- + /* display: the month bar - --------------------------------------------------*/ + */ // Make the month bar appear only once. $myrow["start_date"] = api_get_local_time($myrow["start_date"], null, date_default_timezone_get()); - if ($month_bar != api_format_date($myrow["start_date"], "%m%Y")) - { + if ($month_bar != api_format_date($myrow["start_date"], "%m%Y")) { $month_bar = api_format_date($myrow["start_date"], "%m%Y"); - echo ""; + //Showing month header + echo ''; } - /*-------------------------------------------------- - display: the icon, title, destinees of the item - -------------------------------------------------*/ + /* display: the icon, title, destinees of the item */ echo ''; // highlight: if a date in the small calendar is clicked we highlight the relevant items $db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y"); - if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date) - { - if ($myrow['visibility']=='0') - { + if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date) { + if ($myrow['visibility']=='0') { $style="data_hidden"; $stylenotbold="datanotbold_hidden"; $text_style="text_hidden"; - } - else - { + } else { $style="data"; $stylenotbold="datanotbold"; $text_style="text"; } - - } - else - { + } else { $style="datanow"; $stylenotbold="datanotboldnow"; $text_style="textnow"; @@ -2077,59 +2093,76 @@ function display_agenda_items() // the icons. If the message is sent to one or more specific users/groups // we add the groups icon // 2do: if it is sent to groups we display the group icon, if it is sent to a user we show the user icon - Display::display_icon('agenda.gif', get_lang('Agenda')); - if ($myrow['to_group_id']!=='0') - { - echo Display::return_icon('group.gif', get_lang('ItemForUserSelection')); + if ($myrow['calendar_type'] == 'course') { + Display::display_icon('agenda.gif', get_lang('Agenda')); + if ($myrow['to_group_id']!=='0') { + echo Display::return_icon('group.gif', get_lang('ItemForUserSelection')); + } + echo ''; + echo $myrow['title']; + echo ''; + } elseif ($myrow['calendar_type'] == 'personal') { + Display::display_icon('calendar_personal.gif', get_lang('Personal')); + echo ''; + echo $myrow['title']; + echo ''; + } else { + Display::display_icon('calendar_global.png', get_lang('Personal')); + echo ''; + echo $myrow['title']; + echo ''; } - echo $myrow['title']; - echo ""; - - // the message has been sent to - echo ""; - - if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) - { - if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) - { // a coach can only delete an element belonging to his session + echo ''; + + if ($myrow['calendar_type'] == 'course') { + // the message has been sent to + echo "'; + } elseif ($myrow['calendar_type'] == 'personal') { + echo ''; + } elseif ($myrow['calendar_type'] == 'global') { + echo ''; + } + + if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) && $myrow['calendar_type'] == 'course' ) { + if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) { + // a coach can only delete an element belonging to his session echo ''; } + } else { + echo ''; } - /*-------------------------------------------------- - display: the title - --------------------------------------------------*/ - echo ""; - echo "'; + echo '"; - echo "'; + echo '"; + echo ''; // attachment list - $attachment_list=get_attachment($myrow['id']); - - /*-------------------------------------------------- - display: edit delete button (course admin only) - --------------------------------------------------*/ + $attachment_list=get_attachment($myrow['id']); - - if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) { + /*Display: edit delete button (course admin only) */ + if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) && $myrow['calendar_type'] == 'course') { if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) { // a coach can only delete an element belonging to his session $mylink = api_get_self().'?'.api_get_cidreq().'&origin='.Security::remove_XSS($_GET['origin']).'&id='.$myrow['id'].'&'; echo ''; - echo ''; -} + if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) { + if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) { + // a coach can only delete an element belonging to his session + $td_colspan= ''; + } else { + echo ''; + } + echo ''; - /*-------------------------------------------------- - display: the content - --------------------------------------------------*/ + /* display: the content */ $content = $myrow['content']; $content = make_clickable($content); $content = text_filter($content); - echo ""; - echo "'; + echo ''; - - /*-------------------------------------------------- - display: the added resources - --------------------------------------------------*/ - if (check_added_resources("Agenda", $myrow["id"])) - { - + /* display: the added resources */ + if (check_added_resources("Agenda", $myrow["id"])) { echo ''; echo '"; - } - - + } $event_list.=$myrow['id'].','; - $counter++; - /*-------------------------------------------------- - display: jump-to-top icon - --------------------------------------------------*/ + /* display: jump-to-top icon */ echo ''; echo '"; echo "
". - api_format_date($myrow["start_date"], "%B %Y"). - "
'; + echo api_format_date($myrow["start_date"], "%B %Y"); + echo '
".get_lang("SentTo").": "; - $sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]); - $sent_to_form=sent_to_form($sent_to); - echo $sent_to_form; - echo "".get_lang('SentTo').": "; + $sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]); + $sent_to_form=sent_to_form($sent_to); + echo $sent_to_form; + echo ''.get_lang('Personal').''.get_lang('GlobalEvent').''.get_lang('Modify'); echo '
".get_lang("StartTimeWindow").": "; + /* display: the title */ + echo '
'.get_lang('StartTimeWindow').': '; echo api_format_date($myrow['start_date']); - echo ""; - if ($myrow["end_date"]<>"0000-00-00 00:00:00") { - echo get_lang("EndTimeWindow").": "; - echo api_convert_and_format_date($myrow['end_date'], null, date_default_timezone_get()); + echo ''; + + if ($myrow['calendar_type'] == 'course') { + if ($myrow['end_date']<>'0000-00-00 00:00:00') { + echo get_lang('EndTimeWindow').": "; + echo api_convert_and_format_date($myrow['end_date'], null, date_default_timezone_get()); + } } - echo "'; - // edit + // edit echo ''; echo Display::return_icon('edit.gif', get_lang('ModifyCalendarItem')).""; @@ -2151,38 +2184,38 @@ function display_agenda_items() echo ''.Display::return_icon($image_visibility, $text_visibility),' '; } - if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) { - if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) - { // a coach can only delete an element belonging to his session - $td_colspan= ''; - } else { - $td_colspan= ''; - } - } else { - $td_colspan= ''; - } - $mylink = 'ical_export.php?'.api_get_cidreq().'&type=course&id='.$myrow['id']; - //echo ''.Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')).' '; - //echo ''.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).' '; - //echo ''.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).' '; - echo ''.Display::return_icon('print.gif', get_lang('Print')).' '; - echo '
'; + } else { + $td_colspan= ''; + } + } else { + $td_colspan= ''; + } + $mylink = 'ical_export.php?'.api_get_cidreq().'&type=course&id='.$myrow['id']; + //echo ''.Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')).' '; + //echo ''.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).' '; + //echo ''.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).' '; + echo ''.Display::return_icon('print.gif', get_lang('Print')).' '; + echo ''; + echo '
"; - + + echo '
'; echo $content; // show attachment list if (!empty($attachment_list)) { - $realname=$attachment_list['path']; $user_filename=$attachment_list['filename']; $full_file_name = 'download.php?file='.$realname; @@ -2193,52 +2226,37 @@ function display_agenda_items() if (api_is_allowed_to_edit()) { echo '  '.Display::return_icon('delete.gif',get_lang('Delete')).'
'; } - } - echo '
'; echo "".get_lang("AddedResources")."
"; - if ($myrow['visibility']==0) - { + if ($myrow['visibility']==0) { $addedresource_style="invisible"; } display_added_resources("Agenda", $myrow["id"], $addedresource_style); echo "
'; - if($is_repeated){echo get_lang('RepeatedEvent'),' ',get_lang('RepeatedEventViewOriginalEvent'),'';} + if ($is_repeated) { + echo get_lang('RepeatedEvent'),' ',get_lang('RepeatedEventViewOriginalEvent'),''; + } echo "".Display::return_icon('top.gif', get_lang('Top'))."


"; } // end while ($myrow=Database::fetch_array($result)) - if(!empty($event_list)) - { + if(!empty($event_list)) { $event_list=api_substr($event_list,0,-1); - } - else - { + } else { $event_list='0'; } - echo "
"; // closing the layout table @@ -4277,12 +4295,12 @@ function agenda_add_item($course_info, $title, $content, $db_start_date, $db_end // database table definitions $t_agenda = Database::get_course_table(TABLE_AGENDA,$course_info['dbName']); $agenda_table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT); - $item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); + $item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); // some filtering of the input data $content=stripslashes($content); - $title=Database::escape_string(Security::remove_XSS($title)); - $content = Database::escape_string(Security::remove_XSS($content,COURSEMANAGERLOWSECURITY)); + $title=Database::escape_string($title); + $content = Database::escape_string($content); $start_date = Database::escape_string($db_start_date); $end_date = Database::escape_string($db_end_date); isset($_SESSION['id_session'])?$id_session=intval($_SESSION['id_session']):$id_session=null; @@ -4599,17 +4617,36 @@ function agenda_import_ical($course_info,$file) { $ve = $ical->getComponent(VEVENT); + $ttitle = $ve->getProperty('summary'); $title = api_convert_encoding($ttitle,$charset,'UTF-8'); $tdesc = $ve->getProperty('description'); $desc = api_convert_encoding($tdesc,$charset,'UTF-8'); - $ts = $ve->getProperty('dtstart'); - $start_date = $ts['year'].'-'.$ts['month'].'-'.$ts['day'].' '.$ts['hour'].':'.$ts['min'].':'.$ts['sec']; + $start_date = $ve->getProperty('dtstart'); + $start_date_string = $start_date['year'].'-'.$start_date['month'].'-'.$start_date['day'].' '.$start_date['hour'].':'.$start_date['min'].':'.$start_date['sec']; + + + $ts = $ve->getProperty('dtend'); + if ($ts != false) { + $end_date_string = $ts['year'].'-'.$ts['month'].'-'.$ts['day'].' '.$ts['hour'].':'.$ts['min'].':'.$ts['sec']; + } else { + //Check duration if dtend does not exist + $duration = $ve->getProperty('duration'); + if ($duration != false) { + $duration = $ve->getProperty('duration'); + $duration_string = $duration['year'].'-'.$duration['month'].'-'.$duration['day'].' '.$duration['hour'].':'.$duration['min'].':'.$duration['sec']; + $start_date_tms = mktime(intval($start_date['hour']), intval($start_date['min']), intval($start_date['sec']), intval($start_date['month']), intval($start_date['day']), intval($start_date['year'])); + //$start_date_tms = mktime(($start_date['hour']), ($start_date['min']), ($start_date['sec']), ($start_date['month']), ($start_date['day']), ($start_date['year'])); + //echo date('d-m-Y - h:i:s', $start_date_tms); + + $end_date_string = mktime(intval($start_date['hour']) +$duration['hour'], intval($start_date['min']) + $duration['min'], intval($start_date['sec']) + $duration['sec'], intval($start_date['month']) + $duration['month'], intval($start_date['day'])+$duration['day'], intval($start_date['year']) + $duration['year']); + $end_date_string = date('Y-m-d H:i:s', $end_date_string); + //echo date('d-m-Y - h:i:s', $end_date_string); + } + } - $ts = $ve->getProperty('dtend'); - $end_date = $ts['year'].'-'.$ts['month'].'-'.$ts['day'].' '.$ts['hour'].':'.$ts['min'].':'.$ts['sec']; //echo $start_date.' - '.$end_date; $organizer = $ve->getProperty('organizer'); @@ -4617,7 +4654,7 @@ function agenda_import_ical($course_info,$file) { $course_name = $ve->getProperty('location'); //insert the event in our database //var_dump($title,$desc,$start_date,$end_date); - $id = agenda_add_item($course_info,$title,$desc,$start_date,$end_date,$_POST['selectedform']); + $id = agenda_add_item($course_info,$title,$desc,$start_date_string,$end_date_string,$_POST['selectedform']); $repeat = $ve->getProperty('rrule'); if(is_array($repeat) && !empty($repeat['FREQ'])) { @@ -4686,8 +4723,8 @@ function get_global_agenda_items($agendaitems, $day = "", $month = "", $year = " $sql = " SELECT * FROM ".$tbl_global_agenda." WHERE start_date>='".$start_filter."' AND start_date<='".$end_filter."'"; } $result = Database::query($sql); - while ($item = Database::fetch_array($result)) - { + + while ($item = Database::fetch_array($result)) { // we break the date field in the database into a date and a time part $agenda_db_date = explode(" ", $item['start_date']); $date = $agenda_db_date[0]; diff --git a/main/calendar/agenda.php b/main/calendar/agenda.php index 7f7dbe76f9..45e747183e 100755 --- a/main/calendar/agenda.php +++ b/main/calendar/agenda.php @@ -52,78 +52,64 @@ if (!empty($_GET['view'])) { } /* ------------------------------------------------------------ Libraries ------------------------------------------------------------ */ // containing the functions for the agenda tool -include "agenda.inc.php"; +require_once 'agenda.inc.php'; // some debug functions -include($includePath."/lib/debug.lib.inc.php"); +require_once $includePath."/lib/debug.lib.inc.php"; -/*============================================================================== +/* TREATING THE PARAMETERS 1. viewing month only or everything 2. sort ascending or descending 3. showing or hiding the send-to-specific-groups-or-users form 4. filter user or group - ============================================================================== */ +*/ // 1. show all or show current month? -if (!$_SESSION['show']) -{ +if (!$_SESSION['show']) { $_SESSION['show']="showall"; } -if (!empty($_GET['action']) and $_GET['action']=="showcurrent") -{ +if (!empty($_GET['action']) and $_GET['action']=="showcurrent") { $_SESSION['show']="showcurrent"; } -if (!empty($_GET['action']) and $_GET['action']=="showall") -{ +if (!empty($_GET['action']) and $_GET['action']=="showall") { $_SESSION['show']="showall"; } -//echo $_SESSION['show']; // 2. sorting order (ASC or DESC) -if (empty($_GET['sort']) and empty($_SESSION['sort'])) -{ +if (empty($_GET['sort']) and empty($_SESSION['sort'])) { $_SESSION['sort']="DESC"; } -if (!empty($_GET['sort']) and $_GET['sort']=="asc") -{ +if (!empty($_GET['sort']) and $_GET['sort']=="asc") { $_SESSION['sort']="ASC"; } -if (!empty($_GET['sort']) and $_GET['sort']=="desc") -{ +if (!empty($_GET['sort']) and $_GET['sort']=="desc") { $_SESSION['sort']="DESC"; } // 3. showing or hiding the send-to-specific-groups-or-users form $setting_allow_individual_calendar=true; -if (empty($_POST['To']) and empty($_SESSION['allow_individual_calendar'])) -{ +if (empty($_POST['To']) and empty($_SESSION['allow_individual_calendar'])) { $_SESSION['allow_individual_calendar']="hide"; } $allow_individual_calendar_status=$_SESSION['allow_individual_calendar']; -if (!empty($_POST['To']) and ($allow_individual_calendar_status=="hide")) -{ +if (!empty($_POST['To']) and ($allow_individual_calendar_status=="hide")) { $_SESSION['allow_individual_calendar']="show"; } -if (!empty($_GET['sort']) and ($allow_individual_calendar_status=="show")) -{ +if (!empty($_GET['sort']) and ($allow_individual_calendar_status=="show")) { $_SESSION['allow_individual_calendar']="hide"; } // 4. filter user or group -if (!empty($_GET['user']) or !empty($_GET['group'])) -{ +if (!empty($_GET['user']) or !empty($_GET['group'])) { $_SESSION['user']=(int)$_GET['user']; $_SESSION['group']=(int)$_GET['group']; } -if ((!empty($_GET['user']) and $_GET['user']=="none") or (!empty($_GET['group']) and $_GET['group']=="none")) -{ +if ((!empty($_GET['user']) and $_GET['user']=="none") or (!empty($_GET['group']) and $_GET['group']=="none")) { api_session_unregister("user"); api_session_unregister("group"); - } +} if (!$is_courseAdmin){ if (!empty($_GET['toolgroup'])){ //$_SESSION['toolgroup']=$_GET['toolgroup']; @@ -132,8 +118,7 @@ if (!$is_courseAdmin){ } } //It comes from the group tools. If it's define it overwrites $_SESSION['group'] -if (!empty($_GET['isStudentView']) and $_GET['isStudentView']=="false") -{ +if (!empty($_GET['isStudentView']) and $_GET['isStudentView']=="false") { api_session_unregister("user"); api_session_unregister("group"); } @@ -212,16 +197,13 @@ echo ''; //setting the default year and month $select_year = ''; $select_month = ''; -if(!empty($_GET['year'])) -{ +if(!empty($_GET['year'])) { $select_year = (int)$_GET['year']; } -if(!empty($_GET['month'])) -{ +if(!empty($_GET['month'])) { $select_month = (int)$_GET['month']; } -if (empty($select_year) && empty($select_month)) -{ +if (empty($select_year) && empty($select_month)) { $today = getdate(); $select_year = $today['year']; $select_month = $today['mon']; @@ -314,8 +296,8 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed } } -echo '' - . ''; +echo '
+ '; // THE LEFT PART if (empty($_GET['origin']) or $_GET['origin']!='learnpath') { @@ -323,8 +305,7 @@ if (empty($_GET['origin']) or $_GET['origin']!='learnpath') { // the small calendar $MonthName = $MonthsLong[$select_month -1]; $agenda_items=get_calendar_items($select_month,$select_year); - if (api_get_setting('display_mini_month_calendar') == 'true') - { + if (api_get_setting('display_mini_month_calendar') == 'true') { display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName); } echo '
'; @@ -350,58 +331,57 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed display_ical_import_form(); break; } - display_agenda_items(); - } - else { + display_agenda_items($select_month, $select_year); + } else { display_ical_import_form(); } break; case 'add' : - if ($_POST['submit_event']) { - display_agenda_items(); - } else { - show_add_form(); - } - break; + if ($_POST['submit_event']) { + display_agenda_items($select_month, $select_year); + } else { + show_add_form(); + } + break; case 'edit' : - if ( !(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, intval($_REQUEST['id'])))) { - if ($_POST['submit_event']) { - display_agenda_items(); - } else { - $id=(int)$_GET['id']; - show_add_form($id); - } + if ( !(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, intval($_REQUEST['id'])))) { + if ($_POST['submit_event']) { + display_agenda_items($select_month, $select_year); } else { - display_agenda_items(); + $id=(int)$_GET['id']; + show_add_form($id); } - break; + } else { + display_agenda_items($select_month, $select_year); + } + break; case 'delete': - display_agenda_items(); - break; + display_agenda_items($select_month, $select_year); + break; case 'showhide': - if(!empty($_GET['agenda_id'])) { - display_one_agenda_item((int)$_GET['agenda_id']); - } else { - display_agenda_items(); - } - break; + if(!empty($_GET['agenda_id'])) { + display_one_agenda_item((int)$_GET['agenda_id']); + } else { + display_agenda_items($select_month, $select_year); + } + break; case 'announce': - display_agenda_items(); + display_agenda_items($select_month, $select_year); break; case 'delete_attach': - display_agenda_items(); + display_agenda_items($select_month, $select_year); break; } } // this is for students and whenever the courseaministrator has not chosen any action. It is in fact the default behaviour -if (!$_GET['action'] || $_GET['action']=="showall" || $_GET['action']=="showcurrent" || $_GET['action']=="view") { +if (!$_GET['action'] || $_GET['action']=='showall' || $_GET['action']=='showcurrent' || $_GET['action']=="view") { if ($_GET['origin'] != 'learnpath') { if (!$_SESSION['view'] || $_SESSION['view'] <> 'month') { if(!empty($_GET['agenda_id'])) { - display_one_agenda_item((int)$_GET['agenda_id']); + display_one_agenda_item($_GET['agenda_id']); } else { - display_agenda_items(); + display_agenda_items($select_month, $select_year); } } else { display_monthcalendar($select_month, $select_year); @@ -413,13 +393,11 @@ if (!$_GET['action'] || $_GET['action']=="showall" || $_GET['action']=="showcur echo ' 
'; /* -============================================================================== FOOTER -============================================================================== */ // The footer is displayed only if we are not in the learnpath if ($_GET['origin'] != 'learnpath') { Display::display_footer(); } -?> +?> \ No newline at end of file diff --git a/main/calendar/calendar.php b/main/calendar/calendar.php index fa60b3634a..dce17214c3 100755 --- a/main/calendar/calendar.php +++ b/main/calendar/calendar.php @@ -1,4 +1,4 @@ -'."".$agenda_link." ".Security::remove_XSS($item['title'])."
"; $items[$agendaday][$item['start_date']] .= '
'; } - } // sorting by hour for every day $agendaitems = array (); @@ -136,6 +135,8 @@ function get_myagendaitems($courses_dbs, $month, $year) { $agendaitems[$agendaday] .= $val; } } + + //print_r($agendaitems); return $agendaitems; } @@ -162,19 +163,21 @@ function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=arra $backwardsURL = api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); $forewardsURL = api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); - echo "\n", "\n", ""; - echo "\n", "", ""; + echo '
".Display::return_icon('action_prev.png',get_lang('Previous'))."", $monthName, " ", $year, "".Display::return_icon('action_next.png',get_lang('Next'))."
'.''; + echo ''; + echo ''; + echo ''; + echo ''; - echo "\n"; - for ($ii = 1; $ii < 8; $ii ++) - { - echo "\n"; + echo ''; + for ($ii = 1; $ii < 8; $ii ++) { + echo ''; } - echo "\n"; + echo ''; $curday = -1; $today = getdate(); while ($curday <= $numberofdays[$month]) { - echo "\n"; + echo ""; for ($ii = 0; $ii < 7; $ii ++) { if (($curday == -1) && ($ii == $startdayofweek)) { $curday = 1; @@ -183,22 +186,22 @@ function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=arra $bgcolor = $ii < 5 ? $class = "class=\"days_week\" style=\"width:10%;\"" : $class = "class=\"days_weekend\" style=\"width:10%;\""; $dayheader = "$curday
"; if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { - $dayheader = "$curday - ".get_lang("Today")."
"; + $dayheader = "$curday - ".get_lang('Today')."
"; $class = "class=\"days_today\" style=\"width:10%;\""; } echo "\n"; + echo ""; $curday ++; } else { - echo "\n"; + echo ""; } } - echo "\n"; + echo ""; } - echo "
'.Display::return_icon('action_prev.png',get_lang('Previous')).''.$monthName." ".$year.''.Display::return_icon('action_next.png',get_lang('Next')).'
", $DaysShort[$ii % 7], "
'.$DaysShort[$ii % 7].'
", "".$dayheader; if (!empty($agendaitems[$curday])) { echo "".$agendaitems[$curday].""; } - echo "  
\n"; + echo "
"; } /** * Show the mini calender of the given month @@ -217,20 +220,20 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) { $backwardsURL = api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); $forewardsURL = api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); - echo "\n", "\n", ""; - echo "\n", "", ""; + echo "
".Display::return_icon('action_prev.png',get_lang('Previous'))."", $monthName, " ", $year, "".Display::return_icon('action_next.png',get_lang('Next'))."
", "", ""; + echo "", "", ""; - echo "\n"; + echo ""; for ($ii = 1; $ii < 8; $ii ++) { - echo "\n"; + echo ""; } - echo "\n"; + echo ""; $curday = -1; $today = getdate(); while ($curday <= $numberofdays[$month]) { - echo "\n"; + echo ""; for ($ii = 0; $ii < 7; $ii ++) { if (($curday == -1) && ($ii == $startdayofweek)) { @@ -245,7 +248,7 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) { $dayheader = "$curday"; $class = "class=\"days_today\""; } - echo "\t\n"; + // "a".$dayheader." ".$agendaitems[$curday].""; + echo ""; $curday ++; } else { - echo "\n"; + echo ""; } } - echo "\n"; + echo ""; } - echo "
".Display::return_icon('action_prev.png',get_lang('Previous'))."", $monthName, " ", $year, "".Display::return_icon('action_next.png',get_lang('Next'))."
", $DaysShort[$ii % 7], "", $DaysShort[$ii % 7], "
"; + echo ""; if (!empty($agendaitems[$curday])) { echo "".$dayheader.""; @@ -254,18 +257,18 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) { { echo $dayheader; } - // "a".$dayheader." ".$agendaitems[$curday]."\n"; - echo "  
\n"; + echo ""; } /** @@ -612,12 +615,11 @@ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = $root_url = $url['url']; } } - + $result = Database::query($sql); - while ($item = Database::fetch_array($result)) - { + while ($item = Database::fetch_array($result)) { // we break the date field in the database into a date and a time part - $agenda_db_date = explode(" ", $item[date]); + $agenda_db_date = explode(" ", $item['date']); $date = $agenda_db_date[0]; $time = $agenda_db_date[1]; // we divide the date part into a day, a month and a year @@ -631,31 +633,29 @@ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = $minute = $agendatime[1]; $second = $agendatime[2]; // if the student has specified a course we a add a link to that course - if ($item['course'] <> "") - { + if ($item['course'] <> "") { $url = $root_url."main/calendar/agenda.php?cidReq=".urlencode($item['course'])."&day=$day&month=$month&year=$year#$day"; // RH //Patrick Cool: to highlight the relevant agenda item $course_link = "".$item['course'].""; - } - else - { + } else { $course_link = ""; } // Creating the array that will be returned. If we have week or month view we have an array with the date as the key // if we have a day_view we use a half hour as index => key 33 = 16h30 - if ($type !== "day_view") // This is the array construction for the WEEK or MONTH view - { + if ($type !== "day_view") { + // This is the array construction for the WEEK or MONTH view + //Display events in agenda $agendaitems[$day] .= "
$hour:$minute $course_link ".$item['title']."

"; - } - else // this is the array construction for the DAY view - { + + } else { + // this is the array construction for the DAY view $halfhour = 2 * $agendatime['0']; - if ($agendatime['1'] >= '30') - { + if ($agendatime['1'] >= '30') { $halfhour = $halfhour +1; } //Display events by list $agendaitems[$halfhour] .= "
$hour:$minute $course_link ".$item['title']."
"; + } } //print_r($agendaitems); @@ -688,19 +688,17 @@ function get_personal_agenda_item($id) { * these items in one list (ordered by date and grouped by month (the month_bar) */ function show_personal_agenda() { - global $MonthsLong, $charset; - global $_user; + global $MonthsLong, $charset; $tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA); // The SQL statement that retrieves all the personal agenda items of this user - $sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$_user['user_id']."' ORDER BY date DESC"; + $sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".api_get_user_id()."' ORDER BY date DESC"; $result = Database::query($sql); // variable initialisation $month_bar = ""; // setting the default day, month and year - if (!$_GET['day'] AND !$_GET['month'] AND !$_GET['year']) - { + if (!$_GET['day'] AND !$_GET['month'] AND !$_GET['year']) { $today = getdate(); $year = $today['year']; $month = $today['mon']; @@ -711,36 +709,37 @@ function show_personal_agenda() { $export_icon_high = 'export_high_fade.png'; // starting the table output - echo "\n"; + echo '
'; - if (Database::num_rows($result) > 0) - { - while ($myrow = Database::fetch_array($result)) - { - /*-------------------------------------------------- - display: the month bar - --------------------------------------------------*/ - if ($month_bar != date("m", strtotime($myrow["date"])).date("Y", strtotime($myrow["date"]))) - { + if (Database::num_rows($result) > 0) { + while ($myrow = Database::fetch_array($result)) { + /* display: the month bar */ + if ($month_bar != date("m", strtotime($myrow["date"])).date("Y", strtotime($myrow["date"]))) { $month_bar = date("m", strtotime($myrow["date"])).date("Y", strtotime($myrow["date"])); - echo "\n"; + echo ""; } // highlight: if a date in the small calendar is clicked we highlight the relevant items $db_date = (int) date("d", strtotime($myrow["date"])).date("n", strtotime($myrow["date"])).date("Y", strtotime($myrow["date"])); - if ($_GET["day"].$_GET["month"].$_GET["year"] <> $db_date) - { + if ($_GET["day"].$_GET["month"].$_GET["year"] <> $db_date) { $style = "data"; $text_style = "text"; - } - else - { + } else { $style = "datanow"; $text_style = "text"; } + + /* display: the title */ + + echo ""; + echo '"; + echo ""; + /*-------------------------------------------------- display: date and time --------------------------------------------------*/ - echo "\t\n\t\t"; + echo ""; echo '\n\t"; + //echo ""; echo ""; - /*-------------------------------------------------- - display: the title - --------------------------------------------------*/ - echo ""; - echo '\n\t"; - echo "\n"; + /*-------------------------------------------------- display: the content --------------------------------------------------*/ $content = $myrow['text']; $content = make_clickable($content); $content = text_filter($content); - echo "\t\n\t\t"; /*-------------------------------------------------- display: the edit / delete icons --------------------------------------------------*/ - echo "\t\n\t\t"; @@ -784,7 +776,7 @@ function show_personal_agenda() { { echo ''; } - echo "
".$MonthsLong[date("n", strtotime($myrow["date"])) - 1]." ".date("Y", strtotime($myrow["date"]))."
".$MonthsLong[date("n", strtotime($myrow["date"])) - 1]." ".date("Y", strtotime($myrow["date"]))."
'; + echo $myrow['title']; + echo "
'; // adding an internal anchor echo ""; @@ -752,29 +751,22 @@ function show_personal_agenda() { //echo ''.Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')).''; //echo ''.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).''; //echo ''.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).''; - //echo "\n\t\t
'; - echo $myrow['title']; - echo "\n\t\t
"; + echo "
"; echo $content; echo "
"; + echo "
"; echo "".Display::return_icon('edit.gif', get_lang('Edit')).""; echo "".Display::return_icon('delete.gif', get_lang('Delete')).""; echo "
'.get_lang('NoAgendaItems').'
\n"; + echo ""; } /** diff --git a/main/calendar/myagenda.php b/main/calendar/myagenda.php index aad567e51f..320497a135 100755 --- a/main/calendar/myagenda.php +++ b/main/calendar/myagenda.php @@ -1,46 +1,5 @@ , Ghent University - @author: Toon Van Hoecke , Ghent University - @author: Eric Remy (initial version) - @version: 2.2 alpha - @description: this file generates a general agenda of all items of the - courses the user is registered for - - version info: - ------------- - -> version 2.3 : Yannick Warnier, yannick.warnier@dokeos.com 2008 - Added repeated events - -> 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. -**/ - -// HEADER // name of the language file that needs to be included $language_file = 'agenda'; @@ -76,11 +35,11 @@ Display::display_header(get_lang('MyAgenda')); // SETTING SOME VARIABLES // setting the database variables -$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE); -$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER); -$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA); +$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE); +$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER); +$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA); $TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY); -$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA); +$tbl_personal_agenda= Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA); // the variables for the days and the months // Defining the shorts for the days @@ -91,17 +50,17 @@ $DaysLong = api_get_week_days_long(); $MonthsLong = api_get_months_long(); /* - TREATING THE URL PARAMETERS - 1. The default values - 2. storing it in the session - 3. possible view - 3.a Month view - 3.b Week view - 3.c day view - 3.d personal view (only the personal agenda items) - 4. add personal agenda - 5. edit personal agenda - 6. delete personal agenda + TREATING THE URL PARAMETERS + 1. The default values + 2. storing it in the session + 3. possible view + 3.a Month view + 3.b Week view + 3.c day view + 3.d personal view (only the personal agenda items) + 4. add personal agenda + 5. edit personal agenda + 6. delete personal agenda */ // 1. The default values. if there is no session yet, we have by default the month view @@ -118,51 +77,47 @@ if ($_SESSION['view']) { switch ($_SESSION['view']) { // 3.a Month view case "month" : - $process = "month_view"; + $process = 'month_view'; break; // 3.a Week view case "week" : - $process = "week_view"; + $process = 'week_view'; break; // 3.a Day view case "day" : - $process = "day_view"; + $process = 'day_view'; break; // 3.a Personal view case "personal" : - $process = "personal_view"; + $process = 'personal_view'; break; } } // 4. add personal agenda -if (!empty($_GET['action']) && $_GET['action'] == "add_personal_agenda_item" and !$_POST['Submit']) -{ +if (!empty($_GET['action']) && $_GET['action'] == 'add_personal_agenda_item' and !$_POST['Submit']) { $process = "add_personal_agenda_item"; } -if (!empty($_GET['action']) && $_GET['action'] == "add_personal_agenda_item" and $_POST['Submit']) -{ +if (!empty($_GET['action']) && $_GET['action'] == "add_personal_agenda_item" and $_POST['Submit']) { $process = "store_personal_agenda_item"; } // 5. edit personal agenda -if (!empty($_GET['action']) && $_GET['action'] == "edit_personal_agenda_item" and !$_POST['Submit']) -{ +if (!empty($_GET['action']) && $_GET['action'] == 'edit_personal_agenda_item' and !$_POST['Submit']) { $process = "edit_personal_agenda_item"; } -if (!empty($_GET['action']) && $_GET['action'] == "edit_personal_agenda_item" and $_POST['Submit']) -{ +if (!empty($_GET['action']) && $_GET['action'] == 'edit_personal_agenda_item' and $_POST['Submit']) { $process = "store_personal_agenda_item"; } // 6. delete personal agenda -if (!empty($_GET['action']) && $_GET['action'] == "delete" AND $_GET['id']) -{ +if (!empty($_GET['action']) && $_GET['action'] == "delete" AND $_GET['id']) { $process = "delete_personal_agenda_item"; } + // OUTPUT if (isset ($_user['user_id'])) { // getting all the courses that this user is subscribed to $courses_dbs = get_all_courses_of_user(); - if (!is_array($courses_dbs)) // this is for the special case if the user has no courses (otherwise you get an error) - { + if (!is_array($courses_dbs)) { + // this is for the special case if the user has no courses (otherwise you get an error) $courses_dbs = array (); } // setting and/or getting the year, month, day, week @@ -173,13 +128,11 @@ if (isset ($_user['user_id'])) { $year = $today['year']; } $month = (!empty($_GET['month'])? (int)$_GET['month']:NULL); - if ($month == NULL) - { + if ($month == NULL) { $month = $today['mon']; } $day = (!empty($_GET['day']) ? (int)$_GET['day']:NULL); - if ($day == NULL) - { + if ($day == NULL) { $day = $today['mday']; } $week = (!empty($_GET['week']) ?(int)$_GET['week']:NULL); @@ -207,8 +160,7 @@ if (isset ($_user['user_id'])) { echo ""; $agendaitems = get_myagendaitems($courses_dbs, $month, $year); $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($agendaitems, $day, $month, $year, $week, "month_view"); } display_myminimonthcalendar($agendaitems, $month, $year, $monthName); @@ -224,6 +176,7 @@ if (isset ($_user['user_id'])) { case 'month_view' : $agendaitems = get_myagendaitems($courses_dbs, $month, $year); $agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "month_view"); + if (api_get_setting("allow_personal_agenda") == "true") { $agendaitems = get_personal_agenda_items($agendaitems, $day, $month, $year, $week, "month_view"); diff --git a/main/chat/chat.php b/main/chat/chat.php index b1e10fe7bd..bb1bb871c0 100755 --- a/main/chat/chat.php +++ b/main/chat/chat.php @@ -56,8 +56,15 @@ if (!empty($mycourseid) && $mycourseid != -1) { } if (api_get_setting('show_navigation_menu') != 'false') { $footer_size = 20; -} else { - switch($my_style) { +} else { + $top_size = 135; + switch($my_style) { + case 'chamilo_red' : + case 'chamilo_green' : + case 'chamilo' : + $top_size = 185; + $footer_size = 48; + break; case 'dokeos_classic' : case 'chamilo_classic' : $footer_size = 48; @@ -79,6 +86,7 @@ if (api_get_setting('show_navigation_menu') != 'false') { break; } } + $cidreq = Security::remove_XSS($_GET['cidReq']); ?> @@ -92,7 +100,7 @@ $cidreq = Security::remove_XSS($_GET['cidReq']); echo''.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('siteName').''; if (empty($open_chat_window)) { - echo''; + echo''; echo ''; } diff --git a/main/chat/chat_whoisonline.php b/main/chat/chat_whoisonline.php old mode 100644 new mode 100755 index f676fe8421..7564058d3a --- a/main/chat/chat_whoisonline.php +++ b/main/chat/chat_whoisonline.php @@ -90,6 +90,7 @@ if (!empty($course)) { $user_id = $enreg['user_id']; require 'header_frame.inc.php'; + ?> diff --git a/main/conference/api.php b/main/conference/api.php old mode 100644 new mode 100755 index bb7adb8ab9..3dede1f9a7 --- a/main/conference/api.php +++ b/main/conference/api.php @@ -1,14 +1,13 @@ diff --git a/main/conference/testpost.php b/main/conference/testpost.php old mode 100644 new mode 100755 index f4b7b8b966..c28ed5745f --- a/main/conference/testpost.php +++ b/main/conference/testpost.php @@ -1,4 +1,6 @@ + diff --git a/main/css/academica/default.css b/main/css/academica/default.css index 87da2ee522..3cc0712d2b 100755 --- a/main/css/academica/default.css +++ b/main/css/academica/default.css @@ -643,6 +643,41 @@ form span.form_error { padding: 2px 10px; text-align: center; } +/* The cells for the days (1->31) */ +#agenda_list .days_week { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #f5f5f5; +} +#agenda_list .days_weekend { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #e6e6e6; +} +#agenda_list .days_today { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #FFFFC0; +} + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/baby_orange/default.css b/main/css/baby_orange/default.css index 6023f82366..0bb1a0b4fb 100755 --- a/main/css/baby_orange/default.css +++ b/main/css/baby_orange/default.css @@ -613,6 +613,41 @@ form span.form_error { text-align: center; border:1px solid #EE4C03; } +/* The cells for the days (1->31) */ +#agenda_list .days_week { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #f5f5f5; +} +#agenda_list .days_weekend { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #e6e6e6; +} +#agenda_list .days_today { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #FFFFC0; +} + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /*The caption of the calendar (displays the month and the << and >> links*/ #agenda_list .title { background-color: #680157; diff --git a/main/css/blue_lagoon/default.css b/main/css/blue_lagoon/default.css index 958f5e161c..d59cf15a0c 100755 --- a/main/css/blue_lagoon/default.css +++ b/main/css/blue_lagoon/default.css @@ -701,7 +701,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -710,7 +710,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -719,12 +719,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/chamilo/default.css b/main/css/chamilo/default.css index 407a1bc887..3e893087f6 100755 --- a/main/css/chamilo/default.css +++ b/main/css/chamilo/default.css @@ -1014,7 +1014,7 @@ input.liteoption { text-align: center; } /* The cells with the name of the days of the weeks (mon->sun)*/ -#agenda_list .weekdays { +#agenda_list .weekdays, .data_table .weekdays { background-color: #dcdcdc; text-align: center; font-weight: bold; @@ -1027,7 +1027,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -1036,7 +1036,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -1045,12 +1045,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/chamilo_green/default.css b/main/css/chamilo_green/default.css index 9aa4baa29c..6746d7bf04 100755 --- a/main/css/chamilo_green/default.css +++ b/main/css/chamilo_green/default.css @@ -1031,7 +1031,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -1040,7 +1040,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -1049,12 +1049,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/chamilo_red/default.css b/main/css/chamilo_red/default.css index d1fd6bee98..80483bbbc6 100755 --- a/main/css/chamilo_red/default.css +++ b/main/css/chamilo_red/default.css @@ -1025,7 +1025,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -1034,7 +1034,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -1043,12 +1043,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/cool_blue/default.css b/main/css/cool_blue/default.css index b11a8b8df5..550a6f227e 100755 --- a/main/css/cool_blue/default.css +++ b/main/css/cool_blue/default.css @@ -680,7 +680,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -689,7 +689,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -698,11 +698,15 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; +} + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; } /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { diff --git a/main/css/corporate/default.css b/main/css/corporate/default.css index 6c07e210b4..535b77333e 100755 --- a/main/css/corporate/default.css +++ b/main/css/corporate/default.css @@ -607,34 +607,40 @@ form span.form_error { border: 1px solid #CCCCCC; border-collapse: collapse; } + /* The cells for the days (1->31) */ -.days_week { +#agenda_list .days_week { height: 40px; width: 12%; - border: 1px solid #CCCCCC; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #f9f9f9; + background-color: #f5f5f5; } -.days_weekend { +#agenda_list .days_weekend { height: 40px; width: 12%; - border: 1px solid #CCCCCC; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #eaeaea; + background-color: #e6e6e6; } -.days_today { +#agenda_list .days_today { height: 40px; width: 12%; - border: 1px solid #CCCCCC; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } -.agenda_month_divider { - background-color: #666; - color: #fff; - text-align: center; + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; } /*The caption of the calendar (displays the month and the << and >> links*/ #agenda_list .title { diff --git a/main/css/cosmic_campus/default.css b/main/css/cosmic_campus/default.css index 23bb73c43a..48d9c71564 100755 --- a/main/css/cosmic_campus/default.css +++ b/main/css/cosmic_campus/default.css @@ -692,6 +692,39 @@ form span.form_error { padding: 2px 10px; text-align: center; } +#agenda_list .days_week { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #f5f5f5; +} +#agenda_list .days_weekend { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #e6e6e6; +} +#agenda_list .days_today { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #FFFFC0; +} + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/delicious_bordeaux/default.css b/main/css/delicious_bordeaux/default.css index ca46463de8..fb17a3a1c9 100755 --- a/main/css/delicious_bordeaux/default.css +++ b/main/css/delicious_bordeaux/default.css @@ -699,7 +699,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -708,7 +708,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -717,12 +717,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/dokeos_blue/default.css b/main/css/dokeos_blue/default.css index 253250ba4a..6f89dc9386 100755 --- a/main/css/dokeos_blue/default.css +++ b/main/css/dokeos_blue/default.css @@ -685,7 +685,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -694,7 +694,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -703,12 +703,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/dokeos_classic/default.css b/main/css/dokeos_classic/default.css index 4c11a63fe8..ae6a60abfe 100755 --- a/main/css/dokeos_classic/default.css +++ b/main/css/dokeos_classic/default.css @@ -743,13 +743,14 @@ input.liteoption { border: 1px solid #264269; border-collapse: collapse; } + /* The cells for the days (1->31) */ #agenda_list .days_week { height: 40px; width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -758,7 +759,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -767,12 +768,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/dokeos_classic_2D/default.css b/main/css/dokeos_classic_2D/default.css index baf6ff8dea..157c27dcb5 100755 --- a/main/css/dokeos_classic_2D/default.css +++ b/main/css/dokeos_classic_2D/default.css @@ -699,32 +699,41 @@ input.liteoption { font-weight: bold; text-align: center; } -#agenda_list .days_week, #agenda_list .days_weekend, #agenda_list .days_today { - border: 1px solid #264269; - border-collapse: collapse; +/* The cells for the days (1->31) */ +#agenda_list .days_week { height: 40px; + width: 12%; text-align: left; vertical-align: top; - width: 12%; -} -/* The cells for the days (1->31) */ -#agenda_list .days_week { + border: 1px solid #ccc; + border-collapse: collapse; background-color: #f5f5f5; } #agenda_list .days_weekend { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; background-color: #e6e6e6; } #agenda_list .days_today { - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; -} -#agenda_list .data, #agenda_list .datanotbold, #agenda_list .text, #agenda_list .data_hidden, #agenda_list .datanotbold_hidden, #agenda_list .text_hidden, #agenda_list .datanow, #agenda_list .datanotboldnow, #agenda_list .textnow { - border: 0px solid #4171B5; - border-collapse: collapse; - padding: 2px 10px; + height: 40px; + width: 12%; text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #FFFFC0; +} + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; } + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/empire_green/default.css b/main/css/empire_green/default.css index 09bfe6d5cd..1c25405afa 100755 --- a/main/css/empire_green/default.css +++ b/main/css/empire_green/default.css @@ -696,7 +696,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -705,7 +705,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -714,12 +714,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/fruity_orange/default.css b/main/css/fruity_orange/default.css index 96924df2a9..5be0fb7068 100755 --- a/main/css/fruity_orange/default.css +++ b/main/css/fruity_orange/default.css @@ -695,7 +695,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -704,7 +704,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -713,12 +713,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/medical/default.css b/main/css/medical/default.css index 9abdbcd2e9..e352e86216 100755 --- a/main/css/medical/default.css +++ b/main/css/medical/default.css @@ -782,7 +782,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -791,7 +791,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -800,12 +800,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/public_admin/default.css b/main/css/public_admin/default.css index 578f9bca72..155abe0d66 100755 --- a/main/css/public_admin/default.css +++ b/main/css/public_admin/default.css @@ -793,7 +793,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -802,7 +802,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -811,12 +811,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/royal_purple/default.css b/main/css/royal_purple/default.css index eb652660d8..e2e8b9d74d 100755 --- a/main/css/royal_purple/default.css +++ b/main/css/royal_purple/default.css @@ -693,7 +693,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -702,7 +702,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -711,12 +711,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/silver_line/default.css b/main/css/silver_line/default.css index 753ebf31d5..e658f8d8d0 100755 --- a/main/css/silver_line/default.css +++ b/main/css/silver_line/default.css @@ -830,124 +830,251 @@ div.row div.label { AGENDA ============================================================================== */ - -#agenda_list { +#agenda { + width: 100%; margin: 0 auto; - width: 95%; + border: 1px solid #bbb; + border-collapse: collapse; } -#agenda_list .datanow { - background: #ddd url('images/headertables.jpg') repeat-x top center; - border: 1px solid #ddd; - vertical-align: top; +.agenda_month_divider { + background-color: #dcdcdc; + font-weight: bold; + color: #666; + text-align: center; } -#agenda_list img { - margin-right: .8em; +#agenda .title a { + color: #fff; } -#agenda_list td.data img, #agenda_list td.datanow img { - margin-bottom: -.6em; - margin-top: -.3em; +#agenda .agendaitem { } -#agenda_list td.textnow { - border: 1px solid #bbb; - background-color: #eee; - padding: .5em; +#smallcalendar .title { + background-color: #dcdcdc; + font-weight: bold; + padding: 2px; + color: #666; + text-align: center; + font-size: 11px; } -#agenda_list tr, #agenda_list td { - width: auto; - border: none; +#smallcalendar .title a { + color: #666; } -#agenda_list tr.data, #agenda_list td.data, .data { - background: transparent url('images/headertables.jpg') repeat-x top center; - vertical-align: top; - border: 1px solid #ddd; +#agenda_select { + list-style: none; + border: 0px solid green; + margin: 30px 0 0 0; + padding: 0 0 0 10px; } -#agenda_list tr.text, #agenda_list td.text, .text { - border: 1px solid #ddd; +/* --------------------------------------------------- + styles for the agenda (day, week, month view) +-----------------------------------------------------*/ +#agenda_list { + width: 100%; + margin: 0 auto; + border: 1px solid #fff; + border-collapse: collapse; } -.agenda_month_divider { +/*The caption of the calendar (displays the month and the << and >> links*/ +#agenda_list .title { + background-color: #dcdcdc; + font-weight: bold; + color: #666; + text-align: left; + padding: 2px 10px; text-align: center; - background: #fff url("images/divider2.jpg") no-repeat 50% 1.3em; - height: 2.8em; + border: 1px solid #bbb; } -.agenda_month_divider, .title { - font: bold 1.2em Arial, sans-serif, sans; - color: #4170b4; +#agenda_list .title a:link, #agenda_list #title a:visited { + background-color: #dcdcdc; + font-weight: bold; + font-size: 11px; + color: #666; + padding: 2px 10px; text-align: center; } -#agenda_select img { - margin-right: .2em; +#agenda_list .title a:hover { + background-color: #dcdcdc; + font-weight: bold; + font-size: 11px; + color: #f3840d; + padding: 2px 10px; + text-align: center; } -#agenda_select li { - margin-bottom: .6em; - font: bold 1em Arial, sans-serif, sans; +/* The cells with the name of the days of the weeks (mon->sun)*/ +#agenda_list .weekdays { + background-color: #dcdcdc; + text-align: center; + font-weight: bold; + border: 1px solid #264269; + border-collapse: collapse; } -#agenda_select li a { - font: bold 1em Arial, sans-serif, sans; - text-decoration: none; +/* The cells for the days (1->31) */ +#agenda_list .days_week { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #f5f5f5; } -.alternativeBgLight { - background-color: #ccc; +#agenda_list .days_weekend { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #e6e6e6; } -.announcements_datum { - color: #888; - border: 1px solid #ddd; +#agenda_list .days_today { + height: 40px; + width: 12%; + text-align: left; + vertical-align: top; + border: 1px solid #ccc; + border-collapse: collapse; + background-color: #FFFFC0; +} + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + +/* text in the cells: display of agenda items (visible)*/ +#agenda_list .data { background-color: #eee; + text-align: left; + padding: 2px 10px; + font-weight: bold; + border: 0px solid #dcdcdc; + border-collapse: collapse; } -.data, .announcements_datum, .datanow { - font: bold 1em Arial, sans-serif, sans; +#agenda_list .datanotbold { + background-color: #eee; + text-align: left; + padding: 2px 10px; + font-weight: normal; + border: 0px solid #dcdcdc; + border-collapse: collapse; } -.datanotbold { +#agenda_list .text { + background-color: #fff; + text-align: left; + padding: 2px 10px; font-weight: normal; + border: 0px solid #dcdcdc; + border-collapse: collapse; } -span.agendaitem { - text-align: center; - display: block; - font-size: 95%; - width: 90%; - margin: 0 auto; - font-size: .9em; +/*text in the cells: display of agenda items (invisible)*/ +#agenda_list .data_hidden { + background-color: #eee; + text-align: left; + padding: 2px 10px; + font-weight: bold; + border: 0px solid #dcdcdc; + border-collapse: collapse; + color: #999999; } -span.agendaitem i { - font: bold 97% Arial, sans-serif, sans; - color: #a9a; +#agenda_list .datanotbold_hidden { + background-color: #eee; + text-align: left; + padding: 2px 10px; + font-weight: normal; + border: 0px solid #dcdcdc; + border-collapse: collapse; + color: #999999; } -/* Calendar */ -.days_today { - font: bold 1em Arial, sans-serif, sans; - text-decoration: none; - color: #667; +#agenda_list .text_hidden { + background-color: #fff; + text-align: left; + padding: 2px 10px; + font-weight: normal; + border: 0px solid #dcdcdc; + border-collapse: collapse; + color: #999999; } -.days_week { - background-color: #ccc; +/*text in the cells: display of agenda items (highlighted)*/ +#agenda_list .datanow { + background-color: #FFCC00; + text-align: left; + padding: 2px 10px; + font-weight: bold; + border: 0px solid #dcdcdc; + border-collapse: collapse; } -.days_week, .days_weekend, .days_today { - text-align: center; +#agenda_list .datanotboldnow { + background-color: #FFCC00; + text-align: left; + padding: 2px 10px; + font-weight: normal; + border: 0px solid #dcdcdc; + border-collapse: collapse; } -.days_week a, .days_weekend a { - font: bold 1em Arial, sans-serif, sans; +#agenda_list .textnow { + background-color: #fff; + text-align: left; + padding: 2px 10px; + font-weight: normal; + border: 0px solid #dcdcdc; + border-collapse: collapse; } -.days_weekend { - background-color: #aaa; +/* --------------------------------------------------- + styles for the mini agenda +-----------------------------------------------------*/ +#smallcalendar { + width: 100%; + margin: 0 auto; + border: 1px solid #fff; + border-collapse: collapse; } -.days_weekend .agendaitem i { - color: #444; +#smallcalendar .weekdays { + background-color: #dcdcdc; + text-align: center; + font-size: 11px; + font-weight: bold; + border: 1px solid #fff; + border-collapse: collapse; } -#newedit_form tr.title { - background:none; - text-align:left; +#smallcalendar .days_week { + background-color: #f5f5f5; + text-align: center; + font-size: 11px; + border-collapse: collapse; } -.title { - background: #ddd url('images/headertables.jpg') repeat-x top center; +#smallcalendar .days_weekend { + background-color: #e6e6e6; + text-align: center; + font-size: 11px; + border: 1px solid #fff; + border-collapse: collapse; } -.weekdays { - font: bold 1.1em Arial, sans-serif, sans; - color: #fff; - background-color: #667; +#smallcalendar .days_today { + width: 12%; text-align: center; + font-size: 11px; + border: 1px solid #FA8500; + border-collapse: collapse; + background-color: #FFCA8D; } -.ical_export { - float: right; - margin-top: 0.2em; +/* --------------------------------------------------- + styles for the personal agenda +-----------------------------------------------------*/ +.personal_agenda { + color: #008000; +} +.personal_agenda a:link, .personal_agenda a:visited { + color: #008000; +} +a.personal_agenda:link, a.personal_agenda:visited { + color: #008000; +} +.personal_agenda a:hover, .personal_agenda a:hover { + color: #666666; +} +a.personal_agenda:hover, a.personal_agenda:hover { + color: #666666; } /* ============================================================================== diff --git a/main/css/sober_brown/default.css b/main/css/sober_brown/default.css index 27c213f015..4e959d538a 100755 --- a/main/css/sober_brown/default.css +++ b/main/css/sober_brown/default.css @@ -766,7 +766,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -775,7 +775,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -784,37 +784,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; - border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; -} -/* text in the cells: display of agenda items (visible)*/ -#agenda_list .data { - background-color: #eee; - text-align: left; - padding: 2px 10px; - font-weight: bold; - border: 0px solid #dcdcdc; - border-collapse: collapse; -} -#agenda_list .datanotbold { - background-color: #eee; - text-align: left; - padding: 2px 10px; - font-weight: normal; - border: 0px solid #dcdcdc; + border: 1px solid #ccc; border-collapse: collapse; + background-color: #FFFFC0; } -#agenda_list .text { - background-color: #fff; - text-align: left; - padding: 2px 10px; - font-weight: normal; - border: 0px solid #dcdcdc; - border-collapse: collapse; + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; } + /*text in the cells: display of agenda items (invisible)*/ #agenda_list .data_hidden { background-color: #eee; diff --git a/main/css/steel_grey/default.css b/main/css/steel_grey/default.css index 6fd1d14d29..08abb84f24 100755 --- a/main/css/steel_grey/default.css +++ b/main/css/steel_grey/default.css @@ -698,7 +698,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -707,7 +707,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -716,12 +716,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/css/tasty_olive/default.css b/main/css/tasty_olive/default.css index 4da454f56d..5b0f8b330d 100755 --- a/main/css/tasty_olive/default.css +++ b/main/css/tasty_olive/default.css @@ -695,7 +695,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #f5f5f5; } @@ -704,7 +704,7 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; background-color: #e6e6e6; } @@ -713,12 +713,17 @@ input.liteoption { width: 12%; text-align: left; vertical-align: top; - border: 1px solid #264269; + border: 1px solid #ccc; border-collapse: collapse; - background-color: #FFCA8D; - color: #CC3300; - font-weight: bold; + background-color: #FFFFC0; } + +#agenda_list th { + background-color:#E5EDF9; + border:1px solid gray; + padding-right:12px; +} + /* text in the cells: display of agenda items (visible)*/ #agenda_list .data { background-color: #eee; diff --git a/main/default_course_document/images/logo_dokeos.png b/main/default_course_document/images/logo_dokeos.png old mode 100644 new mode 100755 index ecce8cad1f..b5a87206dc Binary files a/main/default_course_document/images/logo_dokeos.png and b/main/default_course_document/images/logo_dokeos.png differ diff --git a/main/document/document.inc.php b/main/document/document.inc.php index 7088966a43..f49e535d8e 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -62,7 +62,7 @@ function build_directory_selector($folders, $curdirpath, $group_dir = '', $chang $userinfo = Database::get_user_info_from_id(substr($folder_titles[$folder], 8)); $folder_titles[$folder] = api_get_person_name($userinfo['firstname'], $userinfo['lastname']); } - + $folder_titles[$folder] = cut($folder_titles[$folder], 80); $label = str_repeat('   ', count($path_parts) - 2).' — '.$folder_titles[$folder]; $parent_select -> addOption($label, $folder); if ($selected != '') { @@ -78,8 +78,9 @@ function build_directory_selector($folders, $curdirpath, $group_dir = '', $chang $label = '/ ('.get_lang('HomeDirectory').')'; } else { $path_parts = explode('/', str_replace($group_dir, '', $folder)); + $label = cut($label, 80); $label = str_repeat('   ', count($path_parts) - 2).' — '.$label; - } + } $parent_select -> addOption($label, $folder); if ($selected != '') { $parent_select->setSelected($folder); @@ -129,7 +130,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility $ext = explode('.', $path); $ext = strtolower($ext[sizeof($ext) - 1]); // "htmlfiles" are shown in a frameset - if ($ext == 'htm' || $ext == 'html' || $ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png') { + if ($ext == 'htm' || $ext == 'html' || $ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'pdf' || $ext == 'swf' || $ext == 'mp3') { $url = 'showinframes.php?'.api_get_cidreq().'&file='.$url_path.$req_gid; } else { // url-encode for problematic characters (we may not call them dangerous characters...) diff --git a/main/document/document.php b/main/document/document.php index c67a6be04d..bebfb78be2 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -278,7 +278,7 @@ $image_files_only = ''; if ($is_certificate_mode) { $interbreadcrumb[]= array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook')); } else { - $interbreadcrumb[]= array('url' => '', 'name' => get_lang('Document')); + $interbreadcrumb[]= array('url' => '', 'name' => get_lang('Documents')); } // Interbreadcrumb for the current directory root path @@ -305,10 +305,15 @@ for ($i = 0; $i < $array_len; $i++) { } $url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i]; + + //Max char 80 + $url_to_who = cut($dir_array[$i],80); + if ($is_certificate_mode) { - $interbreadcrumb[] = array('url' => $url_dir.'&selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => $dir_array[$i]); + $interbreadcrumb[] = array('url' => $url_dir.'&selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => $url_to_who); } else { - $interbreadcrumb[] = array('url' => $url_dir, 'name' => $dir_array[$i]); + + $interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who); } $dir_acum .= $dir_array[$i].'/'; diff --git a/main/document/edit_document.php b/main/document/edit_document.php index 34762caec0..891873f314 100755 --- a/main/document/edit_document.php +++ b/main/document/edit_document.php @@ -592,8 +592,8 @@ function nav_to_slideshow($slide_id) { $path = Security::remove_XSS($_GET['curdirpath']); $pathurl = urlencode($path); echo ''; } diff --git a/main/document/showinframes.php b/main/document/showinframes.php index 704a96fb0a..630285d30f 100755 --- a/main/document/showinframes.php +++ b/main/document/showinframes.php @@ -42,7 +42,9 @@ if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') { } $interbreadcrumb[] = array('url' => './document.php?curdirpath='.dirname($header_file).$req_gid, 'name' => get_lang('Documents')); -$interbreadcrumb[] = array('url' => 'showinframes.php?file='.$header_file, 'name' => $header_file); +$name_to_show = cut($header_file, 80); +$interbreadcrumb[] = array('url' => 'showinframes.php?file='.$header_file, 'name' => $name_to_show); + $file_url_sys = api_get_path(SYS_COURSE_PATH).'document'.$header_file; $path_info = pathinfo($file_url_sys); $this_section = SECTION_COURSES; @@ -60,7 +62,6 @@ if (!empty($_GET['nopages'])) { $_SESSION['whereami'] = 'document/view'; -$interbreadcrumb[] = array('url' => './document.php', 'name' => get_lang('Documents')); $nameTools = get_lang('Documents'); $file = Security::remove_XSS(urldecode($_GET['file'])); @@ -138,7 +139,7 @@ $htmlHeadXtra[] = ''; } - } // Save the Scores save_scores($test, $score); // Back -if ($origin != 'learnpath') -{ +if ($origin != 'learnpath') { // $url = "Hpdownload.php?doc_url=".$test."&cid=".$cid; // back to the test $url = "exercice.php"; // back to exercices $jscript2run .= ''; echo $jscript2run; -} -else -{ +} else { ?> diff --git a/main/forum/index.php b/main/forum/index.php index 42cfd7b246..4667b24633 100755 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -1,28 +1,5 @@ -'; $htmlHeadXtra[] = '"; } -if ( (! $is_allowed_to_edit) or ($isStudentView) ) -{ +if ( (! $is_allowed_to_edit) or ($isStudentView) ) { error_log('New LP - User not authorized in lp_add_item.php'); header('location:lp_controller.php?action=view&lp_id='.$learnpath_id); + exit; } //from here on, we are admin because of the previous condition, so don't check anymore @@ -202,14 +163,12 @@ $therow=Database::fetch_array($result); //$admin_output = ''; /* ------------------------------------------------------------ Course admin section - all the functions not available for students - always available in this case (page only shown to admin) ------------------------------------------------------------ */ -/*================================================== +/* SHOWING THE ADMIN TOOLS - ==================================================*/ + */ if (isset($_SESSION['gradebook'])){ $gradebook= $_SESSION['gradebook']; } @@ -224,7 +183,7 @@ if (!empty($gradebook) && $gradebook=='view') { $interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path")); $interbreadcrumb[]= array ("url"=>api_get_self()."?action=build&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}")); -switch($_GET['type']){ +switch($_GET['type']) { case 'chapter': $interbreadcrumb[]= array ("url"=>"#", "name" => get_lang("NewChapter")); break; @@ -270,19 +229,14 @@ function confirmation(name) //echo $admin_output; /* ------------------------------------------------------------ DISPLAY SECTION ------------------------------------------------------------ */ echo $_SESSION['oLP']->build_action_menu(); echo '
'; - echo ''; - echo ''; echo ''."\n" . '\n"; -if ($is_allowed_to_edit) -{ +if ($is_allowed_to_edit) { echo '\n" . //xport now is inside "Edit" //'\n" . @@ -180,12 +172,10 @@ $flat_list = $list->get_flat_list(); $test_mode = api_get_setting('server_type'); $max = count($flat_list); //var_dump($flat_list); -if (is_array($flat_list)) -{ +if (is_array($flat_list)) { $counter = 0; $current = 0; - foreach ($flat_list as $id => $details) - { + foreach ($flat_list as $id => $details) { //validacion when belongs to a session $session_img = api_get_session_image($details['lp_session'], $_user['status']); @@ -242,13 +232,10 @@ if (is_array($flat_list)) $lp_theme_css=$mystyle; - if($display_progress_bar) - { - $dsp_progress = ''; - } - else - { - $dsp_progress = ''; + if($display_progress_bar) { + $dsp_progress = ''; + } else { + $dsp_progress = ''; } if($is_allowed_to_edit) { @@ -524,9 +511,7 @@ echo "
'; // show the template list - if (isset($_GET['type']) && $_GET['type']=='document' && !isset($_GET['file'])) - { + if (isset($_GET['type']) && $_GET['type']=='document' && !isset($_GET['file'])) { $count_items = count($_SESSION['oLP']->ordered_items); $style = ($count_items > 12)?' style="height:250px;width:230px;overflow-x : auto; overflow-y : scroll;" ':' class="lp_tree" '; echo '
'; @@ -300,146 +254,90 @@ echo ''; echo ''; } - echo ''; echo ''; - echo ''; - echo '
'; - if(isset($new_item_id) && is_numeric($new_item_id)) - { - switch($_GET['type']) - { - - case 'chapter': - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewChapterCreated')); - break; - - case TOOL_LINK: - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewLinksCreated')); - break; - - case TOOL_STUDENTPUBLICATION: - - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewStudentPublicationCreated')); - break; - - case 'module': - - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewModuleCreated')); - break; - - case TOOL_QUIZ: - - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewExerciseCreated')); - break; - - - case TOOL_DOCUMENT: - Display::display_confirmation_message(get_lang('NewDocumentCreated')); - echo $_SESSION['oLP']->display_item($new_item_id, true, $msg); - break; - - - case TOOL_FORUM: - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewForumCreated')); - break; - - - case 'thread': - echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); - Display::display_confirmation_message(get_lang('NewThreadCreated')); - break; - - } + if(isset($new_item_id) && is_numeric($new_item_id)) { + switch($_GET['type']) { + case 'chapter': + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewChapterCreated')); + break; + case TOOL_LINK: + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewLinksCreated')); + break; + case TOOL_STUDENTPUBLICATION: + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewStudentPublicationCreated')); + break; + case 'module': + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewModuleCreated')); + break; + case TOOL_QUIZ: + + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewExerciseCreated')); + break; + + case TOOL_DOCUMENT: + Display::display_confirmation_message(get_lang('NewDocumentCreated')); + echo $_SESSION['oLP']->display_item($new_item_id, true, $msg); + break; + case TOOL_FORUM: + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewForumCreated')); + break; + case 'thread': + echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']); + Display::display_confirmation_message(get_lang('NewThreadCreated')); + break; } - else - { - switch($_GET['type']) - { - case 'chapter': - - echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang("EnterDataNewChapter")); - - break; - - case 'module': - - echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang("EnterDataNewModule")); - - break; - - case 'document': - - if(isset($_GET['file']) && is_numeric($_GET['file'])) - { - echo $_SESSION['oLP']->display_document_form('add', 0, $_GET['file']); - } - else - { - echo $_SESSION['oLP']->display_document_form('add', 0); - } - - break; - - case 'hotpotatoes': - - echo $_SESSION['oLP']->display_hotpotatoes_form('add', 0, $_GET['file']); - - break; - - case 'quiz': - - echo $_SESSION['oLP']->display_quiz_form('add', 0, $_GET['file']); - - break; - - case 'forum': - - echo $_SESSION['oLP']->display_forum_form('add', 0, $_GET['forum_id']); - - break; - - case 'thread': - - echo $_SESSION['oLP']->display_thread_form('add', 0, $_GET['thread_id']); - - break; - - case 'link': - - echo $_SESSION['oLP']->display_link_form('add', 0, $_GET['file']); - - break; - - case 'student_publication': - - echo $_SESSION['oLP']->display_student_publication_form('add', 0, $_GET['file']); - - break; - - case 'step': - - echo $_SESSION['oLP']->display_resources(); - - break; - } + } else { + switch($_GET['type']) { + case 'chapter': + echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang("EnterDataNewChapter")); + break; + case 'module': + echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang("EnterDataNewModule")); + break; + case 'document': + if(isset($_GET['file']) && is_numeric($_GET['file'])) { + echo $_SESSION['oLP']->display_document_form('add', 0, $_GET['file']); + } else { + echo $_SESSION['oLP']->display_document_form('add', 0); + } + break; + case 'hotpotatoes': + echo $_SESSION['oLP']->display_hotpotatoes_form('add', 0, $_GET['file']); + break; + case 'quiz': + echo $_SESSION['oLP']->display_quiz_form('add', 0, $_GET['file']); + break; + case 'forum': + echo $_SESSION['oLP']->display_forum_form('add', 0, $_GET['forum_id']); + break; + case 'thread': + echo $_SESSION['oLP']->display_thread_form('add', 0, $_GET['thread_id']); + break; + case 'link': + echo $_SESSION['oLP']->display_link_form('add', 0, $_GET['file']); + break; + case 'student_publication': + echo $_SESSION['oLP']->display_student_publication_form('add', 0, $_GET['file']); + break; + case 'step': + echo $_SESSION['oLP']->display_resources(); + break; } - + } echo '
'; /* -============================================================================== FOOTER -============================================================================== */ Display::display_footer(); ?> \ No newline at end of file diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php index 1f8ba69eca..5103554629 100755 --- a/main/newscorm/lp_list.php +++ b/main/newscorm/lp_list.php @@ -60,10 +60,8 @@ $current_session = api_get_session_id(); //api_display_tool_title($nameTools); /* ------------------------------------------------------------ Introduction section (editable by course admins) ------------------------------------------------------------ */ Display::display_introduction_section(TOOL_LEARNPATH, array( 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', @@ -74,16 +72,12 @@ Display::display_introduction_section(TOOL_LEARNPATH, array( $is_allowed_to_edit = api_is_allowed_to_edit(null,true); -if($is_allowed_to_edit) -{ - - - /*-------------------------------------- +if ($is_allowed_to_edit) { + /* DIALOG BOX SECTION - --------------------------------------*/ + */ - if (!empty($dialog_box)) - { + if (!empty($dialog_box)) { switch ($_GET['dialogtype']) { case 'confirmation': @@ -100,8 +94,7 @@ if($is_allowed_to_edit) break; } } - if (api_failure::get_last_failure()) - { + if (api_failure::get_last_failure()) { Display::display_normal_message(api_failure::get_last_failure()); } @@ -157,8 +150,7 @@ if (!empty($curDirPath)) echo '
'.get_lang('Title').''.get_lang('Progress')."'.get_lang('CourseSettings')."'.get_lang('ExportShort')."'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id,api_get_user_id()),'').''.learnpath::get_db_progress($id,api_get_user_id(),'both').''.learnpath::get_progress_bar('%',learnpath::get_db_progress($id,api_get_user_id()),'').''.learnpath::get_db_progress($id,api_get_user_id(),'both').'
"; echo "

"; /* -============================================================================== FOOTER -============================================================================== */ Display::display_footer(); -?> +?> \ No newline at end of file diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index c9f9902c9d..beb097127d 100755 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -391,6 +391,20 @@ window.onload = function() { document.body.style.overflow = 'hidden'; updateContentHeight(); viewportheight = window.innerHeight; + //Fixing IE compatibility of window.innerHeight + + var viewportheight = 0; + if( typeof( window.innerHeight ) == 'number' ) { + //Non-IE + viewportheight = window.innerHeight; + } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { + //IE 6+ in 'standards compliant mode' + viewportheight = document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { + //IE 4 compatible + viewportheight = document.body.clientHeight; + } + document.getElementById('toc_id').style.height = viewportheight - 200 + "px"; } @@ -584,7 +598,21 @@ window.onload = function() { rightZoneHeightOccupied = docHeight - initialRightZoneHeight; document.body.style.overflow = 'hidden'; updateContentHeight(); - viewportheight = window.innerHeight; + + //Fixing IE compatibility of window.innerHeight + + var viewportheight = 0; + if( typeof( window.innerHeight ) == 'number' ) { + //Non-IE + viewportheight = window.innerHeight; + } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { + //IE 6+ in 'standards compliant mode' + viewportheight = document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { + //IE 4 compatible + viewportheight = document.body.clientHeight; + } + document.getElementById('toc_id').style.height = viewportheight - 200 + "px"; @@ -633,4 +661,4 @@ window.onresize = updateContentHeight; //Display::display_footer(); } //restore global setting -$_setting['show_navigation_menu'] = $save_setting; \ No newline at end of file +$_setting['show_navigation_menu'] = $save_setting; diff --git a/main/resourcelinker/resourcelinker.inc.php b/main/resourcelinker/resourcelinker.inc.php index c0480bed34..aebe182e1e 100755 --- a/main/resourcelinker/resourcelinker.inc.php +++ b/main/resourcelinker/resourcelinker.inc.php @@ -1,42 +1,18 @@ "; /* -============================================================================== FOOTER -============================================================================== */ - Display :: display_footer(); -?> - +?> \ No newline at end of file diff --git a/main/social/groups.php b/main/social/groups.php index b5625ff9e5..b0f67d3171 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -142,7 +142,7 @@ if (isset($_GET['view']) && in_array($_GET['view'],$allowed_views)) { } } else { $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups')); - $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('MessageList')); + $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('GroupList')); } Display :: display_header($tool_name, 'Groups'); @@ -431,31 +431,54 @@ if ($group_id != 0 ) { } } + + // display groups (newest, mygroups, pop) echo ''; diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index e94d212dc6..19587cc1d8 100644 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -217,16 +217,16 @@ class survey_manager { } $sql = "INSERT INTO $table_survey (code, title, subtitle, author, lang, avail_from, avail_till, is_shared, template, intro, surveythanks, creation_date, anonymous".$additional['columns'].", session_id) VALUES ( '".Database::escape_string(strtolower(generate_course_code(api_substr($values['survey_code'],0))))."', - '".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['survey_title'])), COURSEMANAGERLOWSECURITY))."', - '".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['survey_subtitle'])), COURSEMANAGERLOWSECURITY))."', + '".Database::escape_string($values['survey_title'])."', + '".Database::escape_string($values['survey_subtitle'])."', '".Database::escape_string($_user['user_id'])."', '".Database::escape_string($values['survey_language'])."', '".Database::escape_string($values['start_date'])."', '".Database::escape_string($values['end_date'])."', '".Database::escape_string($shared_survey_id)."', '".Database::escape_string('template')."', - '".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['survey_introduction'])), COURSEMANAGERLOWSECURITY))."', - '".Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($values['survey_thanks'])), COURSEMANAGERLOWSECURITY))."', + '".Database::escape_string($values['survey_introduction'])."', + '".Database::escape_string($values['survey_thanks'])."', '".date('Y-m-d H:i:s')."', '".Database::escape_string($values['anonymous'])."'".$additional['values'].", ".intval($_SESSION['id_session'])." diff --git a/main/wiki/index.php b/main/wiki/index.php index e7555259ef..a20d4d7638 100755 --- a/main/wiki/index.php +++ b/main/wiki/index.php @@ -93,6 +93,10 @@ event_access_tool(TOOL_WIKI); HEADER & TITLE */ // If it is a group wiki then the breadcrumbs will be different. + +//Setting variable +$_clean['group_id'] = 0; + if ($_SESSION['_gid'] OR $_GET['group_id']) { if (isset($_SESSION['_gid'])) { @@ -111,10 +115,10 @@ if ($_SESSION['_gid'] OR $_GET['group_id']) { //ensure this tool in groups whe it's private or deactivated if ($group_properties['wiki_state']==0) { - echo api_not_allowed(); + api_not_allowed(); } elseif ($group_properties['wiki_state']==2) { if (!api_is_allowed_to_edit(false,true) and !GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid'])) { - echo api_not_allowed(); + api_not_allowed(); } } } else { @@ -448,6 +452,13 @@ if (!in_array($_GET['action'], array('addnew', 'searchpages', 'allpages', 'recen echo '
'; } + +//In new pages go to new page +if (isset($_POST['SaveWikiNew'])) +{ + display_wiki_entry(Security::remove_XSS($_POST['reflink'])); +} + /////////////////////// more options /////////////////////// Juan Carlos RaƱa Trabado //more for export to course document area. See display_wiki_entry @@ -1626,7 +1637,7 @@ if ($_GET['action']=='edit') %'; echo '

'; echo '';//prevent double post - echo '';//for save button Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js + echo '';//for save button Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js echo ''; echo ''; } @@ -1839,18 +1850,14 @@ if ($_GET['action']=='history' or Security::remove_XSS($_POST['HistoryDifference //rss feed. TODO: // -if ($_GET['action']=='recentchanges') -{ +if ($_GET['action']=='recentchanges') { $_clean['group_id']=(int)$_SESSION['_gid']; if ( api_is_allowed_to_session_edit(false,true) ) { - if (check_notify_all()==1) - { + if (check_notify_all()==1) { $notify_all= ''.get_lang('FullNotifyByEmail').''.get_lang('NotNotifyChanges'); $lock_unlock_notify_all='unlocknotifyall'; - } - else - { + } else { $notify_all= ''.get_lang('FullCancelNotifyByEmail').''.get_lang('NotifyChanges'); $lock_unlock_notify_all='locknotifyall'; } @@ -1869,14 +1876,12 @@ if ($_GET['action']=='recentchanges') $sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND '.$tbl_wiki.'.'.$groupfilter.$condition_session.' ORDER BY dtime DESC'; // new version - } - else - { + } else { $sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.$condition_session.' AND visibility=1 ORDER BY dtime DESC'; // old version TODO: Replace by the bottom line //$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND visibility=1 AND '.$tbl_wiki.'.'.$groupfilter.' ORDER BY dtime DESC'; // new version } - + $allpages=Database::query($sql); //show table @@ -2348,12 +2353,6 @@ if ($_GET['action']=='discuss') } } -///in new pages go to new page -if ($_POST['SaveWikiNew']) -{ - display_wiki_entry(Security::remove_XSS($_POST['reflink'])); -} - echo ""; // echo "
"; echo "
"; // echo "
"; diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php index 5d1657efe7..1491e75252 100755 --- a/main/wiki/wiki.inc.php +++ b/main/wiki/wiki.inc.php @@ -270,16 +270,17 @@ function save_wiki() { // NOTE: visibility, visibility_disc and ratinglock_disc changes are not made here, but through the interce buttons // cleaning the variables - $_clean['page_id']=Database::escape_string($_POST['page_id']); - $_clean['reflink']=Database::escape_string(Security::remove_XSS($_POST['reflink'])); - $_clean['title']=Database::escape_string(Security::remove_XSS($_POST['title'])); - $_clean['content']= Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['content'])),COURSEMANAGERLOWSECURITY)); - $_clean['user_id']=(int)Database::escape_string(api_get_user_id()); - $_clean['assignment']=Database::escape_string($_POST['assignment']); - $_clean['comment']=Database::escape_string(Security::remove_XSS($_POST['comment'])); - $_clean['progress']=Database::escape_string($_POST['progress']); - $_clean['version']=Database::escape_string($_POST['version'])+1; - $_clean['linksto'] = links_to($_clean['content']); //and check links content + $_clean['page_id'] = Database::escape_string($_POST['page_id']); + $_clean['reflink'] = Database::escape_string($_POST['reflink']); + $_clean['title'] = Database::escape_string($_POST['title']); + $_clean['content'] = Database::escape_string($_POST['content']); + $_clean['user_id'] = api_get_user_id(); + $_clean['assignment'] = Database::escape_string($_POST['assignment']); + $_clean['comment'] = Database::escape_string($_POST['comment']); + $_clean['progress'] = Database::escape_string($_POST['progress']); + $_clean['version'] = intval($_POST['version']) + 1 ; + $_clean['linksto'] = links_to($_clean['content']); //and check links content + $dtime = date( "Y-m-d H:i:s" ); $session_id = api_get_session_id(); @@ -296,56 +297,55 @@ function save_wiki() { if(!empty($_POST['task'])) { - $_clean['task']= Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['task'])),COURSEMANAGERLOWSECURITY)); + $_clean['task']= Database::escape_string($_POST['task']); } - if(!empty($_POST['feedback1']) || !empty($_POST['feedback2']) || !empty($_POST['feedback3'])) - { - $_clean['feedback1']=Database::escape_string(Security::remove_XSS($_POST['feedback1'])); - $_clean['feedback2']=Database::escape_string(Security::remove_XSS($_POST['feedback2'])); - $_clean['feedback3']=Database::escape_string(Security::remove_XSS($_POST['feedback3'])); - $_clean['fprogress1']=Database::escape_string(Security::remove_XSS($_POST['fprogress1'])); - $_clean['fprogress2']=Database::escape_string(Security::remove_XSS($_POST['fprogress2'])); - $_clean['fprogress3']=Database::escape_string(Security::remove_XSS($_POST['fprogress3'])); + if(!empty($_POST['feedback1']) || !empty($_POST['feedback2']) || !empty($_POST['feedback3'])) { + $_clean['feedback1']=Database::escape_string($_POST['feedback1']); + $_clean['feedback2']=Database::escape_string($_POST['feedback2']); + $_clean['feedback3']=Database::escape_string($_POST['feedback3']); + $_clean['fprogress1']=Database::escape_string($_POST['fprogress1']); + $_clean['fprogress2']=Database::escape_string($_POST['fprogress2']); + $_clean['fprogress3']=Database::escape_string($_POST['fprogress3']); } if(Security::remove_XSS($_POST['initstartdate']==1)) { - $_clean['startdate_assig']=Database::escape_string(Security::remove_XSS(get_date_from_select('startdate_assig'))); + $_clean['startdate_assig']=Database::escape_string(get_date_from_select('startdate_assig')); } else { - $_clean['startdate_assig']=Database::escape_string(Security::remove_XSS($_POST['startdate_assig'])); + $_clean['startdate_assig']=Database::escape_string($_POST['startdate_assig']); } if(Security::remove_XSS($_POST['initenddate']==1)) { - $_clean['enddate_assig']=Database::escape_string(Security::remove_XSS(get_date_from_select('enddate_assig'))); + $_clean['enddate_assig']=Database::escape_string(get_date_from_select('enddate_assig')); } else { - $_clean['enddate_assig']=Database::escape_string(Security::remove_XSS($_POST['enddate_assig'])); + $_clean['enddate_assig']=Database::escape_string($_POST['enddate_assig']); } - $_clean['delayedsubmit']=Database::escape_string(Security::remove_XSS($_POST['delayedsubmit'])); + $_clean['delayedsubmit']=Database::escape_string($_POST['delayedsubmit']); if(!empty($_POST['max_text']) || !empty($_POST['max_version'])) { - $_clean['max_text']=Database::escape_string(Security::remove_XSS($_POST['max_text'])); - $_clean['max_version']=Database::escape_string(Security::remove_XSS($_POST['max_version'])); + $_clean['max_text'] =Database::escape_string($_POST['max_text']); + $_clean['max_version']=Database::escape_string($_POST['max_version']); } - $sql = "INSERT INTO ".$tbl_wiki." (page_id, reflink, title, content, user_id, group_id, dtime, assignment, comment, progress, version, linksto, user_ip, session_id) VALUES ('".$_clean['page_id']."','".$_clean['reflink']."','".$_clean['title']."','".$_clean['content']."','".$_clean['user_id']."','".$_clean['group_id']."','".$dtime."','".$_clean['assignment']."','".$_clean['comment']."','".$_clean['progress']."','".$_clean['version']."','".$_clean['linksto']."','".Database::escape_string($_SERVER['REMOTE_ADDR'])."', '".Database::escape_string($session_id)."')"; + $sql = "INSERT INTO ".$tbl_wiki." (page_id, reflink, title, content, user_id, group_id, dtime, assignment, comment, progress, version, linksto, user_ip, session_id) + VALUES ('".$_clean['page_id']."','".$_clean['reflink']."','".$_clean['title']."','".$_clean['content']."','".$_clean['user_id']."','".$_clean['group_id']."','".$dtime."','".$_clean['assignment']."','".$_clean['comment']."','".$_clean['progress']."','".$_clean['version']."','".$_clean['linksto']."','".Database::escape_string($_SERVER['REMOTE_ADDR'])."', '".Database::escape_string($session_id)."')"; - $result=Database::query($sql); - $Id = Database::insert_id(); + $result = Database::query($sql); + $Id = Database::insert_id(); if ($Id > 0) { //insert into item_property api_item_property_update(api_get_course_info(), TOOL_WIKI, $Id, 'WikiAdded', api_get_user_id(), $_clean['group_id']); } - if ($_clean['page_id'] ==0) - { + if ($_clean['page_id'] ==0) { $sql='UPDATE '.$tbl_wiki.' SET page_id="'.$Id.'" WHERE id="'.$Id.'"'; Database::query($sql); } @@ -354,7 +354,8 @@ function save_wiki() { if ($_clean['reflink']=='index' && $_clean['version']==1) { - $sql="INSERT INTO ".$tbl_wiki_conf." (page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit) VALUES ('".$Id."','".$_clean['task']."','".$_clean['feedback1']."','".$_clean['feedback2']."','".$_clean['feedback3']."','".$_clean['fprogress1']."','".$_clean['fprogress2']."','".$_clean['fprogress3']."','".$_clean['max_text']."','".$_clean['max_version']."','".$_clean['startdate_assig']."','".$_clean['enddate_assig']."','".$_clean['delayedsubmit']."')"; + $sql="INSERT INTO ".$tbl_wiki_conf." (page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit) + VALUES ('".$Id."','".$_clean['task']."','".$_clean['feedback1']."','".$_clean['feedback2']."','".$_clean['feedback3']."','".$_clean['fprogress1']."','".$_clean['fprogress2']."','".$_clean['fprogress3']."','".$_clean['max_text']."','".$_clean['max_version']."','".$_clean['startdate_assig']."','".$_clean['enddate_assig']."','".$_clean['delayedsubmit']."')"; } else { @@ -435,13 +436,13 @@ function save_new_wiki() { $session_id = api_get_session_id(); if($_clean['assignment']==2 || $_clean['assignment']==1) {// Unlike ordinary pages of pages of assignments. Allow create a ordinary page although there is a assignment with the same name - $_clean['reflink']=Database::escape_string(Security::remove_XSS(str_replace(' ','_',$_POST['title']."_uass".$assig_user_id))); + $_clean['reflink']=Database::escape_string(str_replace(' ','_',$_POST['title']."_uass".$assig_user_id)); } else { - $_clean['reflink']=Database::escape_string(Security::remove_XSS(str_replace(' ','_',$_POST['title']))); + $_clean['reflink']=Database::escape_string(str_replace(' ','_',$_POST['title'])); } - $_clean['title']=Database::escape_string(Security::remove_XSS($_POST['title'])); - $_clean['content']= Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['content'])),COURSEMANAGERLOWSECURITY)); + $_clean['title']=Database::escape_string($_POST['title']); + $_clean['content']= Database::escape_string($_POST['content']); if($_clean['assignment']==2) {//config by default for individual assignment (students) @@ -452,7 +453,7 @@ function save_new_wiki() { $_clean['ratinglock_disc']=0; } else { - $_clean['user_id']=(int)Database::escape_string(api_get_user_id()); + $_clean['user_id']=api_get_user_id(); $_clean['visibility']=1; $_clean['visibility_disc']=1; @@ -460,7 +461,7 @@ function save_new_wiki() { } - $_clean['comment']=Database::escape_string(Security::remove_XSS($_POST['comment'])); + $_clean['comment']=Database::escape_string($_POST['comment']); $_clean['progress']=Database::escape_string($_POST['progress']); $_clean['version']=1; @@ -476,44 +477,36 @@ function save_new_wiki() { $_clean['linksto'] = links_to($_clean['content']); //check wikilinks //cleaning config variables - $_clean['task']= Database::escape_string(Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['task'])),COURSEMANAGERLOWSECURITY)); - $_clean['feedback1']=Database::escape_string(Security::remove_XSS($_POST['feedback1'])); - $_clean['feedback2']=Database::escape_string(Security::remove_XSS($_POST['feedback2'])); - $_clean['feedback3']=Database::escape_string(Security::remove_XSS($_POST['feedback3'])); - $_clean['fprogress1']=Database::escape_string(Security::remove_XSS($_POST['fprogress1'])); - $_clean['fprogress2']=Database::escape_string(Security::remove_XSS($_POST['fprogress2'])); - $_clean['fprogress3']=Database::escape_string(Security::remove_XSS($_POST['fprogress3'])); - - if(Security::remove_XSS($_POST['initstartdate']==1)) - { - $_clean['startdate_assig']=Database::escape_string(Security::remove_XSS(get_date_from_select('startdate_assig'))); - } - else - { - $_clean['startdate_assig']=Database::escape_string(Security::remove_XSS($_POST['startdate_assig'])); + $_clean['task']= Database::escape_string($_POST['task']); + $_clean['feedback1']=Database::escape_string($_POST['feedback1']); + $_clean['feedback2']=Database::escape_string($_POST['feedback2']); + $_clean['feedback3']=Database::escape_string($_POST['feedback3']); + $_clean['fprogress1']=Database::escape_string($_POST['fprogress1']); + $_clean['fprogress2']=Database::escape_string($_POST['fprogress2']); + $_clean['fprogress3']=Database::escape_string($_POST['fprogress3']); + + if($_POST['initstartdate']==1) { + $_clean['startdate_assig']=Database::escape_string(get_date_from_select('startdate_assig')); + } else { + $_clean['startdate_assig']=Database::escape_string($_POST['startdate_assig']); } - if(Security::remove_XSS($_POST['initenddate']==1)) - { - $_clean['enddate_assig']=Database::escape_string(Security::remove_XSS(get_date_from_select('enddate_assig'))); - } - else - { - $_clean['enddate_assig']=Database::escape_string(Security::remove_XSS($_POST['enddate_assig'])); + if($_POST['initenddate']==1) { + $_clean['enddate_assig']=Database::escape_string(get_date_from_select('enddate_assig')); + } else { + $_clean['enddate_assig']=Database::escape_string($_POST['enddate_assig']); } - $_clean['delayedsubmit']=Database::escape_string(Security::remove_XSS($_POST['delayedsubmit'])); - $_clean['max_text']=Database::escape_string(Security::remove_XSS($_POST['max_text'])); - $_clean['max_version']=Database::escape_string(Security::remove_XSS($_POST['max_version'])); + $_clean['delayedsubmit']=Database::escape_string($_POST['delayedsubmit']); + $_clean['max_text']=Database::escape_string($_POST['max_text']); + $_clean['max_version']=Database::escape_string($_POST['max_version']); //filter no _uass if (api_eregi('_uass', $_POST['title']) || (api_strtoupper(trim($_POST['title'])) == 'INDEX' || api_strtoupper(trim(api_htmlentities($_POST['title'], ENT_QUOTES, $charset))) == api_strtoupper(api_htmlentities(get_lang('DefaultTitle'), ENT_QUOTES, $charset)))) { $message= get_lang('GoAndEditMainPage'); Display::display_warning_message($message,false); } else { - $var=$_clean['reflink']; - $group_id=Security::remove_XSS($_GET['group_id']); if(!checktitle($var)) { return get_lang('WikiPageTitleExist').''.$_POST['title'].''; @@ -965,12 +958,12 @@ function word_count($document) { # strip all html tags $wc = strip_tags($document); + //remove words and remove one letter words commented temporarily because of problems with utf8 support. TODO: fix and enable # remove 'words' that don't consist of alphanumerical characters or punctuation - $pattern = "#[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@)]+#"; - $wc = trim(preg_replace($pattern, " ", $wc)); - + //$pattern = "#[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@)]+#"; + //$wc = trim(preg_replace($pattern, " ", $wc)); # remove one-letter 'words' that consist only of punctuation - $wc = trim(preg_replace("#\s*[(\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@)]\s*#", " ", $wc)); + //$wc = trim(preg_replace("#\s*[(\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@)]\s*#", " ", $wc)); // # remove superfluous whitespace $wc = preg_replace("/\s\s+/", " ", $wc); @@ -2084,7 +2077,7 @@ function make_select($name,$values,$checked='') { * */ function get_date_from_select($prefix) { - return $_POST[$prefix.'_year'].'-'.two_digits($_POST[$prefix.'_month']).'-'.two_digits($_POST[$prefix.'_day']).' '.two_digits($_POST[$prefix.'_hour']).':'.two_digits($_POST[$prefix.'_minute']).':00'; + return $_POST[$prefix.'_year'].'-'.two_digits($_POST[$prefix.'_month']).'-'.two_digits($_POST[$prefix.'_day']).' '.two_digits($_POST[$prefix.'_hour']).':'.two_digits($_POST[$prefix.'_minute']).':00'; } /** diff --git a/tests/main/inc/lib/fileManage.lib.test.php b/tests/main/inc/lib/fileManage.lib.test.php index 037e626e79..3aab42180d 100755 --- a/tests/main/inc/lib/fileManage.lib.test.php +++ b/tests/main/inc/lib/fileManage.lib.test.php @@ -196,6 +196,7 @@ class TestFileManager extends UnitTestCase { } public function testMkdirs(){ + //This function is deprecated $path=api_get_path(SYS_COURSE_PATH).'document'; $res = $this->fmanager->mkdirs($path); $this->assertFalse($res); diff --git a/tests/main/inc/lib/fileManager.lib.test.php b/tests/main/inc/lib/fileManager.lib.test.php old mode 100644 new mode 100755 index ae61782203..3d19b6753a --- a/tests/main/inc/lib/fileManager.lib.test.php +++ b/tests/main/inc/lib/fileManager.lib.test.php @@ -191,6 +191,7 @@ class TestFileManager extends UnitTestCase { } public function testMkdirs(){ + //This function is deprecated $path='/var/www/path/ruta'; $res = $this->fmanager->mkdirs($path); $this->assertFalse($res);