MDL-10870 All files updated to new build_navigation() method. Most are untested, because they are not easily accessible within a moodle site.

This commit is contained in:
nicolasconnault
2007-08-17 19:09:11 +00:00
parent 45b68eef6c
commit 0be6f67819
59 changed files with 893 additions and 822 deletions
+3 -3
View File
@@ -29,7 +29,7 @@
}
add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
redirect("view.php?id=$course->id");
exit;
}
@@ -57,14 +57,14 @@
$strsummaryof = get_string('summaryof', '', " $sectionname $form->section");
}
print_header_simple($stredit, '', $stredit, 'theform.summary' );
print_header_simple($stredit, '', build_navigation(array(array('name' => $stredit, 'link' => null, 'type' => 'misc'))), 'theform.summary' );
print_heading($strsummaryof);
print_simple_box_start('center');
include('editsection.html');
print_simple_box_end();
if ($usehtmleditor) {
if ($usehtmleditor) {
use_html_editor("summary");
}
print_footer($course);
+9 -9
View File
@@ -1,6 +1,6 @@
<?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");
@@ -15,7 +15,7 @@
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');
}
@@ -32,14 +32,14 @@
print_error('loginasnoenrol', '', $CFG->wwwroot.'/course/view.php?id='.$USER->loginascontext->instanceid);
}
$enrol = enrolment_factory::factory($course->enrol); // do not use if (!$enrol... here, it can not work in PHP4 - see MDL-7529
$enrol = enrolment_factory::factory($course->enrol); // do not use if (!$enrol... here, it can not work in PHP4 - see MDL-7529
/// Refreshing all current role assignments for the current user
load_all_capabilities();
/// Double check just in case they are actually enrolled already and
/// thus got to this script by mistake. This might occur if enrolments
/// Double check just in case they are actually enrolled already and
/// thus got to this script by mistake. This might occur if enrolments
/// changed during this session or something
if (has_capability('moodle/course:view', $context) and !has_capability('moodle/legacy:guest', $context, NULL, false)) {
@@ -57,14 +57,14 @@
print_header_simple();
notice(get_string('coursenotaccessible'), "$CFG->wwwroot/index.php");
}
/// Users can't enroll to site course
if ($course->id == SITEID) {
print_header_simple();
notice(get_string('enrollfirst'), "$CFG->wwwroot/index.php");
}
/// Double check just in case they are enrolled to start in the future
/// Double check just in case they are enrolled to start in the future
if ($course->enrolperiod) { // Only active if the course has an enrolment period in effect
if ($roles = get_user_roles($context, $USER->id)) {
@@ -88,7 +88,7 @@
($course->enrollable == 2 && $course->enrolstartdate > 0 && $course->enrolstartdate > time()) ||
($course->enrollable == 2 && $course->enrolenddate > 0 && $course->enrolenddate <= time())
) {
print_header($course->shortname, $course->fullname, $course->shortname );
print_header($course->shortname, $course->fullname, build_navigation(array(array('name'=>$course->shortname,'link'=>'','type'=>'misc'))) );
notice(get_string('notenrollable'), "$CFG->wwwroot/index.php");
}
+4 -2
View File
@@ -31,9 +31,11 @@
}
$strimport = get_string('import');
$navlinks = array();
$navlinks[] = array('name' => $strimport, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport,
'<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');
+16 -9
View File
@@ -3,7 +3,7 @@
require_once('../../../config.php');
require_once('../../lib.php');
require_once($CFG->dirroot.'/backup/restorelib.php');
$id = required_param('id', PARAM_INT); // course id to import TO
$fromcourse = optional_param('fromcourse', 0, PARAM_INT);
$fromcoursesearch = optional_param('fromcoursesearch', '', PARAM_RAW);
@@ -16,7 +16,7 @@
error("That's an invalid course id");
}
if (!$site = get_site()){
if (!$site = get_site()){
error("Couldn't get site course");
}
@@ -45,7 +45,7 @@
$restore->restoreto = 1;
$restore->course_id = $id;
$restore->importing = 1; // magic variable so we know that we're importing rather than just restoring.
$SESSION->restore = $restore;
redirect($CFG->wwwroot.'/backup/restore.php?file='.$filename.'&id='.$fromcourse.'&to='.$id);
}
@@ -53,12 +53,19 @@
redirect($CFG->wwwroot.'/backup/backup.php?id='.$from->id.'&to='.$course->id);
}
}
print_header("$course->shortname: $strimportactivities", $course->fullname,
"<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();
?>
?>
+32 -26
View File
@@ -1,21 +1,21 @@
<?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.");
}
@@ -27,7 +27,7 @@
$strimportgroups = get_string("importgroups");
$csv_encode = '/\&\#44/';
if (isset($CFG->CSV_DELIMITER)) {
if (isset($CFG->CSV_DELIMITER)) {
$csv_delimiter = '\\' . $CFG->CSV_DELIMITER;
$csv_delimiter2 = $CFG->CSV_DELIMITER;
@@ -40,11 +40,17 @@
}
/// Print the header
$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,
"<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");
print_header("$course->shortname: $strimportgroups", $course->fullname, $navigation);
/// If a file has been uploaded, then process it
@@ -65,12 +71,12 @@
// make arrays of valid fields for error checking
$required = array("groupname" => 1, );
$optionalDefaults = array("lang" => 1, );
$optional = array("coursename" => 1,
$optional = array("coursename" => 1,
"idnumber" =>1,
"description" => 1,
"enrolmentkey" => 1,
"theme" => 1,
"picture" => 1,
"picture" => 1,
"hidepicture" => 1, );
// --- get header (field names) ---
@@ -78,8 +84,8 @@
// check for valid field names
foreach ($header as $i => $h) {
$h = trim($h); $header[$i] = $h; // remove whitespace
if ( !(isset($required[$h]) or
isset($optionalDefaults[$h]) or
if ( !(isset($required[$h]) or
isset($optionalDefaults[$h]) or
isset($optional[$h])) ) {
error(get_string('invalidfieldname', 'error', $h), 'index.php?id='.$id.'&amp;sesskey='.$USER->sesskey);
}
@@ -96,7 +102,7 @@
$linenum = 2; // since header is line 1
while (!feof ($fp)) {
$newgroup = new object();//to make Martin happy
foreach ($optionalDefaults as $key => $value) {
$newgroup->$key = current_language(); //defaults to current language
@@ -117,7 +123,7 @@
if (isset($required[$name]) and !$value) {
error(get_string('missingfield', 'error', $name). " ".
get_string('erroronline', 'error', $linenum) .". ".
get_string('processingstops', 'error'),
get_string('processingstops', 'error'),
'uploaduser.php?sesskey='.$USER->sesskey);
}
else if ($name == "groupname") {
@@ -129,7 +135,7 @@
}
}
///Find the courseid of the course with the given shortname
//if idnumber is set, we use that.
//unset invalid courseid
if (isset($newgroup->idnumber)){
@@ -137,23 +143,23 @@
notify(get_string('unknowncourseidnumber', 'error', $newgroup->idnumber));
unset($newgroup->courseid);//unset so 0 doesnt' get written to database
}
$newgroup->courseid = $mycourse->id;
$newgroup->courseid = $mycourse->id;
}
//else use course short name to look up
//unset invalid coursename (if no id)
else if (isset($newgroup->coursename)){
if (!$mycourse = get_record('course', 'shortname',$newgroup->coursename)){
notify(get_string('unknowncourse', 'error', $newgroup->coursename));
unset($newgroup->courseid);//unset so 0 doesnt' get written to database
}
$newgroup->courseid = $mycourse->id;
$newgroup->courseid = $mycourse->id;
}
//else juse use current id
else{
$newgroup->courseid = $id;
}
//if courseid is set
if (isset($newgroup->courseid)){
@@ -162,22 +168,22 @@
$linenum++;
$groupname = $newgroup->name;
$newgrpcoursecontext = get_context_instance(CONTEXT_COURSE, $newgroup->courseid);
///Users cannot upload groups in courses they cannot update.
if (!has_capability('moodle/course:managegroups', $newgrpcoursecontext)){
notify(get_string('nopermissionforcreation','group',$groupname));
} else {
if ( $groupid = groups_get_group_by_name($newgroup->courseid, $groupname) || !($newgroup->id = groups_create_group($newgroup)) ) {
//Record not added - probably because group is already registered
//In this case, output groupname from previous registration
if ($groupid) {
notify("$groupname :".get_string('groupexistforcourse', 'error', $groupname));
} else {
notify(get_string('groupnotaddederror', 'error', $groupname));
}
}
}
}
else {
notify(get_string('groupaddedsuccesfully', 'group', $groupname));
}
+1 -2
View File
@@ -45,8 +45,7 @@
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
+31 -30
View File
@@ -15,7 +15,7 @@
$moveto = optional_param('moveto',-1,PARAM_INT);
$moveup = optional_param('moveup',0,PARAM_INT);
$movedown = optional_param('movedown',0,PARAM_INT);
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
if (!$site = get_site()) {
@@ -71,17 +71,18 @@
if ($countcategories > 1 || ($countcategories == 1 && count_records('course') > 200)) {
$strcourses = get_string('courses');
$strcategories = get_string('categories');
print_header("$site->shortname: $strcategories", $strcourses,
print_header("$site->shortname: $strcategories", build_navigation(array(array('name'=>$strcourses,'link'=>'','type'=>'misc'))),
$strcategories, '', '', true, update_categories_button());
print_heading($strcategories);
print_box_start('categorybox');
print_category_create_form();
print_category_create_form();
print_whole_category_list();
print_box_end();
print_course_search();
} else {
$strfulllistofcourses = get_string('fulllistofcourses');
print_header("$site->shortname: $strfulllistofcourses", $strfulllistofcourses, $strfulllistofcourses,
print_header("$site->shortname: $strfulllistofcourses", $strfulllistofcourses,
build_navigation(array(array('name'=>$strfulllistofcourses, 'link'=>'','type'=>'misc'))),
'', '', true, update_categories_button());
print_box_start('courseboxes');
print_category_create_form();
@@ -89,7 +90,7 @@
print_box_end();
}
/// I am not sure this context in the next has_capability call is correct.
/// I am not sure this context in the next has_capability call is correct.
if (isloggedin() and !isguest() and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $CFG->enablecourserequests) { // Print link to request a new course
print_single_button('request.php', NULL, get_string('courserequest'), 'get');
}
@@ -108,24 +109,24 @@
/// From now on is all the admin/course creator functions
/// Print headings
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('coursemgmt');
admin_externalpage_setup('coursemgmt');
admin_externalpage_print_header();
} else {
print_header("$site->shortname: $strcategories", $strcourses,
$strcategories, '', '', true, update_categories_button());
}
print_header("$site->shortname: $strcategories", build_navigation(array(array('name'=>$strcourses,'link'=>'','type'=>'misc'))),
$strcategories, '', '', true, update_categories_button());
}
print_heading($strcategories);
/// Delete a category if necessary
if (!empty($delete) and confirm_sesskey()) {
// context is coursecat, if not present admins should have it set in site level
$context = get_context_instance(CONTEXT_COURSECAT, $delete);
$context = get_context_instance(CONTEXT_COURSECAT, $delete);
if ($deletecat = get_record('course_categories', 'id', $delete) and has_capability('moodle/category:delete', $context)) {
if (!empty($sure) && $sure == md5($deletecat->timemodified)) {
/// Send the children categories to live with their grandparent
@@ -136,8 +137,8 @@
}
}
}
/// If the grandparent is a valid (non-zero) category, then
/// If the grandparent is a valid (non-zero) category, then
/// send the children courses to live with their grandparent as well
if ($deletecat->parent) {
if ($childcourses = get_records('course', 'category', $deletecat->id)) {
@@ -148,13 +149,13 @@
}
}
}
/// Finally delete the category itself
if (delete_records('course_categories', 'id', $deletecat->id)) {
notify(get_string('categorydeleted', '', format_string($deletecat->name)));
// MLD-9983
events_trigger('category_deleted', $deletecat);
}
}
}
else {
$strdeletecategorycheck = get_string('deletecategorycheck','', format_string($deletecat->name));
@@ -162,7 +163,7 @@
"index.php?delete=$delete&amp;sure=".md5($deletecat->timemodified)."&amp;sesskey=$USER->sesskey",
"index.php?sesskey=$USER->sesskey");
print_footer();
print_footer();
exit();
}
}
@@ -188,14 +189,14 @@
if (! set_field('course_categories', 'parent', $moveto, 'id', $tempcat->id)) {
notify('Could not update that category!');
} else {
rebuild_context_rel(get_context_instance(CONTEXT_COURSECAT, $move));
}
rebuild_context_rel(get_context_instance(CONTEXT_COURSECAT, $move));
}
}
}
}
/// Hide or show a category
/// Hide or show a category
if ((!empty($hide) or !empty($show)) and confirm_sesskey()) {
if (!empty($hide)) {
$tempcat = get_record('course_categories', 'id', $hide);
@@ -218,7 +219,7 @@
/// Move a category up or down
if ((!empty($moveup) or !empty($movedown)) and confirm_sesskey()) {
$swapcategory = NULL;
$movecategory = NULL;
@@ -283,11 +284,11 @@
}
}
}
fix_course_sortorder();
/// Print form for creating new categories
if (has_capability('moodle/category:create', get_context_instance(CONTEXT_SYSTEM))) {
$mform->display();
}
@@ -323,7 +324,7 @@
$options['category'] = $category->id;
print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
}
if (has_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM, SITEID)) and !empty($CFG->enablecourserequests)) {
print_single_button('pending.php',NULL, get_string('coursespending'), 'get');
}
@@ -341,7 +342,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
global $CFG, $USER;
static $str = '';
if (empty($str)) {
$str->delete = get_string('delete');
$str->moveup = get_string('moveup');
@@ -350,11 +351,11 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
$str->hide = get_string('hide');
$str->show = get_string('show');
}
if ($category) {
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
echo '<tr><td align="left" class="name">';
for ($i=0; $i<$depth;$i++) {
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@@ -373,7 +374,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
echo '<a title="'.$str->delete.'" href="index.php?delete='.$category->id.'&amp;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.'&amp;sesskey='.sesskey().'"><img'.
@@ -423,7 +424,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
$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);
}
}
}
+4 -3
View File
@@ -11,7 +11,7 @@
if (!confirm_sesskey()) {
print_error('confirmsesskeybad');
}
$USER = get_complete_user_data('id', $USER->realuser);
load_all_capabilities(); // load all this user's normal capabilities
@@ -40,7 +40,7 @@
if (!confirm_sesskey()) {
print_error('confirmsesskeybad');
}
if (! $course = get_record('course', 'id', $id)) {
error("Course ID was incorrect");
}
@@ -97,7 +97,8 @@
$strloginas = get_string('loginas');
$strloggedinas = get_string('loggedinas', '', $newfullname);
print_header_simple($strloggedinas, '', $strloggedinas, '', '', true, '&nbsp;', navmenu($course));
print_header_simple($strloggedinas, '', build_navigation(array(array('name'=>$strloggedinas, 'link'=>'','type'=>'misc'))),
'', '', true, '&nbsp;', navmenu($course));
notice($strloggedinas, "$CFG->wwwroot/course/view.php?id=$course->id");
+4 -4
View File
@@ -477,7 +477,7 @@
$CFG->pagepath = 'mod/'.$module->name.'/delete';
print_header_simple($strdeletecheck, '', $strdeletecheck);
print_header_simple($strdeletecheck, '', build_navigation(array(array('name'=>$strdeletecheck,'link'=>'','type'=>'misc'))));
print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
print_heading($strdeletecheckfull);
@@ -646,7 +646,7 @@
} else {
$pageheading = get_string("addinganew", "moodle", $fullmodulename);
}
$CFG->pagepath = 'mod/'.$module->name;
if (!empty($type)) {
$CFG->pagepath .= '/' . $type;
@@ -671,12 +671,12 @@
} else {
$focuscursor = "form.name";
}
$navlinks = array();
$navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
$navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'action');
$navigation = build_navigation($navlinks);
print_header_simple($streditinga, '', $navigation, $focuscursor, "", false);
if (!empty($cm->id)) {
+5 -5
View File
@@ -3,7 +3,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/pagelib.php');
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->libdir.'/blocklib.php');
require_once('lib.php');
require_login();
@@ -69,12 +69,12 @@
}
}
}
$strtitle = get_string('coursespending');
$strheading = get_string(((!empty($reject)) ? 'coursereject' : 'coursespending'));
print_header($strtitle,$strheading,$strheading);
print_header($strtitle,$strheading,build_navigation(array(array('name'=>$strheading,'link'=>'','type'=>'misc'))));
if (!empty($reject) and confirm_sesskey()) {
if ($reject = get_record("course_request","id",$reject)) {
if (empty($rejectnotice)) {
@@ -107,7 +107,7 @@
$collision = 1;
}
//do not output raw html from request, quote html entities using s()!!
$table->data[] = array(((!empty($course->password)) ?
$table->data[] = array(((!empty($course->password)) ?
'<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),
+8 -17
View File
@@ -28,7 +28,7 @@
$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");
@@ -43,14 +43,10 @@
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;
@@ -67,14 +63,9 @@
}
}
}
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)));
+5 -3
View File
@@ -15,8 +15,10 @@
$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');
@@ -29,6 +31,6 @@
echo '</div>';
}
}
print_footer();
?>
+19 -16
View File
@@ -7,9 +7,9 @@
require_once($CFG->libdir.'/adminlib.php');
$id = optional_param('id', 0, PARAM_INT);// Course ID
$host_course = optional_param('host_course', '', PARAM_PATH);// Course ID
if (empty($host_course)) {
$hostid = $CFG->mnet_localhost_id;
if (empty($id)) {
@@ -19,7 +19,7 @@
} else {
list($hostid, $id) = explode('/', $host_course);
}
$group = optional_param('group', -1, PARAM_INT); // Group to display
$user = optional_param('user', 0, PARAM_INT); // User to display
$date = optional_param('date', 0, PARAM_FILE); // Date to display - number or some string
@@ -27,7 +27,7 @@
$modid = optional_param('modid', 0, PARAM_FILE); // number or 'site_errors'
$modaction = optional_param('modaction', '', PARAM_PATH); // an action as recorded in the logs
$page = optional_param('page', '0', PARAM_INT); // which page to show
$perpage = optional_param('perpage', '100', PARAM_INT); // how many per page
$perpage = optional_param('perpage', '100', PARAM_INT); // how many per page
$showcourses = optional_param('showcourses', 0, PARAM_INT); // whether to show courses if we're over our limit.
$showusers = optional_param('showusers', 0, PARAM_INT); // whether to show users if we're over our limit.
$chooselog = optional_param('chooselog', 0, PARAM_INT);
@@ -50,7 +50,7 @@
require_capability('moodle/site:viewreports', $context);
add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id);
add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id);
$strlogs = get_string('logs');
$stradministration = get_string('administration');
@@ -58,6 +58,8 @@
session_write_close();
$navlinks = array();
if (!empty($chooselog)) {
$userinfo = get_string('allparticipants');
$dateinfo = get_string('alldays');
@@ -79,18 +81,19 @@
admin_externalpage_print_header();
} else {
print_header($course->shortname .': '. $strlogs, $course->fullname,
"<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&amp;chooselog=1&amp;user=$user&amp;date=$date&amp;modid=$modid&amp;modaction=$modaction&amp;group=$group",
print_log($course, $user, $date, 'l.time DESC', $page, $perpage,
"index.php?id=$course->id&amp;chooselog=1&amp;user=$user&amp;date=$date&amp;modid=$modid&amp;modaction=$modaction&amp;group=$group",
$modname, $modid, $modaction, $group);
} else {
print_mnet_log($hostid, $id, $user, $date, 'l.time DESC', $page, $perpage, "", $modname, $modid, $modaction, $group);
@@ -125,10 +128,10 @@
admin_externalpage_setup('reportlog');
admin_externalpage_print_header();
} else {
print_header($course->shortname .': '. $strlogs, $course->fullname,
"<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') .':');
+7 -5
View File
@@ -19,7 +19,7 @@
require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->id);
add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->id);
$stractivityreport = get_string("activityreport");
$strparticipants = get_string("participants");
@@ -29,10 +29,12 @@
$strtodaylogs = get_string("todaylogs");
$strreports = get_string("reports");
print_header("$course->shortname: $stractivityreport", $course->fullname,
"<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));
+35 -39
View File
@@ -2,10 +2,10 @@
require_once('../../../config.php');
require_once($CFG->libdir.'/statslib.php');
define('DEFAULT_PAGE_SIZE', 20);
define('SHOW_ALL_PAGE_SIZE', 5000);
$id = required_param('id', PARAM_INT); // course id.
$moduleid = optional_param('moduleid', 0, PARAM_INT); // module id.
$oldmod = optional_param('oldmod', 0, PARAM_INT);
@@ -16,7 +16,7 @@
$page = optional_param('page', 0, PARAM_INT); // which page to show
$perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT); // how many per page
if ($action != 'view' && $action != 'post') {
if ($action != 'view' && $action != 'post') {
$action = ''; // default to all (don't restrict)
}
@@ -35,14 +35,14 @@
require_login($course->id);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (!has_capability('moodle/site:viewreports', $context)) {
print_error('mustbeteacher', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->id);
add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->id);
$strparticipation = get_string('participationreport');
$strviews = get_string('views');
$strposts = get_string('posts');
@@ -51,15 +51,11 @@
$strallactions = get_string('allactions');
$strreports = get_string('reports');
$strnav = "<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',
@@ -96,7 +92,7 @@
$timeoptions[strtotime('-'.$i.' weeks',$now)] = get_string('numweeks','moodle',$i);
}
}
// months
// months
for ($i = 2; $i < 12; $i++) {
if (strtotime('-'.$i.' months',$now) >= $minlog) {
$timeoptions[strtotime('-'.$i.' months',$now)] = get_string('nummonths','moodle',$i);
@@ -121,8 +117,8 @@
'view' => $strview,
'post' => $strpost,
);
// print first controls.
echo '<form class="participationselectform" action="index.php" method="get"><div>'."\n".
'<input type="hidden" name="id" value="'.$course->id.'" />'."\n".
@@ -144,7 +140,7 @@
print_footer();
exit;
}
$baseurl = $CFG->wwwroot.'/course/report/participation/index.php?id='.$course->id.'&amp;roleid='
.$roleid.'&amp;instanceid='.$instanceid.'&amp;timefrom='.$timefrom.'&amp;moduleid='
.$moduleid.'&amp;action='.$action.'&amp;perpage='.$perpage;
@@ -170,13 +166,13 @@
if (!$instances = get_all_instances_in_course($module->name,$course)) {
error(get_string('noinstances','error',$modulename));
}
$instanceoptions = array();
foreach ($instances as $instance) {
$instanceoptions[$instance->id] = $instance->name;
}
if (count($instanceoptions) == 1) { // just display it if there's only one.
$instanceid = array_pop(array_keys($instanceoptions));
}
@@ -193,7 +189,7 @@
echo '<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');
@@ -211,7 +207,7 @@
$table->set_attribute('class', 'generaltable generalbox reporttable');
$table->sortable(true,'lastname','ASC');
$table->set_control_variables(array(
TABLE_VAR_SORT => 'ssort',
TABLE_VAR_HIDE => 'shide',
@@ -221,7 +217,7 @@
TABLE_VAR_PAGE => 'spage'
));
$table->setup();
$primary_roles = sql_primary_role_subselect(); // In dmllib.php
$sql = 'SELECT DISTINCT prs.userid, u.firstname,u.lastname,u.idnumber,count(l.action) as count FROM ('.$primary_roles.') prs'
@@ -237,14 +233,14 @@
break;
default:
// some modules have stuff we want to hide, ie mail blocked etc so do actually need to limit here.
$sql .= ' AND action IN (\''.implode('\',\'',array_merge($viewnames,$postnames)).'\' )';
$sql .= ' AND action IN (\''.implode('\',\'',array_merge($viewnames,$postnames)).'\' )';
}
$sql .= ' WHERE prs.courseid = '.$course->id.' AND prs.primary_roleid = '.$roleid.' AND prs.contextlevel = '.CONTEXT_COURSE.' AND prs.courseid = '.$course->id;
if ($table->get_sql_where()) {
$sql .= ' AND '.$table->get_sql_where(); //initial bar
$sql .= ' AND '.$table->get_sql_where(); //initial bar
}
$sql .= ' GROUP BY prs.userid,u.firstname,u.lastname,u.idnumber,l.userid';
@@ -254,9 +250,9 @@
}
$countsql = 'SELECT COUNT(DISTINCT(prs.userid)) FROM ('.$primary_roles.') prs '
.' JOIN '.$CFG->prefix.'user u ON u.id = prs.userid WHERE prs.courseid = '.$course->id
.' JOIN '.$CFG->prefix.'user u ON u.id = prs.userid WHERE prs.courseid = '.$course->id
.' AND prs.primary_roleid = '.$roleid.' AND prs.contextlevel = '.CONTEXT_COURSE;
$totalcount = count_records_sql($countsql);
if ($table->get_sql_where()) {
@@ -264,11 +260,11 @@
} else {
$matchcount = $totalcount;
}
echo '<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);
@@ -277,14 +273,14 @@
}
$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">
@@ -346,7 +342,7 @@ function checknos() {
else if ($matchcount > 0 && $perpage < $matchcount) {
echo '<div id="showall"><a href="'.$baseurl.'&amp;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) {
@@ -361,7 +357,7 @@ function checknos() {
echo '</div>'."\n";
}
print_footer();
?>
+12 -12
View File
@@ -40,30 +40,30 @@
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, '&nbsp;', $menu);
print_header("$course->shortname: $strstats", $course->fullname,
$crumb, '', '', true, '&nbsp;', $menu);
require_once($CFG->dirroot.'/course/report/stats/report.php');
print_footer();
?>
+5 -1
View File
@@ -18,7 +18,11 @@
$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');
+16 -13
View File
@@ -1,10 +1,10 @@
<?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');
@@ -23,9 +23,12 @@ The feature will also reset the start date of the course if necessary.
$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);
@@ -38,8 +41,8 @@ The feature will also reset the start date of the course if necessary.
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');
}
@@ -67,7 +70,7 @@ The feature will also reset the start date of the course if necessary.
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>';
@@ -78,7 +81,7 @@ The feature will also reset the start date of the course if necessary.
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)) {
@@ -92,12 +95,12 @@ The feature will also reset the start date of the course if necessary.
} 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);
+23 -19
View File
@@ -41,7 +41,7 @@
// modes, set page to 0.
$page = 0;
}
}
}
/// Editing functions
@@ -86,8 +86,12 @@
$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 />";
@@ -102,12 +106,12 @@
}
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));
@@ -159,7 +163,7 @@
$totalcount = count($courses);
}
else {
$courses = get_courses_search($searchterms, "fullname ASC",
$courses = get_courses_search($searchterms, "fullname ASC",
$page*$perpage, $perpage, $totalcount);
}
@@ -168,9 +172,9 @@
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);
@@ -187,7 +191,7 @@
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);
@@ -232,11 +236,11 @@
}
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)) {
@@ -244,11 +248,11 @@
} 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".
@@ -259,13 +263,13 @@
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)) {
@@ -276,14 +280,14 @@
echo "<a title=\"".get_string("show")."\" href=\"search.php?search=$encodedsearch&amp;perpage=$perpage&amp;page=$page&amp;show=$course->id&amp;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&amp;wdir=/backupdata\">\n<img".
+9 -7
View File
@@ -1,10 +1,10 @@
<?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");
@@ -59,20 +59,22 @@
$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&amp;user=$user->id&amp;confirm=yes&amp;sesskey=".sesskey(),
notice_yesno($strunenrolsure, "unenrol.php?id=$id&amp;user=$user->id&amp;confirm=yes&amp;sesskey=".sesskey(),
$_SERVER['HTTP_REFERER']);
} else {
$strunenrolsure = get_string('unenrolsure', '', get_string("yourself"));
notice_yesno($strunenrolsure, "unenrol.php?id=$id&amp;confirm=yes&amp;sesskey=".sesskey(),
notice_yesno($strunenrolsure, "unenrol.php?id=$id&amp;confirm=yes&amp;sesskey=".sesskey(),
$_SERVER['HTTP_REFERER']);
}
+23 -23
View File
@@ -31,7 +31,7 @@
error("You are not allowed to look at this page");
}
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&amp;user=$user->id&amp;mode=$mode", "$user->id");
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&amp;user=$user->id&amp;mode=$mode", "$user->id");
$stractivityreport = get_string("activityreport");
$strparticipants = get_string("participants");
@@ -42,18 +42,18 @@
$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&amp;course=$course->id\">$fullname</a> ->
$stractivityreport -> $strmode");
} else {
print_header("$course->shortname: $stractivityreport ($mode)", $course->fullname,
"<a href=\"../user/view.php?id=$user->id&amp;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&amp;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:
@@ -90,12 +90,12 @@
// 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&amp;user=$user->id&amp;mode=$mode");
break;
@@ -103,7 +103,7 @@
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&amp;user=$user->id&amp;mode=$mode");
break;
case 'stats':
@@ -122,24 +122,24 @@
$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;
@@ -155,7 +155,7 @@
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>';
@@ -202,7 +202,7 @@
default: print_string("section"); break;
}
echo " $i</h2>";
echo '<div class="content">';
if ($mode == "outline") {
@@ -215,7 +215,7 @@
continue;
}
$mod = $mods[$sectionmod];
if (empty($mod->visible)) {
continue;
}
@@ -242,7 +242,7 @@
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>";
@@ -251,7 +251,7 @@
$output = ob_get_contents();
ob_end_clean();
if (str_replace(' ', '', $output) != '<ul></ul>') {
echo $output;
}
@@ -260,7 +260,7 @@
}
}
}
if ($mode == "outline") {
echo "</table>";
}
+6 -3
View File
@@ -54,9 +54,12 @@ class enrolment_plugin_authorize
$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) {
+5 -1
View File
@@ -31,7 +31,11 @@
/// 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)) {
+5 -1
View File
@@ -12,7 +12,11 @@
/// 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
+8 -5
View File
@@ -9,10 +9,13 @@ if (!$site = get_site()) {
/// 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');
@@ -20,7 +23,7 @@ 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);
@@ -29,4 +32,4 @@ $enrol->cron();
print_footer();
exit;
?>
?>
+27 -22
View File
@@ -40,8 +40,8 @@ var $errormsg;
* 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
@@ -54,7 +54,12 @@ function print_entry($course) {
/// 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
@@ -63,9 +68,9 @@ function print_entry($course) {
} 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&amp;confirm=1",
notice_yesno(get_string('enrolmentconfirmation'), "enrol.php?id=$course->id&amp;confirm=1",
"enrol.php?id=$course->id&amp;cancel=1");
print_footer();
exit;
@@ -103,7 +108,7 @@ function print_entry($course) {
$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%");
@@ -118,7 +123,7 @@ function print_entry($course) {
/**
* 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
@@ -194,7 +199,7 @@ function check_group_entry ($courseid, $password) {
/**
* 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
@@ -204,8 +209,8 @@ function config_form($frm) {
if (!isset( $frm->enrol_manual_keyholderrole )) {
$frm->enrol_manual_keyholderrole = '';
}
}
include ("$CFG->dirroot/enrol/manual/config.html");
}
@@ -230,9 +235,9 @@ function process_config($config) {
/**
* 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
*
@@ -245,8 +250,8 @@ function cron() {
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();
@@ -269,8 +274,8 @@ function cron() {
}
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.'
@@ -292,7 +297,7 @@ function cron() {
} 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);
}
}
@@ -304,7 +309,7 @@ function cron() {
$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) {
@@ -358,7 +363,7 @@ function print_enrolmentkeyfrom($course) {
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)
@@ -377,14 +382,14 @@ function print_enrolmentkeyfrom($course) {
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)) {
+5 -2
View File
@@ -29,9 +29,12 @@ function print_entry($course) {
$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
+8 -6
View File
@@ -90,15 +90,17 @@ if ($potentialmembers) {
// 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">
+8 -6
View File
@@ -118,15 +118,17 @@ if ($potentialmemberscount <= MAX_USERS_PER_PAGE) {
// 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">
+10 -5
View File
@@ -60,7 +60,8 @@ function upgrade_plugins($type, $dir, $return) {
$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, '&nbsp;', '&nbsp;');
}
upgrade_log_start();
@@ -82,7 +83,8 @@ function upgrade_plugins($type, $dir, $return) {
// 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, '&nbsp;', '&nbsp;');
}
$updated_plugins = true;
@@ -245,7 +247,8 @@ function upgrade_activity_modules($return) {
$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, '&nbsp;', '&nbsp;');
}
upgrade_log_start();
@@ -270,7 +273,8 @@ function upgrade_activity_modules($return) {
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, '&nbsp;', '&nbsp;');
}
upgrade_log_start();
@@ -330,7 +334,8 @@ function upgrade_activity_modules($return) {
} 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, '&nbsp;', '&nbsp;');
}
upgrade_log_start();
+12 -8
View File
@@ -16,7 +16,7 @@ define('BLOCKS_PINNED_FALSE',1);
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) {
@@ -360,8 +360,8 @@ function blocks_print_group(&$page, &$pageblocks, $position) {
$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);
@@ -522,7 +522,7 @@ function blocks_execute_action($page, &$pageblocks, $blockaction, $instanceorid,
$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>';
@@ -1042,7 +1042,8 @@ function upgrade_blocks_db($continueto) {
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, '&nbsp;', '&nbsp;');
upgrade_log_start();
@@ -1088,7 +1089,8 @@ function upgrade_blocks_db($continueto) {
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');
@@ -1253,7 +1255,8 @@ function upgrade_blocks_plugins($continueto) {
} 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, '&nbsp;', '&nbsp;');
}
$updated_blocks = true;
@@ -1331,7 +1334,8 @@ function upgrade_blocks_plugins($continueto) {
}
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, '&nbsp;', '&nbsp;');
}
$updated_blocks = true;
+35 -34
View File
@@ -1,61 +1,61 @@
<?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.
@@ -63,20 +63,20 @@
/**
* 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;
@@ -88,10 +88,11 @@ function upgrade_local_db($continueto) {
$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');
@@ -120,10 +121,10 @@ function upgrade_local_db($continueto) {
}
/**
* 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
+3 -1
View File
@@ -1780,7 +1780,9 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
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 {
+15 -15
View File
@@ -5,6 +5,8 @@
$id = optional_param('id', SITEID, PARAM_INT); // current course
$strparticipants = get_string('participants');
//HTTPS is potentially required in this page
httpsrequired();
@@ -55,6 +57,9 @@
$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.'&amp;course='.$course->id);
} else if ($data = $mform->get_data()) {
@@ -78,14 +83,13 @@
$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&amp;course=$course->id\">$fullname</a> -> $strpasswordchanged";
$navlinks[] = array('name' => $fullname,
'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&amp;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&amp;course=$id";
@@ -104,15 +108,11 @@
$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&amp;course=$course->id\">$fullname</a> -> $strchangepassword";
$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&amp;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'));
}
+2 -2
View File
@@ -31,7 +31,7 @@
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";
@@ -56,7 +56,7 @@
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";
+9 -12
View File
@@ -18,6 +18,9 @@ $systemcontext = get_context_instance(CONTEXT_SYSTEM);
$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);
@@ -31,10 +34,8 @@ if ($p_secret !== false) {
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)) {
@@ -67,13 +68,11 @@ if ($p_secret !== false) {
$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'));
}
@@ -125,8 +124,7 @@ if ($mform->is_cancelled()) {
}
}
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
@@ -144,12 +142,11 @@ if ($mform->is_cancelled()) {
/// 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();
?>
?>
+2 -1
View File
@@ -10,8 +10,9 @@ $sesskey = sesskey();
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)) {
+7 -2
View File
@@ -42,10 +42,15 @@
$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();
?>
?>
+7 -12
View File
@@ -48,18 +48,13 @@
$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, "&nbsp;", "&nbsp;");
} else {
print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname,
"$strglossaries -> $strsearch", "", "", true, "&nbsp;", "&nbsp;");
}
$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, "&nbsp;", "&nbsp;");
} else {
print_header(); // Needs to be something here to allow linking back to the whole glossary
+13 -16
View File
@@ -32,7 +32,7 @@
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);
@@ -42,13 +42,13 @@
// 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>';
@@ -132,19 +132,19 @@
}
// 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");
@@ -305,7 +305,7 @@
$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) {
@@ -371,10 +371,7 @@
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);
@@ -428,8 +425,8 @@
$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)) {
@@ -451,8 +448,8 @@
// 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
);
}
+6 -3
View File
@@ -31,8 +31,11 @@ add_to_log($course->id, "lams", "view", "view.php?id=$cm->id", "$lams->id");
//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>';
@@ -63,7 +66,7 @@ if(has_capability('mod/lams:manage', $context)){
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.
+9 -5
View File
@@ -375,8 +375,9 @@ class resource_ims extends resource_base {
$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>';
@@ -425,8 +426,11 @@ class resource_ims extends resource_base {
/// 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";
@@ -612,7 +616,7 @@ class resource_ims extends resource_base {
if (!isset($defaults['popup'])) {
// use form defaults
} else if (!empty($defaults['popup'])) {
$defaults['windowpopup'] = 1;
if (array_key_exists('popup', $defaults)) {
@@ -676,7 +680,7 @@ class resource_ims extends resource_base {
$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);
@@ -246,6 +246,8 @@ function display() {
}
$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)) {
@@ -263,7 +265,7 @@ function display() {
$inpopup = optional_param('inpopup', 0, PARAM_BOOL);
$fullurl = $resource->reference. '&amp;HIVE_SESSION='.$SESSION->HIVE_SESSION;
$fullurl = $resource->reference. '&amp;HIVE_SESSION='.$SESSION->HIVE_SESSION;
if (!empty($querystring)) {
$urlpieces = parse_url($resource->reference);
if (empty($urlpieces['query'])) {
@@ -278,7 +280,8 @@ function display() {
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) {
@@ -296,7 +299,8 @@ function display() {
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) {
@@ -310,8 +314,8 @@ function display() {
/// 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\">";
@@ -369,7 +373,8 @@ function display() {
/// 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
@@ -390,7 +395,8 @@ function display() {
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"));
}
+5 -2
View File
@@ -83,7 +83,10 @@ function display() {
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));
@@ -112,7 +115,7 @@ function display() {
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));
+58 -56
View File
@@ -2,7 +2,7 @@
/**
* Global Search Engine for Moodle
* Michael Champanis (mchampan) [[email protected]]
* review 1.8+ : Valery Fremaux [[email protected]]
* review 1.8+ : Valery Fremaux [[email protected]]
* 2007/08/02
*
* The query page - accepts a user-entered query string and returns results.
@@ -52,15 +52,15 @@ if ($check = search_check_php5()) {
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);
@@ -68,82 +68,84 @@ if ($check = search_check_php5()) {
$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);
@@ -155,20 +157,20 @@ $vars = get_object_vars($adv);
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) ?>" />
&nbsp;<input type="submit" value="<?php print_string('search', 'search') ?>" /> &nbsp;
<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();
?>
@@ -195,7 +197,7 @@ else {
<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'){
@@ -204,7 +206,7 @@ else {
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";
@@ -212,8 +214,8 @@ else {
else{
print "<option value='$mod'>".get_string('all', 'search')."</option>\n";
}
}
}
}
}
?>
</select>
</td>
@@ -246,7 +248,7 @@ else {
</table>
<?php
print_box_end();
}
}
?>
</form>
<br/>
@@ -258,10 +260,10 @@ print_string('searching', 'search') . ': ';
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');
@@ -269,7 +271,7 @@ print '.';
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>
@@ -279,28 +281,28 @@ print_box_end();
// 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');
@@ -315,17 +317,17 @@ if ($sq->is_valid()) {
."{$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>
@@ -334,4 +336,4 @@ if ($sq->is_valid()) {
}
print_box_end();
print_footer();
?>
?>
+24 -21
View File
@@ -2,12 +2,12 @@
/**
* Global Search Engine for Moodle
* Michael Champanis (mchampan) [[email protected]]
* review 1.8+ : Valery Fremaux [[email protected]]
* review 1.8+ : Valery Fremaux [[email protected]]
* 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');
@@ -24,19 +24,22 @@ if (empty($CFG->enableglobalsearch)) {
//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) {
@@ -69,7 +72,7 @@ if (isadmin()) {
$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");
@@ -83,36 +86,36 @@ if (isadmin()) {
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>", '&nbsp;');
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";
@@ -128,17 +131,17 @@ $table->data[] = array("<strong>{$databasestr}</strong>", "<em><strong>{$CFG->pr
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);
+5 -1
View File
@@ -28,7 +28,11 @@
$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);
+87 -89
View File
@@ -1,89 +1,87 @@
<?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.'&amp;user='.$note->userid . '#note-' . $note->id , 'add note');
}
}
redirect("$CFG->wwwroot/user/index.php?id=$id");
}
/// Print headers
$straddnote = get_string('addnewnote', 'notes');
if ($course->id != SITEID) {
print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
"<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
$straddnote, "", "", true, "&nbsp;", navmenu($course));
} else {
print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
$straddnote, "", "", true, "&nbsp;", 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);
<?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.'&amp;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, "&nbsp;", 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);
+13 -14
View File
@@ -71,7 +71,7 @@
//Load custom profile fields data
profile_load_data($user);
//create form
$userform = new user_edit_form();
$userform->set_data($user);
@@ -98,12 +98,12 @@
//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);
@@ -134,17 +134,16 @@
$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&amp;course=$course->id\">$userfullname</a>
-> $streditmyprofile", "");
} else {
print_header("$course->shortname: $streditmyprofile", $course->fullname,
"<a href=\"view.php?id=$user->id&amp;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&amp;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';
+12 -13
View File
@@ -106,8 +106,8 @@
}
}
}
// MDL-9983
// MDL-9983
events_trigger('user_updated', $usernew);
}
@@ -174,17 +174,16 @@
$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&amp;course=$course->id\">$userfullname</a>
-> $streditmyprofile", "");
} else {
print_header("$course->shortname: $streditmyprofile", $course->fullname,
"<a href=\"view.php?id=$user->id&amp;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&amp;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';
+11 -14
View File
@@ -21,7 +21,7 @@ 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
@@ -69,7 +69,7 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
}
break;
}
}
}
role_assign($student->roleid, $v, 0, $context->id, $student->timestart, $student->timeend, 0);
}
}
@@ -81,14 +81,11 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
/// 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, "&nbsp;", navmenu($course));
} else {
print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
get_string('extendenrol'), "", "", true, "&nbsp;", 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, "&nbsp;", navmenu($course));
$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');
@@ -126,9 +123,9 @@ $nochange = get_string('nochange');
$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;
}
@@ -160,4 +157,4 @@ print_table($table);
echo "\n<div style=\"width:100%;text-align:center;\"><input type=\"submit\" value=\"".get_string('savechanges')."\" /></div>\n</form>\n";
print_footer($course);
?>
?>
+92 -94
View File
@@ -1,94 +1,92 @@
<?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.'&amp;user='.$note->userid . '#note-' . $note->id , 'add note');
}
}
redirect("$CFG->wwwroot/user/index.php?id=$id");
}
/// Print headers
$straddnote = get_string('groupaddnewnote', 'notes');
if ($course->id != SITEID) {
print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
"<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
$straddnote, "", "", true, "&nbsp;", navmenu($course));
} else {
print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
$straddnote, "", "", true, "&nbsp;", 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);
<?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.'&amp;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, "&nbsp;", 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);
+11 -14
View File
@@ -19,7 +19,7 @@ $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today),
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
@@ -67,7 +67,7 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
}
break;
}
}
}
role_assign($student->roleid, $v, 0, $context->id, $student->timestart, $student->timeend, 0);
}
}
@@ -79,14 +79,11 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
/// 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, "&nbsp;", navmenu($course));
} else {
print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
get_string('extendenrol'), "", "", true, "&nbsp;", 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, "&nbsp;", navmenu($course));
$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');
@@ -124,9 +121,9 @@ $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;
}
@@ -158,4 +155,4 @@ echo '<input type="submit" value="'.get_string('savechanges').'" />';
echo '</div></form>';
print_footer($course);
?>
?>
+26 -29
View File
@@ -52,9 +52,9 @@
$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);
@@ -76,7 +76,7 @@
}
// 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 {
@@ -124,10 +124,12 @@
$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, "&nbsp;", 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, "&nbsp;", navmenu($course));
print_heading(get_string("notingroup", "forum"));
print_footer($course);
exit;
@@ -138,16 +140,11 @@
/// 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, "&nbsp;", navmenu($course));
} else {
print_header("$course->shortname: ".get_string('participants'), $course->fullname,
get_string('participants'), "", "", true, "&nbsp;", 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, "&nbsp;", navmenu($course));
/// setting up tags
if ($course->id == SITEID) {
@@ -296,7 +293,7 @@
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
$table->sortable(true, 'lastaccess', SORT_DESC);
$table->set_attribute('cellspacing', '0');
@@ -330,9 +327,9 @@
$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) {
@@ -342,7 +339,7 @@
} 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
@@ -524,13 +521,13 @@
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 {
@@ -548,15 +545,15 @@
$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.'&amp;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);
@@ -604,7 +601,7 @@
}
$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.'" />';
+8 -3
View File
@@ -18,10 +18,10 @@
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)) {
@@ -65,7 +65,12 @@
$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) {
+1 -1
View File
@@ -33,7 +33,7 @@
$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);
+42 -42
View File
@@ -1,11 +1,11 @@
<?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
@@ -39,17 +39,17 @@
}
$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');
}
@@ -67,14 +67,21 @@
$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, "&nbsp;", 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, "&nbsp;", navmenu($course));
print_heading(get_string('usernotavailable', 'error'));
print_footer($course);
exit;
@@ -82,16 +89,14 @@
} 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, "&nbsp;", navmenu($course));
$navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, "&nbsp;", 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, "&nbsp;", navmenu($course));
$navlinks[] = array('name' => $struser, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, "&nbsp;", navmenu($course));
print_heading(get_string('notenrolledprofile'));
}
print_continue($_SERVER['HTTP_REFERER']);
@@ -104,31 +109,26 @@
// 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, "&nbsp;", navmenu($course));
$navigation = build_navigation($navlinks);
print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, "&nbsp;", 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, "&nbsp;", navmenu($course));
} else {
print_header("$course->fullname: $strpersonalprofile: $fullname", $course->fullname,
"$fullname", "", "", true, "&nbsp;", navmenu($course));
}
$navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->fullname: $strpersonalprofile: $fullname", $course->fullname,
$navigation, "", "", true, "&nbsp;", navmenu($course));
if (($course->id != SITEID) and ! isguest() ) { // Need to have access to a course to see that info
@@ -173,13 +173,13 @@
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
@@ -190,7 +190,7 @@
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') {
@@ -302,7 +302,7 @@
}
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>');
}
@@ -351,7 +351,7 @@
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));
}
@@ -373,14 +373,14 @@
/// 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>";
+6 -6
View File
@@ -1,6 +1,6 @@
<?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)
@@ -16,11 +16,11 @@
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&amp;course=1\"".
@@ -34,7 +34,7 @@
}
echo "</a> \n";
}
print_footer();
?>
+6 -6
View File
@@ -8,15 +8,15 @@
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);
@@ -31,7 +31,7 @@
}
echo "</a> \n";
}
print_footer();
?>