Skip to content

Commit

Permalink
fix in type vertical and horizontal in toolbars navigation - refs CT#…
Browse files Browse the repository at this point in the history
…8389
  • Loading branch information
aragonc committed Oct 12, 2016
1 parent a21ab7e commit 8211c6d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 35 deletions.
10 changes: 9 additions & 1 deletion app/Resources/public/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -5757,10 +5757,18 @@ ul#toolnavbox li a {
display: block;
margin-left: -2px;
font-size: 12px;
width: 200px;
height: 35px;
margin-left:-160px;
}
ul#toolnavbox li a.icons{
width: 70px;
}
ul#toolnavbox li a.icons-text{
width: 200px;
}
ul#toolnavbox li a.text{
width: 180px;
}
ul#toolnavbox .tool-img{
margin-left: 5px;
}
Expand Down
80 changes: 46 additions & 34 deletions main/inc/lib/course_home.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1171,24 +1171,13 @@ public static function show_navigation_menu()
{
$navigation_items = self::get_navigation_items(true);
$course_id = api_get_course_id();

$html = '<div id="toolnav">';
if (api_get_setting('show_navigation_menu') == 'icons') {
$html .= self::show_navigation_tool_shortcuts($orientation = SHORTCUTS_VERTICAL);
} else {
$html .= '<script>$(function() {
$("#toolnavbox a").stop().animate({"margin-left":"-160px"},1000);
$("#toolnavbox > li").hover(
function () {
$("a",$(this)).stop().animate({"margin-left":"-2px"},200);
$("span",$(this)).css("display","block");
},
function () {
$("a",$(this)).stop().animate({"margin-left":"-160px"},200);
$("span",$(this)).css("display","initial");
}
);
});</script>';

$class= null;
$idLearn = null;
$item = null;
$marginLeft = 160;

$html = '<div id="toolnav">';
$html .= '<ul id="toolnavbox">';
$count = 0;
foreach ($navigation_items as $key => $navigation_item) {
Expand All @@ -1201,31 +1190,54 @@ function () {
$url_item = parse_url($navigation_item['link']);
$url_current = parse_url($_SERVER['REQUEST_URI']);

if (strpos($navigation_item['link'], 'chat') !== false &&
api_get_course_setting('allow_open_chat_window', $course_id)
) {
$html .= '<a class="btn btn-default text-left" href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$navigation_item['target'].'"';
} else {
$html .= '<a class="btn btn-default text-left" href="'.$navigation_item['link'].'" target="_top" ';
if (api_get_setting('show_navigation_menu') == 'text') {
$class = 'text';
$marginLeft = 170;
$item = $navigation_item['name'];
} else if (api_get_setting('show_navigation_menu') == 'icons') {
$class = 'icons';
$marginLeft = 25;
$item = Display::return_icon(substr($navigation_item['image'],0,-3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);
}else{
$class = 'icons-text';
$item = $navigation_item['name'] . Display::return_icon(substr($navigation_item['image'],0,-3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);
}

if (stristr($url_item['path'], $url_current['path'])) {
if (!isset($_GET['learnpath_id']) || strpos($url_item['query'], 'learnpath_id='.intval($_GET['learnpath_id'])) === 0) {
$html .= ' id="here"';
$idLearn = ' id="here"';
}
}
$html .= ' title="'.$navigation_item['name'].'">';
if (api_get_setting('show_navigation_menu') != 'icons') {
$html .= $navigation_item['name'];
}
if (api_get_setting('show_navigation_menu') != 'text') {
$html .= Display::return_icon(substr($navigation_item['image'],0,-3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);

if (strpos($navigation_item['link'], 'chat') !== false &&
api_get_course_setting('allow_open_chat_window', $course_id)
) {
$html .= '<a ' . $idLearn . ' class="btn btn-default text-left ' . $class . ' " href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$navigation_item['target'].'"';
$html .= ' title="'.$navigation_item['name'].'">';
$html .= $item;
$html .= '</a>';
} else {
$html .= '<a ' . $idLearn . ' class="btn btn-default text-left ' . $class . '" href="'.$navigation_item['link'].'" target="_top" title="'.$navigation_item['name'].'">';
$html .= $item;
$html .= '</a>';
}
$html .= '</a>';

$html .= '</li>';
}
$html .= '</ul>';
}
$html .= '<script>$(function() {
$("#toolnavbox a").stop().animate({"margin-left":"-'.$marginLeft.'px"},1000);
$("#toolnavbox > li").hover(
function () {
$("a",$(this)).stop().animate({"margin-left":"-2px"},200);
$("span",$(this)).css("display","block");
},
function () {
$("a",$(this)).stop().animate({"margin-left":"-'.$marginLeft.'px"},200);
$("span",$(this)).css("display","initial");
}
);
});</script>';
$html .= '</div>';

return $html;
Expand Down

0 comments on commit 8211c6d

Please sign in to comment.