Browse Source

[svn r13958] Updated to suit anonymous user mode

Yannick Warnier 17 years ago
parent
commit
fc3a1ef36f
2 changed files with 13 additions and 10 deletions
  1. 6 6
      main/calendar/agenda.inc.php
  2. 7 4
      main/calendar/agenda.php

+ 6 - 6
main/calendar/agenda.inc.php

@@ -72,7 +72,7 @@ function get_calendar_items($month, $year)
 
 	$group_memberships=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
 
-	if (is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda'))
+	if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 	{
 		//echo "course admin";
 		// added GROUP BY agenda.id to prevent double display of a message that has been sent to two groups
@@ -1215,7 +1215,7 @@ function save_edit_agenda_item($id,$title,$content,$start_date,$end_date)
 function delete_agenda_item($id)
 {
 	global $_course;
-	if (is_allowed_to_edit()  OR api_get_course_setting('allow_user_edit_agenda'))
+	if (is_allowed_to_edit()  OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 		{
 		if (isset($_GET['id'])&&$_GET['id']&&isset($_GET['action'])&&$_GET['action']=="delete")
 			{
@@ -1252,7 +1252,7 @@ function showhide_agenda_item($id)
 	  ==================================================*/
 	//  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 ((is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda')) and $_GET['isStudentView']<>"false")
+	if ((is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) and $_GET['isStudentView']<>"false")
 	{
 		if (isset($_GET['id'])&&$_GET['id']&&isset($_GET['action'])&&$_GET['action']=="showhide")
 		{
@@ -1314,7 +1314,7 @@ function display_agenda_items()
 	//echo "user:".$_SESSION['user']."group: ".$_SESSION['group'];
 	// A. you are a course admin
 	//if ($is_courseAdmin)
-	if (is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda'))
+	if (is_allowed_to_edit() 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.
@@ -1390,7 +1390,7 @@ function display_agenda_items()
 			}
 		}
 
-	} //if (is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda'))
+	} //if (is_allowed_to_edit() OR( api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 
 	// B. you are a student
 	else
@@ -1577,7 +1577,7 @@ function display_agenda_items()
 	$event_list.=$myrow['id'].',';
 
 	echo "<tr class='row_odd'><td>";
-			if (is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda'))
+			if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 	{
 		// edit
 		echo 	"<a href=\"".api_get_self()."?".api_get_cidreq()."&origin=".$_GET['origin']."&amp;action=edit&amp;id=".$myrow['id']."\">",

+ 7 - 4
main/calendar/agenda.php

@@ -1,4 +1,4 @@
-<?php //$Id: agenda.php 13933 2007-12-05 05:23:10Z yannoo $
+<?php //$Id: agenda.php 13958 2007-12-05 15:17:30Z yannoo $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -29,6 +29,9 @@
 // name of the language file that needs to be included
 $language_file = 'agenda';
 
+// use anonymous mode when accessing this course tool
+$use_anonymous = true;
+
 // setting the global file that gets the general configuration, the databases, the languages, ...
 include('../inc/global.inc.php');
 
@@ -210,7 +213,7 @@ $tbl_session_course_user= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USE
   			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');
+$is_allowed_to_edit = is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous());
 
 /* ==============================================================================
   			TITLE
@@ -255,7 +258,7 @@ if ($_GET['origin']!='learnpath')
 	display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName);
 	// the links for adding, filtering, showall, ...
 	echo '<ul id="agenda_select">';
-	if (is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda'))
+	if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 	{
 		display_courseadmin_links();
 	}
@@ -273,7 +276,7 @@ $fck_attribute['ToolbarSet'] = 'Middle';
 // THE RIGHT PART
 echo "<td valign=\"top\">";
 
-if (is_allowed_to_edit() OR api_get_course_setting('allow_user_edit_agenda'))
+if (is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))
 {
 	switch ($_GET['action'])
 	{