|
@@ -1257,121 +1257,12 @@ class CourseHome
|
|
return $category;
|
|
return $category;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @param bool $include_admin_tools
|
|
|
|
- *
|
|
|
|
- * @return array
|
|
|
|
- */
|
|
|
|
- public static function get_navigation_items($include_admin_tools = false)
|
|
|
|
- {
|
|
|
|
- $navigation_items = [];
|
|
|
|
- $course_id = api_get_course_int_id();
|
|
|
|
- $courseInfo = api_get_course_info();
|
|
|
|
- $sessionId = api_get_session_id();
|
|
|
|
-
|
|
|
|
- $conditionSession = api_get_session_condition(
|
|
|
|
- $sessionId,
|
|
|
|
- true,
|
|
|
|
- true,
|
|
|
|
- 'session_id'
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- if (!empty($course_id)) {
|
|
|
|
- $course_tools_table = Database::get_course_table(TABLE_TOOL_LIST);
|
|
|
|
- /* Link to the Course homepage */
|
|
|
|
- $navigation_items['home']['image'] = 'home.gif';
|
|
|
|
- $navigation_items['home']['link'] = $courseInfo['course_public_url'];
|
|
|
|
- $navigation_items['home']['name'] = get_lang('CourseHomepageLink');
|
|
|
|
-
|
|
|
|
- $sql = "SELECT * FROM $course_tools_table
|
|
|
|
- WHERE
|
|
|
|
- c_id = $course_id AND
|
|
|
|
- visibility = '1' AND
|
|
|
|
- admin = '0'
|
|
|
|
- $conditionSession
|
|
|
|
- ORDER BY id ASC";
|
|
|
|
- $result = Database::query($sql);
|
|
|
|
-
|
|
|
|
- $hideTools = [];
|
|
|
|
- $hideToolsKeys = [];
|
|
|
|
- if (!api_is_platform_admin()) {
|
|
|
|
- $hideTools = api_get_setting('course_hide_tools');
|
|
|
|
- $hideToolsKeys = array_keys($hideTools);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- while ($row = Database::fetch_array($result)) {
|
|
|
|
- if (!empty($hideTools)) {
|
|
|
|
- if (in_array($row['name'], $hideToolsKeys)) {
|
|
|
|
- // Tool is hidden
|
|
|
|
- if ($hideTools[$row['name']] == 'true') {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $navigation_items[$row['id']] = $row;
|
|
|
|
- if (stripos($row['link'], 'http://') === false &&
|
|
|
|
- stripos($row['link'], 'https://') === false
|
|
|
|
- ) {
|
|
|
|
- $navigation_items[$row['id']]['link'] = api_get_path(WEB_CODE_PATH);
|
|
|
|
-
|
|
|
|
- if ($row['category'] == 'plugin') {
|
|
|
|
- $plugin = new AppPlugin();
|
|
|
|
- $pluginInfo = $plugin->getPluginInfo($row['name']);
|
|
|
|
- if (isset($pluginInfo['title'])) {
|
|
|
|
- $navigation_items[$row['id']]['link'] = api_get_path(WEB_PLUGIN_PATH);
|
|
|
|
- $navigation_items[$row['id']]['name'] = $pluginInfo['title'];
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- $navigation_items[$row['id']]['name'] = self::translate_tool_name($row);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $navigation_items[$row['id']]['link'] .= $row['link'];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /* Admin (edit rights) only links
|
|
|
|
- - Course settings (course admin only)
|
|
|
|
- - Course rights (roles & rights overview) */
|
|
|
|
- if ($include_admin_tools) {
|
|
|
|
- $sql = "SELECT name, image FROM $course_tools_table
|
|
|
|
- WHERE c_id = $course_id AND link='course_info/infocours.php'";
|
|
|
|
- $sql_result = Database::query($sql);
|
|
|
|
- $course_setting_info = Database::fetch_array($sql_result);
|
|
|
|
- $course_setting_visual_name = self::translate_tool_name($course_setting_info);
|
|
|
|
- if ($sessionId == 0) {
|
|
|
|
- // course settings item
|
|
|
|
- $navigation_items['course_settings']['image'] = $course_setting_info['image'];
|
|
|
|
- $navigation_items['course_settings']['link'] = api_get_path(WEB_CODE_PATH).'course_info/infocours.php';
|
|
|
|
- $navigation_items['course_settings']['name'] = $course_setting_visual_name;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- foreach ($navigation_items as $key => $navigation_item) {
|
|
|
|
- if (strstr($navigation_item['link'], '?')) {
|
|
|
|
- //link already contains a parameter, add course id parameter with &
|
|
|
|
- $parameter_separator = '&';
|
|
|
|
- } else {
|
|
|
|
- //link doesn't contain a parameter yet, add course id parameter with ?
|
|
|
|
- $parameter_separator = '?';
|
|
|
|
- }
|
|
|
|
- //$navigation_items[$key]['link'] .= $parameter_separator.api_get_cidreq();
|
|
|
|
- $navigation_items[$key]['link'] .= $parameter_separator.'cidReq='.api_get_course_id().'&gidReq=0&id_session='.$sessionId;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return $navigation_items;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Show a navigation menu.
|
|
* Show a navigation menu.
|
|
*/
|
|
*/
|
|
public static function show_navigation_menu()
|
|
public static function show_navigation_menu()
|
|
{
|
|
{
|
|
$blocks = self::getUserBlocks();
|
|
$blocks = self::getUserBlocks();
|
|
-
|
|
|
|
- $course_id = api_get_course_id();
|
|
|
|
-
|
|
|
|
$class = null;
|
|
$class = null;
|
|
$idLearn = null;
|
|
$idLearn = null;
|
|
$item = null;
|
|
$item = null;
|