From 3dc103e04efa415d3b90bdea845c4173260f75eb Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 1 Jun 2007 07:05:44 +0200 Subject: [PATCH] [svn r12519] Fixed breadcrumb so that: - it shows the learning path name (and points to the current learnpath if clicked) - it shows the tool name but points the user to the course homepage if the learnpath tool itself is not visible --- main/newscorm/lp_header.php | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/main/newscorm/lp_header.php b/main/newscorm/lp_header.php index 06df499ff0..c9e7a7f677 100644 --- a/main/newscorm/lp_header.php +++ b/main/newscorm/lp_header.php @@ -17,10 +17,40 @@ if(isset($_SESSION['lpobject'])){ $temp = $_SESSION['lpobject']; $_SESSION['oLP'] = unserialize($temp); } -//$nameTools = $_SESSION['oLP']->get_name(); +$path_name = htmlspecialchars($_SESSION['oLP']->get_name()); +$path_id = $_SESSION['oLP']->get_id(); + +// Check if the learnpaths list should be accessible to the user +$show_link = true; +if(!api_is_allowed_to_edit()) //if the user has no edit permission (simple user) +{ + $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST); + $result = api_sql_query("SELECT * FROM $course_tool_table WHERE name='learnpath'",__FILE__,__LINE__); + if(Database::num_rows($result)>0) + { + $row = Database::fetch_array($result); + if($row['visibility'] == '0') //if the tool is *not* visible + { + $show_link = false; + } + } + else + { + $show_link = false; + } +} + $header_hide_main_div = true; -$interbreadcrumb[]= array ("url"=>"./lp_controller.php?action=list", "name"=> get_lang(ucfirst(TOOL_LEARNPATH))); -//$interbreadcrumb[]= array ("url"=>"./lp_controller.php?action=view&lp_id=".$_SESSION['oLP']->get_id(), "name"=> $nameTools); +if($show_link) +{ + $interbreadcrumb[]= array ("url"=>"./lp_controller.php?action=list", "name"=> get_lang(ucfirst(TOOL_LEARNPATH))); +} +else //if the tool is hidden and the user has no edit permissions, make the breadcrumb link point to the course homepage +{ + $web_course_path = api_get_path(WEB_COURSE_PATH); + $interbreadcrumb[]= array ("url"=>$web_course_path.$_course['path'].'/index.php', "name"=> get_lang(ucfirst(TOOL_LEARNPATH))); +} +$interbreadcrumb[] = array("url"=>"./lp_controller.php?action=view&lp_id=".$path_id,'name'=>$path_name); $noPHP_SELF = true; Display::display_header($nameTools,"Path", null); ?>