}
add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
-
+
redirect("view.php?id=$course->id");
exit;
}
$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);
<?php // $Id$
- // Depending on the current enrolment method, this page
- // presents the user with whatever they need to know when
+ // Depending on the current enrolment method, this page
+ // presents the user with whatever they need to know when
// they try to enrol in a course.
require_once("../config.php");
if (!empty($CFG->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');
}
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)) {
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)) {
($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");
}
}
$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,
- '<a href="view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$strimport);
+ print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport, $navigation);
$directories = get_list_of_plugins('course/import');
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);
error("That's an invalid course id");
}
- if (!$site = get_site()){
+ if (!$site = get_site()){
error("Couldn't get site course");
}
$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);
}
redirect($CFG->wwwroot.'/backup/backup.php?id='.$from->id.'&to='.$course->id);
}
}
-
- print_header("$course->shortname: $strimportactivities", $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
- "-> <a href=\"$CFG->wwwroot/course/import.php?id=$course->id\">".get_string('import')."</a> ".
- "-> $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
+?>
-<?php // $Id: uploadgroups.php, 2005/10/31 19:09:31
+<?php // $Id: uploadgroups.php, 2005/10/31 19:09:31
/// Bulk group creation registration script from a comma separated file
require_once('../../../config.php');
require_once($CFG->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.");
}
$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;
}
/// Print the header
-
- print_header("$course->shortname: $strimportgroups", $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
- "-> <a href=\"$CFG->wwwroot/course/import.php?id=$course->id\">".get_string('import')."</a> ".
- "-> $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
// 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) ---
// 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);
}
$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
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") {
}
}
///Find the courseid of the course with the given shortname
-
+
//if idnumber is set, we use that.
//unset invalid courseid
if (isset($newgroup->idnumber)){
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)){
$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));
}
print_header("$course->shortname: $strassigncourses",
$site->fullname,
- "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassigncourses",
- "searchtext");
+ build_navigation(array(array('name' => $strassigncourses, 'link' => null, 'type' => 'misc'))), "searchtext");
/// Print a help notice about the need to use this page
$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()) {
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();
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');
}
/// 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
}
}
}
-
- /// 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)) {
}
}
}
-
+
/// 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));
"index.php?delete=$delete&sure=".md5($deletecat->timemodified)."&sesskey=$USER->sesskey",
"index.php?sesskey=$USER->sesskey");
- print_footer();
+ print_footer();
exit();
}
}
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);
/// Move a category up or down
if ((!empty($moveup) or !empty($movedown)) and confirm_sesskey()) {
-
+
$swapcategory = NULL;
$movecategory = NULL;
}
}
}
-
+
fix_course_sortorder();
/// Print form for creating new categories
-
+
if (has_capability('moodle/category:create', get_context_instance(CONTEXT_SYSTEM))) {
$mform->display();
}
$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');
}
global $CFG, $USER;
static $str = '';
-
+
if (empty($str)) {
$str->delete = get_string('delete');
$str->moveup = get_string('moveup');
$str->hide = get_string('hide');
$str->show = get_string('show');
}
-
+
if ($category) {
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
-
+
echo '<tr><td align="left" class="name">';
for ($i=0; $i<$depth;$i++) {
echo ' ';
echo '<a title="'.$str->delete.'" href="index.php?delete='.$category->id.'&sesskey='.sesskey().'"><img'.
' src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$str->delete.'" /></a> ';
}
-
+
if (has_capability('moodle/category:visibility', $context)) {
if (!empty($category->visible)) {
echo '<a title="'.$str->hide.'" href="index.php?hide='.$category->id.'&sesskey='.sesskey().'"><img'.
$down = $last ? false : true;
$first = false;
- print_category_edit($cat, $displaylist, $parentslist, $depth+1, $up, $down);
+ print_category_edit($cat, $displaylist, $parentslist, $depth+1, $up, $down);
}
}
}
if (!confirm_sesskey()) {
print_error('confirmsesskeybad');
}
-
+
$USER = get_complete_user_data('id', $USER->realuser);
load_all_capabilities(); // load all this user's normal capabilities
if (!confirm_sesskey()) {
print_error('confirmsesskeybad');
}
-
+
if (! $course = get_record('course', 'id', $id)) {
error("Course ID was incorrect");
}
$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");
$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);
} else {
$pageheading = get_string("addinganew", "moodle", $fullmodulename);
}
-
+
$CFG->pagepath = 'mod/'.$module->name;
if (!empty($type)) {
$CFG->pagepath .= '/' . $type;
} 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)) {
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();
}
}
}
-
+
$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)) {
$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)) ?
'<img hspace="1" alt="'.$strrequireskey.'" class="icon" src="'.$CFG->pixpath.'/i/key.gif" />' : ''),
format_string($course->shortname),format_string($course->fullname),fullname($requester),
format_string($course->summary),format_string($course->reason),
$meta = '<meta name="robots" content="none" />'; // prevent duplicate content in search engines MDL-7299
$loggedinas = user_login_string($course, $USER);
-
+ $navlinks = array();
if (!empty($chooserecent)) {
$userinfo = get_string("allparticipants");
if ($date)
$dateinfo = userdate($date, get_string("strftimedaydate"));
- if ($course->id != SITEID) {
- print_header("$course->shortname: $strrecentactivity", $course->fullname,
- "<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $userinfo, $dateinfo", "", $meta);
- } else {
- print_header("$course->shortname: $strrecentactivity", $course->fullname,
- "<a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $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;
}
}
}
-
- if ($course->id != SITEID) {
- print_header("$course->shortname: $strrecentactivity", $course->fullname,
- "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $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)));
$strreports = get_string('reports');
- print_header($course->fullname.': '.$strreports, $course->fullname.': '.$strreports,
- '<a href="view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$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');
echo '</div>';
}
}
-
+
print_footer();
?>
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)) {
} 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
$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);
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');
session_write_close();
+ $navlinks = array();
+
if (!empty($chooselog)) {
$userinfo = get_string('allparticipants');
$dateinfo = get_string('alldays');
admin_externalpage_print_header();
} else {
- print_header($course->shortname .': '. $strlogs, $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"$CFG->wwwroot/course/report.php?id=$course->id\">$strreports</a> ->
- <a href=\"index.php?id=$course->id\">$strlogs</a> -> $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);
admin_externalpage_setup('reportlog');
admin_externalpage_print_header();
} else {
- print_header($course->shortname .': '. $strlogs, $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"$CFG->wwwroot/course/report.php?id=$course->id\">$strreports</a> ->
- $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') .':');
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");
$strtodaylogs = get_string("todaylogs");
$strreports = get_string("reports");
- print_header("$course->shortname: $stractivityreport", $course->fullname,
- "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"../../report.php?id=$course->id\">$strreports</a> ->
- $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));
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);
$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)
}
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');
$strallactions = get_string('allactions');
$strreports = get_string('reports');
- $strnav = "<a href=\"../../view.php?id=$course->id\">" . format_string($course->shortname) . "</a> ->
- <a href=\"../../report.php?id=$course->id\">$strreports</a> -> ". $strparticipation;
-
- print_header("$course->shortname: $strparticipation", $course->fullname,
- "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"../../report.php?id=$course->id\">$strreports</a> ->
- $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',
$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);
'view' => $strview,
'post' => $strpost,
);
-
-
+
+
// print first controls.
echo '<form class="participationselectform" action="index.php" method="get"><div>'."\n".
'<input type="hidden" name="id" value="'.$course->id.'" />'."\n".
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;
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));
}
echo '<input type="submit" value="'.get_string('go').'" />'."\n".
'</div>'."\n".
"</form>\n";
-
+
if (!empty($instanceid) && !empty($roleid)) {
if (!$cm = get_coursemodule_from_instance($module->name,$instanceid,$course->id)) {
print_error('cmunknown');
$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',
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'
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';
}
$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()) {
} else {
$matchcount = $totalcount;
}
-
+
echo '<div id="participationreport">' . "\n";
echo '<p class="modulename">'.$modulename . ' ' . $strviews.': '.implode(', ',$viewnames).'<br />'."\n"
. $modulename . ' ' . $strposts.': '.implode(', ',$postnames).'</p>'."\n";
-
+
$table->initialbars($totalcount > $perpage);
$table->pagesize($perpage, $matchcount);
}
$data = array();
-
+
$a->count = $totalcount;
$a->items = $role->name;
-
+
if ($matchcount != $totalcount) {
$a->items .= ' ('.get_string('matched').' '.$matchcount.')';
}
-
+
echo '<h2>'.get_string('counteditems', '', $a).'</h2>'."\n";
echo '
<script type="text/javascript">
else if ($matchcount > 0 && $perpage < $matchcount) {
echo '<div id="showall"><a href="'.$baseurl.'&perpage='.SHOW_ALL_PAGE_SIZE.'">'.get_string('showall', '', $matchcount).'</a></div>'."\n";
}
-
+
echo '<input type="button" onclick="checkall()" value="'.get_string('selectall').'" /> '."\n";
echo '<input type="button" onclick="checknone()" value="'.get_string('deselectall').'" /> '."\n";
if ($perpage >= $matchcount) {
echo '</div>'."\n";
}
-
+
print_footer();
?>
require_login($course->id);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
-
+
if (!has_capability('moodle/site:viewreports', $context)) {
error('You need do not have the required permission to view reports for this course');
}
- add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
+ add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
stats_check_uptodate($course->id);
-
-
+
+
$strreports = get_string("reports");
$strstats = get_string('stats');
$menu = report_stats_mode_menu($course, $mode, $time, "$CFG->wwwroot/course/report/stats/index.php");
- $crumb = "<a href=\"../../view.php?id=$course->id\">" . format_string($course->shortname) . "</a> ->
- <a href=\"../../report.php?id=$course->id\">$strreports</a> ->
- $strstats";
+ $navlinks = array();
+ $navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $strstats, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$course->shortname: $strstats", $course->fullname, $navigation, '', '', true, ' ', $menu);
+
- print_header("$course->shortname: $strstats", $course->fullname,
- $crumb, '', '', true, ' ', $menu);
-
-
require_once($CFG->dirroot.'/course/report/stats/report.php');
-
+
print_footer();
?>
$requestform = new course_request_form();
$strtitle = get_string('courserequest');
- print_header($strtitle, $strtitle, $strtitle, $requestform->focus());
+ $navlinks = array();
+ $navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($strtitle, $strtitle, $navigation, $requestform->focus());
print_simple_box_start('center');
print_string('courserequestintro');
<?php // $Id$
/*
resetcourse.php - Mark Flach and moodle.com
-The purpose of this feature is to quickly remove all user related data from a course
-in order to make it available for a new semester. This feature can handle the removal
-of general course data like students, teachers, logs, events and groups as well as module
-specific data. Each module must be modified to take advantage of this new feature.
+The purpose of this feature is to quickly remove all user related data from a course
+in order to make it available for a new semester. This feature can handle the removal
+of general course data like students, teachers, logs, events and groups as well as module
+specific data. Each module must be modified to take advantage of this new feature.
The feature will also reset the start date of the course if necessary.
*/
require('../config.php');
$strresetcourse = get_string('resetcourse');
$strremove = get_string('remove');
- print_header($course->fullname.': '.$strresetcourse, $course->fullname.': '.$strresetcourse,
- '<a href="view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$strresetcourse);
-
+ $navlinks = array();
+ $navlinks[] = array('name' => $strresetcourse, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($course->fullname.': '.$strresetcourse, $course->fullname.': '.$strresetcourse, $navigation);
+
print_simple_box_start();
print_heading($strresetcourse);
reset_course_userdata($data, true);
if (!empty($data->reset_start_date)) {
- if (set_field('course', 'startdate',
- make_timestamp($data->startyear, $data->startmonth, $data->startday),
+ if (set_field('course', 'startdate',
+ make_timestamp($data->startyear, $data->startmonth, $data->startday),
'id', $course->id)) {
notify(get_string('datechanged'), 'notifysuccess');
}
print_checkbox('reset_events', 1, true, get_string('courseevents', 'calendar'), '', ''); echo '<br />';
print_checkbox('reset_logs', 1, true, get_string('logs'), '', ''); echo '<br />';
print_checkbox('reset_groups', 1, true, get_string('groups'), '', ''); echo '<br />';
- print_checkbox('reset_start_date', 1, true, get_string('startdate'), '', '');
+ print_checkbox('reset_start_date', 1, true, get_string('startdate'), '', '');
print_date_selector('startday', 'startmonth', 'startyear');
helpbutton('coursestartdate', get_string('startdate'));
echo '</div>';
foreach ($allmods as $mod) {
$modname = $mod->name;
$modfile = $CFG->dirroot .'/mod/'. $modname .'/lib.php';
- $mod_reset_course_form = $modname .'_reset_course_form';
+ $mod_reset_course_form = $modname .'_reset_course_form';
if (file_exists($modfile)) {
@include_once($modfile);
if (function_exists($mod_reset_course_form)) {
} else {
error('No modules are installed!');
}
-
+
echo '<input name="id" value="'.$course->id.'" type="hidden" />';
echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
echo '<p align="center"><input name="submit" value="'.$strresetcourse.'" type="submit" /></p>';
echo '</form>';
-
+
print_simple_box_end();
print_footer($course);
// modes, set page to 0.
$page = 0;
}
- }
+ }
/// Editing functions
$strnovalidcourses = get_string('novalidcourses');
if (empty($search) and empty($blocklist) and empty($modulelist)) {
- print_header("$site->fullname : $strsearch", $site->fullname,
- "<a href=\"index.php\">$strcourses</a> -> $strsearch", "", "");
+ $navlinks = array();
+ $navlinks[] = array('name' => $strcourses, 'link' => "index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strsearch, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$site->fullname : $strsearch", $site->fullname, $navigation, "", "");
print_simple_box_start("center");
echo "<center>";
echo "<br />";
}
if (!empty($moveto) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved
-
+
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
error("Error finding the category");
}
-
- $courses = array();
+
+ $courses = array();
foreach ( $data as $key => $value ) {
if (preg_match('/^c\d+$/', $key)) {
array_push($courses, substr($key, 1));
$totalcount = count($courses);
}
else {
- $courses = get_courses_search($searchterms, "fullname ASC",
+ $courses = get_courses_search($searchterms, "fullname ASC",
$page*$perpage, $perpage, $totalcount);
}
if (!empty($courses) && has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
$searchform .= update_categories_search_button($search,$page,$perpage);
}
-
- print_header("$site->fullname : $strsearchresults", $site->fullname,
+
+ print_header("$site->fullname : $strsearchresults", $site->fullname,
"<a href=\"index.php\">$strcourses</a> -> <a href=\"search.php\">$strsearch</a> -> '".s($search, true)."'", "", "", "", $searchform);
echo "<a href=\"search.php?search=$encodedsearch&perpage=99999\">".get_string("showall", "", $totalcount)."</a>";
echo "</p></center>";
}
-
+
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
foreach ($courses as $course) {
$course->fullname = highlight("$search", $course->fullname);
}
echo "<tr>\n";
- echo "<td><a $linkcss href=\"view.php?id=$course->id\">"
+ echo "<td><a $linkcss href=\"view.php?id=$course->id\">"
. format_string($course->fullname) . "</a></td>\n";
echo "<td>".$displaylist[$course->category]."</td>\n";
echo "<td>\n";
-
+
// this is ok since this will get inherited from course category context
// if it is set
if (has_capability('moodle/category:update', $coursecontext)) {
} else {
echo "<input type=\"checkbox\" name=\"c$course->id\" disabled=\"disabled\" />\n";
}
-
+
echo "</td>\n";
echo "<td>\n";
$pixpath = $CFG->pixpath;
-
+
// checks whether user can update course settings
if (has_capability('moodle/course:update', $coursecontext)) {
echo "<a title=\"".get_string("settings")."\" href=\"$CFG->wwwroot/course/edit.php?id=$course->id\">\n<img".
if (has_capability('moodle/role:assign', $coursecontext)) {
echo'<a title="'.get_string('assignroles', 'role').'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$coursecontext->id.'">';
echo '<img src="'.$CFG->pixpath.'/i/roles.gif" class="iconsmall" alt="'.get_string('assignroles', 'role').'" /></a> ' . "\n";
- }
+ }
// checks whether user can delete course
- if (has_capability('moodle/course:delete', $coursecontext)) {
+ if (has_capability('moodle/course:delete', $coursecontext)) {
echo "<a title=\"".get_string("delete")."\" href=\"delete.php?id=$course->id\">\n<img".
" src=\"$pixpath/t/delete.gif\" class=\"iconsmall\" alt=\"".get_string("delete")."\" /></a>\n ";
- }
+ }
// checks whether user can change visibility
if (has_capability('moodle/course:visibility', $coursecontext)) {
echo "<a title=\"".get_string("show")."\" href=\"search.php?search=$encodedsearch&perpage=$perpage&page=$page&show=$course->id&sesskey=$USER->sesskey\">\n<img".
" src=\"$pixpath/t/show.gif\" class=\"iconsmall\" alt=\"".get_string("show")."\" /></a>\n ";
}
- }
+ }
// checks whether user can do site backup
if (has_capability('moodle/site:backup', $coursecontext)) {
echo "<a title=\"".get_string("backup")."\" href=\"../backup/backup.php?id=$course->id\">\n<img".
" src=\"$pixpath/t/backup.gif\" class=\"iconsmall\" alt=\"".get_string("backup")."\" /></a>\n ";
}
-
+
// checks whether user can do restore
if (has_capability('moodle/site:restore', $coursecontext)) {
echo "<a title=\"".get_string("restore")."\" href=\"../files/index.php?id=$course->id&wdir=/backupdata\">\n<img".
<?php // $Id$
-// Remove oneself or someone else from a course, unassigning all
+// Remove oneself or someone else from a course, unassigning all
// roles one might have
//
-// This will not delete any of their data from the course,
-// but will remove them from the participant list and prevent
+// This will not delete any of their data from the course,
+// but will remove them from the participant list and prevent
// any course email being sent to them.
require_once("../config.php");
$strunenrol = get_string('unenrol');
+ $navlinks = array();
+ $navlinks[] = array('name' => $strunenrol, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
- print_header("$course->shortname: $strunenrol", $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $strunenrol");
+ print_header("$course->shortname: $strunenrol", $course->fullname, $navigation);
if ($userid) {
if (!$user = get_record('user', 'id', $userid)) {
error('That user does not exist!');
}
$strunenrolsure = get_string('unenrolsure', '', fullname($user, true));
- notice_yesno($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes&sesskey=".sesskey(),
+ notice_yesno($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes&sesskey=".sesskey(),
$_SERVER['HTTP_REFERER']);
} else {
$strunenrolsure = get_string('unenrolsure', '', get_string("yourself"));
- notice_yesno($strunenrolsure, "unenrol.php?id=$id&confirm=yes&sesskey=".sesskey(),
+ notice_yesno($strunenrolsure, "unenrol.php?id=$id&confirm=yes&sesskey=".sesskey(),
$_SERVER['HTTP_REFERER']);
}
error("You are not allowed to look at this page");
}
- add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
+ add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
$stractivityreport = get_string("activityreport");
$strparticipants = get_string("participants");
$strmode = get_string($mode);
$fullname = fullname($user, true);
+ $navlinks = array();
if ($course->id != SITEID) {
- print_header("$course->shortname: $stractivityreport ($mode)", $course->fullname,
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"../user/index.php?id=$course->id\">$strparticipants</a> ->
- <a href=\"../user/view.php?id=$user->id&course=$course->id\">$fullname</a> ->
- $stractivityreport -> $strmode");
- } else {
- print_header("$course->shortname: $stractivityreport ($mode)", $course->fullname,
- "<a href=\"../user/view.php?id=$user->id&course=$course->id\">$fullname</a> ->
- $stractivityreport -> $strmode");
+ $navlinks[] = array('name' => $strparticipants, 'link' => "../user/index.php?id=$course->id", 'type' => 'misc');
}
+ $navlinks[] = array('name' => $fullname, 'link' => "../user/view.php?id=$user->id&course=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $stractivityreport, 'link' => null, 'type' => 'misc');
+ $navlinks[] = array('name' => $strmode, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$course->shortname: $stractivityreport ($mode)", $course->fullname, $navigation);
+
/// Print tabs at top
/// This same call is made in:
// print_student_grade($user, $course);
}
break;
-
+
case "todaylogs" :
echo '<div class="graph">';
print_log_graph($course, $user->id, "userday.png");
echo '</div>';
- print_log($course, $user->id, usergetmidnight(time()), "l.time DESC", $page, $perpage,
+ print_log($course, $user->id, usergetmidnight(time()), "l.time DESC", $page, $perpage,
"user.php?id=$course->id&user=$user->id&mode=$mode");
break;
echo '<div class="graph">';
print_log_graph($course, $user->id, "usercourse.png");
echo '</div>';
- print_log($course, $user->id, 0, "l.time DESC", $page, $perpage,
+ print_log($course, $user->id, 0, "l.time DESC", $page, $perpage,
"user.php?id=$course->id&user=$user->id&mode=$mode");
break;
case 'stats':
$earliestday = get_field_sql('SELECT timeend FROM '.$CFG->prefix.'stats_user_daily ORDER BY timeend');
$earliestweek = get_field_sql('SELECT timeend FROM '.$CFG->prefix.'stats_user_weekly ORDER BY timeend');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$CFG->prefix.'stats_user_monthly ORDER BY timeend');
-
+
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
-
+
$now = stats_get_base_daily();
$lastweekend = stats_get_base_weekly();
$lastmonthend = stats_get_base_monthly();
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
- if (empty($timeoptions)) {
+ if (empty($timeoptions)) {
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
}
// use the earliest.
$time = array_pop(array_keys($timeoptions));
-
+
$param = stats_get_parameters($time,STATS_REPORT_USER_VIEW,$course->id,STATS_MODE_DETAILED);
$param->table = 'user_'.$param->table;
if (empty($stats)) {
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
}
-
+
// MDL-10818, do not display broken graph when user has no permission to view graph
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $id))) {
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
default: print_string("section"); break;
}
echo " $i</h2>";
-
+
echo '<div class="content">';
if ($mode == "outline") {
continue;
}
$mod = $mods[$sectionmod];
-
+
if (empty($mod->visible)) {
continue;
}
echo "<h4>$image $mod->modfullname: ".
"<a href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
format_string($instance->name,true)."</a></h4>";
-
+
ob_start();
echo "<ul>";
$output = ob_get_contents();
ob_end_clean();
-
+
if (str_replace(' ', '', $output) != '<ul></ul>') {
echo $output;
}
}
}
}
-
+
if ($mode == "outline") {
echo "</table>";
}
$strcourses = get_string('courses');
$strloginto = get_string('loginto', '', $course->shortname);
- print_header($strloginto,
- $course->fullname,
- "<a href=\"$CFG->wwwroot/course/\">$strcourses</a> -> $strloginto");
+ $navlinks = array();
+ $navlinks[] = array('name' => $strcourses, 'link' => "$CFG->wwwroot/course/", 'type' => 'misc');
+ $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($strloginto, $course->fullname, $navigation);
print_course($course, '80%');
if ($course->password) {
/// Print header
$strpaymentmanagement = get_string('paymentmanagement', 'enrol_authorize');
- print_header_simple($strpaymentmanagement, "", "<a href=\"index.php\">$strpaymentmanagement</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $strpaymentmanagement, 'link' => 'index.php', 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header_simple($strpaymentmanagement, "", $navigation);
/// If orderid is empty, user wants to see all orders
if (empty($orderid)) {
/// Print header
$struploadcsv = get_string('uploadcsv', 'enrol_authorize');
- print_header_simple($struploadcsv, "", "<a href=\"uploadcsv.php\">$struploadcsv</a>");
+ $navlinks = array();
+ $navlinks[] = array('name' => $struploadcsv, 'link' => "uploadcsv.php", 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header_simple($struploadcsv, "", $navigation);
print_heading_with_help($struploadcsv, 'uploadcsv', 'enrol/authorize');
/// Handle CSV file
/// get language strings
$str = get_strings(array('enrolments', 'users', 'administration', 'settings'));
+$navlinks = array();
+$navlinks[] = array('name' => $str->administration, 'link' => "../../$CFG->admin/index.php", 'type' => 'misc');
+$navlinks[] = array('name' => $str->enrolments, 'link' => null, 'type' => 'misc');
+$navlinks[] = array('name' => 'IMS import', 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
-print_header("$site->shortname: $str->enrolments", $site->fullname,
- "<a href=\"../../$CFG->admin/index.php\">$str->administration</a> ->
- $str->enrolments -> IMS import");
+print_header("$site->shortname: $str->enrolments", $site->fullname, $navigation);
require_once('enrol.php');
$enrol = new enrolment_plugin_imsenterprise();
?>
-<p>Launching the IMS Enterprise "cron" function. The import log will appear below (giving details of any
+<p>Launching the IMS Enterprise "cron" function. The import log will appear below (giving details of any
problems that might require attention).</p>
<pre style="margin:10px; padding: 2px; border: 1px solid black; background-color: white; color: black;"><?php
//error_reporting(E_ALL);
print_footer();
exit;
-?>
\ No newline at end of file
+?>
* Prints the entry form/page for this enrolment
*
* This is only called from course/enrol.php
-* Most plugins will probably override this to print payment
-* forms etc, or even just a notice to say that manual enrolment
+* Most plugins will probably override this to print payment
+* forms etc, or even just a notice to say that manual enrolment
* is disabled
*
* @param course current course object
/// Automatically enrol into courses without password
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+
+ $navlinks = array();
+ $navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc');
+ $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
if ($course->password == '') { // no password, so enrol
} else if (empty($_GET['confirm']) && empty($_GET['cancel'])) {
- print_header($strloginto, $course->fullname, "<a href=\".\">$strcourses</a> -> $strloginto");
+ print_header($strloginto, $course->fullname, $navigation);
echo '<br />';
- notice_yesno(get_string('enrolmentconfirmation'), "enrol.php?id=$course->id&confirm=1",
+ notice_yesno(get_string('enrolmentconfirmation'), "enrol.php?id=$course->id&confirm=1",
"enrol.php?id=$course->id&cancel=1");
print_footer();
exit;
$password = '';
}
- print_header($strloginto, $course->fullname, "<a href=\".\">$strcourses</a> -> $strloginto", "form.password");
+ print_header($strloginto, $course->fullname, $navigation, "form.password");
print_course($course, "80%");
/**
* The other half to print_entry, this checks the form data
*
-* This function checks that the user has completed the task on the
+* This function checks that the user has completed the task on the
* enrolment entry page and then enrolls them.
*
* @param form the form data submitted, as an object
/**
* Prints a form for configuring the current enrolment plugin
*
-* This function is called from admin/enrol.php, and outputs a
+* This function is called from admin/enrol.php, and outputs a
* full page with a form for defining the current enrolment plugin.
*
* @param frm an object containing all the data for this page
if (!isset( $frm->enrol_manual_keyholderrole )) {
$frm->enrol_manual_keyholderrole = '';
- }
-
+ }
+
include ("$CFG->dirroot/enrol/manual/config.html");
}
/**
-* This function is run by admin/cron.php every time
+* This function is run by admin/cron.php every time
*
-* The cron function can perform regular checks for the current
+* The cron function can perform regular checks for the current
* enrollment plugin. For example it can check a foreign database,
* all look for a file to pull data in from
*
if (empty($CFG->lastexpirynotify)) {
$CFG->lastexpirynotify = 0;
}
-
- if ($CFG->lastexpirynotify < date('Ymd') &&
+
+ if ($CFG->lastexpirynotify < date('Ymd') &&
($courses = get_records_select('course', 'enrolperiod > 0 AND expirynotify > 0 AND expirythreshold > 0'))) {
$admin = get_admin();
}
if ($oldenrolments = get_records_sql('
- SELECT u.*
- FROM '.$CFG->prefix.'role_assignments ra,
+ SELECT u.*
+ FROM '.$CFG->prefix.'role_assignments ra,
'.$CFG->prefix.'user u
WHERE ra.contextid = '.$context->id.'
AND ra.timeend > 0 AND ra.timeend <= '.$expiry.'
} else {
$a->current[] = fullname($user) . " <$user->email>";
if ($course->notifystudents) { // Send this guy notice
- email_to_user($user, $teacher, $SITE->fullname .' '. $strexpirynotify,
+ email_to_user($user, $teacher, $SITE->fullname .' '. $strexpirynotify,
$strexpirynotifystudentsemail);
}
}
$strexpirynotifyemail = get_string('expirynotifyemail', '', $a);
if ($a->current || $a->past) {
- if ($teachers = get_users_by_capability($context, 'moodle/course:update',
+ if ($teachers = get_users_by_capability($context, 'moodle/course:update',
'u.*,ra.hidden', 'r.sortorder ASC',
'', '', '', '', false)) {
foreach ($teachers as $teacher) {
global $CFG;
global $USER;
- $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
+ $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
$guest = has_capability('moodle/legacy:guest', $context, $USER->id, false);
// if a keyholder role is defined we list teachers in that role (if any exist)
echo "$contactname<br />";
}
$contactslisted = true;
- }
+ }
}
// if no keyholder role is defined OR nobody is in that role we do this the 'old' way
// (show the first person with update rights)
if (!$contactslisted) {
- if ($teachers = get_users_by_capability(get_context_instance(CONTEXT_COURSE, $course->id), 'moodle/course:update',
- 'u.*,ra.hidden', 'r.sortorder ASC', 0, 1, '', '', false, true)) {
+ if ($teachers = get_users_by_capability(get_context_instance(CONTEXT_COURSE, $course->id), 'moodle/course:update',
+ 'u.*,ra.hidden', 'r.sortorder ASC', 0, 1, '', '', false, true)) {
$teacher = array_shift($teachers);
}
if (!empty($teacher)) {
$manual->print_entry($course);
} else {
+ $navlinks = array();
+ $navlinks[] = array('name' => $strcourses, 'link' => "$CFG->wwwroot/course", 'type' => 'misc');
+ $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
- print_header($strloginto, $course->fullname,
- "<a href=\"$CFG->wwwroot/course/\">$strcourses</a> -> $strloginto");
+ print_header($strloginto, $course->fullname, $navigation);
print_course($course, "80%");
if ($course->password) { // Presenting two options
// Print the page and form
$strgroups = get_string('groups');
$strparticipants = get_string('participants');
+$straddgroupstogroupings = get_string('addgroupstogroupings', 'group');
$groupingname = format_string($grouping->name);
-print_header("$course->shortname: $strgroups",
- $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
- "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
- "-> <a href=\"$CFG->wwwroot/group/index.php?id=$courseid\">$strgroups</a>".
- '-> '. get_string('addgroupstogroupings', 'group'), '', '', true, '', user_login_string($course, $USER));
+$navlinks = array();
+$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$courseid", 'type' => 'misc');
+$navlinks[] = array('name' => $strgroups, 'link' => "$CFG->wwwroot/group/index.php?id=$courseid", 'type' => 'misc');
+$navlinks[] = array('name' => $straddgroupstogroupings, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+
+print_header("$course->shortname: $strgroups", $course->fullname, $navigation, '', '', true, '', user_login_string($course, $USER));
?>
<div id="addmembersform">
// Print the page and form
$strgroups = get_string('groups');
$strparticipants = get_string('participants');
+$stradduserstogroup = get_string('adduserstogroup', 'group');
$groupname = format_string($group->name);
-print_header("$course->shortname: $strgroups",
- $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
- "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
- "-> <a href=\"$CFG->wwwroot/group/index.php?id=$courseid\">$strgroups</a>".
- '-> '. get_string('adduserstogroup', 'group'), '', '', true, '', user_login_string($course, $USER));
+$navlinks = array();
+$navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$courseid", 'type' => 'misc');
+$navlinks[] = array('name' => $strgroups, 'link' => "$CFG->wwwroot/group/index.php?id=$courseid", 'type' => 'misc');
+$navlinks[] = array('name' => $stradduserstogroup, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+
+print_header("$course->shortname: $strgroups", $course->fullname, $navigation, '', '', true, '', user_login_string($course, $USER));
?>
<div id="addmembersform">
$info->currentmoodle = $CFG->version;
$info->requiremoodle = $plugin->requires;
if (!$updated_plugins) {
- print_header($strpluginsetup, $strpluginsetup, $strpluginsetup, '',
+ print_header($strpluginsetup, $strpluginsetup,
+ build_navigation(array(array('name' => $strpluginsetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
// do nothing
} else if ($CFG->$pluginversion < $plugin->version) {
if (!$updated_plugins) {
- print_header($strpluginsetup, $strpluginsetup, $strpluginsetup, '',
+ print_header($strpluginsetup, $strpluginsetup,
+ build_navigation(array(array('name' => $strpluginsetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
$updated_plugins = true;
$info->currentmoodle = $CFG->version;
$info->requiremoodle = $module->requires;
if (!$updated_modules) {
- print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '',
+ print_header($strmodulesetup, $strmodulesetup,
+ build_navigation(array(array('name' => $strmodulesetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
continue;
}
if (!$updated_modules) {
- print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '',
+ print_header($strmodulesetup, $strmodulesetup,
+ build_navigation(array(array('name' => $strmodulesetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
} else { // module not installed yet, so install it
if (!$updated_modules) {
- print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '',
+ print_header($strmodulesetup, $strmodulesetup,
+ build_navigation(array(array('name' => $strmodulesetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
define('BLOCKS_PINNED_BOTH',2);
require_once($CFG->libdir.'/pagelib.php');
-require_once($CFG->dirroot.'/course/lib.php'); // needed to solve all those: Call to undefined function: print_recent_activity() when adding Recent Activity
+require_once($CFG->dirroot.'/course/lib.php'); // needed to solve all those: Call to undefined function: print_recent_activity() when adding Recent Activity
// Returns false if this block is incompatible with the current version of Moodle.
function block_is_compatible($blockname) {
$managecourseblocks = has_capability('moodle/site:manageblocks', $coursecontext);
$editmymoodle = $page->type == PAGE_MY_MOODLE && has_capability('moodle/my:manageblocks', $coursecontext);
- if ($page->blocks_default_position() == $position &&
- $page->user_is_editing() &&
+ if ($page->blocks_default_position() == $position &&
+ $page->user_is_editing() &&
($managecourseblocks || $editmymoodle || $myownblogpage)) {
blocks_print_adminblock($page, $pageblocks);
$page->print_header(get_string('pageheaderconfigablock', 'moodle'), array($strheading => ''));
echo '<div class="block-config" id="'.$block->name.'">'; /// Make CSS easier
-
+
print_heading($strheading);
echo '<form method="post" action="'. $page->url_get_path() .'">';
echo '<p>';
if (empty($CFG->blocks_version)) { // Blocks have never been installed.
$strdatabaseupgrades = get_string('databaseupgrades');
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
+ print_header($strdatabaseupgrades, $strdatabaseupgrades,
+ build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
upgrade_log_start();
if ($blocks_version > $CFG->blocks_version) { // Upgrade tables
$strdatabaseupgrades = get_string('databaseupgrades');
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
+ print_header($strdatabaseupgrades, $strdatabaseupgrades,
+ build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript());
upgrade_log_start();
print_heading('blocks');
} else if ($currblock->version < $block->version) {
if (empty($updated_blocks)) {
$strblocksetup = get_string('blocksetup');
- print_header($strblocksetup, $strblocksetup, $strblocksetup, '',
+ print_header($strblocksetup, $strblocksetup,
+ build_navigation(array(array('name' => $strblocksetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
$updated_blocks = true;
}
if (empty($updated_blocks)) {
$strblocksetup = get_string('blocksetup');
- print_header($strblocksetup, $strblocksetup, $strblocksetup, '',
+ print_header($strblocksetup, $strblocksetup,
+ build_navigation(array(array('name' => $strblocksetup, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
$updated_blocks = true;
<?php
/**
* This file provides hooks from moodle core into custom code.
- *
+ *
* Important note
* --------------
- *
- * If at all possible, the facilities provided here should not be used.
- * Wherever possible, customisations should be written using one of the
+ *
+ * If at all possible, the facilities provided here should not be used.
+ * Wherever possible, customisations should be written using one of the
* standard plug-in points like modules, blocks, auth plugins, themes, ...
- *
+ *
* However, sometimes that is just not possible, because of the nature
* of the change you want to make. In which case the second best plan is
* to implement your feature in a generally useful way, which can
* be contributed back to the moodle project so that everyone benefits.
- *
+ *
* But supposing you are forced to implement some nasty hack that only
* you will ever want, then the local folder is for you. The idea is that
- * instead of scattering your changes throughout the code base, you
+ * instead of scattering your changes throughout the code base, you
* put them all in a folder called 'local'. Then you won't have to
* deal with merging problems when you upgrade the rest of your moodle
* installation.
- *
- *
+ *
+ *
* Available hooks
* ===============
- *
+ *
* These are similar to the module interface, however, not all the the
* facilities that are available to modules are available to local code (yet).
- *
- *
+ *
+ *
* Local database customisations
* -----------------------------
- *
+ *
* If your local customisations require changes to the database, use the files:
- *
+ *
* local/version.php
* local/db/upgrade.php
- *
+ *
* In the file version.php, set the variable $local_version to a versionstamp
* value like 2006030300 (a concatenation of year, month, day, serial).
- *
+ *
* In the file upgrade.php, implement the
* function xmldb_local_upgrade($oldversion) to make the database changes.
- *
+ *
* Note that you don't need to have an install.xml file. Instead,
* when your moodle instance is first installed, xmldb_local_upgrade() will be called
* with $oldversion set to 0, so that all the updates run.
- *
- *
+ *
+ *
* Course deletion
* ---------------
- *
+ *
* To have your local customisations notified when a course is deleted,
- * make a file called
- *
+ * make a file called
+ *
* local/lib.php
- *
+ *
* In there, implement the function local_delete_course($courseid). This
* function will then be called whenever the functions remove_course_contents()
* or delete_course() from moodlelib are called.
/**
* This function checks to see whether local database customisations are up-to-date
- * by comparing $CFG->local_version to the variable $local_version defined in
+ * by comparing $CFG->local_version to the variable $local_version defined in
* local/version.php. If not, it looks for a function called 'xmldb_local_upgrade'
- * in a file called 'local/db/upgrade.php', and if it's there calls it with the
+ * in a file called 'local/db/upgrade.php', and if it's there calls it with the
* appropiate $oldversion parameter. Then it updates $CFG->local_version.
* On success it prints a continue link. On failure it prints an error.
- *
- * @uses $CFG
+ *
+ * @uses $CFG
* @uses $db to do something really evil with the debug setting that should probably be eliminated. TODO!
* @param string $continueto a URL passed to print_continue() if the local upgrades succeed.
*/
function upgrade_local_db($continueto) {
global $CFG, $db;
-
+
// if we don't have code version or a db upgrade file, just return true, we're unneeded
if (!file_exists($CFG->dirroot.'/local/version.php') || !file_exists($CFG->dirroot.'/local/db/upgrade.php')) {
return true;
$CFG->local_version = 0;
}
- if ($local_version > $CFG->local_version) { // upgrade!
+ if ($local_version > $CFG->local_version) { // upgrade!
$strdatabaseupgrades = get_string('databaseupgrades');
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
-
+ print_header($strdatabaseupgrades, $strdatabaseupgrades,
+ build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript());
+
upgrade_log_start();
require_once ($CFG->dirroot .'/local/db/upgrade.php');
}
/**
- * Notify local code that a course is being deleted.
- * Look for a function local_delete_course() in a file called
+ * Notify local code that a course is being deleted.
+ * Look for a function local_delete_course() in a file called
* local/lib.php andn call it if it is there.
- *
+ *
* @param int $courseid the course that is being deleted.
* @param bool $showfeedback Whether to display notifications on success.
* @return false if local_delete_course failed, or true if
break;
default: /// Guests not allowed
- print_header_simple('', '', get_string('loggedinasguest'));
+ $strloggedinasguest = get_string('loggedinasguest');
+ print_header_simple('', '',
+ build_navigation(array(array('name' => $strloggedinasguest, 'link' => null, 'type' => 'misc'))));
if (empty($USER->switchrole[$context->id])) { // Normal guest
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), "$CFG->wwwroot/login/index.php");
} else {
$id = optional_param('id', SITEID, PARAM_INT); // current course
+ $strparticipants = get_string('participants');
+
//HTTPS is potentially required in this page
httpsrequired();
$mform = new login_change_password_form();
$mform->set_data(array('id'=>$course->id));
+ $navlinks = array();
+ $navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
+
if ($mform->is_cancelled()) {
redirect($CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$course->id);
} else if ($data = $mform->get_data()) {
$fullname = fullname($USER, true);
- if ($course->id != SITEID) {
- $navstr = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> ";
- } else {
- $navstr = '';
- }
- $navstr .= "<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">".get_string("participants")."</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$fullname</a> -> $strpasswordchanged";
+ $navlinks[] = array('name' => $fullname,
+ 'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $strpasswordchanged, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
- print_header($strpasswordchanged, $strpasswordchanged, $navstr);
+ print_header($strpasswordchanged, $strpasswordchanged, $navigation);
if (empty($SESSION->wantsurl) or $SESSION->wantsurl == $CFG->httpswwwroot.'/login/change_password.php') {
$returnto = "$CFG->wwwroot/user/view.php?id=$USER->id&course=$id";
$fullname = fullname($USER, true);
- if ($course->id != SITEID) {
- $navstr = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> ";
- } else {
- $navstr = '';
- }
- $navstr .= "<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">".get_string('participants')."</a> -> <a href=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$fullname</a> -> $strchangepassword";
-
+ $navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $strchangepassword, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
- print_header($strchangepassword, $strchangepassword, $navstr);
+ print_header($strchangepassword, $strchangepassword, $navigation);
if (get_user_preferences('auth_forcepasswordchange')) {
notify(get_string('forcepasswordchangenotice'));
}
if ($confirmed == AUTH_CONFIRM_ALREADY) {
$user = get_complete_user_data('username', $username);
- print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), "", "");
+ print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), array(), "");
print_box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
echo "<p>".get_string("alreadyconfirmed")."</p>\n";
redirect($goto);
}
- print_header(get_string("confirmed"), get_string("confirmed"), "", "");
+ print_header(get_string("confirmed"), get_string("confirmed"), array(), "");
print_box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
echo "<p>".get_string("confirmed")."</p>\n";
$strforgotten = get_string('passwordforgotten');
$strlogin = get_string('login');
+$navigation = build_navigation(array(array('name' => $strlogin, 'link' => "$CFG->wwwroot/login/index.php", 'type' => 'misc'),
+ array('name' => $strforgotten, 'link' => null, 'type' => 'misc')));
+
// if you are logged in then you shouldn't be here!
if (isloggedin() and !isguestuser()) {
redirect($CFG->wwwroot.'/index.php', get_string('loginalready'), 5);
update_login_count();
$user = get_complete_user_data('username', $p_username);
-
if (!empty($user) and $user->secret === '') {
- print_header($strforgotten, $strforgotten,
- "<a href=\"{$CFG->wwwroot}/login/index.php\">{$strlogin}</a>->{$strforgotten}");
+ print_header($strforgotten, $strforgotten, $navigation);
error(get_string('secretalreadyused'));
} else if (!empty($user) and $user->secret == stripslashes($p_secret)) {
$a->email = $user->email;
$a->link = $changepasswordurl;
- print_header($strforgotten, $strforgotten,
- "<a href=\"{$CFG->wwwroot}/login/index.php\">{$strlogin}</a>->{$strforgotten}");
+ print_header($strforgotten, $strforgotten, $navigation);
notice(get_string('emailpasswordsent', '', $a), $changepasswordurl);
} else {
- print_header($strforgotten, $strforgotten,
- "<a href=\"{$CFG->wwwroot}/login/index.php\">{$strlogin}</a>->{$strforgotten}");
+ print_header($strforgotten, $strforgotten, $navigation);
error(get_string('forgotteninvalidurl'));
}
}
}
- print_header($strforgotten, $strforgotten,
- "<a href=\"{$CFG->wwwroot}/login/index.php\">{$strlogin}</a>->{$strforgotten}");
+ print_header($strforgotten, $strforgotten, $navigation
if (empty($user->email) or !empty($CFG->protectusernames)) {
// Print general confirmation message
/// DISPLAY FORM
-print_header($strforgotten, $strforgotten,
- "<a href=\"{$CFG->wwwroot}/login/index.php\">{$strlogin}</a>->{$strforgotten}", 'id_email');
+print_header($strforgotten, $strforgotten, $navigation, 'id_email');
print_box(get_string('passwordforgotteninstructions'), 'generalbox boxwidthnormal boxaligncenter');
$mform->display();
print_footer();
-?>
\ No newline at end of file
+?>
if (isloggedin() and !isguestuser()) {
redirect( $CFG->wwwroot.'/', get_string('loginalready'), 5);
}
+$navigation = build_navigation(array(array('name' => 'MNET ID Provider', 'link' => null, 'type' => 'misc')));
-print_header('MNET ID Provider', 'MNET ID Provider', 'MNET ID Provider', 'form.email' );
+print_header('MNET ID Provider', 'MNET ID Provider', $navigation, 'form.email' );
if ($form = data_submitted() and confirm_sesskey()) {
if ($user = get_record('user', 'username', $username, 'email', $form->email)) {
$langs = get_list_of_languages();
$langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
- print_header($newaccount, $newaccount, "<a href=\"index.php\">$login</a> -> $newaccount", $mform_signup->focus(), "", true, "<div class=\"langmenu\">$langmenu</div>");
+
+ $navlinks = array();
+ $navlinks[] = array('name' => $login, 'link' => "index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $newaccount, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header($newaccount, $newaccount, $navigation, $mform_signup->focus(), "", true, "<div class=\"langmenu\">$langmenu</div>");
$mform_signup->display();
print_footer();
-?>
\ No newline at end of file
+?>
$strsearch = get_string("search");
$CFG->framename = "newwindow";
- if ($course->id != SITEID) {
- $navlinks = array();
- $navlinks[] = array('name' => $strglossaries, 'link' => '', 'type' => 'activity');
- $navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
-
- $navigation = build_navigation($navlinks);
-
- print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname, $navigation, "", "", true, " ", " ");
- } else {
- print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname,
- "$strglossaries -> $strsearch", "", "", true, " ", " ");
- }
+ $navlinks = array();
+ $navlinks[] = array('name' => $strglossaries, 'link' => '', 'type' => 'activity');
+ $navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
+
+ $navigation = build_navigation($navlinks);
+
+ print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname, $navigation, "", "", true, " ", " ");
} else {
print_header(); // Needs to be something here to allow linking back to the whole glossary
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
error("Course Module ID was incorrect");
}
-
+
}
require_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
// header strings
$title = format_string($course->shortname.': '.$hotpot->name, true);
$heading = $course->fullname;
-
+
$navlinks = array();
$navlinks[] = array('name' => get_string("modulenameplural", "hotpot"), 'link' => $CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id, 'type' => 'activity');
$navlinks[] = array('name' => $hotpot->name, 'link' => '', 'type' => 'activityinstance');
-
+
$navigation = build_navigation($navlinks);
-
+
$button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot"));
$button = '<div style="font-size:0.75em;">'.$button.'</div>';
$loggedinas = '<span class="logininfo">'.user_login_string($course, $USER).'</span>';
}
// if HTML is being requested ...
if (empty($get_js) && empty($get_css)) {
- if (empty($frameset)) {
+ if (empty($frameset)) {
// HP v6
if ($hotpot->navigation==HOTPOT_NAVIGATION_FRAME || $hotpot->navigation==HOTPOT_NAVIGATION_IFRAME) {
$get_html = ($framename=='main') ? true : false;
} else {
$get_html = true;
}
- } else {
+ } else {
// HP5 v5
$get_html = empty($framename) ? true : false;
}
if ($get_html) {
-
+
if (HOTPOT_FIRST_ATTEMPT) {
add_to_log($course->id, "hotpot", "view", "view.php?id=$cm->id", "$hotpot->id", "$cm->id");
$body = '';
$body_tags = '';
$footer = '</html>';
- // HP6 and some HP5 (v6 and v4)
+ // HP6 and some HP5 (v6 and v4)
if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
$body = $matches[5]; // contents of first <body onload="StartUp()">...</body> block
if ($pageid) {
switch ($hotpot->navigation) {
case HOTPOT_NAVIGATION_BAR:
//update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em')
- print_header(
- $title, $heading, $navigation,
- "", $head.$styles.$scripts, true, $button,
- $loggedinas, false, $body_tags
+ print_header($title, $heading, $navigation, "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags
);
if (!empty($available_msg)) {
notify($available_msg);
$body_tags = " onload=\"set_iframe_height('$iframe_id')\"";
$iframe_js = '<script src="iframe.js" type="text/javascript"></script>'."\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)) {
// do nothing
} else {
$hp->html = preg_replace(
- '|<meta[^>]*charset=iso-8859-1[^>]*>|is',
- '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />',
+ '|<meta[^>]*charset=iso-8859-1[^>]*>|is',
+ '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />',
$hp->html
);
}
//if ($course->id != SITEID) {
// $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
//}
-print_header_simple(format_string($lams->name), "",
- "<a href=\"index.php?id=$course->id\">$strchoices</a> -> ".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 '<table id="layout-table"><tr>';
print_simple_box_start('center');
echo '<a target="LAMS Monitor" title="LAMS Monitor" href="'.$url.'">'.get_string("openmonitor", "lams").'</a>';
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.
$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 '<p align="center">'.$errortext.'</p>';
/// 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<script type=\"text/javascript\">";
echo "\n<!--\n";
if (!isset($defaults['popup'])) {
// use form defaults
-
+
} else if (!empty($defaults['popup'])) {
$defaults['windowpopup'] = 1;
if (array_key_exists('popup', $defaults)) {
$mform->addElement('selectyesno', 'param_skipsubmenus', get_string('skipsubmenus', 'resource'));
$mform->setDefault('param_skipsubmenus', 1);
$mform->disabledIf('param_skipsubmenus', 'param_navigationmenu', 'eq', 1);
-
+
$mform->addElement('selectyesno', 'param_navigationupbutton', get_string('navigationup', 'resource'));
$mform->setDefault('param_navigationupbutton', 1);
$mform->disabledIf('param_navigationupbutton', 'param_navigationmenu', 'eq', 1);
}
+ $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
+ $this->navigation = build_navigation($this->navlinks);
/// Form the parse string
if (!empty($resource->alltext)) {
$inpopup = optional_param('inpopup', 0, PARAM_BOOL);
- $fullurl = $resource->reference. '&HIVE_SESSION='.$SESSION->HIVE_SESSION;
+ $fullurl = $resource->reference. '&HIVE_SESSION='.$SESSION->HIVE_SESSION;
if (!empty($querystring)) {
$urlpieces = parse_url($resource->reference);
if (empty($urlpieces['query'])) {
if ($inpopup) {
print_header($pagetitle, $course->fullname);
} else {
- 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));
}
notify('You do not have access to HarvestRoad Hive. This resource is unavailable.');
if ($inpopup) {
if ($inpopup) {
print_header($pagetitle, $course->fullname);
} else {
- 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));
}
notify(get_string('notallowedlocalfileaccess', 'resource', ''));
if ($inpopup) {
/// Check whether this is supposed to be a popup, but was called directly
if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window
-
- 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<script type=\"text/javascript\">";
/// If we are in a frameset, just print the top of it
if (!empty($frameset) and $frameset == "top") {
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
+ print_header($pagetitle, $course->fullname, $this->navigation, "", "", true,
+ update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
echo '<div class="summary">'.format_text($resource->summary, FORMAT_HTML, $formatoptions).'</div>';
if (!empty($localpath)) { // Show some help
if ($inpopup) {
print_header($pagetitle);
} else {
- print_header($pagetitle, $course->fullname, "$this->navigation <a $CFG->frametarget title=\"$strdirectlink\" href=\"$fullurl\"> ".format_string($resource->name,true)."</a>", "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
+ print_header($pagetitle, $course->fullname, $this->navigation, "", "", true,
+ update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
}
print_footer($course);
} else { /// Make a page and a pop-up window
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name),
+ $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,
"", "", true, update_module_button($cm->id, $course->id, $this->strresource),
navmenu($course, $cm));
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
$this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'title');
$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));
/**
* Global Search Engine for Moodle
* Michael Champanis (mchampan) [cynnical@gmail.com]
-* review 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
+* review 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
* 2007/08/02
*
* The query page - accepts a user-entered query string and returns results.
if ($pages && isset($_SESSION['search_advanced_query'])) {
// if both are set, then we are busy browsing through the result pages of an advanced query
$adv = unserialize($_SESSION['search_advanced_query']);
- }
+ }
else if ($advanced) {
// otherwise we are dealing with a new advanced query
unset($_SESSION['search_advanced_query']);
session_unregister('search_advanced_query');
-
+
// chars to strip from strings (whitespace)
$chars = " \t\n\r\0\x0B,-+";
-
+
// retrieve advanced query variables
$adv->mustappear = trim(optional_param('mustappear', '', PARAM_CLEAN), $chars);
$adv->notappear = trim(optional_param('notappear', '', PARAM_CLEAN), $chars);
$adv->module = optional_param('module', '', PARAM_CLEAN);
$adv->title = trim(optional_param('title', '', PARAM_CLEAN), $chars);
$adv->author = trim(optional_param('author', '', PARAM_CLEAN), $chars);
- }
+ }
if ($advanced) {
//parse the advanced variables into a query string
//TODO: move out to external query class (QueryParse?)
-
+
$query_string = '';
-
+
// get all available module types
$module_types = array_merge(array('all'), array_values(search_get_document_types()));
$adv->module = in_array($adv->module, $module_types) ? $adv->module : 'all';
-
+
// convert '1 2' into '+1 +2' for required words field
if (strlen(trim($adv->mustappear)) > 0) {
$query_string = ' +'.implode(' +', preg_split("/[\s,;]+/", $adv->mustappear));
- }
-
+ }
+
// convert '1 2' into '-1 -2' for not wanted words field
if (strlen(trim($adv->notappear)) > 0) {
$query_string .= ' -'.implode(' -', preg_split("/[\s,;]+/", $adv->notappear));
- }
-
+ }
+
// this field is left untouched, apart from whitespace being stripped
if (strlen(trim($adv->canappear)) > 0) {
$query_string .= ' '.implode(' ', preg_split("/[\s,;]+/", $adv->canappear));
- }
-
+ }
+
// add module restriction
$doctypestr = get_string('doctype', 'search');
$titlestr = get_string('title', 'search');
$authorstr = get_string('author', 'search');
if ($adv->module != 'all') {
$query_string .= " +{$doctypestr}:".$adv->module;
- }
-
+ }
+
// create title search string
if (strlen(trim($adv->title)) > 0) {
$query_string .= " +{$titlestr}:".implode(" +{$titlestr}:", preg_split("/[\s,;]+/", $adv->title));
- }
-
+ }
+
// create author search string
if (strlen(trim($adv->author)) > 0) {
$query_string .= " +{$authorstr}:".implode(" +{$authorstr}:", preg_split("/[\s,;]+/", $adv->author));
- }
-
+ }
+
// save our options if the query is valid
if (!empty($query_string)) {
$_SESSION['search_advanced_query'] = serialize($adv);
- }
- }
+ }
+ }
// normalise page number
if ($page_number < 1) {
$page_number = 1;
- }
+ }
//run the query against the index
$sq = new SearchQuery($query_string, $page_number, 10, false);
-}
+}
if (!$site = get_site()) {
redirect("index.php");
-}
+}
-$strsearch = get_string('search', 'search');
+$strsearch = get_string('search', 'search');
$strquery = get_string('enteryoursearchquery', 'search');
-
-print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
- "<a href=\"index.php\">$strsearch</a> -> $strquery");
+$navlinks = array();
+$navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc');
+$navlinks[] = array('name' => $strquery, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+print_header("$site->shortname: $strsearch: $strquery", "$site->fullname", $navigation);
//keep things pretty, even if php5 isn't available
if (!$check) {
print_heading(search_check_php5(true));
print_footer();
exit(0);
-}
+}
print_box_start();
print_heading($strquery);
if (isset($vars)) {
foreach ($vars as $key => $value) {
$adv->$key = stripslashes(htmlentities($value));
- }
+ }
}
?>
<form id="query" method="get" action="query.php">
-<?php
-if (!$advanced) {
+<?php
+if (!$advanced) {
?>
<input type="text" name="query_string" length="50" value="<?php print stripslashes($query_string) ?>" />
<input type="submit" value="<?php print_string('search', 'search') ?>" />
<a href="query.php?a=1"><?php print_string('advancedsearch', 'search') ?></a> |
<a href="stats.php"><?php print_string('statistics', 'search') ?></a>
-<?php
-}
+<?php
+}
else {
print_box_start();
?>
<td><?php print_string('whichmodulestosearch?', 'search') ?>:</td>
<td>
<select name="module">
-<?php
+<?php
foreach($module_types as $mod) {
if ($mod == $adv->module) {
if ($mod != 'all'){
else{
print "<option value='$mod' selected=\"selected\">".get_string('all', 'search')."</option>\n";
}
- }
+ }
else {
if ($mod != 'all'){
print "<option value='$mod'>".get_string('modulenameplural', $mod)."</option>\n";
else{
print "<option value='$mod'>".get_string('all', 'search')."</option>\n";
}
- }
- }
+ }
+ }
?>
</select>
</td>
</table>
<?php
print_box_end();
- }
+ }
?>
</form>
<br/>
if ($sq->is_valid_index()) {
//use cached variable to show up-to-date index size (takes deletions into account)
print $CFG->search_index_size;
-}
+}
else {
print "0";
-}
+}
print ' ';
print_string('documents', 'search');
if (!$sq->is_valid_index() and isadmin()) {
print '<p>' . get_string('noindexmessage', 'search') . '<a href="indexersplash.php">' . get_string('createanindex', 'search')."</a></p>\n";
-}
+}
?>
</div>
// prints all the results in a box
if ($sq->is_valid()) {
print_box_start();
-
+
search_stopwatch();
$hit_count = $sq->count();
-
+
print "<br />";
-
+
print $hit_count.' '.get_string('resultsreturnedfor', 'search') . " '".stripslashes($query_string)."'.";
print "<br />";
-
+
if ($hit_count > 0) {
$page_links = $sq->page_numbers();
$hits = $sq->results();
-
+
if ($advanced) {
// if in advanced mode, search options are saved in the session, so
// we can remove the query string var from the page links, and replace
// it with a=1 (Advanced = on) instead
$page_links = preg_replace("/query_string=[^&]+/", 'a=1', $page_links);
- }
-
+ }
+
print "<ol>";
-
+
$typestr = get_string('type', 'search');
$scorestr = get_string('score', 'search');
$authorstr = get_string('author', 'search');
."{$typestr}: ".$listing->doctype.", {$scorestr}: ".round($listing->score, 3).", {$authorstr}: ".$listing->author."\n"
."</li>\n";
}
-
+
print "</ol>";
print $page_links;
- }
+ }
print_box_end();
?>
<div align="center">
-<?php
+<?php
print_string('ittook', 'search');
- search_stopwatch();
+ search_stopwatch();
print_string('tofetchtheseresults', 'search');
?>.
</div>
}
print_box_end();
print_footer();
-?>
\ No newline at end of file
+?>
/**
* Global Search Engine for Moodle
* Michael Champanis (mchampan) [cynnical@gmail.com]
-* review 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
+* review 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
* 2007/08/02
*
* Prints some basic statistics about the current index.
* Does some diagnostics if you are logged in as an administrator.
-*
+*
*/
require_once('../config.php');
//check for php5, but don't die yet
if ($check = search_check_php5()) {
require_once("{$CFG->dirroot}/search/indexlib.php");
-
+
$indexinfo = new IndexInfo();
-}
+}
if (!$site = get_site()) {
redirect("index.php");
-}
+}
$strsearch = get_string('search', 'search');
-$strquery = get_string('statistics', 'search');
+$strquery = get_string('statistics', 'search');
-print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
- "<a href=\"index.php\">$strsearch</a> -> $strquery");
+$navlinks = array();
+$navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc');
+$navlinks[] = array('name' => $strquery, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+print_header("$site->shortname: $strsearch: $strquery", "$site->fullname", $navigation);
//keep things pretty, even if php5 isn't available
if (!$check) {
$checkdbadvicestr = get_string('checkdbadvice', 'search');
$runindexerteststr = get_string('runindexertest', 'search');
$runindexerstr = get_string('runindexer', 'search');
-
+
$admin_table->tablealign = "center";
$admin_table->align = array ("right", "left");
$admin_table->wrap = array ("nowrap", "nowrap");
if ($indexinfo->time > 0) {
$admin_table->data[] = array(get_string('createdon', 'search'), date('r', $indexinfo->time));
- }
+ }
else {
$admin_table->data[] = array(get_string('createdon', 'search'), '-');
- }
+ }
if (!$indexinfo->valid($errors)) {
$admin_table->data[] = array("<strong>{$errorsstr}</strong>", ' ');
foreach ($errors as $key => $value) {
$admin_table->data[] = array($key.' ... ', $value);
- }
+ }
}
print_table($admin_table);
print_spacer(20);
print_heading($solutionsstr);
-
+
unset($admin_table->data);
if (isset($errors['dir'])) {
$admin_table->data[] = array($checkdirstr, $checkdiradvicestr);
- }
+ }
if (isset($errors['db'])) {
$admin_table->data[] = array($checkdbstr, $checkdbadvicestr);
- }
-
+ }
+
$admin_table->data[] = array($runindexerteststr, '<a href="tests/index.php" target="_blank">tests/index.php</a>');
$admin_table->data[] = array($runindexerstr, '<a href="indexersplash.php" target="_blank">indexersplash.php</a>');
-
+
print_table($admin_table);
print_spacer(20);
-}
+}
//this is the standard summary table for normal users, shows document counts
$table->tablealign = "center";
if (isadmin()) {
//don't want to confuse users if the two totals don't match (hint: they should)
$table->data[] = array($documentsinindexstr, $indexinfo->indexcount);
-
+
//*cough* they should match if deletions were actually removed from the index,
//as it turns out, they're only marked as deleted and not returned in search results
$table->data[] = array($deletionsinindexstr, (int)$indexinfo->indexcount - (int)$indexinfo->dbcount);
-}
+}
$table->data[] = array($documentsindatabasestr, $indexinfo->dbcount);
foreach($indexinfo->types as $key => $value) {
$table->data[] = array(get_string('documentsfor', 'search') . " '".get_string('modulenameplural', $key)."'", $value);
-}
+}
print_heading($databasestatestr);
print_table($table);
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
- print_header("$site->shortname: $strpreview", $site->fullname, "$strthemes -> $strpreview");
+ $navlinks = array();
+ $navlinks[] = array('name' => $strthemes, 'link' => null, 'type' => 'misc');
+ $navlinks[] = array('name' => $strpreview, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$site->shortname: $strpreview", $site->fullname, $navigation);
print_simple_box_start('center', '80%');
print_heading($preview);
-<?php // $Id$\r
-require_once("../config.php");\r
-require_once($CFG->dirroot .'/notes/lib.php');\r
-\r
-$id = required_param('id', PARAM_INT); // course id\r
-$users = optional_param('userid', array(), PARAM_INT); // array of user id\r
-$contents = optional_param('contents', array(), PARAM_RAW); // array of user notes\r
-$states = optional_param('states', array(), PARAM_ALPHA); // array of notes states\r
-if (! $course = get_record('course', 'id', $id)) {\r
- error("Course ID is incorrect");\r
-}\r
-\r
-$context = get_context_instance(CONTEXT_COURSE, $id);\r
-require_login($course->id);\r
-\r
-// to create notes the current user needs a capability\r
-require_capability('moodle/notes:manage', $context);\r
-\r
-if (!empty($users) && confirm_sesskey()) {\r
- if (count($users) != count($contents) || count($users) != count($states)) {\r
- error('Parameters malformation', $CFG->wwwroot.'/user/index.php?id='.$id);\r
- }\r
-\r
- $note = new object();\r
- $note->courseid = $id;\r
- $note->format = FORMAT_PLAIN;\r
- foreach ($users as $k => $v) {\r
- if(!$user = get_record('user', 'id', $v) || empty($contents[$k])) {\r
- continue;\r
- }\r
- $note->id = 0;\r
- $note->content = $contents[$k];\r
- $note->publishstate = $states[$k];\r
- $note->userid = $v;\r
- if (note_save($note)) {\r
- add_to_log($note->courseid, 'notes', 'add', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'add note');\r
- }\r
- }\r
- redirect("$CFG->wwwroot/user/index.php?id=$id");\r
-}\r
-\r
-/// Print headers\r
-\r
-$straddnote = get_string('addnewnote', 'notes');\r
-if ($course->id != SITEID) {\r
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,\r
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".\r
- $straddnote, "", "", true, " ", navmenu($course));\r
-} else {\r
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,\r
- $straddnote, "", "", true, " ", navmenu($course));\r
-}\r
-\r
-// this will contain all available the based On select options, but we'll disable some on them on a per user basis\r
-\r
-print_heading($straddnote);\r
-echo '<form method="post" action="addnote.php">';\r
-echo '<input type="hidden" name="id" value="'.$course->id.'" />';\r
-echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';\r
-$table->head = array (get_string('fullname'), \r
- get_string('content', 'notes') . helpbutton('writing', get_string('helpwriting'), 'moodle', true, false, '', true), \r
- get_string('publishstate', 'notes') . helpbutton('status', get_string('publishstate', 'notes'), 'notes', true, false, '', true), \r
- );\r
-$table->align = array ('left', 'center', 'center');\r
-$state_names = note_get_state_names();\r
-\r
-// the first time list hack\r
-if (empty($users)) {\r
- foreach ($_POST as $k => $v) {\r
- if (preg_match('/^user(\d+)$/',$k,$m)) {\r
- $users[] = $m[1];\r
- }\r
- }\r
-}\r
-\r
-foreach ($users as $k => $v) {\r
- if(!$user = get_record('user', 'id', $v)) {\r
- continue;\r
- }\r
- $checkbox = choose_from_menu($state_names, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], '', '', '0', true);\r
- $table->data[] = array(\r
- '<input type="hidden" name="userid['.$k.']" value="'.$v.'" />'. fullname($user, true),\r
- '<textarea name="contents['. $k . ']" rows="2" cols="40">' . strip_tags(@$contents[$k]) . '</textarea>',\r
- $checkbox\r
- );\r
-}\r
-print_table($table);\r
-echo '<div style="width:100%;text-align:center;"><input type="submit" value="' . get_string('savechanges'). '" /></div></form>';\r
-print_footer($course);\r
+<?php // $Id$
+require_once("../config.php");
+require_once($CFG->dirroot .'/notes/lib.php');
+
+$id = required_param('id', PARAM_INT); // course id
+$users = optional_param('userid', array(), PARAM_INT); // array of user id
+$contents = optional_param('contents', array(), PARAM_RAW); // array of user notes
+$states = optional_param('states', array(), PARAM_ALPHA); // array of notes states
+if (! $course = get_record('course', 'id', $id)) {
+ error("Course ID is incorrect");
+}
+
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_login($course->id);
+
+// to create notes the current user needs a capability
+require_capability('moodle/notes:manage', $context);
+
+if (!empty($users) && confirm_sesskey()) {
+ if (count($users) != count($contents) || count($users) != count($states)) {
+ error('Parameters malformation', $CFG->wwwroot.'/user/index.php?id='.$id);
+ }
+
+ $note = new object();
+ $note->courseid = $id;
+ $note->format = FORMAT_PLAIN;
+ foreach ($users as $k => $v) {
+ if(!$user = get_record('user', 'id', $v) || empty($contents[$k])) {
+ continue;
+ }
+ $note->id = 0;
+ $note->content = $contents[$k];
+ $note->publishstate = $states[$k];
+ $note->userid = $v;
+ if (note_save($note)) {
+ add_to_log($note->courseid, 'notes', 'add', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'add note');
+ }
+ }
+ redirect("$CFG->wwwroot/user/index.php?id=$id");
+}
+
+/// Print headers
+
+$straddnote = get_string('addnewnote', 'notes');
+
+$navlinks = array();
+$navlinks[] = array('name' => $straddnote, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+
+print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
+
+// this will contain all available the based On select options, but we'll disable some on them on a per user basis
+
+print_heading($straddnote);
+echo '<form method="post" action="addnote.php">';
+echo '<input type="hidden" name="id" value="'.$course->id.'" />';
+echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
+$table->head = array (get_string('fullname'),
+ get_string('content', 'notes') . helpbutton('writing', get_string('helpwriting'), 'moodle', true, false, '', true),
+ get_string('publishstate', 'notes') . helpbutton('status', get_string('publishstate', 'notes'), 'notes', true, false, '', true),
+ );
+$table->align = array ('left', 'center', 'center');
+$state_names = note_get_state_names();
+
+// the first time list hack
+if (empty($users)) {
+ foreach ($_POST as $k => $v) {
+ if (preg_match('/^user(\d+)$/',$k,$m)) {
+ $users[] = $m[1];
+ }
+ }
+}
+
+foreach ($users as $k => $v) {
+ if(!$user = get_record('user', 'id', $v)) {
+ continue;
+ }
+ $checkbox = choose_from_menu($state_names, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], '', '', '0', true);
+ $table->data[] = array(
+ '<input type="hidden" name="userid['.$k.']" value="'.$v.'" />'. fullname($user, true),
+ '<textarea name="contents['. $k . ']" rows="2" cols="40">' . strip_tags(@$contents[$k]) . '</textarea>',
+ $checkbox
+ );
+}
+print_table($table);
+echo '<div style="width:100%;text-align:center;"><input type="submit" value="' . get_string('savechanges'). '" /></div></form>';
+print_footer($course);
//Load custom profile fields data
profile_load_data($user);
-
+
//create form
$userform = new user_edit_form();
$userform->set_data($user);
//update preferences
useredit_update_user_preference($usernew);
-
+
//update interests
if (!empty($CFG->usetags)) {
useredit_update_interests($usernew, $usernew->interests);
}
-
+
//update user picture
if (!empty($CFG->gdversion) and empty($CFG->disableuserimages)) {
useredit_update_picture($usernew, $userform);
$streditmyprofile = get_string('editmyprofile');
$strparticipants = get_string('participants');
$userfullname = fullname($user, true);
- if ($course->id != SITEID) {
- print_header("$course->shortname: $streditmyprofile", "$course->fullname: $streditmyprofile",
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
- -> <a href=\"index.php?id=$course->id\">$strparticipants</a>
- -> <a href=\"view.php?id=$user->id&course=$course->id\">$userfullname</a>
- -> $streditmyprofile", "");
- } else {
- print_header("$course->shortname: $streditmyprofile", $course->fullname,
- "<a href=\"view.php?id=$user->id&course=$course->id\">$userfullname</a>
- -> $streditmyprofile", "");
- }
+
+ $navlinks = array();
+ $navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $userfullname,
+ 'link' => "view.php?id=$user->id&course=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $streditmyprofile, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $streditmyprofile", $course->fullname, $navigation, "");
+
/// Print tabs at the top
$showroles = 1;
$currenttab = 'editprofile';
}
}
}
-
- // MDL-9983
+
+ // MDL-9983
events_trigger('user_updated', $usernew);
}
$strparticipants = get_string('participants');
$strnewuser = get_string('newuser');
$userfullname = fullname($user, true);
- if ($course->id != SITEID) {
- print_header("$course->shortname: $streditmyprofile", "$course->fullname: $streditmyprofile",
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
- -> <a href=\"index.php?id=$course->id\">$strparticipants</a>
- -> <a href=\"view.php?id=$user->id&course=$course->id\">$userfullname</a>
- -> $streditmyprofile", "");
- } else {
- print_header("$course->shortname: $streditmyprofile", $course->fullname,
- "<a href=\"view.php?id=$user->id&course=$course->id\">$userfullname</a>
- -> $streditmyprofile", "");
- }
+
+ $navlinks = array();
+ $navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $userfullname,
+ 'link' => "view.php?id=$user->id&course=$course->id",
+ 'type' => 'misc');
+ $navlinks[] = array('name' => $streditmyprofile, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: $streditmyprofile", $course->fullname, $navigation, "");
+
/// Print tabs at the top
$showroles = 1;
$currenttab = 'editprofile';
}
foreach ($form->userid as $k => $v) {
- // find all roles this student have in this course
+ // find all roles this student have in this course
if ($students = get_records_sql("SELECT ra.id, ra.roleid, ra.timestart, ra.timeend
FROM {$CFG->prefix}role_assignments ra
WHERE userid = $v
}
break;
}
- }
+ }
role_assign($student->roleid, $v, 0, $context->id, $student->timestart, $student->timeend, 0);
}
}
/// Print headers
-if ($course->id != SITEID) {
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
- get_string('extendenrol'), "", "", true, " ", navmenu($course));
-} else {
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
- get_string('extendenrol'), "", "", true, " ", navmenu($course));
-}
+$navlinks = array();
+$navlinks[] = array('name' => get_string('extendenrol'), 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+
+print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');
$notavailable = get_string('notavailable');
foreach ($_POST as $k => $v) {
if (preg_match('/^user(\d+)$/',$k,$m)) {
-
- if (!($user = get_record_sql("SELECT * FROM {$CFG->prefix}user u
- INNER JOIN {$CFG->prefix}role_assignments ra ON u.id=ra.userid
+
+ if (!($user = get_record_sql("SELECT * FROM {$CFG->prefix}user u
+ INNER JOIN {$CFG->prefix}role_assignments ra ON u.id=ra.userid
WHERE u.id={$m[1]} AND ra.contextid = $context->id"))) {
continue;
}
echo "\n<div style=\"width:100%;text-align:center;\"><input type=\"submit\" value=\"".get_string('savechanges')."\" /></div>\n</form>\n";
print_footer($course);
-?>
\ No newline at end of file
+?>
-<?php // $Id$\r
-require_once("../config.php");\r
-require_once($CFG->dirroot .'/notes/lib.php');\r
-\r
-$id = required_param('id', PARAM_INT); // course id\r
-$users = optional_param('userid', array(), PARAM_INT); // array of user id\r
-$content = optional_param('content', '', PARAM_RAW); // note content\r
-$state = optional_param('state', '', PARAM_ALPHA); // note publish state\r
-\r
-if (! $course = get_record('course', 'id', $id)) {\r
- error("Course ID is incorrect");\r
-}\r
-\r
-$context = get_context_instance(CONTEXT_COURSE, $id);\r
-require_login($course->id);\r
-\r
-// to create notes the current user needs a capability\r
-require_capability('moodle/notes:manage', $context);\r
-\r
-if (!empty($users) && !empty($content) && confirm_sesskey()) {\r
- $note = new object();\r
- $note->courseid = $id;\r
- $note->format = FORMAT_PLAIN;\r
- $note->content = $content;\r
- $note->publishstate = $state;\r
- foreach ($users as $k => $v) {\r
- if(!$user = get_record('user', 'id', $v)) {\r
- continue;\r
- }\r
- $note->id = 0;\r
- $note->userid = $v;\r
- if (note_save($note)) {\r
- add_to_log($note->courseid, 'notes', 'add', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'add note');\r
- }\r
- }\r
- \r
- redirect("$CFG->wwwroot/user/index.php?id=$id");\r
-}\r
-\r
-/// Print headers\r
-\r
-$straddnote = get_string('groupaddnewnote', 'notes');\r
-if ($course->id != SITEID) {\r
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,\r
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".\r
- $straddnote, "", "", true, " ", navmenu($course));\r
-} else {\r
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,\r
- $straddnote, "", "", true, " ", navmenu($course));\r
-}\r
-\r
-// this will contain all available the based On select options, but we'll disable some on them on a per user basis\r
-\r
-print_heading($straddnote);\r
-echo '<form method="post" action="groupaddnote.php" >';\r
-echo '<div style="width:100%;text-align:center;">';\r
-echo '<input type="hidden" name="id" value="'.$course->id.'" />';\r
-echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';\r
-$state_names = note_get_state_names();\r
-\r
-// the first time list hack\r
-if (empty($users)) {\r
- foreach ($_POST as $k => $v) {\r
- if (preg_match('/^user(\d+)$/',$k,$m)) {\r
- $users[] = $m[1];\r
- }\r
- }\r
-}\r
-\r
-$strpublishstate = get_string('publishstate', 'notes');\r
-\r
-$userlist = array();\r
-foreach ($users as $k => $v) {\r
- if(!$user = get_record('user', 'id', $v)) {\r
- continue;\r
- }\r
- echo '<input type="hidden" name="userid['.$k.']" value="'.$v.'" />';\r
- $userlist[] = fullname($user, true);\r
-}\r
-echo '<p>';\r
-echo get_string('users'). ': ' . implode(', ', $userlist) . '.';\r
-echo '</p>';\r
-\r
-echo '<p>' . get_string('content', 'notes');\r
-helpbutton('writing', get_string('helpwriting'));\r
-echo '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>';\r
-\r
-echo '<p>' . $strpublishstate;\r
-helpbutton('status', $strpublishstate, 'notes');\r
-choose_from_menu($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, '');\r
-echo '</p>';\r
-\r
-echo '<input type="submit" value="' . get_string('savechanges'). '" /></div></form>';\r
-print_footer($course);\r
+<?php // $Id$
+require_once("../config.php");
+require_once($CFG->dirroot .'/notes/lib.php');
+
+$id = required_param('id', PARAM_INT); // course id
+$users = optional_param('userid', array(), PARAM_INT); // array of user id
+$content = optional_param('content', '', PARAM_RAW); // note content
+$state = optional_param('state', '', PARAM_ALPHA); // note publish state
+
+if (! $course = get_record('course', 'id', $id)) {
+ error("Course ID is incorrect");
+}
+
+$context = get_context_instance(CONTEXT_COURSE, $id);
+require_login($course->id);
+
+// to create notes the current user needs a capability
+require_capability('moodle/notes:manage', $context);
+
+if (!empty($users) && !empty($content) && confirm_sesskey()) {
+ $note = new object();
+ $note->courseid = $id;
+ $note->format = FORMAT_PLAIN;
+ $note->content = $content;
+ $note->publishstate = $state;
+ foreach ($users as $k => $v) {
+ if(!$user = get_record('user', 'id', $v)) {
+ continue;
+ }
+ $note->id = 0;
+ $note->userid = $v;
+ if (note_save($note)) {
+ add_to_log($note->courseid, 'notes', 'add', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'add note');
+ }
+ }
+
+ redirect("$CFG->wwwroot/user/index.php?id=$id");
+}
+
+/// Print headers
+
+$straddnote = get_string('groupaddnewnote', 'notes');
+
+$navlinks = array();
+$navlinks[] = array('name' => $straddnote, 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+
+print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
+
+// this will contain all available the based On select options, but we'll disable some on them on a per user basis
+
+print_heading($straddnote);
+echo '<form method="post" action="groupaddnote.php" >';
+echo '<div style="width:100%;text-align:center;">';
+echo '<input type="hidden" name="id" value="'.$course->id.'" />';
+echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
+$state_names = note_get_state_names();
+
+// the first time list hack
+if (empty($users)) {
+ foreach ($_POST as $k => $v) {
+ if (preg_match('/^user(\d+)$/',$k,$m)) {
+ $users[] = $m[1];
+ }
+ }
+}
+
+$strpublishstate = get_string('publishstate', 'notes');
+
+$userlist = array();
+foreach ($users as $k => $v) {
+ if(!$user = get_record('user', 'id', $v)) {
+ continue;
+ }
+ echo '<input type="hidden" name="userid['.$k.']" value="'.$v.'" />';
+ $userlist[] = fullname($user, true);
+}
+echo '<p>';
+echo get_string('users'). ': ' . implode(', ', $userlist) . '.';
+echo '</p>';
+
+echo '<p>' . get_string('content', 'notes');
+helpbutton('writing', get_string('helpwriting'));
+echo '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>';
+
+echo '<p>' . $strpublishstate;
+helpbutton('status', $strpublishstate, 'notes');
+choose_from_menu($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, '');
+echo '</p>';
+
+echo '<input type="submit" value="' . get_string('savechanges'). '" /></div></form>';
+print_footer($course);
if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
foreach ($form->userid as $k => $v) {
- // find all roles this student have in this course
+ // find all roles this student have in this course
if ($students = get_records_sql("SELECT ra.id, ra.roleid, ra.timestart, ra.timeend
FROM {$CFG->prefix}role_assignments ra
WHERE userid = $v
}
break;
}
- }
+ }
role_assign($student->roleid, $v, 0, $context->id, $student->timestart, $student->timeend, 0);
}
}
/// Print headers
-if ($course->id != SITEID) {
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
- get_string('extendenrol'), "", "", true, " ", navmenu($course));
-} else {
- print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
- get_string('extendenrol'), "", "", true, " ", navmenu($course));
-}
+$navlinks = array();
+$navlinks[] = array('name' => get_string('extendenrol'), 'link' => null, 'type' => 'misc');
+$navigation = build_navigation($navlinks);
+
+print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');
foreach ($_POST as $k => $v) {
if (preg_match('/^user(\d+)$/',$k,$m)) {
-
- if (!($user = get_record_sql("SELECT * FROM {$CFG->prefix}user u
- INNER JOIN {$CFG->prefix}role_assignments ra ON u.id=ra.userid
+
+ if (!($user = get_record_sql("SELECT * FROM {$CFG->prefix}user u
+ INNER JOIN {$CFG->prefix}role_assignments ra ON u.id=ra.userid
WHERE u.id={$m[1]} AND ra.contextid = $context->id"))) {
continue;
}
echo '</div></form>';
print_footer($course);
-?>
\ No newline at end of file
+?>
$avoidroles = array();
if ($roles = get_roles_used_in_context($context, true)) {
- // We should ONLY allow roles with moodle/course:view because otherwise we get little niggly issues
+ // We should ONLY allow roles with moodle/course:view because otherwise we get little niggly issues
// like MDL-8093
- // We should further exclude "admin" users (those with "doanything" at site level) because
+ // We should further exclude "admin" users (those with "doanything" at site level) because
// Otherwise they appear in every participant list
$canviewroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context);
}
// no roles to display yet?
- if (empty($rolenames)) {
+ if (empty($rolenames)) {
if (has_capability('moodle/user:assign', $context)) {
redirect($CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id);
} else {
$isseparategroups = ($course->groupmode == SEPARATEGROUPS and $course->groupmodeforce and
!has_capability('moodle/site:accessallgroups', $context));
- if ($isseparategroups and (!$currentgroup) ) {
- print_header("$course->shortname: ".get_string('participants'), $course->fullname,
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> ".
- get_string('participants'), "", "", true, " ", navmenu($course));
+ if ($isseparategroups and (!$currentgroup) ) {
+ $navlinks = array();
+ $navlinks[] = array('name' => get_string('participants'), 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$course->shortname: ".get_string('participants'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
print_heading(get_string("notingroup", "forum"));
print_footer($course);
exit;
/// Print headers
- if ($course->id != SITEID) {
- print_header("$course->shortname: ".get_string('participants'), $course->fullname,
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
- get_string('participants'), "", "", true, " ", navmenu($course));
- } else {
- print_header("$course->shortname: ".get_string('participants'), $course->fullname,
- get_string('participants'), "", "", true, " ", navmenu($course));
- }
-
+ $navlinks = array();
+ $navlinks[] = array('name' => get_string('participants'), 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$course->shortname: ".get_string('participants'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
/// setting up tags
if ($course->id == SITEID) {
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
-
+
$table->sortable(true, 'lastaccess', SORT_DESC);
$table->set_attribute('cellspacing', '0');
$from = "FROM {$CFG->prefix}user u INNER JOIN
{$CFG->prefix}role_assignments r on u.id=r.userid LEFT OUTER JOIN
- {$CFG->prefix}user_lastaccess ul on (r.userid=ul.userid and ul.courseid = $course->id)";
-
- $hiddensql = has_capability('moodle/role:viewhiddenassigns', $context)? '':' AND r.hidden = 0 ';
+ {$CFG->prefix}user_lastaccess ul on (r.userid=ul.userid and ul.courseid = $course->id)";
+
+ $hiddensql = has_capability('moodle/role:viewhiddenassigns', $context)? '':' AND r.hidden = 0 ';
// exclude users with roles we are avoiding
if ($avoidroles) {
} else {
$adminroles = '';
}
-
+
// join on 2 conditions
// otherwise we run into the problem of having records in ul table, but not relevant course
// and user record is not pulled out
if (!empty($userlist)) {
foreach ($userlist as $user) {
- if ($user->hidden) {
+ if ($user->hidden) {
// if the assignment is hidden, display icon
$hidden = "<img src=\"{$CFG->pixpath}/t/hide.gif\" alt=\"".get_string('hiddenassign')."\" class=\"hide-show-image\"/>";
} else {
- $hidden = '';
+ $hidden = '';
}
-
+
if ($user->lastaccess) {
$lastaccess = format_time(time() - $user->lastaccess, $datestring);
} else {
$country = $countries[$user->country];
}
}
-
+
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
-
+
if ($piclink = ($USER->id == $user->id || has_capability('moodle/user:viewdetails', $context) ||has_capability('moodle/user:viewdetails', $context))) {
$profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id.'">'.fullname($user).'</a></strong>';
} else {
- $profilelink = '<strong>'.fullname($user).'</strong>';
+ $profilelink = '<strong>'.fullname($user).'</strong>';
}
-
+
$data = array (
print_user_picture($user->id, $course->id, $user->picture, false, true, $piclink),
$profilelink);
}
$displaylist['extendenrol.php'] = get_string('extendenrol');
$displaylist['groupextendenrol.php'] = get_string('groupextendenrol');
-
+
helpbutton("participantswithselectedusers", get_string("withselectedusers"));
choose_from_menu ($displaylist, "formaction", "", get_string("withselectedusers"), "if(checksubmit(this.form))this.form.submit();", "");
echo '<input type="hidden" name="id" value="'.$course->id.'" />';
require_login();
require_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_COURSE, $id));
-
+
// fix for MDL-10112
if (empty($CFG->messaging)) {
- error("Messaging is disabled on this site");
+ error("Messaging is disabled on this site");
}
if (empty($SESSION->emailto)) {
$formstart = "";
}
- print_header($strtitle,$strtitle,"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> <a href=\"index.php?id=$course->id\">".get_string("participants")."</a> -> ".$strtitle,$formstart);
+ $navlinks = array();
+ $navlinks[] = array('name' => get_string('participants'), 'link' => "index.php?id=$course->id", 'type' => 'misc');
+ $navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header($strtitle,$strtitle,$navigation,$formstart);
if ($count) {
$strpolicyagreement = get_string('policyagreement');
$strpolicyagreementclick = get_string('policyagreementclick');
- print_header($strpolicyagreement, $SITE->fullname, $strpolicyagreement);
+ print_header($strpolicyagreement, $SITE->fullname, build_navigation(array(array('name'=>$strpolicyagreement, 'link'=>null, 'type'=>'misc'))));
print_heading($strpolicyagreement);
<?PHP // $Id$
// Display profile for a particular user
-
+
require_once("../config.php");
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/tag/lib.php');
-
+
$id = optional_param('id', 0, PARAM_INT); // user id
$course = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
$enable = optional_param('enable', ''); // enable email
}
$usercontext = get_context_instance(CONTEXT_USER, $user->id); // User context
$systemcontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
-
+
if (!empty($CFG->forcelogin) || $course->id != SITEID) {
// do not force parents to enrol
if (!get_record('role_assignments', 'userid', $USER->id, 'contextid', $usercontext->id)) {
require_login($course->id);
}
}
-
+
// make sure user can view this student's profile
- if ($USER->id != $user->id
- && !has_capability('moodle/user:viewdetails', $coursecontext)
+ if ($USER->id != $user->id
+ && !has_capability('moodle/user:viewdetails', $coursecontext)
&& !has_capability('moodle/user:viewdetails', $usercontext)) {
error('You can not view the profile of this user');
}
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext));
+ $navlinks = array();
+ $navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
+
/// If the user being shown is not ourselves, then make sure we are allowed to see them!
if (!$currentuser) {
if ($course->id == SITEID) { // Reduce possibility of "browsing" userbase at site level
- if ($CFG->forceloginforprofiles and !isteacherinanycourse() and !isteacherinanycourse($user->id) and !has_capability('moodle/user:viewdetails', $usercontext)) { // Teachers can browse and be browsed at site level. If not forceloginforprofiles, allow access (bug #4366)
- print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
- "<a href=\"index.php?id=$course->id\">$strparticipants</a> -> $struser",
- "", "", true, " ", navmenu($course));
+ if ($CFG->forceloginforprofiles and !isteacherinanycourse()
+ and !isteacherinanycourse($user->id)
+ and !has_capability('moodle/user:viewdetails', $usercontext)) { // Teachers can browse and be browsed at site level. If not forceloginforprofiles, allow access (bug #4366)
+
+ $navlinks[] = array('name' => $struser, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+
+ print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course));
print_heading(get_string('usernotavailable', 'error'));
print_footer($course);
exit;
} else { // Normal course
if (!has_capability('moodle/course:view', $coursecontext, $user->id, false)) {
if (has_capability('moodle/course:view', $coursecontext)) {
- print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"index.php?id=$course->id\">$strparticipants</a> -> $fullname",
- "", "", true, " ", navmenu($course));
+ $navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course));
print_heading(get_string('notenrolled', '', $fullname));
} else {
- print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"index.php?id=$course->id\">$strparticipants</a> -> $struser",
- "", "", true, " ", navmenu($course));
+ $navlinks[] = array('name' => $struser, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course));
print_heading(get_string('notenrolledprofile'));
}
print_continue($_SERVER['HTTP_REFERER']);
// If groups are in use, make sure we can see that group
if (groupmode($course) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $coursecontext)) {
require_login();
-
+
///this is changed because of mygroupid
$gtrue = (bool)groups_get_all_groups($course->id, $user->id);
if (!$gtrue) {
- print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"index.php?id=$course->id\">$strparticipants</a>",
- "", "", true, " ", navmenu($course));
+ $navigation = build_navigation($navlinks);
+ print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course));
error(get_string("groupnotamember"), "../course/view.php?id=$course->id");
}
}
}
-
+
/// We've established they can see the user's name at least, so what about the rest?
- if ($course->id != SITEID) {
- print_header("$strpersonalprofile: $fullname", "$strpersonalprofile: $fullname",
- "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"index.php?id=$course->id\">$strparticipants</a> -> $fullname",
- "", "", true, " ", navmenu($course));
- } else {
- print_header("$course->fullname: $strpersonalprofile: $fullname", $course->fullname,
- "$fullname", "", "", true, " ", navmenu($course));
- }
+ $navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc');
+
+ $navigation = build_navigation($navlinks);
+
+ print_header("$course->fullname: $strpersonalprofile: $fullname", $course->fullname,
+ $navigation, "", "", true, " ", navmenu($course));
if (($course->id != SITEID) and ! isguest() ) { // Need to have access to a course to see that info
if (is_mnet_remote_user($user)) {
$sql = "
- SELECT DISTINCT
- h.id,
+ SELECT DISTINCT
+ h.id,
h.name,
h.wwwroot,
a.name as application,
a.display_name
- FROM
+ FROM
{$CFG->prefix}mnet_host h,
{$CFG->prefix}mnet_application a
WHERE
h.name";
$remotehost = get_record_sql($sql);
-
+
echo '<p class="errorboxcontent">'.get_string('remote'.$remotehost->application.'user')." <br />\n";
if ($USER->id == $user->id) {
if ($remotehost->application =='moodle') {
}
if ($user->skype && !isset($hiddenfields['skypeid'])) {
- print_row(get_string('skypeid').':','<a href="callto:'.urlencode($user->skype).'">'.s($user->skype).
+ print_row(get_string('skypeid').':','<a href="callto:'.urlencode($user->skype).'">'.s($user->skype).
' <img src="http://mystatus.skype.com/smallicon/'.urlencode($user->skype).'" alt="'.get_string('status').'" '.
' /></a>');
}
print_row(get_string("lastaccess").":", $datestring);
}
/// printing roles
-
+
if ($rolestring = get_user_roles_in_context($id, $coursecontext->id)) {
print_row(get_string('roles').':', format_string($rolestring, false));
}
/// Printing Interests
if( !empty($CFG->usetags)) {
$interests = get_item_tags('user', $user->id);
-
+
$instereststr = tag_links_csv($interests);
-
+
if ($interests) {
print_row(get_string('interests').": ",rtrim($instereststr));
}
}
-/// End of Printing Interests
+/// End of Printing Interests
echo "</table>";
<?php // $Id$
// This simple script displays all the users with pictures on one page.
- // By default it is not linked anywhere on the site. If you want to
+ // By default it is not linked anywhere on the site. If you want to
// make it available you should link it in yourself from somewhere.
// Remember also to comment or delete the lines restricting access
// to administrators only (see below)
if (!$users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname")) {
error("no users!");
}
-
+
$title = get_string("users");
-
- print_header($title, $title, $title);
-
+
+ print_header($title, $title, build_navigation(array(array('name' => $title, 'link' => null, 'type' => 'misc'))));
+
foreach ($users as $user) {
$fullname = fullname($user);
echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=1\"".
}
echo "</a> \n";
}
-
+
print_footer();
?>
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
-
+
if (!$users = get_records("user", "picture", "1", "lastaccess DESC", "id,firstname,lastname")) {
error("no users!");
}
-
+
$title = get_string("users");
-
- print_header($title, $title, $title);
-
+
+ print_header($title, $title, build_navigation(array(array('name' => $title, 'link' => null, 'type' => 'misc'))));
+
foreach ($users as $user) {
upgrade_profile_image($user->id);
$fullname = fullname($user);
}
echo "</a> \n";
}
-
+
print_footer();
?>