Ejemplo n.º 1
0
 /**
  * @param bool $include_admin_tools
  * @return array
  */
 static function get_navigation_items($include_admin_tools = false)
 {
     $navigation_items = array();
     $course_id = api_get_course_int_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'] = api_get_path(REL_COURSE_PATH) . Security::remove_XSS($_SESSION['_course']['path']) . '/index.php';
         $navigation_items['home']['name'] = get_lang('CourseHomepageLink');
         $sql_menu_query = "SELECT * FROM {$course_tools_table}\n                               WHERE c_id = {$course_id} AND visibility='1' and admin='0'\n                               ORDER BY id ASC";
         $sql_result = Database::query($sql_menu_query);
         while ($row = Database::fetch_array($sql_result)) {
             $navigation_items[$row['id']] = $row;
             if (stripos($row['link'], 'http://') === false && stripos($row['link'], 'https://') === false) {
                 $navigation_items[$row['id']]['link'] = api_get_path(REL_CODE_PATH) . $row['link'];
                 $navigation_items[$row['id']]['name'] = CourseHome::translate_tool_name($row);
             }
         }
         /* 	Admin (edit rights) only links
             - Course settings (course admin only)
             - Course rights (roles & rights overview) */
         if ($include_admin_tools) {
             $course_settings_sql = "SELECT name,image FROM {$course_tools_table}\n                                        WHERE c_id = {$course_id}  AND link='course_info/infocours.php'";
             $sql_result = Database::query($course_settings_sql);
             $course_setting_info = Database::fetch_array($sql_result);
             $course_setting_visual_name = CourseHome::translate_tool_name($course_setting_info);
             if (api_get_session_id() == 0) {
                 // course settings item
                 $navigation_items['course_settings']['image'] = $course_setting_info['image'];
                 $navigation_items['course_settings']['link'] = api_get_path(REL_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=' . api_get_session_id();
     }
     return $navigation_items;
 }
Ejemplo n.º 2
0
        $content .= CourseHome::show_session_data($session_id);
        $content .= '</table></div>';
    }
    $content .= '<div class="Authoringview">';
    $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
    $content .= CourseHome::show_tools_category($my_list);
    $content .= '</div>';
    //	TOOLS AUTHORING
} else {
    $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
    if (count($my_list) > 0) {
        $content .= '<div class="course-student-view-activity-3col">';
        //ordering by get_lang name
        $order_tool_list = array();
        foreach ($my_list as $key => $new_tool) {
            $tool_name = CourseHome::translate_tool_name($new_tool);
            $order_tool_list[$key] = $tool_name;
        }
        natsort($order_tool_list);
        $my_temp_tool_array = array();
        foreach ($order_tool_list as $key => $new_tool) {
            $my_temp_tool_array[] = $my_list[$key];
        }
        $my_list = $my_temp_tool_array;
        $i = 0;
        foreach ($my_list as $new_tool) {
            if ($i >= 10) {
                $my_list2[] = $new_tool;
            } else {
                $my_list1[] = $new_tool;
            }