$conditions = ' WHERE visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") ';
if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') {
$conditions = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") OR (name = "'.TOOL_TRACKING.'") ) ';
$conditions = ' WHERE (
visibility = 1 AND (
category = "authoring" OR
category = "interaction" OR
category = "plugin"
) OR (name = "'.TOOL_TRACKING.'")
)';
}
$sql = "SELECT *
FROM $course_tool_table t
$conditions AND
c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
case TOOL_AUTHORING:
$sql = "SELECT * FROM $course_tool_table t
WHERE category = 'authoring' AND c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
case TOOL_INTERACTION:
$sql = "SELECT * FROM $course_tool_table t
WHERE category = 'interaction' AND c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
case TOOL_ADMIN_VISIBLE:
$sql = "SELECT * FROM $course_tool_table t
WHERE category = 'admin' AND visibility ='1' AND c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
case TOOL_ADMIN_PLATFORM:
$sql = "SELECT * FROM $course_tool_table t
WHERE category = 'admin' AND c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
case TOOL_DRH:
$sql = "SELECT * FROM $course_tool_table t
WHERE name IN ('tracking') AND c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
case TOOL_COURSE_PLUGIN:
@ -533,12 +539,14 @@ class CourseHome
// but plugins are not present in the tool table, only globally and inside the course_settings table once configured
$sql = "SELECT * FROM $course_tool_table t
WHERE category = 'plugin' AND name <> 'courseblock' AND c_id = $course_id $condition_session
ORDER BY id";
";
$result = Database::query($sql);
break;
}
//Get the list of hidden tools - this might imply performance slowdowns
$sql .= " ORDER BY id ";
// Get the list of hidden tools - this might imply performance slowdowns
// if the course homepage is loaded many times, so the list of hidden
// tools might benefit from a shared memory storage later on