Fixed - bug in the emerging icons - DT#5455

skala
Cristian Fasanando 16 years ago
parent 4ffc3dbbf0
commit 3c7d415d1f
  1. 6
      main/course_description/index.php
  2. 2
      main/inc/lib/main_api.lib.php
  3. 19
      main/survey/survey.lib.php
  4. 3
      main/survey/survey_list.php
  5. 26
      user_portal.php

@ -122,6 +122,12 @@ $default_description_title_editable[5] = true;
$default_description_title_editable[6] = true;
$default_description_title_editable[7] = true;
/*
-----------------------------------------------------------
Tracking
-----------------------------------------------------------
*/
event_access_tool(TOOL_COURSE_DESCRIPTION);
/*
==============================================================================

@ -2285,6 +2285,8 @@ function api_item_property_update($_course, $tool, $item_id, $lastedit_type, $us
$time = date("Y-m-d H:i:s", $time);
if (!empty($session_id)) {
$session_id = intval($session_id);
} else {
$session_id = api_get_session_id();
}
// Definition of tables

@ -43,7 +43,7 @@ class survey_manager
* @param integer $survey_id the id of the survey
* @param boolean $shared this parameter determines if we have to get the information of a survey from the central (shared) database or from the
* course database
*
* @param string course code optional
* @return array
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@ -51,12 +51,15 @@ class survey_manager
*
* @todo this is the same function as in create_new_survey.php
*/
function get_survey($survey_id,$shared=0)
function get_survey($survey_id,$shared=0,$course_code='')
{
global $_course;
// table definition
if (isset($_GET['course'])) {
if (!empty($course_code)) {
$my_course_id = $course_code;
} else if (isset($_GET['course'])) {
$my_course_id=Security::remove_XSS($_GET['course']);
} else {
$my_course_id=api_get_course_id();
@ -4280,6 +4283,7 @@ class SurveyUtil {
* This function gets all the invited users for a given survey code.
*
* @param string Survey code
* @param string optional - course database
* @return array Array containing the course users and additional users (non course users)
*
* @todo consider making $defaults['additional_users'] also an array
@ -4287,10 +4291,15 @@ class SurveyUtil {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version January 2007
*/
function get_invited_users($survey_code)
function get_invited_users($survey_code,$course_db='')
{
// Database table definition
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
if (!empty($course_db)) {
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION,$course_db);
} else {
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
}
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
// Selecting all the invitations of this survey AND the additional emailaddresses (the left join)

@ -46,6 +46,9 @@ require ('../inc/global.inc.php');
require_once('survey.lib.php');
require_once (api_get_path(LIBRARY_PATH)."/course.lib.php");
//Tracking
event_access_tool(TOOL_SURVEY);
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit(false,true)) //coach can see this
{

@ -61,6 +61,7 @@ require_once $libpath.'debug.lib.inc.php';
require_once $libpath.'system_announcements.lib.php';
require_once $libpath.'groupmanager.lib.php';
require_once $libpath.'usermanager.lib.php';
require_once 'main/survey/survey.lib.php';
api_block_anonymous_users(); // only users who are logged in can proceed
@ -716,7 +717,7 @@ function show_notification($my_course) {
$sqlLastTrackInCourse = "SELECT * FROM $t_track_e_access
USE INDEX (access_cours_code, access_user_id)
WHERE access_cours_code = '".$my_course['k']."'
AND access_user_id = '$user_id'";
AND access_user_id = '$user_id' AND access_session_id ='".$my_course['id_session']."'";
$resLastTrackInCourse = Database::query($sqlLastTrackInCourse, __FILE__, __LINE__);
$oldestTrackDate = "3000-01-01 00:00:00";
while ($lastTrackInCourse = Database::fetch_array($resLastTrackInCourse)) {
@ -733,7 +734,7 @@ function show_notification($my_course) {
WHERE tet.lastedit_date > '$oldestTrackDate'
AND ctt.name = tet.tool
AND ctt.visibility = '1'
AND tet.lastedit_user_id != $user_id
AND tet.lastedit_user_id != $user_id AND tet.id_session = '".$my_course['id_session']."'
ORDER BY tet.lastedit_date";
$res = Database::query($sql);
@ -742,14 +743,19 @@ function show_notification($my_course) {
$group_ids[] = 0; //add group 'everyone'
//filter all selected items
while ($res && ($item_property = Database::fetch_array($res))) {
if ((!isset ($lastTrackInCourseDate[$item_property['tool']])
|| $lastTrackInCourseDate[$item_property['tool']] < $item_property['lastedit_date'])
&& ((in_array($item_property['to_group_id'], $group_ids) && $item_property['tool'] != TOOL_DROPBOX)
|| $item_property['to_user_id'] == $user_id)
&& ($item_property['visibility'] == '1'
|| ($my_course['s'] == '1' && $item_property['visibility'] == '0')
|| !isset ($item_property['visibility']))) {
$notifications[$item_property['tool']] = $item_property;
if ((!isset ($lastTrackInCourseDate[$item_property['tool']]) || $lastTrackInCourseDate[$item_property['tool']] < $item_property['lastedit_date'])
&& ((in_array($item_property['to_group_id'], $group_ids) && ($item_property['tool'] != TOOL_DROPBOX && $item_property['tool'] != TOOL_NOTEBOOK && $item_property['tool'] != TOOL_CHAT)))
&& ($item_property['visibility'] == '1' || ($my_course['s'] == '1' && $item_property['visibility'] == '0') || !isset ($item_property['visibility']))) {
if (($item_property['tool'] == TOOL_ANNOUNCEMENT || $item_property['tool'] == TOOL_CALENDAR_EVENT) && (($item_property['to_user_id'] != $user_id ) && (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'],$group_ids)) )) continue;
if ($item_property['tool'] == TOOL_SURVEY) {
$survey_info = survey_manager::get_survey($item_property['ref'],0,$my_course['k']);
$invited_users = SurveyUtil::get_invited_users($survey_info['code'],$course_database);
if (!in_array($user_id,$invited_users['course_users'])) continue;
}
$notifications[$item_property['tool']] = $item_property;
}
}
//show all tool icons where there is something new

Loading…
Cancel
Save