diff --git a/course/editsection.php b/course/editsection.php index 783461d0ac461..6e9b848a66825 100644 --- a/course/editsection.php +++ b/course/editsection.php @@ -29,7 +29,7 @@ } add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section"); - + redirect("view.php?id=$course->id"); exit; } @@ -57,14 +57,14 @@ $strsummaryof = get_string('summaryof', '', " $sectionname $form->section"); } - print_header_simple($stredit, '', $stredit, 'theform.summary' ); + print_header_simple($stredit, '', build_navigation(array(array('name' => $stredit, 'link' => null, 'type' => 'misc'))), 'theform.summary' ); print_heading($strsummaryof); print_simple_box_start('center'); include('editsection.html'); print_simple_box_end(); - if ($usehtmleditor) { + if ($usehtmleditor) { use_html_editor("summary"); } print_footer($course); diff --git a/course/enrol.php b/course/enrol.php index 6c077504e3ed0..1cc1f87e22085 100644 --- a/course/enrol.php +++ b/course/enrol.php @@ -1,6 +1,6 @@ loginhttps)) { $wwwroot = str_replace('http:','https:', $wwwroot); } - // do not use require_login here because we are usually comming from it + // do not use require_login here because we are usually comming from it redirect($wwwroot.'/login/index.php'); } @@ -32,14 +32,14 @@ print_error('loginasnoenrol', '', $CFG->wwwroot.'/course/view.php?id='.$USER->loginascontext->instanceid); } - $enrol = enrolment_factory::factory($course->enrol); // do not use if (!$enrol... here, it can not work in PHP4 - see MDL-7529 + $enrol = enrolment_factory::factory($course->enrol); // do not use if (!$enrol... here, it can not work in PHP4 - see MDL-7529 /// Refreshing all current role assignments for the current user load_all_capabilities(); -/// Double check just in case they are actually enrolled already and -/// thus got to this script by mistake. This might occur if enrolments +/// Double check just in case they are actually enrolled already and +/// thus got to this script by mistake. This might occur if enrolments /// changed during this session or something if (has_capability('moodle/course:view', $context) and !has_capability('moodle/legacy:guest', $context, NULL, false)) { @@ -57,14 +57,14 @@ print_header_simple(); notice(get_string('coursenotaccessible'), "$CFG->wwwroot/index.php"); } - + /// Users can't enroll to site course if ($course->id == SITEID) { print_header_simple(); notice(get_string('enrollfirst'), "$CFG->wwwroot/index.php"); } -/// Double check just in case they are enrolled to start in the future +/// Double check just in case they are enrolled to start in the future if ($course->enrolperiod) { // Only active if the course has an enrolment period in effect if ($roles = get_user_roles($context, $USER->id)) { @@ -88,7 +88,7 @@ ($course->enrollable == 2 && $course->enrolstartdate > 0 && $course->enrolstartdate > time()) || ($course->enrollable == 2 && $course->enrolenddate > 0 && $course->enrolenddate <= time()) ) { - print_header($course->shortname, $course->fullname, $course->shortname ); + print_header($course->shortname, $course->fullname, build_navigation(array(array('name'=>$course->shortname,'link'=>'','type'=>'misc'))) ); notice(get_string('notenrollable'), "$CFG->wwwroot/index.php"); } diff --git a/course/import.php b/course/import.php index eef47dc477761..3c30c3832388f 100644 --- a/course/import.php +++ b/course/import.php @@ -31,9 +31,11 @@ } $strimport = get_string('import'); + $navlinks = array(); + $navlinks[] = array('name' => $strimport, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); - print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport, - ''.$course->shortname.' -> '.$strimport); + print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport, $navigation); $directories = get_list_of_plugins('course/import'); diff --git a/course/import/activities/index.php b/course/import/activities/index.php index 8364871af74c0..8b593cacd2d87 100644 --- a/course/import/activities/index.php +++ b/course/import/activities/index.php @@ -3,7 +3,7 @@ require_once('../../../config.php'); require_once('../../lib.php'); require_once($CFG->dirroot.'/backup/restorelib.php'); - + $id = required_param('id', PARAM_INT); // course id to import TO $fromcourse = optional_param('fromcourse', 0, PARAM_INT); $fromcoursesearch = optional_param('fromcoursesearch', '', PARAM_RAW); @@ -16,7 +16,7 @@ error("That's an invalid course id"); } - if (!$site = get_site()){ + if (!$site = get_site()){ error("Couldn't get site course"); } @@ -45,7 +45,7 @@ $restore->restoreto = 1; $restore->course_id = $id; $restore->importing = 1; // magic variable so we know that we're importing rather than just restoring. - + $SESSION->restore = $restore; redirect($CFG->wwwroot.'/backup/restore.php?file='.$filename.'&id='.$fromcourse.'&to='.$id); } @@ -53,12 +53,19 @@ redirect($CFG->wwwroot.'/backup/backup.php?id='.$from->id.'&to='.$course->id); } } - - print_header("$course->shortname: $strimportactivities", $course->fullname, - "wwwroot/course/view.php?id=$course->id\">$course->shortname ". - "-> wwwroot/course/import.php?id=$course->id\">".get_string('import')." ". - "-> $strimportactivities"); + + $navlinks = array(); + $navlinks[] = array('name' => $course->shortname, + 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", + 'type' => 'misc'); + $navlinks[] = array('name' => get_string('import'), + 'link' => "$CFG->wwwroot/course/import.php?id=$course->id", + 'type' => 'misc'); + $navlinks[] = array('name' => $strimportactivities, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + + print_header("$course->shortname: $strimportactivities", $course->fullname, $navigation); require_once('mod.php'); print_footer(); -?> \ No newline at end of file +?> diff --git a/course/import/groups/index.php b/course/import/groups/index.php index 831d1fe4d6173..7dc75208cf5e6 100755 --- a/course/import/groups/index.php +++ b/course/import/groups/index.php @@ -1,21 +1,21 @@ -dirroot.'/course/lib.php'); require_once($CFG->dirroot.'/group/lib.php'); - + $id = required_param('id', PARAM_INT); // Course id - + if (! $course = get_record('course', 'id', $id) ) { error("That's an invalid course id"); } - + require_login($course->id); $context = get_context_instance(CONTEXT_COURSE, $id); - - + + if (!has_capability('moodle/course:managegroups', $context)) { error("You do not have the required permissions to manage groups."); } @@ -27,7 +27,7 @@ $strimportgroups = get_string("importgroups"); $csv_encode = '/\&\#44/'; - if (isset($CFG->CSV_DELIMITER)) { + if (isset($CFG->CSV_DELIMITER)) { $csv_delimiter = '\\' . $CFG->CSV_DELIMITER; $csv_delimiter2 = $CFG->CSV_DELIMITER; @@ -40,11 +40,17 @@ } /// Print the header - - print_header("$course->shortname: $strimportgroups", $course->fullname, - "wwwroot/course/view.php?id=$course->id\">$course->shortname ". - "-> wwwroot/course/import.php?id=$course->id\">".get_string('import')." ". - "-> $strimportgroups"); + $navlinks = array(); + $navlinks[] = array('name' => $course->shortname, + 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", + 'type' => 'misc'); + $navlinks[] = array('name' => get_string('import'), + 'link' => "$CFG->wwwroot/course/import.php?id=$course->id", + 'type' => 'misc'); + $navlinks[] = array('name' => $strimportgroups, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + + print_header("$course->shortname: $strimportgroups", $course->fullname, $navigation); /// If a file has been uploaded, then process it @@ -65,12 +71,12 @@ // make arrays of valid fields for error checking $required = array("groupname" => 1, ); $optionalDefaults = array("lang" => 1, ); - $optional = array("coursename" => 1, + $optional = array("coursename" => 1, "idnumber" =>1, "description" => 1, "enrolmentkey" => 1, "theme" => 1, - "picture" => 1, + "picture" => 1, "hidepicture" => 1, ); // --- get header (field names) --- @@ -78,8 +84,8 @@ // check for valid field names foreach ($header as $i => $h) { $h = trim($h); $header[$i] = $h; // remove whitespace - if ( !(isset($required[$h]) or - isset($optionalDefaults[$h]) or + if ( !(isset($required[$h]) or + isset($optionalDefaults[$h]) or isset($optional[$h])) ) { error(get_string('invalidfieldname', 'error', $h), 'index.php?id='.$id.'&sesskey='.$USER->sesskey); } @@ -96,7 +102,7 @@ $linenum = 2; // since header is line 1 while (!feof ($fp)) { - + $newgroup = new object();//to make Martin happy foreach ($optionalDefaults as $key => $value) { $newgroup->$key = current_language(); //defaults to current language @@ -117,7 +123,7 @@ if (isset($required[$name]) and !$value) { error(get_string('missingfield', 'error', $name). " ". get_string('erroronline', 'error', $linenum) .". ". - get_string('processingstops', 'error'), + get_string('processingstops', 'error'), 'uploaduser.php?sesskey='.$USER->sesskey); } else if ($name == "groupname") { @@ -129,7 +135,7 @@ } } ///Find the courseid of the course with the given shortname - + //if idnumber is set, we use that. //unset invalid courseid if (isset($newgroup->idnumber)){ @@ -137,23 +143,23 @@ notify(get_string('unknowncourseidnumber', 'error', $newgroup->idnumber)); unset($newgroup->courseid);//unset so 0 doesnt' get written to database } - $newgroup->courseid = $mycourse->id; + $newgroup->courseid = $mycourse->id; } //else use course short name to look up //unset invalid coursename (if no id) - + else if (isset($newgroup->coursename)){ if (!$mycourse = get_record('course', 'shortname',$newgroup->coursename)){ notify(get_string('unknowncourse', 'error', $newgroup->coursename)); unset($newgroup->courseid);//unset so 0 doesnt' get written to database } - $newgroup->courseid = $mycourse->id; + $newgroup->courseid = $mycourse->id; } //else juse use current id else{ $newgroup->courseid = $id; } - + //if courseid is set if (isset($newgroup->courseid)){ @@ -162,22 +168,22 @@ $linenum++; $groupname = $newgroup->name; $newgrpcoursecontext = get_context_instance(CONTEXT_COURSE, $newgroup->courseid); - + ///Users cannot upload groups in courses they cannot update. if (!has_capability('moodle/course:managegroups', $newgrpcoursecontext)){ notify(get_string('nopermissionforcreation','group',$groupname)); } else { if ( $groupid = groups_get_group_by_name($newgroup->courseid, $groupname) || !($newgroup->id = groups_create_group($newgroup)) ) { - + //Record not added - probably because group is already registered //In this case, output groupname from previous registration if ($groupid) { notify("$groupname :".get_string('groupexistforcourse', 'error', $groupname)); } else { notify(get_string('groupnotaddederror', 'error', $groupname)); - } - } + } + } else { notify(get_string('groupaddedsuccesfully', 'group', $groupname)); } diff --git a/course/importstudents.php b/course/importstudents.php index d182dde227ddb..845cd51a1bb24 100644 --- a/course/importstudents.php +++ b/course/importstudents.php @@ -45,8 +45,7 @@ print_header("$course->shortname: $strassigncourses", $site->fullname, - "id\">$course->shortname -> $strassigncourses", - "searchtext"); + build_navigation(array(array('name' => $strassigncourses, 'link' => null, 'type' => 'misc'))), "searchtext"); /// Print a help notice about the need to use this page diff --git a/course/index.php b/course/index.php index 5ab89eb36b7b7..44ac487f933b2 100644 --- a/course/index.php +++ b/course/index.php @@ -15,7 +15,7 @@ $moveto = optional_param('moveto',-1,PARAM_INT); $moveup = optional_param('moveup',0,PARAM_INT); $movedown = optional_param('movedown',0,PARAM_INT); - + $context = get_context_instance(CONTEXT_SYSTEM, SITEID); if (!$site = get_site()) { @@ -71,17 +71,18 @@ if ($countcategories > 1 || ($countcategories == 1 && count_records('course') > 200)) { $strcourses = get_string('courses'); $strcategories = get_string('categories'); - print_header("$site->shortname: $strcategories", $strcourses, + print_header("$site->shortname: $strcategories", build_navigation(array(array('name'=>$strcourses,'link'=>'','type'=>'misc'))), $strcategories, '', '', true, update_categories_button()); print_heading($strcategories); print_box_start('categorybox'); - print_category_create_form(); + print_category_create_form(); print_whole_category_list(); print_box_end(); print_course_search(); } else { $strfulllistofcourses = get_string('fulllistofcourses'); - print_header("$site->shortname: $strfulllistofcourses", $strfulllistofcourses, $strfulllistofcourses, + print_header("$site->shortname: $strfulllistofcourses", $strfulllistofcourses, + build_navigation(array(array('name'=>$strfulllistofcourses, 'link'=>'','type'=>'misc'))), '', '', true, update_categories_button()); print_box_start('courseboxes'); print_category_create_form(); @@ -89,7 +90,7 @@ print_box_end(); } - /// I am not sure this context in the next has_capability call is correct. + /// I am not sure this context in the next has_capability call is correct. if (isloggedin() and !isguest() and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $CFG->enablecourserequests) { // Print link to request a new course print_single_button('request.php', NULL, get_string('courserequest'), 'get'); } @@ -108,24 +109,24 @@ /// From now on is all the admin/course creator functions /// Print headings - + if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { require_once($CFG->libdir.'/adminlib.php'); - admin_externalpage_setup('coursemgmt'); + admin_externalpage_setup('coursemgmt'); admin_externalpage_print_header(); } else { - print_header("$site->shortname: $strcategories", $strcourses, - $strcategories, '', '', true, update_categories_button()); - } - + print_header("$site->shortname: $strcategories", build_navigation(array(array('name'=>$strcourses,'link'=>'','type'=>'misc'))), + $strcategories, '', '', true, update_categories_button()); + } + print_heading($strcategories); /// Delete a category if necessary if (!empty($delete) and confirm_sesskey()) { - + // context is coursecat, if not present admins should have it set in site level - $context = get_context_instance(CONTEXT_COURSECAT, $delete); + $context = get_context_instance(CONTEXT_COURSECAT, $delete); if ($deletecat = get_record('course_categories', 'id', $delete) and has_capability('moodle/category:delete', $context)) { if (!empty($sure) && $sure == md5($deletecat->timemodified)) { /// Send the children categories to live with their grandparent @@ -136,8 +137,8 @@ } } } - - /// If the grandparent is a valid (non-zero) category, then + + /// If the grandparent is a valid (non-zero) category, then /// send the children courses to live with their grandparent as well if ($deletecat->parent) { if ($childcourses = get_records('course', 'category', $deletecat->id)) { @@ -148,13 +149,13 @@ } } } - + /// Finally delete the category itself if (delete_records('course_categories', 'id', $deletecat->id)) { notify(get_string('categorydeleted', '', format_string($deletecat->name))); // MLD-9983 events_trigger('category_deleted', $deletecat); - } + } } else { $strdeletecategorycheck = get_string('deletecategorycheck','', format_string($deletecat->name)); @@ -162,7 +163,7 @@ "index.php?delete=$delete&sure=".md5($deletecat->timemodified)."&sesskey=$USER->sesskey", "index.php?sesskey=$USER->sesskey"); - print_footer(); + print_footer(); exit(); } } @@ -188,14 +189,14 @@ if (! set_field('course_categories', 'parent', $moveto, 'id', $tempcat->id)) { notify('Could not update that category!'); } else { - rebuild_context_rel(get_context_instance(CONTEXT_COURSECAT, $move)); - } + rebuild_context_rel(get_context_instance(CONTEXT_COURSECAT, $move)); + } } } } -/// Hide or show a category +/// Hide or show a category if ((!empty($hide) or !empty($show)) and confirm_sesskey()) { if (!empty($hide)) { $tempcat = get_record('course_categories', 'id', $hide); @@ -218,7 +219,7 @@ /// Move a category up or down if ((!empty($moveup) or !empty($movedown)) and confirm_sesskey()) { - + $swapcategory = NULL; $movecategory = NULL; @@ -283,11 +284,11 @@ } } } - + fix_course_sortorder(); /// Print form for creating new categories - + if (has_capability('moodle/category:create', get_context_instance(CONTEXT_SYSTEM))) { $mform->display(); } @@ -323,7 +324,7 @@ $options['category'] = $category->id; print_single_button('edit.php', $options, get_string('addnewcourse'), 'get'); } - + if (has_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->enablecourserequests)) { print_single_button('pending.php',NULL, get_string('coursespending'), 'get'); } @@ -341,7 +342,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $ global $CFG, $USER; static $str = ''; - + if (empty($str)) { $str->delete = get_string('delete'); $str->moveup = get_string('moveup'); @@ -350,11 +351,11 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $ $str->hide = get_string('hide'); $str->show = get_string('show'); } - + if ($category) { $context = get_context_instance(CONTEXT_COURSECAT, $category->id); - + echo ''; for ($i=0; $i<$depth;$i++) { echo '      '; @@ -373,7 +374,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $ echo ' '; } - + if (has_capability('moodle/category:visibility', $context)) { if (!empty($category->visible)) { echo 'realuser); load_all_capabilities(); // load all this user's normal capabilities @@ -40,7 +40,7 @@ if (!confirm_sesskey()) { print_error('confirmsesskeybad'); } - + if (! $course = get_record('course', 'id', $id)) { error("Course ID was incorrect"); } @@ -97,7 +97,8 @@ $strloginas = get_string('loginas'); $strloggedinas = get_string('loggedinas', '', $newfullname); - print_header_simple($strloggedinas, '', $strloggedinas, '', '', true, ' ', navmenu($course)); + print_header_simple($strloggedinas, '', build_navigation(array(array('name'=>$strloggedinas, 'link'=>'','type'=>'misc'))), + '', '', true, ' ', navmenu($course)); notice($strloggedinas, "$CFG->wwwroot/course/view.php?id=$course->id"); diff --git a/course/mod.php b/course/mod.php index 828da8efcbbc5..89968269c0e4a 100644 --- a/course/mod.php +++ b/course/mod.php @@ -477,7 +477,7 @@ $CFG->pagepath = 'mod/'.$module->name.'/delete'; - print_header_simple($strdeletecheck, '', $strdeletecheck); + print_header_simple($strdeletecheck, '', build_navigation(array(array('name'=>$strdeletecheck,'link'=>'','type'=>'misc')))); print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox'); print_heading($strdeletecheckfull); @@ -646,7 +646,7 @@ } else { $pageheading = get_string("addinganew", "moodle", $fullmodulename); } - + $CFG->pagepath = 'mod/'.$module->name; if (!empty($type)) { $CFG->pagepath .= '/' . $type; @@ -671,12 +671,12 @@ } else { $focuscursor = "form.name"; } - + $navlinks = array(); $navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity'); $navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'action'); $navigation = build_navigation($navlinks); - + print_header_simple($streditinga, '', $navigation, $focuscursor, "", false); if (!empty($cm->id)) { diff --git a/course/pending.php b/course/pending.php index 0f865386a8f22..cee06ed43306f 100644 --- a/course/pending.php +++ b/course/pending.php @@ -3,7 +3,7 @@ require_once('../config.php'); require_once($CFG->libdir.'/pagelib.php'); - require_once($CFG->libdir.'/blocklib.php'); + require_once($CFG->libdir.'/blocklib.php'); require_once('lib.php'); require_login(); @@ -69,12 +69,12 @@ } } } - + $strtitle = get_string('coursespending'); $strheading = get_string(((!empty($reject)) ? 'coursereject' : 'coursespending')); - print_header($strtitle,$strheading,$strheading); - + print_header($strtitle,$strheading,build_navigation(array(array('name'=>$strheading,'link'=>'','type'=>'misc')))); + if (!empty($reject) and confirm_sesskey()) { if ($reject = get_record("course_request","id",$reject)) { if (empty($rejectnotice)) { @@ -107,7 +107,7 @@ $collision = 1; } //do not output raw html from request, quote html entities using s()!! - $table->data[] = array(((!empty($course->password)) ? + $table->data[] = array(((!empty($course->password)) ? ''.$strrequireskey.'' : ''), format_string($course->shortname),format_string($course->fullname),fullname($requester), format_string($course->summary),format_string($course->reason), diff --git a/course/recent.php b/course/recent.php index af2f60f1aeda7..b909b0af65028 100644 --- a/course/recent.php +++ b/course/recent.php @@ -28,7 +28,7 @@ $meta = ''; // prevent duplicate content in search engines MDL-7299 $loggedinas = user_login_string($course, $USER); - + $navlinks = array(); if (!empty($chooserecent)) { $userinfo = get_string("allparticipants"); @@ -43,14 +43,10 @@ if ($date) $dateinfo = userdate($date, get_string("strftimedaydate")); - if ($course->id != SITEID) { - print_header("$course->shortname: $strrecentactivity", $course->fullname, - "id\">$course->shortname -> - id\">$strrecentactivity -> $userinfo, $dateinfo", "", $meta); - } else { - print_header("$course->shortname: $strrecentactivity", $course->fullname, - "id\">$strrecentactivity -> $userinfo, $dateinfo", "", $meta); - } + $navlinks[] = array('name' => $strrecentactivity, 'link' => "recent.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => "$userinfo, $dateinfo", 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: $strrecentactivity", $course->fullname, $navigation, "", $meta); print_heading(format_string($course->fullname) . ": $userinfo, $dateinfo (".usertimezone().")", '', 3); $advancedfilter = 1; @@ -67,14 +63,9 @@ } } } - - if ($course->id != SITEID) { - print_header("$course->shortname: $strrecentactivity", $course->fullname, - "id\">$course->shortname -> $strrecentactivity", "", $meta); - } else { - print_header("$course->shortname: $strrecentactivity", $course->fullname, - "$strrecentactivity", "", $meta); - } + $navlinks[] = array('name' => $strrecentactivity, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: $strrecentactivity", $course->fullname, $navigation, "", $meta); print_heading(get_string("activitysince", "", userdate($date))); diff --git a/course/report.php b/course/report.php index 5954b3f597a4d..515e0bb5d4d8d 100644 --- a/course/report.php +++ b/course/report.php @@ -15,8 +15,10 @@ $strreports = get_string('reports'); - print_header($course->fullname.': '.$strreports, $course->fullname.': '.$strreports, - ''.$course->shortname.' -> '.$strreports); + $navlinks = array(); + $navlinks[] = array('name' => $strreports, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header($course->fullname.': '.$strreports, $course->fullname.': '.$strreports, $navigation); $directories = get_list_of_plugins('course/report'); @@ -29,6 +31,6 @@ echo ''; } } - + print_footer(); ?> diff --git a/course/report/log/index.php b/course/report/log/index.php index a2dcc54f2942b..96bb6e5d6c35a 100644 --- a/course/report/log/index.php +++ b/course/report/log/index.php @@ -7,9 +7,9 @@ require_once($CFG->libdir.'/adminlib.php'); $id = optional_param('id', 0, PARAM_INT);// Course ID - + $host_course = optional_param('host_course', '', PARAM_PATH);// Course ID - + if (empty($host_course)) { $hostid = $CFG->mnet_localhost_id; if (empty($id)) { @@ -19,7 +19,7 @@ } else { list($hostid, $id) = explode('/', $host_course); } - + $group = optional_param('group', -1, PARAM_INT); // Group to display $user = optional_param('user', 0, PARAM_INT); // User to display $date = optional_param('date', 0, PARAM_FILE); // Date to display - number or some string @@ -27,7 +27,7 @@ $modid = optional_param('modid', 0, PARAM_FILE); // number or 'site_errors' $modaction = optional_param('modaction', '', PARAM_PATH); // an action as recorded in the logs $page = optional_param('page', '0', PARAM_INT); // which page to show - $perpage = optional_param('perpage', '100', PARAM_INT); // how many per page + $perpage = optional_param('perpage', '100', PARAM_INT); // how many per page $showcourses = optional_param('showcourses', 0, PARAM_INT); // whether to show courses if we're over our limit. $showusers = optional_param('showusers', 0, PARAM_INT); // whether to show users if we're over our limit. $chooselog = optional_param('chooselog', 0, PARAM_INT); @@ -50,7 +50,7 @@ require_capability('moodle/site:viewreports', $context); - add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id); + add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id); $strlogs = get_string('logs'); $stradministration = get_string('administration'); @@ -58,6 +58,8 @@ session_write_close(); + $navlinks = array(); + if (!empty($chooselog)) { $userinfo = get_string('allparticipants'); $dateinfo = get_string('alldays'); @@ -79,18 +81,19 @@ admin_externalpage_print_header(); } else { - print_header($course->shortname .': '. $strlogs, $course->fullname, - "wwwroot/course/view.php?id=$course->id\">$course->shortname -> - wwwroot/course/report.php?id=$course->id\">$strreports -> - id\">$strlogs -> $userinfo, $dateinfo", ''); + $navlinks[] = array('name' => $strreports, 'link' => "$CFG->wwwroot/course/report.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => $strlogs, 'link' => "index.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => "$userinfo, $dateinfo", 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header($course->shortname .': '. $strlogs, $course->fullname, $navigation ''); } print_heading(format_string($course->fullname) . ": $userinfo, $dateinfo (".usertimezone().")"); print_mnet_log_selector_form($hostid, $course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers, $logformat); - + if($hostid == $CFG->mnet_localhost_id) { - print_log($course, $user, $date, 'l.time DESC', $page, $perpage, - "index.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction&group=$group", + print_log($course, $user, $date, 'l.time DESC', $page, $perpage, + "index.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction&group=$group", $modname, $modid, $modaction, $group); } else { print_mnet_log($hostid, $id, $user, $date, 'l.time DESC', $page, $perpage, "", $modname, $modid, $modaction, $group); @@ -125,10 +128,10 @@ admin_externalpage_setup('reportlog'); admin_externalpage_print_header(); } else { - print_header($course->shortname .': '. $strlogs, $course->fullname, - "wwwroot/course/view.php?id=$course->id\">$course->shortname -> - wwwroot/course/report.php?id=$course->id\">$strreports -> - $strlogs", ''); + $navlinks[] = array('name' => $strreports, 'link' => "$CFG->wwwroot/course/report.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => $strlogs, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header($course->shortname .': '. $strlogs, $course->fullname, $navigation, ''); } print_heading(get_string('chooselogs') .':'); diff --git a/course/report/outline/index.php b/course/report/outline/index.php index 99c5461bd5b69..784d589fcc36a 100644 --- a/course/report/outline/index.php +++ b/course/report/outline/index.php @@ -19,7 +19,7 @@ require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id)); - add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->id); + add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->id); $stractivityreport = get_string("activityreport"); $strparticipants = get_string("participants"); @@ -29,10 +29,12 @@ $strtodaylogs = get_string("todaylogs"); $strreports = get_string("reports"); - print_header("$course->shortname: $stractivityreport", $course->fullname, - "id\">$course->shortname -> - id\">$strreports -> - $stractivityreport"); + $navlinks = array(); + $navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => $stractivityreport, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + + print_header("$course->shortname: $stractivityreport", $course->fullname, $navigation); print_heading(format_string($course->fullname)); diff --git a/course/report/participation/index.php b/course/report/participation/index.php index 9baf30c0fe9e8..cf4339d890c29 100644 --- a/course/report/participation/index.php +++ b/course/report/participation/index.php @@ -2,10 +2,10 @@ require_once('../../../config.php'); require_once($CFG->libdir.'/statslib.php'); - + define('DEFAULT_PAGE_SIZE', 20); define('SHOW_ALL_PAGE_SIZE', 5000); - + $id = required_param('id', PARAM_INT); // course id. $moduleid = optional_param('moduleid', 0, PARAM_INT); // module id. $oldmod = optional_param('oldmod', 0, PARAM_INT); @@ -16,7 +16,7 @@ $page = optional_param('page', 0, PARAM_INT); // which page to show $perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT); // how many per page - if ($action != 'view' && $action != 'post') { + if ($action != 'view' && $action != 'post') { $action = ''; // default to all (don't restrict) } @@ -35,14 +35,14 @@ require_login($course->id); $context = get_context_instance(CONTEXT_COURSE, $course->id); - + if (!has_capability('moodle/site:viewreports', $context)) { print_error('mustbeteacher', '', $CFG->wwwroot.'/course/view.php?id='.$course->id); } - - add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->id); - + + add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->id); + $strparticipation = get_string('participationreport'); $strviews = get_string('views'); $strposts = get_string('posts'); @@ -51,15 +51,11 @@ $strallactions = get_string('allactions'); $strreports = get_string('reports'); - $strnav = "id\">" . format_string($course->shortname) . " -> - id\">$strreports -> ". $strparticipation; - - print_header("$course->shortname: $strparticipation", $course->fullname, - "id\">$course->shortname -> - id\">$strreports -> - $strparticipation"); - -// print_header($course->fullname.' '.$strparticipation,$strparticipation,$strnav); + $navlinks = array(); + $navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => $strparticipation, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: $strparticipation", $course->fullname, $navigation); $allowedmodules = array('assignment','book','chat','choice','exercise','forum','glossary','hotpot', 'journal','lesson','questionnaire','quiz','resource','scorm', @@ -96,7 +92,7 @@ $timeoptions[strtotime('-'.$i.' weeks',$now)] = get_string('numweeks','moodle',$i); } } - // months + // months for ($i = 2; $i < 12; $i++) { if (strtotime('-'.$i.' months',$now) >= $minlog) { $timeoptions[strtotime('-'.$i.' months',$now)] = get_string('nummonths','moodle',$i); @@ -121,8 +117,8 @@ 'view' => $strview, 'post' => $strpost, ); - - + + // print first controls. echo '
'."\n". ''."\n". @@ -144,7 +140,7 @@ print_footer(); exit; } - + $baseurl = $CFG->wwwroot.'/course/report/participation/index.php?id='.$course->id.'&roleid=' .$roleid.'&instanceid='.$instanceid.'&timefrom='.$timefrom.'&moduleid=' .$moduleid.'&action='.$action.'&perpage='.$perpage; @@ -170,13 +166,13 @@ if (!$instances = get_all_instances_in_course($module->name,$course)) { error(get_string('noinstances','error',$modulename)); } - + $instanceoptions = array(); - + foreach ($instances as $instance) { $instanceoptions[$instance->id] = $instance->name; } - + if (count($instanceoptions) == 1) { // just display it if there's only one. $instanceid = array_pop(array_keys($instanceoptions)); } @@ -193,7 +189,7 @@ echo ''."\n". '
'."\n". "
\n"; - + if (!empty($instanceid) && !empty($roleid)) { if (!$cm = get_coursemodule_from_instance($module->name,$instanceid,$course->id)) { print_error('cmunknown'); @@ -211,7 +207,7 @@ $table->set_attribute('class', 'generaltable generalbox reporttable'); $table->sortable(true,'lastname','ASC'); - + $table->set_control_variables(array( TABLE_VAR_SORT => 'ssort', TABLE_VAR_HIDE => 'shide', @@ -221,7 +217,7 @@ TABLE_VAR_PAGE => 'spage' )); $table->setup(); - + $primary_roles = sql_primary_role_subselect(); // In dmllib.php $sql = 'SELECT DISTINCT prs.userid, u.firstname,u.lastname,u.idnumber,count(l.action) as count FROM ('.$primary_roles.') prs' @@ -237,14 +233,14 @@ break; default: // some modules have stuff we want to hide, ie mail blocked etc so do actually need to limit here. - $sql .= ' AND action IN (\''.implode('\',\'',array_merge($viewnames,$postnames)).'\' )'; + $sql .= ' AND action IN (\''.implode('\',\'',array_merge($viewnames,$postnames)).'\' )'; } - + $sql .= ' WHERE prs.courseid = '.$course->id.' AND prs.primary_roleid = '.$roleid.' AND prs.contextlevel = '.CONTEXT_COURSE.' AND prs.courseid = '.$course->id; - + if ($table->get_sql_where()) { - $sql .= ' AND '.$table->get_sql_where(); //initial bar + $sql .= ' AND '.$table->get_sql_where(); //initial bar } $sql .= ' GROUP BY prs.userid,u.firstname,u.lastname,u.idnumber,l.userid'; @@ -254,9 +250,9 @@ } $countsql = 'SELECT COUNT(DISTINCT(prs.userid)) FROM ('.$primary_roles.') prs ' - .' JOIN '.$CFG->prefix.'user u ON u.id = prs.userid WHERE prs.courseid = '.$course->id + .' JOIN '.$CFG->prefix.'user u ON u.id = prs.userid WHERE prs.courseid = '.$course->id .' AND prs.primary_roleid = '.$roleid.' AND prs.contextlevel = '.CONTEXT_COURSE; - + $totalcount = count_records_sql($countsql); if ($table->get_sql_where()) { @@ -264,11 +260,11 @@ } else { $matchcount = $totalcount; } - + echo '
' . "\n"; echo '

'.$modulename . ' ' . $strviews.': '.implode(', ',$viewnames).'
'."\n" . $modulename . ' ' . $strposts.': '.implode(', ',$postnames).'

'."\n"; - + $table->initialbars($totalcount > $perpage); $table->pagesize($perpage, $matchcount); @@ -277,14 +273,14 @@ } $data = array(); - + $a->count = $totalcount; $a->items = $role->name; - + if ($matchcount != $totalcount) { $a->items .= ' ('.get_string('matched').' '.$matchcount.')'; } - + echo '

'.get_string('counteditems', '', $a).'

'."\n"; echo ' '."\n"; print_header( - $title, $heading, $navigation, - "", $head.$styles.$scripts.$iframe_js, true, $button, + $title, $heading, $navigation, + "", $head.$styles.$scripts.$iframe_js, true, $button, $loggedinas, false, $body_tags ); if (!empty($available_msg)) { @@ -451,8 +448,8 @@ // do nothing } else { $hp->html = preg_replace( - '|]*charset=iso-8859-1[^>]*>|is', - '', + '|]*charset=iso-8859-1[^>]*>|is', + '', $hp->html ); } diff --git a/mod/lams/view.php b/mod/lams/view.php index 84103ea508a06..353f719e044d6 100644 --- a/mod/lams/view.php +++ b/mod/lams/view.php @@ -31,8 +31,11 @@ //if ($course->id != SITEID) { // $navigation = "id\">$course->shortname ->"; //} -print_header_simple(format_string($lams->name), "", - "id\">$strchoices -> ".format_string($lams->name), "", "", true, +$navlinks = array(); +$navlinks[] = array('name' => $strchoices, 'link' => "index.php?id=$course->id", 'type' => 'misc'); +$navlinks[] = array('name' => format_string($lams->name), 'link' => null, 'type' => 'misc'); +$navigation = build_navigation($navlinks); +print_header_simple(format_string($lams->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, get_string("lesson","lams")), navmenu($course, $cm)); echo ''; @@ -63,7 +66,7 @@ print_simple_box_start('center'); echo ''.get_string("openmonitor", "lams").''; print_simple_box_end(); - + $plaintext = trim($datetime).trim($USER->username).trim($LAMSCONSTANTS->learner_method).trim($CFG->lams_serverid).trim($CFG->lams_serverkey); $hash = sha1(strtolower($plaintext)); $url = $CFG->lams_serverurl.$LAMSCONSTANTS->login_request. diff --git a/mod/resource/type/ims/resource.class.php b/mod/resource/type/ims/resource.class.php index 4ce1c9262be0f..d79107ca9a0c3 100644 --- a/mod/resource/type/ims/resource.class.php +++ b/mod/resource/type/ims/resource.class.php @@ -375,8 +375,9 @@ function display() { $this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance'); $this->navigation = build_navigation($this->navlinks); - - print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); + + print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, + update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); } print_simple_box_start('center', '60%'); echo '

'.$errortext.'

'; @@ -425,8 +426,11 @@ function display() { /// Check whether this is supposed to be a popup, but was called directly if (empty($frameset) && $resource->popup && !$inpopup) { /// Make a page and a pop-up window + $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); + $this->navigation = build_navigation($this->navlinks); - print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); + print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, + update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); echo "\n