Skip to content

Commit

Permalink
setting up for tintructor admin toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
atutorlangs committed Nov 7, 2013
1 parent e0ddc32 commit 69b9ed6
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 53 deletions.
7 changes: 5 additions & 2 deletions include/header.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,14 @@
$section_title = _AT('my_start_page');
}

if($_current_sub_level_page_i){
$savant->assign('current_sub_level_page', $_current_sub_level_page_i);
} else{
$savant->assign('current_sub_level_page', $_current_sub_level_page);
}
$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
13 changes: 8 additions & 5 deletions include/lib/menu_pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ function get_sub_navigation($current_page) {
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();
Expand All @@ -427,6 +428,7 @@ function get_sub_navigation_i($current_page) {
} 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']));

}
Expand Down Expand Up @@ -455,7 +457,7 @@ function get_current_sub_navigation_page_i($current_page) {

if (!page_available($current_page)) return;

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

if (isset($parent_page) && defined($parent_page)) {
return AT_print($_base_path, 'url.page') . $current_page;
Expand All @@ -464,15 +466,17 @@ function get_current_sub_navigation_page_i($current_page) {
}
}
function get_path($current_page) {
global $_pages, $_base_path, $_base_href;
global $_pages, $_pages, $_base_path, $_base_href;

$path = array();

if (!page_available($current_page)){
return $path;
}
if($_pages[$current_page]['other_parent'] && $_SERVER['HTTP_REFERER'] == $_base_href.'tools/index.php'){
$parent_page = $_pages[$current_page]['other_parent'];
if($_pages_i[$current_page]['other_parent'] && $_SERVER['HTTP_REFERER'] == $_base_href.'tools/index.php'){
$parent_page = $_pages_i[$current_page]['other_parent'];
} else if($_pages_i[$current_page]['children']){
$parent_page = $_pages_i[$current_page]['other_parent'];
}else{
$parent_page = $_pages[$current_page]['parent'];
}
Expand All @@ -483,7 +487,6 @@ function get_path($current_page) {
} else {
$_page_title = _AT($_pages[$current_page]['title_var']);
}

if (isset($parent_page) && defined($parent_page)) {
$path[] = array('url' => AT_print($_base_path, 'url.page') . url_rewrite($current_page), 'title' => $_page_title);
return $path;
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function remove_module(module)
$sql = "SELECT COUNT(*) AS cnt FROM %snews WHERE course_id=%d";
$row = queryDB($sql, array(TABLE_PREFIX, $course_id), TRUE);
}
//debug($row);

if ($row['cnt'] > 0) {

$num_results = $row['cnt'];
Expand Down
6 changes: 3 additions & 3 deletions mods/_core/content/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
$this->_pages['mods/_core/editor/edit_content_folder.php']['title_var'] = 'edit_content_folder';
}
if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_ANNOUNCEMENTS, TRUE)){
$this->_pages['mods/_core/editor/add_content.php']['title_var'] = 'add_content';
$this->_pages['mods/_core/editor/add_content.php']['other_parent'] = 'index.php';
$this->_pages['index.php']['children'] = array('mods/_core/editor/add_content.php');
$this->_pages_i['mods/_core/editor/add_content.php']['title_var'] = 'add_content';
$this->_pages_i['mods/_core/editor/add_content.php']['other_parent'] = 'index.php';
$this->_pages_i['index.php']['children'] = array('mods/_core/editor/add_content.php');
}
$this->_pages['mods/_core/editor/edit_content_folder.php']['parent'] = 'mods/_core/content/index.php';

Expand Down
7 changes: 4 additions & 3 deletions mods/_core/groups/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
$this->_pages['mods/_core/groups/members.php']['title_var'] = 'group_members';
$this->_pages['mods/_core/groups/members.php']['parent'] = 'mods/_core/groups/index.php';
if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_GROUPS, TRUE)){
$this->_pages['mods/_core/groups/create.php']['title_var'] = 'create_groups';
$this->_pages['mods/_core/groups/create.php']['parent'] = 'mods/_core/groups/index.php';
$this->_pages['mods/_core/groups/groups.php']['children'] = array('mods/_core/groups/create.php');
$this->_pages_i['mods/_core/groups/create.php']['title_var'] = 'create_groups';
$this->_pages_i['mods/_core/groups/create.php']['parent'] = 'mods/_core/groups/index.php';
$this->_pages_i['mods/_core/groups/groups.php']['children'] = array('mods/_core/groups/create.php');
$this->_pages['mods/_core/groups/groups.php']['children'] = array();
}
// student stuff
$this->_pages['mods/_core/groups/groups.php']['title_var'] = 'groups';
Expand Down
7 changes: 4 additions & 3 deletions mods/_core/properties/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ function delete() {
$this->_pages['mods/_core/properties/access.php']['guide'] = 'instructor/?p=authenticated_access.php';

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_ADMIN, TRUE)){
// $this->_pages['mods/_core/properties/course_properties.php']['title_var'] = 'properties';
//$this->_pages['mods/_core/properties/course_properties.php']['other_parent'] = 'index.php';
$this->_pages['index.php']['children'] = array('mods/_core/properties/course_properties.php');
$this->_pages_i['mods/_core/properties/course_properties.php']['title_var'] = 'properties';
$this->_pages_i['mods/_core/properties/course_properties.php']['other_parent'] = 'index.php';
$this->_pages_i['index.php']['children'] = array('mods/_core/properties/course_properties.php');
$this->_pages['index.php']['children'] = array();
}
?>
6 changes: 3 additions & 3 deletions mods/_standard/announcements/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
$this->_pages['mods/_standard/announcements/delete_news.php']['parent'] = 'mods/_standard/announcements/index.php';

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_ANNOUNCEMENTS, TRUE)){
$this->_pages['mods/_standard/announceents/add_news.php']['title_var'] = 'add_announcement';
$this->_pages['mods/_standard/announcements/add_news.php']['other_parent'] = 'index.php';
$this->_pages['index.php']['children'] = array('mods/_standard/announcements/add_news.php');
$this->_pages_i['mods/_standard/announcements/add_news.php']['title_var'] = 'add_announcement';
$this->_pages_i['mods/_standard/announcements/add_news.php']['other_parent'] = 'index.php';
$this->_pages_i['index.php']['children'] = array('mods/_standard/announcements/add_news.php');
}
?>
2 changes: 1 addition & 1 deletion mods/_standard/assignments/index_instructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
exit;
} else if (isset($_GET['submissions'])){
$_GET['assignment'] = intval($_GET['assignment']);
header('Location: '.url_rewrite('mods/_standard/file_storage/index.php?ot='.WORKSPACE_ASSIGNMENT.SEP.'oid='.$_GET['assignment'], AT_PRETTY_URL_IS_HEADER));
//header('Location: '.url_rewrite('mods/_standard/file_storage/index.php?ot='.WORKSPACE_ASSIGNMENT.SEP.'oid='.$_GET['assignment'], AT_PRETTY_URL_IS_HEADER));
exit;
}
$msg->addInfo('ASSIGNMENT_FS_SUBMISSIONS');
Expand Down
7 changes: 4 additions & 3 deletions mods/_standard/chat/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
$this->_pages['mods/_standard/chat/manage/start_transcript.php']['parent'] = 'mods/_standard/chat/manage/index.php';

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_CHAT, TRUE)){
$this->_pages['mods/_standard/chat/manage/start_transcript.php']['title_var'] = 'chat_transcript';
$this->_pages['mods/_standard/chat/manage/start_transcript.php']['other_parent'] = 'mods/_standard/chat/index.php';
$this->_pages['mods/_standard/chat/index.php']['children'] = array('mods/_standard/chat/manage/start_transcript.php');
$this->_pages_i['mods/_standard/chat/manage/start_transcript.php']['title_var'] = 'chat_transcript';
$this->_pages_i['mods/_standard/chat/manage/start_transcript.php']['other_parent'] = 'mods/_standard/chat/index.php';
$this->_pages_i['mods/_standard/chat/index.php']['children'] = array('mods/_standard/chat/manage/start_transcript.php');
$this->_pages['mods/_standard/chat/index.php']['children'] = array();
}
$this->_pages['mods/_standard/chat/manage/delete_transcript.php']['title_var'] = 'chat_delete_transcript';
$this->_pages['mods/_standard/chat/manage/delete_transcript.php']['parent'] = 'mods/_standard/chat/manage/index.php';
Expand Down
6 changes: 3 additions & 3 deletions mods/_standard/course_tools/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
$this->_pages['mods/_standard/course_tools/side_menu.php']['avail_in_mobile'] = true;

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_STYLES, TRUE)){
$this->_pages['mods/_standard/course_tools/modules.php']['title_var'] = 'course_tools';
$this->_pages['mods/_standard/course_tools/modules.php']['other_parent'] = 'index.php';
$this->_pages['index.php']['children'] = array('mods/_standard/course_tools/modules.php');
$this->_pages_i['mods/_standard/course_tools/modules.php']['title_var'] = 'course_tools';
$this->_pages_i['mods/_standard/course_tools/modules.php']['other_parent'] = 'index.php';
$this->_pages_i['index.php']['children'] = array('mods/_standard/course_tools/modules.php');
}

?>
12 changes: 7 additions & 5 deletions mods/_standard/faq/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
$this->_pages['mods/_standard/faq/edit_question.php']['parent'] = 'mods/_standard/faq/index_instructor.php';

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_FAQ, TRUE)){
$this->_pages['mods/_standard/faq/add_topic.php']['title_var'] = 'add_topic';
$this->_pages['mods/_standard/faq/add_topic.php']['other_parent'] = 'mods/_standard/faq/index.php';
$this->_pages['mods/_standard/faq/add_question.php']['title_var'] = 'add_question';
$this->_pages['mods/_standard/faq/add_question.php']['other_parent'] = 'mods/_standard/faq/index.php';
$this->_pages['mods/_standard/faq/index.php']['children'] = array('mods/_standard/faq/add_question.php','mods/_standard/faq/add_topic.php');
$this->_pages_i['mods/_standard/faq/add_topic.php']['title_var'] = 'add_topic';
$this->_pages_i['mods/_standard/faq/add_topic.php']['other_parent'] = 'mods/_standard/faq/index.php';
$this->_pages_i['mods/_standard/faq/add_question.php']['title_var'] = 'add_question';
$this->_pages_i['mods/_standard/faq/add_question.php']['other_parent'] = 'mods/_standard/faq/index.php';
$this->_pages_i['mods/_standard/faq/index.php']['children'] = array('mods/_standard/faq/add_question.php','mods/_standard/faq/add_topic.php');
$this->_pages['mods/_standard/faq/index.php']['children'] = array();
}

// student page:
$this->_pages['mods/_standard/faq/index.php']['title_var'] = 'faq';
$this->_pages['mods/_standard/faq/index.php']['img'] = 'images/home-faq.png';
Expand Down
10 changes: 10 additions & 0 deletions mods/_standard/links/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@

$this->_pages['mods/_standard/links/add.php']['title_var'] = 'suggest_link';
$this->_pages['mods/_standard/links/add.php']['parent'] = 'mods/_standard/links/index.php';
/*
if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_LINKS, TRUE)){
$this->_pages_i['mods/_standard/links/tools/index.php']['title_var'] = 'manage_links';
$this->_pages_i['mods/_standard/links/tools/index.php']['parent'] = 'mods/_standard/links/index.php';
$this->_pages_i['mods/_standard/links/tools/index.php']['children'] = array('mods/_standard/links/tools/add.php', 'mods/_standard/links/tools/categories.php', 'mods/_standard/links/tools/categories_create.php');
$this->_pages['mods/_standard/links/tools/index.php']['guide'] = 'instructor/?p=links.php';
//$this->_pages['mods/_standard/chat/index.php']['children'] = array();
}
*/

function links_get_group_url($group_id) {
// Adding queryDB to what might be a broken SQL query. This query might return multiple rows and only the first one is selected.
Expand Down
7 changes: 4 additions & 3 deletions mods/_standard/polls/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
$this->_pages['mods/_standard/polls/tools/delete.php']['parent'] = 'mods/_standard/polls/tools/index.php';

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_POLLS, TRUE)){
$this->_pages['mods/_standard/polls/tools/add.php']['title_var'] = 'add_poll';
$this->_pages['mods/_standard/polls/tools/add.php']['other_parent'] = 'mods/_standard/polls/index.php';
$this->_pages['mods/_standard/polls/index.php']['children'] = array('mods/_standard/polls/tools/add.php');
$this->_pages_i['mods/_standard/polls/tools/add.php']['title_var'] = 'add_poll';
$this->_pages_i['mods/_standard/polls/tools/add.php']['other_parent'] = 'mods/_standard/polls/index.php';
$this->_pages_i['mods/_standard/polls/index.php']['children'] = array('mods/_standard/polls/tools/add.php');
$this->_pages['mods/_standard/polls/index.php']['children'] = array();
}
?>
14 changes: 7 additions & 7 deletions mods/_standard/reading_list/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@


if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_READING_LIST, TRUE)){
$this->_pages['mods/_standard/reading_list/display_resources.php']['title_var'] = 'rl_create_resources';
$this->_pages['mods/_standard/reading_list/display_resources.php']['other_parent'] = 'mods/_standard/reading_list/index.php';
$this->_pages['mods/_standard/reading_list/index_instructor.php']['title_var'] = 'reading_list';
$this->_pages['mods/_standard/reading_list/index_instructor.php']['other_parent'] = 'mods/_standard/reading_list/index.php';
$this->_pages['mods/_standard/reading_list/index.php']['children'] = array('mods/_standard/reading_list/index_instructor.php','mods/_standard/reading_list/display_resources.php');
$this->_pages['mods/_standard/reading_list/index.php']['children'] = array_merge($this->_pages['mods/_standard/reading_list/index.php']['children'], array('mods/_standard/reading_list/reading_details.php'));

$this->_pages_i['mods/_standard/reading_list/display_resources.php']['title_var'] = 'rl_create_resources';
$this->_pages_i['mods/_standard/reading_list/display_resources.php']['other_parent'] = 'mods/_standard/reading_list/index.php';
$this->_pages_i['mods/_standard/reading_list/index_instructor.php']['title_var'] = 'reading_list';
$this->_pages_i['mods/_standard/reading_list/index_instructor.php']['other_parent'] = 'mods/_standard/reading_list/index.php';
$this->_pages_i['mods/_standard/reading_list/index.php']['children'] = array('mods/_standard/reading_list/index_instructor.php','mods/_standard/reading_list/display_resources.php');
//$this->_pages_i['mods/_standard/reading_list/index.php']['children'] = array_merge($this->_pages['mods/_standard/reading_list/index.php']['children'], array('mods/_standard/reading_list/reading_details.php'));
$this->_pages['mods/_standard/reading_list/index.php']['children'] = array();
} else {
$this->_pages['mods/_standard/reading_list/index.php']['children'] = array('mods/_standard/reading_list/reading_details.php');

Expand Down
19 changes: 10 additions & 9 deletions mods/_standard/tests/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,16 @@
$this->_pages['mods/_standard/tests/test_intro.php']['parent'] = 'mods/_standard/tests/my_tests.php';

if($_SESSION['is_admin'] > 0 || authenticate(AT_PRIV_TESTS, TRUE)){
$this->_pages['mods/_standard/tests/index.php']['title_var'] = 'tests';
$this->_pages['mods/_standard/tests/index.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages['mods/_standard/tests/question_db.php']['title_var'] = 'question_database';
$this->_pages['mods/_standard/tests/question_db.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages['mods/_standard/tests/question_cats.php']['title_var'] = 'question_categories';
$this->_pages['mods/_standard/tests/question_cats.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages['mods/_standard/tests/create_test.php']['title_var'] = 'create_test';
$this->_pages['mods/_standard/tests/create_test.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages['mods/_standard/tests/my_tests.php']['children'] = array('mods/_standard/tests/index.php','mods/_standard/tests/question_db.php','mods/_standard/tests/create_test.php', 'mods/_standard/tests/question_cats.php');
$this->_pages_i['mods/_standard/tests/index.php']['title_var'] = 'tests';
$this->_pages_i['mods/_standard/tests/index.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages_i['mods/_standard/tests/question_db.php']['title_var'] = 'question_database';
$this->_pages_i['mods/_standard/tests/question_db.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages_i['mods/_standard/tests/question_cats.php']['title_var'] = 'question_categories';
$this->_pages_i['mods/_standard/tests/question_cats.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages_i['mods/_standard/tests/create_test.php']['title_var'] = 'create_test';
$this->_pages_i['mods/_standard/tests/create_test.php']['other_parent'] = 'mods/_standard/tests/my_tests.php';
$this->_pages_i['mods/_standard/tests/my_tests.php']['children'] = array('mods/_standard/tests/index.php','mods/_standard/tests/question_db.php','mods/_standard/tests/create_test.php', 'mods/_standard/tests/question_cats.php');
$this->_pages['mods/_standard/tests/my_tests.php']['children'] = array();
}


Expand Down
32 changes: 30 additions & 2 deletions themes/default/include/header.tmpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
* $this->top_level_pages associative array of the top level navigation
* $this->current_top_level_page the full path to the current top level page with file name
* $this->sub_level_pages associate array of sub level navigation
* $this->sub_level_pages_i associate array of sub level navigation tools for instructors
* $this->back_to_page if set, the path and file name to the part of this page (if parent is not a top level nav)
* $this->current_sub_level_page the full path to the current sub level page with file name
* $this->current_sub_level_page_i the full path to the current sub level page with file name for sub navigation intructor tools
* $this->guide the full path and file name to the guide page
* $this->shortcuts the array of tools' shortcuts to display at top right corner. Used by content.php and edit_content_folder.php
* ======================================
Expand Down Expand Up @@ -367,7 +369,9 @@
</div>


<?php if (count($this->sub_level_pages) > 0): ?>
<?php

if (count($this->sub_level_pages) > 0): ?>
<div id="subnavlistcontainer" role="navigation" aria-live="rude">
<a name="admin_tools" id="admin_tools" title="admin tools"></a>
<div id="subnavbacktopage">
Expand All @@ -378,7 +382,9 @@
</div>

<ul id="subnavlist">
<?php $num_pages = count($this->sub_level_pages);
<?php

$num_pages = count($this->sub_level_pages);

?>
<?php for ($i=0; $i<$num_pages; $i++): ?>
Expand All @@ -393,6 +399,28 @@
<?php endif; ?>
<?php endfor; ?>
</ul>


<?php
$num_pages_i = count($this->sub_level_pages_i);
if(is_array($this->sub_level_pages_i)){
$num_pages_i = count($this->sub_level_pages_i);
?>
<ul id="subnavlist_i">

<?php for ($i=0; $i<$num_pages_i; $i++): ?>

<?php if ($this->sub_level_pages_i[$i]['url'] == $this->current_sub_level_page): ?>
<li class="active"><?php echo htmlentities_utf8($this->sub_level_pages_i[$i]['title']); ?></li>
<?php else: ?>
<li><a href="<?php echo $this->sub_level_pages_i[$i]['url']; ?>"><?php echo htmlentities_utf8($this->sub_level_pages_i[$i]['title']); ?></a></li>
<?php endif; ?>
<?php if ($i < $num_pages-1):
echo " ";?>
<?php endif; ?>
<?php endfor; ?>
</ul>
<?php } ?>
</div>
<?php endif; ?>

Expand Down

0 comments on commit 69b9ed6

Please sign in to comment.