[svn r13958] Updated to suit anonymous user mode

skala
Yannick Warnier 18 years ago
parent f822b97b3a
commit fc3a1ef36f
  1. 12
      main/calendar/agenda.inc.php
  2. 11
      main/calendar/agenda.php

@ -72,7 +72,7 @@ function get_calendar_items($month, $year)
$group_memberships=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']); $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"; //echo "course admin";
// added GROUP BY agenda.id to prevent double display of a message that has been sent to two groups // 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) function delete_agenda_item($id)
{ {
global $_course; 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") 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: // and $_GET['isStudentView']<>"false" is added to prevent that the visibility is changed after you do the following:
// change visibility -> studentview -> course manager view // 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") 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']; //echo "user:".$_SESSION['user']."group: ".$_SESSION['group'];
// A. you are a course admin // A. you are a course admin
//if ($is_courseAdmin) //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 // 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. // => 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 // B. you are a student
else else
@ -1577,7 +1577,7 @@ function display_agenda_items()
$event_list.=$myrow['id'].','; $event_list.=$myrow['id'].',';
echo "<tr class='row_odd'><td>"; 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 // edit
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&origin=".$_GET['origin']."&amp;action=edit&amp;id=".$myrow['id']."\">", echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&origin=".$_GET['origin']."&amp;action=edit&amp;id=".$myrow['id']."\">",

@ -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 Dokeos - elearning and course management software
@ -29,6 +29,9 @@
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = 'agenda'; $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, ... // setting the global file that gets the general configuration, the databases, the languages, ...
include('../inc/global.inc.php'); include('../inc/global.inc.php');
@ -210,7 +213,7 @@ $tbl_session_course_user= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USE
ACCESS RIGHTS ACCESS RIGHTS
============================================================================== */ ============================================================================== */
// permission stuff - also used by loading from global in agenda.inc.php // 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 TITLE
@ -255,7 +258,7 @@ if ($_GET['origin']!='learnpath')
display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName); display_minimonthcalendar($agenda_items, $select_month,$select_year, $MonthName);
// the links for adding, filtering, showall, ... // the links for adding, filtering, showall, ...
echo '<ul id="agenda_select">'; 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(); display_courseadmin_links();
} }
@ -273,7 +276,7 @@ $fck_attribute['ToolbarSet'] = 'Middle';
// THE RIGHT PART // THE RIGHT PART
echo "<td valign=\"top\">"; 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']) switch ($_GET['action'])
{ {

Loading…
Cancel
Save