The PclZip library has been upgraded to version 2.6. Additionally, a known bug has been fixed - improper processing of the option PCLZIP_OPT_REMOVE_PATH on Windows (FS#3243)
Fixed a bug causing improper numeric sorting of data displayed in various tables (FS#3282)
Agenda tool: Fixed a wrong range for hour selection. The bug has been reported and solved in a forum by TL (FS#3324)
+
Agenda tool: Fixed bugs found when you filter by group and user in agenda, bugs found when you add a calendar event with recipient list and modify it, and style changes (FS#2436)
CSS changes
diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php
index 9fa43d2744..77436663df 100644
--- a/main/calendar/agenda.inc.php
+++ b/main/calendar/agenda.inc.php
@@ -1,4 +1,4 @@
-".$curday."";
+ $dayheader="".$curday."";
foreach ($data[$curday] as $key=>$agenda_item)
{
foreach ($agenda_item as $key=>$value)
{
- $dayheader .= ' '.substr($value['start_date'],11,8).'';
+ $dayheader .= ' '.substr($value['start_date'],11,8).'';
$dayheader .= ' - ';
$dayheader .= $value['title'];
}
@@ -392,23 +392,23 @@ function validate()
}
function selectAll(cbList,bSelect,showwarning)
-{
- //if (cbList.length < 1) {
- // alert(\"$Send2All\");
- // return;
- //}
- for (var i=0; i ".get_lang('AddAnAttachment')."';
- }
+ }
}
function plus_repeated_event() {
@@ -427,7 +427,7 @@ function plus_repeated_event() {
} else {
document.getElementById('options2').style.display = 'none';
document.getElementById('plus2').innerHTML=' ".get_lang('RepeatedEvent')."';
- }
+ }
}
// End -->
@@ -508,7 +508,7 @@ return $users;
function get_course_groups()
{
$group_list = array();
-
+
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($_SESSION['id_session']));
return $group_list;
}
@@ -643,13 +643,13 @@ function store_new_agenda_item()
global $_user, $_course;
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$t_agenda_repeat = Database::get_course_Table(TABLE_AGENDA_REPEAT);
-
+
// some filtering of the input data
$title=strip_tags(trim($_POST['title'])); // no html allowed in the title
$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";
-
+
// store in the table calendar_event
$sql = "INSERT INTO ".$TABLEAGENDA."
(title,content, start_date, end_date)
@@ -657,7 +657,7 @@ function store_new_agenda_item()
('".$title."','".$content."', '".$start_date."','".$end_date."')";
$result = api_sql_query($sql,__FILE__,__LINE__);
$last_id = Database::insert_id();
-
+
// store in last_tooledit (first the groups, then the users
$to=$_POST['selectedform'];
@@ -687,7 +687,7 @@ function store_new_agenda_item()
}
// storing the resources
store_resources($_SESSION['source_type'],$last_id);
-
+
//if repetitive, insert element into agenda_repeat table
if(!empty($_POST['repeat']) && !empty($_POST['repeat_type']))
{
@@ -699,10 +699,8 @@ function store_new_agenda_item()
$end = mktime((int)$_POST['fhour'],(int)$_POST['fminute'],0,$end_m,$end_d,$end_y);
$now = time();
$type = Database::escape_string($_POST['repeat_type']);
-
- if($end > $now
- && in_array($type,array('daily','weekly','monthlyByDate','monthlyByDay','monthlyByDayR','yearly')))
- {
+
+ if ($end > $now && in_array($type,array('daily','weekly','monthlyByDate','monthlyByDay','monthlyByDayR','yearly'))) {
$sql = "INSERT INTO $t_agenda_repeat (cal_id, cal_type, cal_end)" .
" VALUES ($last_id,'$type',$end)";
$res = Database::query($sql,__FILE__,__LINE__);
@@ -796,7 +794,7 @@ function separate_users_groups($to)
{
foreach($to as $to_item)
{
- list($type, $id) = explode(':', $to_item);
+ list($type, $id) = explode(':', $to_item);
switch($type)
{
case 'GROUP':
@@ -809,7 +807,7 @@ function separate_users_groups($to)
}
$send_to['groups']=$grouplist;
$send_to['users']=$userlist;
- }
+ }
return $send_to;
}
@@ -1087,9 +1085,10 @@ function change_visibility($tool,$id)
* The links that allows the course administrator to add a new agenda item, to filter on groups or users
* @author Patrick Cool , Ghent University
*/
-function display_courseadmin_links() {
- echo "".Display::return_icon('calendar_add.gif', get_lang('AgendaAdd'))." ".get_lang('AgendaAdd')."";
-
+function display_courseadmin_links() {
+
+ echo "".Display::return_icon('calendar_add.gif', get_lang('AgendaAdd'))." ".get_lang('AgendaAdd')." | ";
+
if (empty ($_SESSION['toolgroup']))
{
echo get_lang('UserGroupFilter');
@@ -1110,30 +1109,30 @@ function display_student_links()
global $show;
if ($_SESSION['sort'] == 'DESC')
{
- echo "".Display::return_icon('calendar_up.gif',get_lang('AgendaSortChronologicallyUp')).' '.get_lang("AgendaSortChronologicallyUp")." ";
+ 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")." ";
+ echo "".Display::return_icon('calendar_down.gif',get_lang('AgendaSortChronologicallyDown')).' '.get_lang("AgendaSortChronologicallyDown")." ";
}
// showing the link to show all items or only those of the current month
if ($_SESSION['show']=="showcurrent")
{
- echo "".Display::return_icon('calendar_select.gif', get_lang("ShowAll")).' '.get_lang("ShowAll")." ";
+ echo "".Display::return_icon('calendar_select.gif', get_lang("ShowAll")).' '.get_lang("ShowAll")." ";
}
else
{
- echo "".Display::return_icon('calendar_month.gif', get_lang("ShowCurrent")).' '.get_lang("ShowCurrent")." ";
+ echo "".Display::return_icon('calendar_month.gif', get_lang("ShowCurrent")).' '.get_lang("ShowCurrent")." ";
}
-
+
if ($_SESSION['view'] <> 'month')
{
- echo "".Display::return_icon('calendar_month.gif', get_lang('MonthView'))." ".get_lang('MonthView')." ";
+ echo "".Display::return_icon('calendar_month.gif', get_lang('MonthView'))." ".get_lang('MonthView')." ";
}
- else
+ else
{
- echo "\t".Display::return_icon('calendar_select.gif', get_lang('ListView'))." ".get_lang('ListView')." ";
+ echo "\t".Display::return_icon('calendar_select.gif', get_lang('ListView'))." ".get_lang('ListView')." ";
}
}
@@ -1200,7 +1199,7 @@ function get_agenda_item($id)
* 3. modify the attachments (if needed)
* @author Patrick Cool , Ghent University
*/
-function store_edited_agenda_item($id_user,$id_group,$id_attach,$file_comment)
+function store_edited_agenda_item($id_attach,$file_comment)
{
global $_user, $_course;
@@ -1217,13 +1216,13 @@ function store_edited_agenda_item($id_user,$id_group,$id_attach,$file_comment)
$to=$_POST['selectedform'];
// 1.b. the actual saving in calendar_event table
$edit_result=save_edit_agenda_item($id,$title,$content,$start_date,$end_date);
-
+
if (empty($id_attach)) {
add_agenda_attachment_file($file_comment,$id);
} else {
edit_agenda_attachment_file($file_comment,$id,$id_attach);
}
-
+
// step 2: editing the item_propery table (=delete all and add the new destination users/groups)
if ($edit_result=true)
{
@@ -1254,7 +1253,7 @@ function store_edited_agenda_item($id_user,$id_group,$id_attach,$file_comment)
}
else // the message is sent to everyone, so we set the group to 0
{
- api_item_property_update($_course, TOOL_CALENDAR_EVENT, $id,"AgendaModified", $_user['user_id'], $id_group,$id_user,$start_date,$end_date);
+ api_item_property_update($_course, TOOL_CALENDAR_EVENT, $id,"AgendaModified", $_user['user_id'], '','',$start_date,$end_date);
}
} //if ($edit_result=true)
@@ -1263,6 +1262,7 @@ function store_edited_agenda_item($id_user,$id_group,$id_attach,$file_comment)
update_added_resources("Agenda", $id);
// return the message;
+ echo ' ';
Display::display_normal_message(get_lang("EditSuccess"));
}
@@ -1315,7 +1315,7 @@ function delete_agenda_item($id)
{
while ($row_child = Database::fetch_array($res_children))
{
- api_item_property_update($_course,TOOL_CALENDAR_EVENT,$row_child['id'],'delete',api_get_user_id());
+ api_item_property_update($_course,TOOL_CALENDAR_EVENT,$row_child['id'],'delete',api_get_user_id());
}
}
$sql_del = "DELETE FROM $t_agenda_r WHERE cal_id = $id";
@@ -1335,6 +1335,7 @@ function delete_agenda_item($id)
$id=null;
// displaying the result message in the yellow box
+ echo ' ';
Display::display_normal_message(get_lang("AgendaDeleteSuccess"));
} // if (isset($id)&&$id&&isset($action)&&$action=="delete")
} // if ($is_allowed_to_edit)
@@ -1359,6 +1360,7 @@ function showhide_agenda_item($id)
{
$id=(int)addslashes($_GET['id']);
change_visibility($nameTools,$id);
+ echo ' ';
Display::display_normal_message(get_lang("VisibilityChanged"));
}
}
@@ -1428,14 +1430,14 @@ function display_agenda_items()
{
$group_id=$_SESSION['toolgroup'];
}
-
+
$repeats = array(); //placeholder for repeated events
//echo "user:".$_SESSION['user']."group: ".$_SESSION['group'];
// A. you are a course admin
//if ($is_courseAdmin)
-
+
$session_condition = intval($_SESSION['id_session'])==0 ? '' : ' AND agenda.session_id IN (0,'.intval($_SESSION['id_session']).') ';
-
+
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
@@ -1582,10 +1584,10 @@ function display_agenda_items()
$month_bar="";
$event_list="";
$counter=0;
- $export_icon = api_get_path('WEB_IMG_PATH').'export.png';
- $export_icon_low = api_get_path('WEB_IMG_PATH').'export_low_fade.png';
- $export_icon_high = api_get_path('WEB_IMG_PATH').'export_high_fade.png';
-
+ $export_icon = 'export.png';
+ $export_icon_low = 'export_low_fade.png';
+ $export_icon_high = 'export_high_fade.png';
+
while($myrow=Database::fetch_array($result))
{
$is_repeated = !empty($myrow['parent_event_id']);
@@ -1606,7 +1608,7 @@ function display_agenda_items()
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)date("d",strtotime($myrow["start_date"])).date("n",strtotime($myrow["start_date"])).date("Y",strtotime($myrow["start_date"]));
if ($_GET["day"].$_GET["month"].$_GET["year"] <>$db_date)
@@ -1623,7 +1625,7 @@ function display_agenda_items()
$stylenotbold="datanotbold";
$text_style="text";
}
-
+
}
else
{
@@ -1631,7 +1633,7 @@ function display_agenda_items()
$stylenotbold="datanotboldnow";
$text_style="textnow";
}
-
+
echo "\t\t
\n";
// adding an internal anchor
echo "\t\t\t";
@@ -1645,23 +1647,23 @@ function display_agenda_items()
}
echo " ".$myrow['title']."\n";
echo "\t\t
\n";
-
+
// the message has been sent to
echo "\t\t
";
-
+
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 '
'.get_lang('Modify');
+ echo '
'.get_lang('Modify');
echo '
';
}
}
-
+
/*--------------------------------------------------
display: the title
--------------------------------------------------*/
@@ -1678,29 +1680,29 @@ function display_agenda_items()
echo ucfirst(strftime($timeNoSecFormat,strtotime($myrow["end_date"])))."";
}
echo "\n";
-
+
// attachment list
$attachment_list=get_attachment($myrow['id']);
-
+
/*--------------------------------------------------
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())))
{
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']).'&group='.Security::remove_XSS($_REQUEST['group']).'&user='.Security::remove_XSS($_REQUEST['user']).'&id='.$myrow['id'];
+ $mylink = api_get_self().'?'.api_get_cidreq().'&origin='.Security::remove_XSS($_GET['origin']).'&id='.$myrow['id'];
echo '
';
-
-
+
+
/*--------------------------------------------------
display: the added resources
--------------------------------------------------*/
if (check_added_resources("Agenda", $myrow["id"]))
{
-
+
echo '
';
- echo '
';
+ echo '
';
echo "".get_lang("AddedResources")." ";
if ($myrow['visibility']==0)
{
@@ -1781,10 +1785,10 @@ function display_agenda_items()
display_added_resources("Agenda", $myrow["id"], $addedresource_style);
echo "
";
}
-
-
+
+
$event_list.=$myrow['id'].',';
-
+
$counter++;
/*--------------------------------------------------
display: jump-to-top icon
@@ -1804,9 +1808,9 @@ function display_agenda_items()
{
$event_list='0';
}
-
+
echo "";
-
+
// closing the layout table
echo "",
"",
@@ -1815,21 +1819,21 @@ function display_agenda_items()
/**
* Show a list with all the attachments according to the post's id
- * @param the post's id
- * @return array with the post info
- * @author Christian Fasanando
+ * @param the post's id
+ * @return array with the post info
+ * @author Christian Fasanando
* @version November 2008, dokeos 1.8.6
- */
-
-function get_attachment($agenda_id) {
+ */
+
+function get_attachment($agenda_id) {
$agenda_table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
- $row=array();
+ $row=array();
$sql = 'SELECT id,path, filename,comment FROM '. $agenda_table_attachment.' WHERE agenda_id = '.(int)$agenda_id.'';
$result=api_sql_query($sql, __FILE__, __LINE__);
if (Database::num_rows($result)!=0) {
$row=Database::fetch_array($result);
}
- return $row;
+ return $row;
}
/**
@@ -1864,7 +1868,7 @@ function display_one_agenda_item($agenda_id)
$result=api_sql_query($sql,__FILE__,__LINE__) or die(Database::error());
$number_items=Database::num_rows($result);
$myrow=Database::fetch_array($result); // there should be only one item so no need for a while loop
-
+
$sql_rep = "SELECT * FROM $TABLEAGENDA WHERE id = $agenda_id AND parent_event_id IS NOT NULL AND parent_event_id !=0";
$res_rep = Database::query($sql_rep,__FILE__,__LINE__);
$repeat = false;
@@ -1873,9 +1877,9 @@ function display_one_agenda_item($agenda_id)
{
$repeat=true;
$row_rep = Database::fetch_array($res_rep);
- $repeat_id = $row_rep['parent_event_id'];
+ $repeat_id = $row_rep['parent_event_id'];
}
-
+
/*--------------------------------------------------
DISPLAY: NO ITEMS
--------------------------------------------------*/
@@ -1959,9 +1963,9 @@ function display_one_agenda_item($agenda_id)
/*--------------------------------------------------
DISPLAY: the content
--------------------------------------------------*/
- $export_icon = api_get_path('WEB_IMG_PATH').'export.png';
- $export_icon_low = api_get_path('WEB_IMG_PATH').'export_low_fade.png';
- $export_icon_high = api_get_path('WEB_IMG_PATH').'export_high_fade.png';
+ $export_icon = '../img/export.png';
+ $export_icon_low = '../img/export_low_fade.png';
+ $export_icon_high = '../img/export_high_fade.png';
$content = $myrow['content'];
$content = make_clickable($content);
@@ -1970,7 +1974,7 @@ function display_one_agenda_item($agenda_id)
//echo $content;
//echo "";
echo "
";
- echo '
';
+ echo '
';
echo $content;
echo '
';
@@ -1995,7 +1999,7 @@ function display_one_agenda_item($agenda_id)
echo '