mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
Course request feature. Allows normal users to 'request' courses they would like created,
and admins can approve or reject pending courses. Also, contains the ability to restrict activity modules on a per course basic. Strict config options: enable restricting modules at ALL (for all courses, no courses, requested courses), what to do by default for newly created courses as well as what modules to enable for above category by default. This feature was created for the aim of building a community side to moodle - for institutes that have strict courses and enrolments, allowing normal users to request interest courses is a good feature, but some modules may be redundant (assignment, lesson, quiz etc) Please test!
This commit is contained in:
parent
575122f98e
commit
0705ff843b
@ -34,6 +34,9 @@
|
||||
if ($name == "sessioncookie") {
|
||||
$value = eregi_replace("[^a-zA-Z]", "", $value);
|
||||
}
|
||||
if ($name == "defaultallowedmodules") {
|
||||
$value = implode(',',$value);
|
||||
}
|
||||
unset($conf);
|
||||
$conf->name = $name;
|
||||
$conf->value = $value;
|
||||
|
@ -206,6 +206,67 @@ class configvarrss extends configvar {
|
||||
choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
|
||||
|
||||
|
||||
unset($options);
|
||||
$options['none'] = 'No courses';
|
||||
$options['all'] = 'All courses';
|
||||
$options['requested'] = 'Requested courses';
|
||||
|
||||
$permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
|
||||
' <script language="JavaScript">
|
||||
function togglemodules(index) {
|
||||
if (index == 0) {
|
||||
document.getElementById(\'allowedmodules\').disabled=true;
|
||||
}
|
||||
else {
|
||||
document.getElementById(\'allowedmodules\').disabled=false;
|
||||
}
|
||||
}
|
||||
</script>'.
|
||||
choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
|
||||
|
||||
$permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
|
||||
choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
|
||||
|
||||
$allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
|
||||
|
||||
$allowedmodules = array();
|
||||
if (!empty($config->defaultallowedmodules)) {
|
||||
$allowedmodules = explode(',',$config->defaultallowedmodules);
|
||||
}
|
||||
$mods = get_records("modules");
|
||||
$s = "selected=\"selected\"";
|
||||
$allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
|
||||
foreach ($mods as $mod) {
|
||||
$selected = "";
|
||||
if (in_array($mod->id,$allowedmodules))
|
||||
$selected = $s;
|
||||
$allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
|
||||
}
|
||||
$allowstr .= '</select>';
|
||||
|
||||
$permissions['defaultallowedmoules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr);
|
||||
|
||||
|
||||
/// course requests
|
||||
$reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'),
|
||||
choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) );
|
||||
|
||||
/// default category for course requests
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
$reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'),
|
||||
choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) );
|
||||
|
||||
$reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'),
|
||||
'<input type="text" name="requestedteachername" size="20" maxlength="100" value="'.s($config->requestedteachername).'" />');
|
||||
|
||||
$reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'),
|
||||
'<input type="text" name="requestedteachersname" size="20" maxlength="100" value="'.s($config->requestedteachersname).'" />');
|
||||
|
||||
$reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'),
|
||||
'<input type="text" name="requestedstudentname" size="20" maxlength="100" value="'.s($config->requestedstudentname).'" />');
|
||||
|
||||
$reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'),
|
||||
'<input type="text" name="requestedstudentsname" size="20" maxlength="100" value="'.s($config->requestedstudentsname).'" />');
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// INTERFACE config variables
|
||||
@ -479,6 +540,7 @@ class configvarrss extends configvar {
|
||||
$configvars['mail'] = $mail;
|
||||
$configvars['user'] = $user;
|
||||
$configvars['permissions'] = $permissions;
|
||||
$configvars['requestedcourse'] = $reqcourse;
|
||||
$configvars['misc'] = $misc;
|
||||
|
||||
?>
|
||||
|
@ -21,6 +21,9 @@
|
||||
if (!isset($form->metacourse)) {
|
||||
$form->metacourse = 0;
|
||||
}
|
||||
if(!isset($form->restrictmodules)) {
|
||||
$form->restrictmodules = 0;
|
||||
}
|
||||
?>
|
||||
<form method="post" action="edit.php" name="form">
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
@ -294,6 +297,43 @@
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (isadmin() && ((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("restrictmodules") ?>:</td>
|
||||
<td valign="top"><table cellpadding="0" border="0"><tr valign="top"><td>
|
||||
<script language="JavaScript">
|
||||
function togglemodules(index) {
|
||||
if (index == 0) {
|
||||
document.getElementById('allowedmods').disabled=true;
|
||||
}
|
||||
else {
|
||||
document.getElementById('allowedmods').disabled=false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[0] = get_string("no");
|
||||
$options[1] = get_string("yes");
|
||||
choose_from_menu($options,"restrictmodules",$form->restrictmodules,"","togglemodules(this.selectedIndex);","");
|
||||
?> </td><td> <?php p(strtolower(get_string('to'))); ?> </td><td>
|
||||
<select name="allowedmods[]" id="allowedmods" multiple="multiple" size="10" <?php echo ((empty($form->restrictmodules)) ? "disabled=\"disabled\"" : ""); ?>>
|
||||
<?php
|
||||
$mods = get_records("modules");
|
||||
$s = "selected=\"selected\"";
|
||||
echo '<option value="0" '.((empty($allowedmods)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
|
||||
foreach ($mods as $mod) {
|
||||
$selected = "";
|
||||
if (in_array($mod->id,$allowedmods))
|
||||
$selected = $s;
|
||||
echo '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
|
||||
}
|
||||
?>
|
||||
</select></td></tr></table></td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="restrictmodules" value="<?php p($form->restrictmodules); ?>" />
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
||||
|
@ -66,8 +66,14 @@
|
||||
|
||||
if (count($err) == 0) {
|
||||
|
||||
$allowedmods = array();
|
||||
if (!empty($form->allowedmods)) {
|
||||
$allowedmods = $form->allowedmods;
|
||||
unset($form->allowedmods);
|
||||
}
|
||||
|
||||
$form->timemodified = time();
|
||||
|
||||
|
||||
if (!empty($course)) {
|
||||
// Test for and remove blocks which aren't appropriate anymore
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $course->id);
|
||||
@ -76,6 +82,10 @@
|
||||
// Update with the new data
|
||||
if (update_record('course', $form)) {
|
||||
add_to_log($course->id, "course", "update", "edit.php?id=$id", "");
|
||||
if (isadmin()) {
|
||||
$course->restrictmodules = $form->restrictmodules;
|
||||
update_restricted_mods($course,$allowedmods);
|
||||
}
|
||||
fix_course_sortorder();
|
||||
redirect($page->url_get_full(), get_string('changessaved'));
|
||||
} else {
|
||||
@ -97,6 +107,11 @@
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newcourseid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
|
||||
if (isadmin()) {
|
||||
$course = get_record("course","id",$newcourseid);
|
||||
update_restricted_mods($course,$allowedmods);
|
||||
}
|
||||
|
||||
$section = NULL;
|
||||
$section->course = $newcourseid; // Create a default section.
|
||||
$section->section = 0;
|
||||
@ -193,6 +208,29 @@
|
||||
$form->courseformats["$courseformat"] = get_string("format$courseformat");
|
||||
}
|
||||
|
||||
if (empty($allowedmods)) {
|
||||
$allowedmods = array();
|
||||
if (!empty($course)) {
|
||||
if ($am = get_records("course_allowed_modules","course",$course->id)) {
|
||||
foreach ($am as $m) {
|
||||
$allowedmods[] = $m->module;
|
||||
}
|
||||
} else {
|
||||
if (empty($course->restrictmodules)) {
|
||||
$allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
} // it'll be greyed out but we want these by default anyway.
|
||||
}
|
||||
} else {
|
||||
if ($CFG->restrictmodulesfor == 'all') {
|
||||
$allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
if (!empty($CFG->restrictbydefault)) {
|
||||
$form->restrictmodules = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$usehtmleditor = can_use_html_editor();
|
||||
|
||||
$streditcoursesettings = get_string("editcoursesettings");
|
||||
|
@ -58,12 +58,14 @@
|
||||
print_courses(0, "80%");
|
||||
}
|
||||
|
||||
echo "<center>";
|
||||
if (iscreator()) { // Print link to create a new course
|
||||
echo "<center>";
|
||||
print_single_button("edit.php", NULL, get_string("addnewcourse"), "get");
|
||||
echo "</center>";
|
||||
}
|
||||
|
||||
if (!empty($CFG->enablecourserequests)) {
|
||||
print_single_button('request.php',NULL, get_string('requestcourse'),"get");
|
||||
}
|
||||
echo "</center>";
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
@ -309,6 +311,7 @@
|
||||
unset($options);
|
||||
$options["category"] = $category->id;
|
||||
print_single_button("edit.php", $options, get_string("addnewcourse"), "get");
|
||||
print_single_button('pending.php',NULL, get_string('coursespending'),"get");
|
||||
echo "<br />";
|
||||
echo "</center>";
|
||||
|
||||
|
@ -1120,17 +1120,32 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
|
||||
foreach ($resourceraw as $type => $name) {
|
||||
$resources["resource&type=$type"] = $name;
|
||||
}
|
||||
$resources['label'] = get_string('resourcetypelabel', 'resource');
|
||||
if (course_allowed_module($course,'label')) {
|
||||
$resources['label'] = get_string('resourcetypelabel', 'resource');
|
||||
}
|
||||
}
|
||||
|
||||
$output = '<div style="text-align: right">';
|
||||
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&sesskey=$USER->sesskey&add=",
|
||||
$resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true);
|
||||
if (course_allowed_module($course,'resource')) {
|
||||
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&sesskey=$USER->sesskey&add=",
|
||||
$resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true);
|
||||
}
|
||||
|
||||
if ($vertical) {
|
||||
$output .= '<div>';
|
||||
}
|
||||
|
||||
// we need to loop through the forms and check to see if we can add them.
|
||||
foreach ($modnames as $key) {
|
||||
if (!course_allowed_module($course,$key))
|
||||
unset($modnames[strtolower($key)]);
|
||||
}
|
||||
|
||||
// this is stupid but labels get put into resource, so if resource is hidden and label is not, we're in trouble.
|
||||
if (course_allowed_module($course,'label') && empty($resourceallowed)) {
|
||||
$modnames['label'] = get_string('modulename', 'label');
|
||||
}
|
||||
|
||||
$output .= ' ';
|
||||
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&sesskey=$USER->sesskey&add=",
|
||||
$modnames, "section$section", "", $straddactivity, 'mods', $straddactivity, true);
|
||||
@ -1238,11 +1253,26 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
|
||||
$down = $last ? false : true;
|
||||
$first = false;
|
||||
|
||||
print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1);
|
||||
print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1, $printfunction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this function will return $options array for choose_from_menu, with whitespace to denote nesting.
|
||||
|
||||
function make_categories_options() {
|
||||
make_categories_list($cats,$parents);
|
||||
foreach ($cats as $key => $value) {
|
||||
if (array_key_exists($key,$parents)) {
|
||||
if ($indent = count($parents[$key])) {
|
||||
for ($i = 0; $i < $indent; $i++) {
|
||||
$cats[$key] = ' '.$cats[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $cats;
|
||||
}
|
||||
|
||||
function print_category_info($category, $depth) {
|
||||
/// Prints the category info in indented fashion
|
||||
@ -1890,4 +1920,46 @@ function print_visible_setting($form, $course=NULL) {
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
function update_restricted_mods($course,$mods) {
|
||||
delete_records("course_allowed_modules","course",$course->id);
|
||||
if (empty($course->restrictmodules)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
foreach ($mods as $mod) {
|
||||
if ($mod == 0)
|
||||
continue; // this is the 'allow none' option
|
||||
$am->course = $course->id;
|
||||
$am->module = $mod;
|
||||
insert_record("course_allowed_modules",$am);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will take an int (module id) or a string (module name)
|
||||
* and return true or false, whether it's allowed in the given course (object)
|
||||
* $mod is not allowed to be an object, as the field for the module id is inconsistent
|
||||
* depending on where in the code it's called from (sometimes $mod->id, sometimes $mod->module)
|
||||
*/
|
||||
|
||||
function course_allowed_module($course,$mod) {
|
||||
if (empty($course->restrictmodules)) {
|
||||
return true;
|
||||
}
|
||||
if (isadmin()) {
|
||||
return true;
|
||||
}
|
||||
if (is_numeric($mod)) {
|
||||
$modid = $mod;
|
||||
} else if (is_string($mod)) {
|
||||
if ($mod = get_field("modules","id","name",strtolower($mod)))
|
||||
$modid = $mod;
|
||||
}
|
||||
if (empty($modid)) {
|
||||
return false;
|
||||
}
|
||||
return (record_exists("course_allowed_modules","course",$course->id,"module",$modid));
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -110,6 +110,10 @@
|
||||
|
||||
case "add":
|
||||
|
||||
if (!course_allowed_module($course,$mod->modulename)) {
|
||||
error("This module ($mod->modulename) has been disabled for this particular course");
|
||||
}
|
||||
|
||||
if (trim($mod->name) == '') {
|
||||
$mod->name = get_string("modulename", $mod->modulename);
|
||||
}
|
||||
@ -560,6 +564,10 @@
|
||||
error("This module type doesn't exist");
|
||||
}
|
||||
|
||||
if (!course_allowed_module($course,$module->id)) {
|
||||
error("This module has been disabled for this particular course");
|
||||
}
|
||||
|
||||
$form->section = $section; // The section number itself
|
||||
$form->course = $course->id;
|
||||
$form->module = $module->id;
|
||||
|
6
course/pending-reject.html
Normal file
6
course/pending-reject.html
Normal file
@ -0,0 +1,6 @@
|
||||
<form action="pending.php" method="post" name="reject">
|
||||
<input type="hidden" name="reject" value="<?php p($reject->id); ?>" />
|
||||
<textarea name="rejectnotice" rows="10" cols="50"></textarea><br />
|
||||
<input type="submit" value="<?php print_string("savechanges");?>" />
|
||||
<input type="button" value="<?php print_string("cancel"); ?>" onClick="window.location='pending.php';" />
|
||||
</form>
|
139
course/pending.php
Normal file
139
course/pending.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
// allow the administrators to look through a list of course requests and either approve them or reject them.
|
||||
require_once(dirname(dirname(__FILE__)).'/config.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/lib/pagelib.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/lib/blocklib.php');
|
||||
require_once(dirname(__FILE__).'/lib.php');
|
||||
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error("Only the admin can use this page");
|
||||
}
|
||||
|
||||
$approve = optional_param('approve',NULL,PARAM_INT);
|
||||
$reject = optional_param('reject',NULL,PARAM_INT);
|
||||
|
||||
if (!empty($approve)) {
|
||||
if ($course = get_record("course_request","id",$approve)) {
|
||||
foreach (array_keys((array)$course) as $key) {
|
||||
$course->$key = addslashes($course->$key);
|
||||
}
|
||||
|
||||
// place at beginning of category
|
||||
fix_course_sortorder();
|
||||
if (empty($CFG->defaultrequestedcategory)) {
|
||||
$CFG->defaultrequestedcategory = 1; //yuk, but default to miscellaneous.
|
||||
}
|
||||
$course->category = $CFG->defaultrequestedcategory;
|
||||
$course->sortorder = get_field_sql("SELECT min(sortorder)-1 FROM {$CFG->prefix}course WHERE category=$course->category");
|
||||
if (empty($course->sortorder)) {
|
||||
$course->sortorder = 1000;
|
||||
}
|
||||
$course->requested = 1;
|
||||
unset($course->reason);
|
||||
unset($course->id);
|
||||
$teacherid = $course->requester;
|
||||
unset($course->requester);
|
||||
$course->teacher = get_string("defaultcourseteacher");
|
||||
if (!empty($CFG->requestedteachername)) {
|
||||
$course->teacher = $CFG->requestedteachername;
|
||||
}
|
||||
$course->teachers = get_string("defaultcourseteachers");
|
||||
if (!empty($CFG->requestedteachersname)) {
|
||||
$course->teachers = $CFG->requestedteachersname;
|
||||
}
|
||||
$course->student = get_string("defaultcoursestudent");
|
||||
if (!empty($CFG->requestedstudentname)) {
|
||||
$course->student = $CFG->requestedstudentname;
|
||||
}
|
||||
$course->students = get_string("defaultcoursestudents");
|
||||
if (!empty($CFG->requestedstudentsname)) {
|
||||
$course->students = $CFG->requestedstudentsname;
|
||||
}
|
||||
if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) {
|
||||
$course->restrictmodules = 1;
|
||||
}
|
||||
if ($courseid = insert_record("course",$course)) {
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $courseid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
add_teacher($teacherid,$courseid);
|
||||
$course->id = $courseid;
|
||||
if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) { // if we're all or requested we're ok.
|
||||
$allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
update_restricted_mods($course,$allowedmods);
|
||||
}
|
||||
delete_records('course_request','id',$approve);
|
||||
$success = 1;
|
||||
}
|
||||
if (!empty($success)) {
|
||||
$user = get_record('user','id',$teacherid);
|
||||
$a->name = $course->fullname;
|
||||
$a->url = $CFG->wwwroot.'/course/view.php?id='.$courseid;
|
||||
$a->teacher = $course->teacher;
|
||||
email_to_user($user,$USER,get_string('courseapprovedsubject'),get_string('courseapprovedemail','moodle',$a));
|
||||
redirect($CFG->wwwroot.'/course/edit.php?id='.$courseid);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
error(get_string('courseapprovedfailed'));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$strtitle = get_string('coursespending');
|
||||
$strheading = get_string(((!empty($reject)) ? 'coursereject' : 'coursespending'));
|
||||
|
||||
print_header($strtitle,$strheading,$strheading);
|
||||
|
||||
if (!empty($reject)) {
|
||||
if ($reject = get_record("course_request","id",$reject)) {
|
||||
$rejectnotice = stripslashes(optional_param('rejectnotice',NULL,PARAM_CLEAN));
|
||||
if (empty($rejectnotice)) {
|
||||
// display a form for writing a reason
|
||||
print_simple_box_start('center');
|
||||
print_string('courserejectreason');
|
||||
include('pending-reject.html');
|
||||
print_simple_box_end();
|
||||
}
|
||||
else {
|
||||
$user = get_record("user","id",$reject->requester);
|
||||
email_to_user($user,$USER,get_string('courserejectsubject'),get_string('courserejectemail','moodle',$rejectnotice));
|
||||
delete_records("course_request","id",$reject->id);
|
||||
notice(get_string('courserejected'),'pending.php');
|
||||
}
|
||||
}
|
||||
} else if ($pending = get_records("course_request")) {
|
||||
// loop through
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 3;
|
||||
$table->align = array('center','center','center','center','center','center');
|
||||
$table->head = array(get_string('shortname'),get_string('fullname'),get_string('requestedby'),get_string('summary'),
|
||||
get_string('requestreason'),'');
|
||||
foreach ($pending as $course) {
|
||||
$requester = get_record('user','id',$course->requester);
|
||||
// check here for shortname collisions and warn about them.
|
||||
if ($match = get_record("course","shortname",$course->shortname)) {
|
||||
$course->shortname .= ' [*]';
|
||||
$collision = 1;
|
||||
}
|
||||
$table->data[] = array($course->shortname,$course->fullname,fullname($requester),
|
||||
$course->summary,$course->reason,
|
||||
'<a href="pending.php?approve='.$course->id.'">'.get_string('approve').'</a> | '
|
||||
.'<a href="pending.php?reject='.$course->id.'">'.get_string('reject').'</a>');
|
||||
}
|
||||
print_table($table);
|
||||
if (!empty($collision)) {
|
||||
print_string('shortnamecollisionwarning');
|
||||
}
|
||||
} else {
|
||||
notice(get_string('nopendingcourses'));
|
||||
// no pending messages.
|
||||
}
|
||||
|
||||
print_footer();
|
||||
|
||||
|
||||
?>
|
59
course/request.html
Normal file
59
course/request.html
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// make sure all variables are defined
|
||||
if (empty($form->shortname)) {
|
||||
$form->shortname = '';
|
||||
}
|
||||
if (empty($form->fullname)) {
|
||||
$form->fullname = '';
|
||||
}
|
||||
if (empty($form->summary)) {
|
||||
$form->summary = '';
|
||||
}
|
||||
if (empty($form->reason)) {
|
||||
$form->reason = '';
|
||||
}
|
||||
if (empty($usehtmleditor)) {
|
||||
$usehtmleditor = 0;
|
||||
}
|
||||
?>
|
||||
<form method="post" action="request.php" name="request">
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("fullname") ?>:</td>
|
||||
<td><input type="text" name="fullname" maxlength="254" size="50" value="<?php p($form->fullname) ?>" alt="<?php print_string("fullname") ?>" />
|
||||
<?php helpbutton("coursefullname", get_string("fullname")) ?>
|
||||
<?php if (isset($err["fullname"])) formerr($err["fullname"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("shortname") ?>:</td>
|
||||
<td><input type="text" name="shortname" maxlength="15" size="10" value="<?php p($form->shortname) ?>" alt="<?php print_string("shortname") ?>" />
|
||||
<?php helpbutton("courseshortname", get_string("shortname")) ?>
|
||||
<?php if (isset($err["shortname"])) formerr($err["shortname"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("summary") ?>:</td>
|
||||
<td><?php
|
||||
print_textarea($usehtmleditor, 10, 50, 660, 200, "summary", $form->summary);
|
||||
helpbutton("text", get_string("helptext"));
|
||||
if (isset($err["summary"])) formerr($err["summary"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("courserequestreason") ?>:</td>
|
||||
<td><?php
|
||||
print_textarea($usehtmleditor, 10, 50, 660, 200, "reason", $form->reason);
|
||||
helpbutton("text", get_string("helptext"));
|
||||
if (isset($err["reason"])) formerr($err["reason"]);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $form->sesskey ?>" />
|
||||
</form>
|
102
course/request.php
Normal file
102
course/request.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/// this allows a student to request a course be created for them.
|
||||
|
||||
require_once(dirname(dirname(__FILE__)).'/config.php');
|
||||
|
||||
require_login();
|
||||
|
||||
if (empty($CFG->enablecourserequests)) {
|
||||
error(get_string('courserequestdisabled'));
|
||||
}
|
||||
|
||||
$strtitle = get_string('courserequest');
|
||||
|
||||
print_header($strtitle,$strtitle,$strtitle);
|
||||
|
||||
$form = data_submitted();
|
||||
if (!empty($form) && confirm_sesskey()) {
|
||||
validate_form($form,$err) ;
|
||||
|
||||
if (empty($err)) {
|
||||
$form->requester = $USER->id;
|
||||
|
||||
if (insert_record('course_request',$form)) {
|
||||
notice(get_string('courserequestsuccess'));
|
||||
}
|
||||
else {
|
||||
notice(get_string('courserequestfailed'));
|
||||
}
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$form->sesskey = !empty($USER->id) ? $USER->sesskey : '';
|
||||
|
||||
// print_simple_box(get_string('courserequestintro'),'center');
|
||||
print_simple_box_start("center");
|
||||
print_string('courserequestintro');
|
||||
include("request.html");
|
||||
print_simple_box_end();
|
||||
|
||||
print_footer($course);
|
||||
|
||||
if ($usehtmleditor) {
|
||||
use_html_editor("summary");
|
||||
use_html_editor("reason");
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
function validate_form(&$form,&$err) {
|
||||
|
||||
if (empty($form->shortname)) {
|
||||
$err['shortname'] = get_string('missingshortname');
|
||||
}
|
||||
|
||||
if (empty($form->fullname)) {
|
||||
$err['fullname'] = get_string('missingfullname');
|
||||
}
|
||||
|
||||
if (empty($form->summary)) {
|
||||
$err["summary"] = get_string("missingsummary");
|
||||
}
|
||||
|
||||
if (empty($form->reason)) {
|
||||
$err["reason"] = get_string("missingreqreason");
|
||||
}
|
||||
|
||||
$foundcourses = get_records("course", "shortname", $form->shortname);
|
||||
$foundreqcourses = get_records("course_request", "shortname", $form->shortname);
|
||||
if (!empty($foundreqcourses)) {
|
||||
$foundcourses = array_merge($foundcourses,$foundreqcourses);
|
||||
}
|
||||
|
||||
if (!empty($foundcourses)) {
|
||||
if (!empty($course->id)) {
|
||||
unset($foundcourses[$course->id]);
|
||||
}
|
||||
if (!empty($foundcourses)) {
|
||||
foreach ($foundcourses as $foundcourse) {
|
||||
if ($foundcourse->requester) {
|
||||
$pending = 1;
|
||||
$foundcoursenames[] = $foundcourse->fullname.' [*]';
|
||||
}
|
||||
else {
|
||||
$foundcoursenames[] = $foundcourse->fullname;
|
||||
}
|
||||
}
|
||||
$foundcoursenamestring = addslashes(implode(',', $foundcoursenames));
|
||||
|
||||
$err["shortname"] = get_string("shortnametaken", "", $foundcoursenamestring);
|
||||
if (!empty($pending)) {
|
||||
$err["shortname"] .= '<br />'.get_string('starpending');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -27,10 +27,13 @@ $string['configclamfailureonupload'] = 'If you have configured clam to scan uplo
|
||||
$string['configcountry'] = 'If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset.';
|
||||
$string['configdbsessions'] = 'If enabled, this setting will use the database to store information about current sessions. This is especially useful for large/busy sites or sites built on cluster of servers. For most sites this should probably be left disabled so that the server disk is used instead. Note that changing this setting now will log out all current users (including you).';
|
||||
$string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed. This is only useful for developers.';
|
||||
$string['configdefaultallowedmodules'] = 'For the courses which fall into the above category, which modules do you want to allow by default <b>when the course is created</b>?';
|
||||
$string['configdefaultrequestedcategory'] = 'Default category to put courses that were requested into, if they\'re approved.';
|
||||
$string['configdeleteunconfirmed'] = 'If you are using email authentication, this is the period within which a response will be accepted from users. After this period, old unconfirmed accounts are deleted.';
|
||||
$string['configdenyemailaddresses'] = 'To deny email addresses from particular domains list them here in the same way. All other domains will be accepted. eg <strong>hotmail.com yahoo.co.uk</strong>';
|
||||
$string['configdigestmailtime'] = 'People who choose to have emails sent to them in digest form will be emailed the digest daily. This setting controls which time of day the daily mail will be sent (the next cron that runs after this hour will send it).';
|
||||
$string['configdisplayloginfailures'] = 'This will display information to selected users about previous failed logins.';
|
||||
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
|
||||
$string['configenablerssfeeds'] = 'This switch will enable RSS feeds from across the site. To actually see any change you will need to enable RSS feeds in the individual modules too - go to the Modules settings under Admin Configuration.';
|
||||
$string['configenablerssfeedsdisabled'] = ' It is not available because RSS feeds are disabled in all the Site. To enable them, go to the Variables settings under Admin Configuration.';
|
||||
$string['configerrorlevel'] = 'Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice.';
|
||||
@ -67,6 +70,12 @@ $string['configopentogoogle'] = 'If you enable this setting, then Google will be
|
||||
$string['configpathtoclam'] = 'Path to clam AV. Probably something like /usr/bin/clamscan or /usr/bin/clamdscan. You need this in order for clam AV to run.';
|
||||
$string['configproxyhost'] = 'If this <b>server</b> needs to use a proxy computer (eg a firewall) to access the Internet, then provide the proxy hostname and port here. Otherwise leave it blank.';
|
||||
$string['configquarantinedir'] = 'If you want clam AV to move infected files to a quarantine directory, enter it here. It must be writable by the webserver. If you leave this blank, or if you enter a directory that doesn\'t exit or isn\'t writable, infected files will be deleted. Do not include a trailing slash.';
|
||||
$string['configrequestedteachername'] = 'Word for teacher used in requested courses';
|
||||
$string['configrequestedteachersname'] = 'Word for teachers used in requested courses';
|
||||
$string['configrequestedstudentname'] = 'Word for student used in requested courses';
|
||||
$string['configrequestedstudentsname'] = 'Word for students used in requested courses';
|
||||
$string['configrestrictbydefault'] = 'Should new courses that are created that fall into the above category have their modules restricted by default?';
|
||||
$string['configrestrictmodulesfor'] = 'Which courses should have <b>the setting</b> for disabling some activity modules?';
|
||||
$string['configrunclamonupload'] = 'Run clam AV on file upload? You will need a correct path in pathtoclam for this to work. (Clam AV is a free virus scanner that you can get from http://www.clamav.net/)';
|
||||
$string['configsectioninterface'] = 'Interface';
|
||||
$string['configsectionmail'] = 'Mail';
|
||||
@ -74,6 +83,7 @@ $string['configsectionmaintenance'] = 'Maintenance';
|
||||
$string['configsectionmisc'] = 'Miscellaneous';
|
||||
$string['configsectionoperatingsystem'] = 'Operating System';
|
||||
$string['configsectionpermissions'] = 'Permissions';
|
||||
$string['configsectionrequestedcourse'] = 'Course requests';
|
||||
$string['configsectionsecurity'] = 'Security';
|
||||
$string['configsectionuser'] = 'User';
|
||||
$string['configsecureforms'] = 'Moodle can use an additional level of security when accepting data from web forms. If this is enabled, then the browser\'s HTTP_REFERER variable is checked against the current form address. In a very few cases this can cause problems if the user is using a firewall (eg Zonealarm) configured to strip HTTP_REFERER from their web traffic. Symptoms are getting \'stuck\' on a form. If your users are having problems with the login page (for example) you might want to disable this setting, although it might leave your site more open to brute-force password attacks. If in doubt, leave this set to \'Yes\'.';
|
||||
|
@ -42,7 +42,7 @@ $string['adminhelpauthentication'] = 'You can use internal user accounts or exte
|
||||
$string['adminhelpbackup'] = 'Configure automated backups and their schedule';
|
||||
$string['adminhelpconfiguration'] = 'Configure how the site looks and works';
|
||||
$string['adminhelpconfigvariables'] = 'Configure variables that affect general operation of the site';
|
||||
$string['adminhelpcourses'] = 'Define courses and categories and assign people to them';
|
||||
$string['adminhelpcourses'] = 'Define courses and categories and assign people to them, edit pending courses.';
|
||||
$string['adminhelpeditorsettings'] = 'Define basic settings for HTML editor';
|
||||
$string['adminhelpedituser'] = 'Browse the list of user accounts and edit any of them';
|
||||
$string['adminhelpenrolments'] = 'Choose internal or external ways to control enrolments';
|
||||
@ -78,6 +78,7 @@ $string['alllogs'] = 'All logs';
|
||||
$string['allow'] = 'Allow';
|
||||
$string['allowguests'] = 'This course allows guest users to enter';
|
||||
$string['allowinternal'] = 'Allow internal methods as well';
|
||||
$string['allownone'] = 'Allow none';
|
||||
$string['allownot'] = 'Do not allow';
|
||||
$string['allparticipants'] = 'All participants';
|
||||
$string['allteachers'] = 'All teachers';
|
||||
@ -86,6 +87,7 @@ $string['alphanumerical'] = 'Can only contain alphabetical letters or numbers';
|
||||
$string['alreadyconfirmed'] = 'Registration has already been confirmed';
|
||||
$string['always'] = 'Always';
|
||||
$string['answer'] = 'Answer';
|
||||
$string['approve'] = 'Approve';
|
||||
$string['areyousuretorestorethis'] = 'Do you want to continue?';
|
||||
$string['areyousuretorestorethisinfo'] = 'Later in this process you will have a choice of adding this backup to an existing course or creating a completely new course.';
|
||||
$string['assessment'] = 'Assessment';
|
||||
@ -200,6 +202,9 @@ $string['country'] = 'Country';
|
||||
$string['course'] = 'Course';
|
||||
$string['courseavailable'] = 'This course is available to students';
|
||||
$string['courseavailablenot'] = 'This course is not available to students';
|
||||
$string['courseapprovedsubject'] = 'Your course has been approved!';
|
||||
$string['courseapprovedemail'] = 'Your requested course, $a->name, has been approved and you have been made a $a->teacher. To access your new course, go to $a->url';
|
||||
$string['courseapprovedfailed'] = 'Failed to save the course as approved!';
|
||||
$string['coursebackup'] = 'Course backup';
|
||||
$string['coursecategories'] = 'Course categories';
|
||||
$string['coursecategory'] = 'Course category';
|
||||
@ -208,8 +213,20 @@ $string['coursefiles'] = 'Course files';
|
||||
$string['courseformats'] = 'Course formats';
|
||||
$string['coursegrades'] = 'Course grades';
|
||||
$string['courseinfo'] = 'Course info';
|
||||
$string['coursereject'] = 'Reject a course request';
|
||||
$string['courserejected'] = 'Course has been rejected and the requester has been notified.';
|
||||
$string['courserejectreason'] = 'Outline your reasons for rejecting this course<br />(this will be emailed to the requester)';
|
||||
$string['courserejectsubject'] = 'Your course has been rejected';
|
||||
$string['courserejectemail'] = 'Sorry, but the course you requested has been rejected. Here is the reason provided:'."\n\n".'$a';
|
||||
$string['courserequest'] = 'Course request';
|
||||
$string['courserequestdisabled'] = 'Sorry, but requesting courses has been disabled by the administrator';
|
||||
$string['courserequestintro'] = 'Use this form to request a course to be created for you.<br />Try and fill in as much information as you can to allow<br />the administrators to understand your reasons for wanting this course.';
|
||||
$string['courserequestsuccess'] = 'Successfully saved your course request. Expect an email within a few days with the outcome';
|
||||
$string['courserequestfailed'] = 'For some reason, your course request could not be saved';
|
||||
$string['courserequestreason'] = 'Reasons for wanting this course';
|
||||
$string['courserestore'] = 'Course restore';
|
||||
$string['courses'] = 'Courses';
|
||||
$string['coursespending'] = 'Courses pending approval';
|
||||
$string['coursestaught'] = 'Courses I have taught';
|
||||
$string['coursescategory'] = 'Courses in the same category';
|
||||
$string['coursehidden'] = 'This course is currently unavailable to students';
|
||||
@ -693,6 +710,7 @@ $string['missinglastname'] = 'Missing surname';
|
||||
$string['missingname'] = 'Missing name';
|
||||
$string['missingnewpassword'] = 'Missing new password';
|
||||
$string['missingpassword'] = 'Missing password';
|
||||
$string['missingreqreason'] = 'Missing reason';
|
||||
$string['missingshortname'] = 'Missing short name';
|
||||
$string['missingshortsitename'] = 'Missing short site name';
|
||||
$string['missingsitedescription'] = 'Missing site description';
|
||||
@ -781,6 +799,7 @@ $string['noimagesyet'] = 'No images have been uploaded to your course yet';
|
||||
$string['nomorecourses'] = 'No more matching courses could be found';
|
||||
$string['nomoreidnumber'] = 'Not using an idnumber to avoid collisions';
|
||||
$string['none'] = 'None';
|
||||
$string['nopendingcourses'] = 'There are no courses pending approval';
|
||||
$string['nopotentialadmins'] = 'No potential admins';
|
||||
$string['nopotentialcreators'] = 'No potential course creators';
|
||||
$string['nopotentialstudents'] = 'No potential students';
|
||||
@ -897,12 +916,16 @@ for important notifications such as security alerts and new releases of Moodle.<
|
||||
$string['registrationno'] = 'No, I do not want to receive email';
|
||||
$string['registrationsend'] = 'Send registration information to moodle.org';
|
||||
$string['registrationyes'] = 'Yes, please notify me about important issues';
|
||||
$string['reject'] = 'Reject';
|
||||
$string['removeadmin'] = 'Remove admin';
|
||||
$string['removecreator'] = 'Remove course creator';
|
||||
$string['removestudent'] = 'Remove student';
|
||||
$string['removeteacher'] = 'Remove teacher';
|
||||
$string['rename'] = 'Rename';
|
||||
$string['renamefileto'] = 'Rename <b>$a</b> to';
|
||||
$string['requestcourse'] = 'Request a course';
|
||||
$string['requestedby'] = 'Requested by';
|
||||
$string['requestreason'] = 'Reason for course request';
|
||||
$string['required'] = 'Required';
|
||||
$string['requireskey'] = 'This course requires an enrolment key';
|
||||
$string['requirespayment'] = 'This course requires payment for access';
|
||||
@ -913,6 +936,7 @@ $string['restorecancelled'] = 'Restore canceled';
|
||||
$string['restorecoursenow'] = 'Restore this course now!';
|
||||
$string['restorefinished'] = 'Restore completed successfully';
|
||||
$string['restoreto'] = 'Restore to';
|
||||
$string['restrictmodules'] = 'Restrict activity modules?';
|
||||
$string['returningtosite'] = 'Returning to this web site?';
|
||||
$string['revert'] = 'Revert';
|
||||
$string['role'] = 'Role';
|
||||
@ -949,6 +973,7 @@ $string['separateandconnected'] = 'Separate and Connected ways of knowing';
|
||||
$string['serverlocaltime'] = 'Server\'s local time';
|
||||
$string['settings'] = 'Settings';
|
||||
$string['shortname'] = 'Short name';
|
||||
$string['shortnamecollisionwarning'] ='[*] = This shortname is already in use by a course and will need to be changed upon approval';
|
||||
$string['shortnametaken'] = 'Short name is already used for another course ($a)';
|
||||
$string['shortsitename'] = 'Short name for site (eg single word)';
|
||||
$string['show'] = 'Show';
|
||||
@ -993,6 +1018,7 @@ $string['someerrorswerefound'] = 'Some information was missing or incorrect. Loo
|
||||
$string['sortby'] = 'Sort by';
|
||||
$string['specifyname'] = 'You must specify a name.';
|
||||
$string['startdate'] = 'Course start date';
|
||||
$string['starpending'] = '([*] = course pending approval)';
|
||||
$string['startsignup'] = 'Create new account';
|
||||
$string['state'] = 'State/Province';
|
||||
$string['statistics'] = 'Statistics';
|
||||
|
@ -1492,6 +1492,34 @@ function main_upgrade($oldversion=0) {
|
||||
table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005081600) { //set up the course requests table
|
||||
modify_database('',"CREATE TABLE `prefix_course_request` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`fullname` varchar(254) NOT NULL default '',
|
||||
`shortname` varchar(15) NOT NULL default '',
|
||||
`summary` text NOT NULL,
|
||||
`reason` text NOT NULL,
|
||||
`requester` int(10) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `shortname` (`shortname`)
|
||||
) TYPE=MyISAM;");
|
||||
|
||||
table_column('course','','requested');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005081601) {
|
||||
modify_database('',"CREATE TABLE `prefix_course_allowed_modules` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default 0,
|
||||
`module` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `course` (`course`),
|
||||
KEY `module` (`module`)
|
||||
) TYPE=MyISAM;");
|
||||
|
||||
table_column('course','','restrictmodules','int','1','','0','not null');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,8 @@ CREATE TABLE `prefix_course` (
|
||||
`timecreated` int(10) unsigned NOT NULL default '0',
|
||||
`timemodified` int(10) unsigned NOT NULL default '0',
|
||||
`metacourse` int(1) unsigned NOT NULL default '0',
|
||||
`requested` int(1) unsigned NOT NULL default '0',
|
||||
`restrictmodules` int(1) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `category` (`category`),
|
||||
KEY `idnumber` (`idnumber`),
|
||||
@ -174,6 +176,37 @@ CREATE TABLE `prefix_course_sections` (
|
||||
) TYPE=MyISAM;
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `course_request`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_course_request` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`fullname` varchar(254) NOT NULL default '',
|
||||
`shortname` varchar(15) NOT NULL default '',
|
||||
`summary` text NOT NULL,
|
||||
`reason` text NOT NULL,
|
||||
`requester` int(10) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `shortname` (`shortname`)
|
||||
) TYPE=MyISAM;
|
||||
# ---------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `coursre_allowed_modules`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_course_allowed_modules` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default 0,
|
||||
`module` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `course` (`course`),
|
||||
KEY `module` (`module`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `event`
|
||||
#
|
||||
|
@ -1236,6 +1236,34 @@ function main_upgrade($oldversion=0) {
|
||||
table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005081600) { //set up the course requests table
|
||||
modify_database('',"CREATE TABLE prefix_course_request (
|
||||
id SERIAL PRIMARY KEY,
|
||||
fullname varchar(254) NOT NULL default '',
|
||||
shortname varchar(15) NOT NULL default '',
|
||||
summary text NOT NULL default '',
|
||||
reason text NOT NULL default '',
|
||||
requester INTEGER NOT NULL default 0
|
||||
);");
|
||||
|
||||
modify_database('','CREATE INDEX prefix_course_request_shortname_idx ON prefix_course_request (shortname);');
|
||||
|
||||
table_column('course','','requested');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005081601) {
|
||||
modify_database('','CREATE TABLE prefix_course_allowed_modules (
|
||||
id SERIAL PRIMARY KEY,
|
||||
course INTEGER NOT NULL default 0,
|
||||
module INTEGER NOT NULL default 0
|
||||
);');
|
||||
|
||||
modify_database('','CREATE INDEX prefix_course_allowed_modules_course_idx ON prefix_course_allowed_modules (course);');
|
||||
modify_database('','CREATE INDEX prefix_course_allowed_modules_module_idx ON prefix_course_allowed_modules (module);');
|
||||
table_column('course','','restrictmodules','int','1','','0','not null');
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,9 @@ CREATE TABLE prefix_course (
|
||||
currency varchar(3) NOT NULL default 'USD',
|
||||
timecreated integer NOT NULL default '0',
|
||||
timemodified integer NOT NULL default '0',
|
||||
metacourse integer NOT NULL default '0'
|
||||
metacourse integer NOT NULL default '0',
|
||||
requested integer NOT NULL default '0',
|
||||
restrictmodules integer NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX prefix_course_category_sortorder_uk ON prefix_course (category,sortorder);
|
||||
@ -112,6 +114,26 @@ CREATE TABLE prefix_course_sections (
|
||||
|
||||
CREATE INDEX prefix_course_sections_coursesection_idx ON prefix_course_sections (course,section);
|
||||
|
||||
CREATE TABLE prefix_course_request (
|
||||
id SERIAL PRIMARY KEY,
|
||||
fullname varchar(254) NOT NULL default '',
|
||||
shortname varchar(15) NOT NULL default '',
|
||||
summary text NOT NULL default '',
|
||||
reason text NOT NULL default '',
|
||||
requester INTEGER NOT NULL default 0
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_course_request_shortname_idx ON prefix_course_request (shortname);
|
||||
|
||||
CREATE TABLE prefix_course_allowed_modules (
|
||||
id SERIAL PRIMARY KEY,
|
||||
course INTEGER NOT NULL default 0,
|
||||
module INTEGER NOT NULL default 0
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_course_allowed_modules_course_idx ON prefix_course_allowed_modules (course);
|
||||
CREATE INDEX prefix_course_allowed_modules_module_idx ON prefix_course_allowed_modules (module);
|
||||
|
||||
CREATE TABLE prefix_event (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name varchar(255) NOT NULL default '',
|
||||
|
@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2005072200; // YYYYMMDD = date
|
||||
$version = 2005081601; // YYYYMMDD = date
|
||||
// XY = increments within a single day
|
||||
|
||||
$release = '1.6 development'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user