From 84e1901be9d64087bc1b7703d8ef89aaeb924f31 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 12 Apr 2011 17:28:38 +0200 Subject: [PATCH] Adding some fixes in the calendar view + fixing bug when adding an event in the work tool --- main/admin/calendar.php | 10 +-- main/calendar/agenda.inc.php | 146 +++++++++++++++------------------ main/calendar/agenda.php | 13 ++- main/calendar/myagenda.inc.php | 72 +++++++++------- main/css/base.css | 35 ++++++-- main/work/work.php | 32 ++++---- 6 files changed, 163 insertions(+), 145 deletions(-) diff --git a/main/admin/calendar.php b/main/admin/calendar.php index ad2c90d1e8..abd9d34624 100755 --- a/main/admin/calendar.php +++ b/main/admin/calendar.php @@ -208,15 +208,7 @@ if (api_is_allowed_to_edit(false,true)) { $event_start = (int) $_POST['fyear'].'-'.(int) $_POST['fmonth'].'-'.(int) $_POST['fday'].' '.(int) $_POST['fhour'].':'.(int) $_POST['fminute'].':00'; $event_stop = (int) $_POST['end_fyear'].'-'.(int) $_POST['end_fmonth'].'-'.(int) $_POST['end_fday'].' '.(int) $_POST['end_fhour'].':'.(int) $_POST['end_fminute'].':00'; - $id = agenda_add_item($course_info,$_POST['title'],$_POST['content'],$event_start,$event_stop,$_POST['selectedform'],false,$_POST['file_comment']); -/* - if(!empty($_POST['repeat'])) { - $end_y = intval($_POST['repeat_end_year']); - $end_m = intval($_POST['repeat_end_month']); - $end_d = intval($_POST['repeat_end_day']); - $end = mktime(23, 59, 59, $end_m, $end_d, $end_y); - $res = agenda_add_repeat_item($course_info,$id,$_POST['repeat_type'],$end,null,$_POST['file_comment']); - }*/ + $id = agenda_add_item($course_info,$_POST['title'],$_POST['content'],$event_start,$event_stop,$_POST['selectedform'],false,$_POST['file_comment']); display_agenda_items(); } else { show_add_form(); diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php index efbe17b151..fa3d58adac 100755 --- a/main/calendar/agenda.inc.php +++ b/main/calendar/agenda.inc.php @@ -166,10 +166,8 @@ function get_calendar_items($month, $year) { $session_condition GROUP BY ip.ref ORDER BY start_date ".$_SESSION['sort']; - } - // A.3 you are a course admin without any group or user filter + } // A.3 you are a course admin without any group or user filter 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') { @@ -375,6 +373,7 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName) { /** * show the calender of the given month * @author: Patrick Cool , Ghent University +* @author Julio Montoya - adding some nice styles * @param integer $month: the integer value of the month we are viewing * @param integer $year: the 4-digit year indication e.g. 2005 * @return html code @@ -385,7 +384,7 @@ function display_monthcalendar($month, $year) { global $origin; // Grabbing all the calendar items for this year and storing it in a array + my personal calendar events if exist and if enabled - $data = get_calendar_items($month,$year); + $data = get_calendar_items($month, $year); //Handle leap year $numberofdays = array(0,31,28,31,30,31,30,31,31,30,31,30,31); @@ -424,7 +423,6 @@ function display_monthcalendar($month, $year) { if (($curday == -1) && ($ii==$startdayofweek)) { $curday = 1; } - if (($curday>0)&&($curday<=$numberofdays[$month])) { $bgcolor = $ii<5 ? 'class="row_odd"' : 'class="row_even"'; @@ -433,7 +431,8 @@ function display_monthcalendar($month, $year) { if (key_exists($curday, $data)) { foreach ($data[$curday] as $key=>$agenda_item) { - $dayheader = "".$curday.""; + //$day_url = "".$curday.""; + $dayheader = Display::div($curday, array('class'=>'agenda_day')); $some_content = false; foreach ($agenda_item as $key=>$value) { @@ -444,56 +443,61 @@ function display_monthcalendar($month, $year) { $some_content = true; $start_time = api_convert_and_format_date($value['start_date'], TIME_NO_SEC_FORMAT); - $end_time = api_convert_and_format_date($value['end_date'], TIME_NO_SEC_FORMAT); - - //Setting a personal event to green - $personal_start = $personal_end = ''; - if ($value['calendar_type'] == 'personal') { - $personal_start = '
'.get_lang('MyAgenda'); - $personal_end = '
'; - } elseif ($value['calendar_type'] == 'global') { - $personal_start = '
'.get_lang('GlobalEvent'); - $personal_end = '
'; - } - $dayheader.= $personal_start; - - $value['title'] = Display::tag('strong',$value['title']); - - if ($value['end_date']=='0000-00-00 00:00:00') { - $dayheader .= '
'.get_lang('Work').'
'; - $dayheader .= $value['title']; - $dayheader .= '
'; - } else { - if ($value['calendar_type'] == 'personal') { - $dayheader .= '
'.$start_time.' '; - } else { - $dayheader .= '
'.$start_time.' - '.$end_time.' '; - } - $dayheader .= '
'; - $dayheader .= $value['title']; - $dayheader .= '
'; + $end_time = ''; + if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') { + $end_time = api_convert_and_format_date($value['end_date'], DATE_TIME_FORMAT_LONG); + } + switch($value['calendar_type']) { + case 'personal': + $bg_color = '#58E24C'; + $subtitle = get_lang('MyAgenda'); + $time = ''.$start_time.' '; + break; + case 'global': + $bg_color = '#FD553D'; + if (!empty($end_time)) { + $time = ''.$start_time.' - '.$end_time.' '; + } else { + $time = ''.$start_time.' '; + } + $subtitle = get_lang('GlobalEvent'); + break; + case 'course': + $bg_color = '#FFF'; + $subtitle = get_lang('Course'); + if (!empty($end_time)) { + $time = ''.$start_time.' - '.$end_time.' '; + } else { + $time = ''.$start_time.' '; + } + break; + /*case 'work': + $bg_color = '#FDAC3D'; + $subtitle = get_lang('Work'); + $time = ''.$start_time.' - '.$end_time.' '; + break;*/ + default: + //$time = ''.$start_time.' - '.$end_time.' '; + break; } - $dayheader .= $personal_end; - } else { - //$dayheader=$curday; + //Setting a personal event to green + $dayheader.= '
'; + + $value['title'] = Display::tag('strong', $value['title']); + $dayheader .= $time.' - '.$subtitle.'
'.$value['title']; + $dayheader .= '
'; } } //Do not show links with no content if (!$some_content) { $dayheader = $curday; } - } } - //var_dump($dayheader); - if (($curday==$today['mday']) && ($year ==$today['year'])&&($month == $today['mon'])) { echo ''.$dayheader; } else { - $class = 'days_week'; - if (!is_numeric($dayheader)) { - $class = 'days_week_selected'; - } + $class = 'days_week'; echo ''.$dayheader; } echo ''; @@ -2974,8 +2978,6 @@ function show_add_form($id = '') { } function get_agendaitems($month, $year) { - global $_configuration; - $items = array (); $month = Database::escape_string($month); $year = Database::escape_string($year); @@ -3037,22 +3039,12 @@ function get_agendaitems($month, $year) { $mycourse = api_get_course_info(); $result = Database::query($sqlquery); - global $_configuration; - $root_url = $_configuration['root_web']; - if ($_configuration['multiple_access_urls']) { - $access_url_id = api_get_current_access_url_id(); - if ($access_url_id != -1 ) { - $url = api_get_access_url($access_url_id); - $root_url = $url['url']; - } - } - - while ($item = Database::fetch_array($result)) - { + + while ($item = Database::fetch_array($result)) { $agendaday_string = api_convert_and_format_date($item['start_date'], "%d", date_default_timezone_get()); $agendaday = intval($agendaday_string); $time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT); - $URL = $root_url.'main/calendar/agenda.php?cidReq='.$mycourse['id']."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item + $URL = api_get_path(WEB_CODE_PATH).'calendar/agenda.php?cidReq='.$mycourse['id']."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item $items[$agendaday][$item['start_time']] .= ''.$time.' '.$mycourse['official_code'].' '.$item['title'].'
'; } @@ -3345,7 +3337,6 @@ function display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $month * Show the monthcalender of the given month */ function get_day_agendaitems($courses_dbs, $month, $year, $day) { - global $_configuration; global $setting_agenda_link; $items = array (); @@ -3427,9 +3418,7 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day) { } else { $agenda_link = Display::return_icon('course_home.png',' ','',22); } - - //$URL = $_configuration['root_web'].$mycours["dir"]."/"; - $URL = api_get_path(WEB_PATH).'main/calendar/agenda.php?cidReq='.urlencode($array_course_info["code"])."&day=$day&month=$month&year=$year#$day"; // RH //Patrick Cool: to highlight the relevant agenda item + $URL = api_get_path(WEB_CODE_PATH).'calendar/agenda.php?cidReq='.urlencode($array_course_info["code"])."&day=$day&month=$month&year=$year#$day"; // RH //Patrick Cool: to highlight the relevant agenda item $items[$halfhour][] .= "".$hours.":".$minutes." ".$agenda_link." ".$item['title']."
"; } @@ -3450,7 +3439,6 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day) { * Return agenda items of the week */ function get_week_agendaitems($courses_dbs, $month, $year, $week = '') { - global $_configuration; global $setting_agenda_link; $TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA); @@ -3540,7 +3528,7 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '') { $agenda_link = Display::return_icon('course_home.png',' ','',22); } - $URL = $_configuration['root_web']."main/calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item + $URL = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item //Display the events in agenda $items[$agendaday][$item['start_date']] .= "$start_time - $end_time ".$agenda_link.""; $items[$agendaday][$item['start_date']] .= "
".$item['title']."

"; @@ -4275,7 +4263,7 @@ function add_year($timestamp,$num=1) * @param int Parent id (optional) * @return int The new item's DB ID */ -function agenda_add_item($course_info, $title, $content, $db_start_date, $db_end_date,$to=array(), $parent_id=null,$file_comment='') { +function agenda_add_item($course_info, $title, $content, $db_start_date, $db_end_date, $to = array(), $parent_id = null, $file_comment='') { $user_id = api_get_user_id(); // database table definitions @@ -4288,9 +4276,10 @@ function agenda_add_item($course_info, $title, $content, $db_start_date, $db_end $content = Database::escape_string($content); $db_start_date = api_get_utc_datetime($db_start_date); $start_date = Database::escape_string($db_start_date); - - $db_end_date = api_get_utc_datetime($db_end_date); - $end_date = Database::escape_string($db_end_date); + if (!empty($db_end_date)) { + $db_end_date = api_get_utc_datetime($db_end_date); + } + $end_date = Database::escape_string($db_end_date); $id_session = api_get_session_id(); // check if exists in calendar_event table and if it is not deleted! @@ -4309,11 +4298,10 @@ function agenda_add_item($course_info, $title, $content, $db_start_date, $db_end if ($count > 0) { return false; } - $sql = "INSERT INTO ".$t_agenda." (title,content, start_date, end_date".(!empty($parent_id)?',parent_event_id':'').", session_id) VALUES('".$title."','".$content."', '".$start_date."','".$end_date."'".(!empty($parent_id)?','.((int)$parent_id):'').", '".$id_session."')"; - - $result = Database::query($sql) or die (Database::error()); + + $result = Database::query($sql); $last_id = Database::insert_id(); // add a attachment file in agenda @@ -4665,7 +4653,6 @@ function get_global_agenda_items($agendaitems, $day = "", $month = "", $year = " $day = Database::escape_string($day); // 1. creating the SQL statement for getting the personal agenda items in MONTH view - global $_configuration; $current_access_url_id = 1; if ($_configuration['multiple_access_urls']) { $current_access_url_id = api_get_current_access_url_id(); @@ -4717,18 +4704,19 @@ function get_global_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'] <> "") { - $url = $_configuration['root_web']."main/admin/agenda.php?cidReq=".urlencode($item['course'])."&day=$day&month=$month&year=$year#$day"; // RH //Patrick Cool: to highlight the relevant agenda item + if ($item['course'] <> "") { + $url = api_get_path(WEB_CODE_PATH)."admin/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 { $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 the Agenda global in the tab agenda (administrator) - $agendaitems[$day] .= "".get_lang('StartTimeWindow')." $hour:$minute - "; + $agendaitems[$day] .= "$hour:$minute - "; $agendaitems[$day] .= "".get_lang('GlobalEvent').""; $agendaitems[$day] .= "
".$item['title']."

"; } else { @@ -4740,7 +4728,7 @@ function get_global_agenda_items($agendaitems, $day = "", $month = "", $year = " //$agendaitems[$halfhour] .= "
$hour:$minute ".get_lang('Evento Global'). ": ".$item['title']."
"; if (!is_array($agendaitems[$halfhour])) $content = $agendaitems[$halfhour]; - $agendaitems[$halfhour] = $content."
$hour:$minute ".get_lang('GlobalEvent'). ": ".$item['title']."
"; + $agendaitems[$halfhour] = $content."
$hour:$minute ".get_lang('GlobalEvent'). ": ".$item['title']."
"; } } //print_r($agendaitems); diff --git a/main/calendar/agenda.php b/main/calendar/agenda.php index 69c415e241..f9e28c6872 100755 --- a/main/calendar/agenda.php +++ b/main/calendar/agenda.php @@ -295,11 +295,9 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed if ($_GET['view'] == 'month' || $_SESSION['view'] == 'month' ) { -} else { - +} else { -echo ' - '; + echo '
'; // THE LEFT PART if (empty($_GET['origin']) or $_GET['origin']!='learnpath') { @@ -324,8 +322,7 @@ echo '
'; echo '
'; } -if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false,true) )) { - +if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false,true) )) { switch ($_GET['action']) { case 'importical' : if (isset($_POST['ical_submit'])) { @@ -378,13 +375,13 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed } // 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($_GET['agenda_id']); } else { - display_agenda_items($select_month, $select_year); + display_agenda_items($select_month, $select_year); } } else { display_monthcalendar($select_month, $select_year); diff --git a/main/calendar/myagenda.inc.php b/main/calendar/myagenda.inc.php index 48b366bb5c..d19be4f1d6 100755 --- a/main/calendar/myagenda.inc.php +++ b/main/calendar/myagenda.inc.php @@ -1,4 +1,4 @@ -, Ghent University @@ -107,8 +107,8 @@ function get_myagendaitems($courses_dbs, $month, $year) { $items[$agendaday]=array(); } $time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT); - $end_time = api_convert_and_format_date($item['end_date'], TIME_NO_SEC_FORMAT); - $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item + $end_time = api_convert_and_format_date($item['end_date'], DATE_TIME_FORMAT_LONG); + $URL = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item if ($setting_agenda_link == 'coursecode') { $title=$array_course_info['title']; $agenda_link = api_substr($title, 0, 14); @@ -181,20 +181,55 @@ function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=arra $curday = 1; } if (($curday > 0) && ($curday <= $numberofdays[$month])) { - $bgcolor = $ii < 5 ? $class = 'class="days_week" style="height:122px;width:10%;"' : $class = 'class="days_weekend" style="width:10%;"'; + $bgcolor = $class = 'class="days_week"'; $dayheader = "$curday
"; if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { $dayheader = "$curday
"; $class = "class=\"days_today\" style=\"width:10%;\""; } echo ""; $curday ++; } else { - echo ""; + echo ""; } } echo ""; @@ -553,8 +588,6 @@ function get_courses_of_user() { * This function retrieves all the personal agenda items and add them to the agenda items found by the other functions. */ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = "", $week = "", $type) { - global $_configuration; - $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 if ($type == "month_view" or $type == "") // we are in month view @@ -584,23 +617,7 @@ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = $start_filter = $year."-".$month."-".$day." 00:00:00"; $end_filter = $year."-".$month."-".$day." 23:59:59"; $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".api_get_user_id()."' AND date>='".$start_filter."' AND date<='".$end_filter."'"; - } - //echo "day:".$day."/"; - //echo "month:".$month."/"; - //echo "year:".$year."/"; - //echo "week:".$week."/"; - //echo $type."

"; - //echo "

".$sql."
"; - - global $_configuration; - $root_url = $_configuration['root_web']; - if ($_configuration['multiple_access_urls']) { - $access_url_id = api_get_current_access_url_id(); - if ($access_url_id != -1 ) { - $url = api_get_access_url($access_url_id); - $root_url = $url['url']; - } - } + } $result = Database::query($sql); while ($item = Database::fetch_array($result)) { @@ -620,7 +637,7 @@ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = $second = $agendatime[2]; // if the student has specified a course we a add a link to that 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 + $url = api_get_path(WEB_CODE_PATH)."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 { $course_link = ""; @@ -835,7 +852,6 @@ function show_simple_personal_agenda($user_id) { } else { return $content; } - } /** diff --git a/main/css/base.css b/main/css/base.css index a2855022da..b2c2cb2b4b 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -90,10 +90,10 @@ input.maininput:focus { background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #E5E5E5; - -webkit-border-radius: 11px 11px 11px 11px; - -opera-border-radius: 11px 11px 11px 11px; - -moz-border-radius: 11px 11px 11px 11px; - border-radius: 11px 11px 11px 11px; + -webkit-border-radius: 11px; + -opera-border-radius: 11px; + -moz-border-radius: 11px; + border-radius: 11px; -webkit-box-shadow: 0 4px 18px #C8C8C8; -opera-box-shadow: 0 4px 18px #C8C8C8; @@ -104,4 +104,29 @@ input.maininput:focus { height: auto; margin: 10px 8px 15px 15px; padding: 16px 12px 5px; -} \ No newline at end of file +} + +.rounded_div_agenda { + background: none repeat scroll 0 0 #FFFFFF; + + -webkit-border-radius: 11px; + -opera-border-radius: 11px; + -moz-border-radius: 11px; + border-radius: 11px; + + -webkit-box-shadow: 0 4px 18px #C8C8C8; + -opera-box-shadow: 0 4px 18px #C8C8C8; + -moz-box-shadow: 0 4px 18px #C8C8C8; + box-shadow: 0 4px 18px #C8C8C8; + + float: left; + height: auto; + margin: 10px 8px 15px 15px; + padding: 8px; + width: 80%; +} + +.agenda_day { + float:left; + margin:5px; +} diff --git a/main/work/work.php b/main/work/work.php index f504308103..aed6d17158 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -537,15 +537,15 @@ if (!empty($_REQUEST['new_dir'])) { require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php'; require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php'; $course = isset($course_info) ? $course_info : null; - $date = api_get_utc_datetime(); + $date = time(); $title = Security::remove_XSS($_POST['new_dir']); if (!empty($_POST['type1'])) { - $date = api_get_utc_datetime(get_date_from_select('expires')); + $date = get_date_from_select('expires'); $title = sprintf(get_lang('HandingOverOfTaskX'),Security::remove_XSS($_POST['new_dir'])); } $content = ''.Security::remove_XSS($_POST['new_dir']).' - '.Security::remove_XSS($_POST['description']); - $agenda_id = agenda_add_item($course, $title, $content, $date, $date, array('GROUP:'.$toolgroup), 0); + $agenda_id = agenda_add_item($course, $title, $content, $date, '', array('GROUP:'.$toolgroup), 0); } $sql_add_publication = "INSERT INTO " . $work_table . " SET " . "url = '".Database::escape_string($dir_name_sql)."', @@ -583,12 +583,12 @@ if (!empty($_REQUEST['new_dir'])) { if (!empty($_POST['type1']) || !empty($_POST['type2'])) { $enable_calification = isset($_POST['enable_calification']) ? (int)$_POST['enable_calification'] : null; - $sql_add_homework = "INSERT INTO $TSTDPUBASG SET " . - "expires_on = '".((isset($_POST['type1']) && $_POST['type1']==1) ? api_get_utc_datetime(get_date_from_select('expires')) : '0000-00-00 00:00:00'). "', - ends_on = '".((isset($_POST['type2']) && $_POST['type2']==1) ? api_get_utc_datetime(get_date_from_select('ends')) : '0000-00-00 00:00:00')."', - add_to_calendar = '$agenda_id', - enable_qualification = '".$enable_calification."', - publication_id = '".$id."'"; + $sql_add_homework = "INSERT INTO $TSTDPUBASG SET + expires_on = '".((isset($_POST['type1']) && $_POST['type1']==1) ? api_get_utc_datetime(get_date_from_select('expires')) : '0000-00-00 00:00:00'). "', + ends_on = '".((isset($_POST['type2']) && $_POST['type2']==1) ? api_get_utc_datetime(get_date_from_select('ends')) : '0000-00-00 00:00:00')."', + add_to_calendar = '$agenda_id', + enable_qualification = '".$enable_calification."', + publication_id = '".$id."'"; Database::query($sql_add_homework); $sql_add_publication = "UPDATE ".$work_table." SET "."has_properties = ".Database::insert_id().", view_properties = 1 ".' where id = '.$id; @@ -596,12 +596,12 @@ if (!empty($_REQUEST['new_dir'])) { } else { - $sql_add_homework = "INSERT INTO $TSTDPUBASG SET " . - "expires_on = '0000-00-00 00:00:00', - ends_on = '0000-00-00 00:00:00', - add_to_calendar = '$agenda_id', - enable_qualification = '".(isset($_POST['enable_calification'])?(int)$_POST['enable_calification']:'')."', - publication_id = '".$id."'"; + $sql_add_homework = "INSERT INTO $TSTDPUBASG SET + expires_on = '0000-00-00 00:00:00', + ends_on = '0000-00-00 00:00:00', + add_to_calendar = '$agenda_id', + enable_qualification = '".(isset($_POST['enable_calification'])?(int)$_POST['enable_calification']:'')."', + publication_id = '".$id."'"; Database::query($sql_add_homework); $sql_add_publication = "UPDATE ".$work_table." SET "."has_properties = ".Database::insert_id().", view_properties = 0 ".' where id = '.$id; @@ -623,7 +623,7 @@ if (!empty($_REQUEST['new_dir'])) { // end features - if(api_get_course_setting('email_alert_students_on_new_homework') == 1) { + if (api_get_course_setting('email_alert_students_on_new_homework') == 1) { send_email_on_homework_creation(api_get_course_id()); }
".$dayheader; - if (!empty($agendaitems[$curday])) { - echo "".$agendaitems[$curday].""; + if (!empty($agendaitems[$curday])) { + $data = $agendaitems[$curday]; + /* + $start_time = api_convert_and_format_date($value['start_date'], TIME_NO_SEC_FORMAT); + $end_time = api_convert_and_format_date($value['end_date'], DATE_TIME_FORMAT_LONG); + $value = null; + switch($value['calendar_type']) { + case 'personal': + $bg_color = '#58E24C'; + $subtitle = get_lang('MyAgenda'); + $time = ''.$start_time.' '; + break; + case 'global': + $bg_color = '#FD553D'; + $time = ''.$start_time.' - '.$end_time.' '; + $subtitle = get_lang('GlobalEvent'); + break; + case 'course': + $bg_color = '#FFF'; + $subtitle = get_lang('Course'); + $time = ''.$start_time.' - '.$end_time.' '; + break; + default: + //$time = ''.$start_time.' - '.$end_time.' '; + break; + }*/ + //Setting a personal event to green + $result = '
'; + + $value['title'] = Display::tag('strong', $value['title']); + //$result .= $time.' - '.$subtitle.'
'.$value['title']; + $result .= $data; + $result .= '
'; + echo $result; + + + } echo "