Skip to content

Commit

Permalink
initial commit of redesigned hide_admin bar, separating and for instr…
Browse files Browse the repository at this point in the history
…uctor course admin tools
  • Loading branch information
atutorlangs committed Nov 6, 2013
1 parent 74358e5 commit e0ddc32
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 31 deletions.
9 changes: 8 additions & 1 deletion include/header.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@
exit;
}
$_sub_level_pages = get_sub_navigation($current_page);
$_sub_level_pages_i = get_sub_navigation_i($current_page);

$_current_sub_level_page = get_current_sub_navigation_page($current_page);
$_current_sub_level_page_i = get_current_sub_navigation_page_i($current_page);

$_path = get_path($current_page);
unset($_path[0]);
Expand Down Expand Up @@ -229,6 +231,10 @@
$back_to_page = $_path[3];
} else if (isset($_path[1]['url'], $_sub_level_pages[0]['url']) && $_path[1]['url'] == $_sub_level_pages[0]['url']) {
$back_to_page = isset($_path[2]) ? $_path[2] : null;
} else if (isset($_path[2]['url'], $_sub_level_pages_i[0]['url']) && $_path[2]['url'] == $_sub_level_pages_i[0]['url']) {
$back_to_page = $_path[3];
} else if (isset($_path[1]['url'], $_sub_level_pages_i[0]['url']) && $_path[1]['url'] == $_sub_level_pages_i[0]['url']) {
$back_to_page = isset($_path[2]) ? $_path[2] : null;
} else if (isset($_path[1])) {
$back_to_page = $_path[1];
}
Expand Down Expand Up @@ -293,8 +299,9 @@

$savant->assign('current_top_level_page', $_current_top_level_page);
$savant->assign('sub_level_pages', $_sub_level_pages);
$savant->assign('sub_level_pages_i', $_sub_level_pages_i);
$savant->assign('current_sub_level_page', $_current_sub_level_page);

$savant->assign('current_sub_level_page_i', $_current_sub_level_page_i);
$savant->assign('path', $_path);
$savant->assign('back_to_page', isset($back_to_page) ? $back_to_page : null);
$savant->assign('page_title', htmlspecialchars($_page_title, ENT_COMPAT, "UTF-8"));
Expand Down
42 changes: 42 additions & 0 deletions include/lib/menu_pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,37 @@ function get_sub_navigation($current_page) {

return $_sub_level_pages;
}
/**
* Get tools for the instructors admin tool bar
* gatheres the $_pages_i array of instrtor tools
* @param $current_page - string, the page location used as a key in $_pages_i
*/
function get_sub_navigation_i($current_page) {
global $_pages_i, $_base_path;
$_sub_level_pages_i = '';
if (isset($current_page) && defined($current_page)) {
// reached the top
return array();
} else if (isset($_pages_i[$current_page]['children']) && page_available($current_page)) {

foreach ($_pages_i[$current_page]['children'] as $child) {
if (!page_available($child)) continue;

if (isset($_pages_i[$child]['title']) && $_pages_i[$child]['title'] != '') {
$_page_title = $_pages_i[$child]['title'];
} else {
$_page_title = _AT($_pages_i[$child]['title_var']);
}
$_sub_level_pages_i[] = array('url' => AT_print($_base_path, 'url.page') . $child, 'title' => $_page_title, 'has_children' => isset($_pages_i[$child]['children']));

}
} else if (isset($_pages_i[$current_page]['parent'])) {
// no children
$parent_page = $_pages_i[$current_page]['parent'];
return get_sub_navigation_i($parent_page);
}
return $_sub_level_pages_i;
}
function get_current_sub_navigation_page($current_page) {
global $_pages, $_base_path;

Expand All @@ -420,7 +450,19 @@ function get_current_sub_navigation_page($current_page) {
return AT_print($_base_path, 'url.page') . $current_page;
}
}
function get_current_sub_navigation_page_i($current_page) {
global $_pages_i, $_base_path;

if (!page_available($current_page)) return;

$parent_page = $_pages_i[$current_page]['parent'];

if (isset($parent_page) && defined($parent_page)) {
return AT_print($_base_path, 'url.page') . $current_page;
} else {
return AT_print($_base_path, 'url.page') . $current_page;
}
}
function get_path($current_page) {
global $_pages, $_base_path, $_base_href;

Expand Down
6 changes: 3 additions & 3 deletions jscripts/ATutor_js.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//Handle the hide admin tool switch
var initialStatus = ($.cookie('showSubNav') === "on") ? "1" : "0";
if(initialStatus === "0"){
$("#subnavlistcontainer").toggleClass("hidden").hide('slow');
$("#subnavlist_i").toggleClass("hidden").hide('slow');
$(".menuedit").toggleClass("hidden").hide('slow');
$("#shortcuts").toggleClass("hidden").hide('slow');
$(".del-content-icon").toggleClass("hidden").hide('slow');
Expand All @@ -51,7 +51,7 @@
}
ATutor.switchView = function (viewFlag) {
if(viewFlag === "0"){
$("#subnavlistcontainer").toggleClass("show").show('slow');
$("#subnavlist_i").toggleClass("show").show('slow');
$(".menuedit").toggleClass("show").show('slow');
$("#shortcuts").toggleClass("show").show('slow');
$(".del-content-icon").toggleClass("show").show('slow');
Expand All @@ -61,7 +61,7 @@
console.log("viewFlag 1; " + viewFlag + "; " + $.cookie("showSubNav"));
console.log("switchval=" + $('#admin_switch').val() + ' initial=' + initialStatus);
} else if(viewFlag === "1") {
$("#subnavlistcontainer").toggleClass("hidden").hide('slow');
$("#subnavlist_i").toggleClass("hidden").hide('slow');
$(".menuedit").toggleClass("hidden").hide('slow');
$("#shortcuts").toggleClass("hidden").hide('slow');
$(".del-content-icon").toggleClass("hidden").hide('slow');
Expand Down
7 changes: 5 additions & 2 deletions mods/_core/modules/classes/Module.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class Module {
var $_admin_privilege; // priv bit(s) | 0 (in dec form)
var $_display_defaults; // bit(s)
var $_pages;
var $_pages_i; // instructor course admin tools
var $_type; // core, standard, extra
var $_module_path; // module path is different for core/standard module and extra module
var $_properties; // array from xml
Expand Down Expand Up @@ -249,14 +250,16 @@ function getAdminPrivilege() { return $this->_admin_privilege; }

function load() {
if (is_file($this->_module_path . $this->_directoryName.'/module.php')) {
global $_modules, $_pages, $_stacks, $_list, $_tool, $_content_tools, $_callbacks; // $_list is for sublinks on "detail view"
global $_modules, $_pages, $_pages_i, $_stacks, $_list, $_tool, $_content_tools, $_callbacks; // $_list is for sublinks on "detail view"

require($this->_module_path . $this->_directoryName.'/module.php');

if (isset($this->_pages)) {
$_pages = array_merge_recursive((array) $_pages, $this->_pages);
}

if (isset($this->_pages_i)) {
$_pages_i = array_merge_recursive((array) $_pages_i, $this->_pages_i);
}
//side menu items
if (isset($this->_stacks)) {
$count = 0;
Expand Down
6 changes: 3 additions & 3 deletions mods/_standard/farchive/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
$this->_pages['mods/_standard/forums/index.php']['children'] = array('mods/_standard/farchive/index_instructor.php');

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_FARCHIVE, TRUE)){
$this->_pages['mods/_standard/farchive/index_instructor.php']['title_var'] = 'farchive_export';
$this->_pages['mods/_standard/farchive/index_instructor.php']['other_parent'] = 'mods/_standard/forums/forum/list.php';
$this->_pages['mods/_standard/forums/forum/list.php']['children'] = array('mods/_standard/farchive/index_instructor.php');
$this->_pages_i['mods/_standard/farchive/index_instructor.php']['title_var'] = 'farchive_export';
$this->_pages_i['mods/_standard/farchive/index_instructor.php']['other_parent'] = 'mods/_standard/forums/forum/list.php';
$this->_pages_i['mods/_standard/forums/forum/list.php']['children'] = array('mods/_standard/farchive/index_instructor.php');
}
?>
11 changes: 5 additions & 6 deletions mods/_standard/forums/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@
$this->_pages['mods/_standard/forums/forum/list.php']['icon'] = 'images/pin.png'; //added favicon
//$this->_pages['forum/list.php']['text'] = 'Sezione Forum'; //added text

// The instructor course admin tools
if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_FORUMS, TRUE)){
$this->_pages['mods/_standard/forums/add_forum.php']['title_var'] = 'create_forum';
$this->_pages['mods/_standard/forums/add_forum.php']['parent'] = 'mods/_standard/forums/forum/list.php';
$this->_pages['mods/_standard/forums/forum/list.php']['children'] = array('search.php?search_within[]=forums', 'mods/_standard/forums/add_forum.php');

}else{
$this->_pages['mods/_standard/forums/forum/list.php']['children'] = array('search.php?search_within[]=forums');
$this->_pages_i['mods/_standard/forums/add_forum.php']['title_var'] = 'create_forum';
$this->_pages_i['mods/_standard/forums/add_forum.php']['parent'] = 'mods/_standard/forums/forum/list.php';
$this->_pages_i['mods/_standard/forums/forum/list.php']['children'] = array('mods/_standard/forums/add_forum.php');

}
$this->_pages['mods/_standard/forums/forum/list.php']['children'] = array('search.php?search_within[]=forums');

//list.php's children
$this->_pages['search.php?search_within[]=forums']['title_var'] = 'search';
Expand Down
43 changes: 27 additions & 16 deletions themes/default/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2022,53 +2022,64 @@ div.toolcontainer{
border-radius:.5em;
-moz-border-radius: .5em .5em .5em .5em;
}

ul#subnavlist_i {
font-family: Verdana,Helvetica,Arial,serif;
float:right;
margin-top: -2.2em;
background-image:url("images/wand.png");
background-position: 1em .3em;
background-repeat:no-repeat;
}
ul#subnavlist {
border-bottom:1px solid #DED29E;
margin-top: 0px;
font-family: Verdana,Helvetica,Arial,serif;

/*font-size:1.0em;*/


}

ul#subnavlist_i li {
list-style: none;
display: inline-block;
font-weight:700;
text-align:center;
border-top:1px solid #DED29E;
border-left:1px solid #DED29E;
border-right:1px solid #DED29E;
border-radius: .3em .3em 0em 0em;
-moz-border-radius: .3em .3em 0em 0em;
padding: .4em .5em .2em .5em ;
border-bottom: 3px solid blue;
}
ul#subnavlist li {
list-style: none;
display: inline-block;
font-weight:700;
text-align:center;
border-bottom:3px solid transparent;
/* border-top:1px solid #685642;
border-left:1px solid #685642;
border-right:1px solid #685642;*/
border-radius: .3em .3em 0em 0em;
-moz-border-radius: .3em .3em 0em 0em;
height:1.3em;
/* -moz-box-shadow:.1em .0em .1em #999999;
box-shadow: .1em .0em .1em #999999;*/
padding: .4em .5em .2em .5em ;
}

ul#subnavlist li a:hover, ul#subnavlist li a:focus, ul#subnavlist li:hover{
ul#subnavlist li a:hover, ul#subnavlist li a:focus, ul#subnavlist li:hover,
ul#subnavlist_i li a:hover, ul#subnavlist_i li a:focus, ul#subnavlist_i li:hover{
color: black;
text-decoration:none;
background-color: #F3F3F3;

background-image: linear-gradient(#FAFAFA, #EAEAEA);
}
ul#subnavlist li.active, ul#subnavlist li:hover, ul#subnavlist li a:focus{
ul#subnavlist li.active, ul#subnavlist li:hover, ul#subnavlist li a:focus,
ul#subnavlist_i li.active, ul#subnavlist_i li:hover, ul#subnavlist_i li a:focus {
color: black;
text-decoration:none;
background-color: #F3F3F3;
border-bottom: 3px solid #D26911;
background-image: linear-gradient(#FAFAFA, #EAEAEA);
}
ul#subnavlist li a {
ul#subnavlist li a, ul#subnavlist_i li a {
/* The normal, unselected tabs. They are all links */
color: #555;
height: 1.5em;
padding:.2em;
padding: .4em .4em .2em .4em ;
text-decoration:underline;
font-weight:500;
}
Expand Down

0 comments on commit e0ddc32

Please sign in to comment.