Adding reporting icon for DRH see 7064

1.9.x
Julio Montoya 11 years ago
parent 13e657ef32
commit c916b21c1c
  1. 8
      main/course_home/activity.php
  2. 24
      main/course_home/course_home.php
  3. 39
      main/inc/lib/course_home.lib.php
  4. 22
      main/mySpace/myStudents.php

@ -172,7 +172,15 @@ if ($session_id == 0 && api_is_course_admin() && api_is_allowed_to_edit(null, tr
$content .= CourseHome::show_tools_category($tools); $content .= CourseHome::show_tools_category($tools);
$content .= '</div>'; $content .= '</div>';
} }
if ($isDrhOfCourse) {
$drhTool = CourseHome::get_tools_category(TOOL_DRH);
$content .= '<div class="row">';
$content .= CourseHome::show_tools_category($drhTool);
$content .= '</div>';
}
} }
/** /**
* @param string $title * @param string $title
* @param string $content * @param string $content

@ -127,18 +127,18 @@ $this_section = SECTION_COURSES;
/* Constants */ /* Constants */
define('TOOL_PUBLIC', 'Public'); define('TOOL_PUBLIC', 'Public');
define('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide'); define('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define('TOOL_COURSE_ADMIN', 'courseAdmin'); define('TOOL_COURSE_ADMIN', 'courseAdmin');
define('TOOL_PLATFORM_ADMIN', 'platformAdmin'); define('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define('TOOL_AUTHORING', 'toolauthoring'); define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction'); define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_COURSE_PLUGIN', 'toolcourseplugin'); //all plugins that can be enabled in courses define('TOOL_COURSE_PLUGIN', 'toolcourseplugin'); //all plugins that can be enabled in courses
define('TOOL_ADMIN', 'tooladmin'); define('TOOL_ADMIN', 'tooladmin');
define('TOOL_ADMIN_PLATFORM', 'tooladminplatform'); define('TOOL_ADMIN_PLATFORM', 'tooladminplatform');
define('TOOL_DRH', 'tool_drh');
define('TOOL_STUDENT_VIEW', 'toolstudentview'); define('TOOL_STUDENT_VIEW', 'toolstudentview');
define('TOOL_ADMIN_VISIBLE', 'tooladminvisible'); define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$course_code = api_get_course_id(); $course_code = api_get_course_id();

@ -434,7 +434,8 @@ class CourseHome
* display: "toolauthoring", "toolinteraction", "tooladmin", "tooladminplatform", "toolplugin" * display: "toolauthoring", "toolinteraction", "tooladmin", "tooladminplatform", "toolplugin"
* @return array * @return array
*/ */
public static function get_tools_category($course_tool_category) { public static function get_tools_category($course_tool_category)
{
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST); $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$is_platform_admin = api_is_platform_admin(); $is_platform_admin = api_is_platform_admin();
$all_tools_list = array(); $all_tools_list = array();
@ -450,36 +451,41 @@ class CourseHome
if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') { if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') {
$condition_display_tools = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") OR (name = "'.TOOL_TRACKING.'") ) '; $condition_display_tools = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") OR (name = "'.TOOL_TRACKING.'") ) ';
} }
$sql = "SELECT * FROM $course_tool_table $condition_display_tools AND c_id = $course_id $condition_session ORDER BY id"; $sql = "SELECT *
FROM $course_tool_table
$condition_display_tools AND
c_id = $course_id $condition_session
ORDER BY id";
$result = Database::query($sql); $result = Database::query($sql);
$col_link = "##003399";
break; break;
case TOOL_AUTHORING: case TOOL_AUTHORING:
$sql = "SELECT * FROM $course_tool_table $sql = "SELECT * FROM $course_tool_table
WHERE category = 'authoring' AND c_id = $course_id $condition_session WHERE category = 'authoring' AND c_id = $course_id $condition_session
ORDER BY id"; ORDER BY id";
$result = Database::query($sql); $result = Database::query($sql);
$col_link = "##003399";
break; break;
case TOOL_INTERACTION: case TOOL_INTERACTION:
$sql = "SELECT * FROM $course_tool_table $sql = "SELECT * FROM $course_tool_table
WHERE category = 'interaction' AND c_id = $course_id $condition_session WHERE category = 'interaction' AND c_id = $course_id $condition_session
ORDER BY id"; ORDER BY id";
$result = Database::query($sql); $result = Database::query($sql);
$col_link = "##003399";
break; break;
case TOOL_ADMIN_VISIBLE: case TOOL_ADMIN_VISIBLE:
$sql = "SELECT * FROM $course_tool_table $sql = "SELECT * FROM $course_tool_table
WHERE category = 'admin' AND visibility ='1' AND c_id = $course_id $condition_session WHERE category = 'admin' AND visibility ='1' AND c_id = $course_id $condition_session
ORDER BY id"; ORDER BY id";
$result = Database::query($sql); $result = Database::query($sql);
$col_link = "##003399";
break; break;
case TOOL_ADMIN_PLATFORM: case TOOL_ADMIN_PLATFORM:
$sql = "SELECT * FROM $course_tool_table $sql = "SELECT * FROM $course_tool_table
WHERE category = 'admin' AND c_id = $course_id $condition_session ORDER BY id"; WHERE category = 'admin' AND c_id = $course_id $condition_session ORDER BY id";
$result = Database::query($sql); $result = Database::query($sql);
$col_link = "##003399"; break;
case TOOL_DRH:
$sql = "SELECT * FROM $course_tool_table
WHERE name IN ('tracking') AND c_id = $course_id $condition_session
ORDER BY id";
$result = Database::query($sql);
break; break;
case TOOL_COURSE_PLUGIN: case TOOL_COURSE_PLUGIN:
//Other queries recover id, name, link, image, visibility, admin, address, added_tool, target, category and session_id //Other queries recover id, name, link, image, visibility, admin, address, added_tool, target, category and session_id
@ -783,11 +789,13 @@ class CourseHome
$tool_link_params = array(); $tool_link_params = array();
$toolId = isset($tool["id"]) ? $tool["id"] : null;
//$tool['link'] = htmlspecialchars($tool['link']) ; //$tool['link'] = htmlspecialchars($tool['link']) ;
//@todo this visio stuff should be removed //@todo this visio stuff should be removed
if (strpos($tool['name'], 'visio_') !== false) { if (strpos($tool['name'], 'visio_') !== false) {
$tool_link_params = array( $tool_link_params = array(
'id' => 'tooldesc_'.$tool["id"], 'id' => 'tooldesc_'.$toolId,
'href' => '"javascript: void(0);"', 'href' => '"javascript: void(0);"',
'class' => $class, 'class' => $class,
'onclick' => 'javascript: window.open(\''.$tool['link'].'\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')', 'onclick' => 'javascript: window.open(\''.$tool['link'].'\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')',
@ -795,7 +803,7 @@ class CourseHome
); );
} elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) { } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
$tool_link_params = array( $tool_link_params = array(
'id' => 'tooldesc_'.$tool["id"], 'id' => 'tooldesc_'.$toolId,
'class' => $class, 'class' => $class,
'href' => 'javascript: void(0);', 'href' => 'javascript: void(0);',
'onclick' => 'javascript: window.open(\''.$tool['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')', //Chat Open Windows 'onclick' => 'javascript: window.open(\''.$tool['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')', //Chat Open Windows
@ -804,14 +812,15 @@ class CourseHome
} else { } else {
if (count(explode('type=classroom', $tool['link'])) == 2 || count(explode('type=conference', $tool['link'])) == 2) { if (count(explode('type=classroom', $tool['link'])) == 2 || count(explode('type=conference', $tool['link'])) == 2) {
$tool_link_params = array( $tool_link_params = array(
'id' => 'tooldesc_'.$tool["id"], 'id' => 'tooldesc_'.$toolId,
'href' => $tool['link'], 'href' => $tool['link'],
'class' => $class, 'class' => $class,
'target' => '_blank' 'target' => '_blank'
); );
} else { } else {
$tool_link_params = array( $tool_link_params = array(
'id' => 'tooldesc_'.$tool["id"], 'id' => 'tooldesc_'.$toolId,
'href' => $tool['link'], 'href' => $tool['link'],
'class' => $class, 'class' => $class,
'target' => $tool['target'] 'target' => $tool['target']
@ -831,7 +840,7 @@ class CourseHome
$tool_link_params['href'] = api_get_path(WEB_PLUGIN_PATH).$tool['original_link'].'?'.api_get_cidreq(); $tool_link_params['href'] = api_get_path(WEB_PLUGIN_PATH).$tool['original_link'].'?'.api_get_cidreq();
} }
$icon = Display::return_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id']), ICON_SIZE_BIG, false); $icon = Display::return_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$toolId), ICON_SIZE_BIG, false);
// Validation when belongs to a session // Validation when belongs to a session
$session_img = api_get_session_image($tool['session_id'], (!empty($_user['status']) ? $_user['status'] : '')); $session_img = api_get_session_image($tool['session_id'], (!empty($_user['status']) ? $_user['status'] : ''));
@ -862,18 +871,18 @@ class CourseHome
$data = ''; $data = '';
$html .= '<div class="span4 course-tool">'; $html .= '<div class="span4 course-tool">';
$image = (substr($item['tool']['image'], 0, strpos($item['tool']['image'], '.'))).'.png'; $image = (substr($item['tool']['image'], 0, strpos($item['tool']['image'], '.'))).'.png';
$toolId = isset($item['tool']['id']) ? $item['tool']['id'] : null;
if (isset($item['tool']['custom_image'])) { if (isset($item['tool']['custom_image'])) {
$original_image = Display::img( $original_image = Display::img(
$item['tool']['custom_image'], $item['tool']['custom_image'],
$item['name'], $item['name'],
array('id' => 'toolimage_'.$item['tool']['id']) array('id' => 'toolimage_'.$toolId)
); );
} else { } else {
$original_image = Display::return_icon( $original_image = Display::return_icon(
$image, $image,
$item['name'], $item['name'],
array('id' => 'toolimage_'.$item['tool']['id']), array('id' => 'toolimage_'.$toolId),
ICON_SIZE_BIG, ICON_SIZE_BIG,
false false
); );

@ -33,6 +33,7 @@ require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
api_block_anonymous_users(); api_block_anonymous_users();
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) { if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) {
// Check if the user is tutor of the course // Check if the user is tutor of the course
$user_course_status = CourseManager::get_tutor_in_course_status( $user_course_status = CourseManager::get_tutor_in_course_status(
@ -85,7 +86,7 @@ if (isset($_GET['details'])) {
"name" => get_lang("Users") "name" => get_lang("Users")
); );
} else } else
if (!empty ($_GET['origin']) && $_GET['origin'] == 'tracking_course') { if (!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
$course_info = CourseManager :: get_course_information($get_course_code); $course_info = CourseManager :: get_course_information($get_course_code);
$interbreadcrumb[] = array ( $interbreadcrumb[] = array (
"url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(), "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(),
@ -222,10 +223,9 @@ if ($check) {
} }
Security::clear_token(); Security::clear_token();
} }
//Generate a new token
// user info // user info
$user_info = api_get_user_info($student_id); $user_info = api_get_user_info($student_id);
$courses_in_session = array(); $courses_in_session = array();
//See #4676 //See #4676
@ -243,8 +243,8 @@ $sessions_coached_by_user = Tracking::get_sessions_coached_by_user(api_get_user_
// RRHH or session admin // RRHH or session admin
if (api_is_session_admin() || api_is_drh()) { if (api_is_session_admin() || api_is_drh()) {
$courses = CourseManager::get_courses_followed_by_drh(api_get_user_id()); $courses = CourseManager::get_courses_followed_by_drh(api_get_user_id());
$session_by_session_admin = SessionManager::get_sessions_followed_by_drh(api_get_user_id()); $session_by_session_admin = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
if (!empty($session_by_session_admin)) { if (!empty($session_by_session_admin)) {
foreach ($session_by_session_admin as $session_coached_by_user) { foreach ($session_by_session_admin as $session_coached_by_user) {
$courses_followed_by_coach = Tracking :: get_courses_list_from_session($session_coached_by_user['id']); $courses_followed_by_coach = Tracking :: get_courses_list_from_session($session_coached_by_user['id']);
@ -299,6 +299,12 @@ while ($row = Database :: fetch_array($rs)) {
} }
} }
} }
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_user_id(),
api_get_course_info()
);
if (api_is_drh() && !api_is_platform_admin()) { if (api_is_drh() && !api_is_platform_admin()) {
if (!empty($student_id)) { if (!empty($student_id)) {
@ -313,8 +319,12 @@ if (api_is_drh() && !api_is_platform_admin()) {
api_not_allowed(true); api_not_allowed(true);
}*/ }*/
} else { } else {
if (api_is_drh() && !UserManager::is_user_followed_by_drh($student_id, api_get_user_id())) { if (!($isDrhOfCourse)) {
api_not_allowed(true); if (api_is_drh() &&
!UserManager::is_user_followed_by_drh($student_id, api_get_user_id())
) {
api_not_allowed(true);
}
} }
} }
} }

Loading…
Cancel
Save