);
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
+ $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
$temp->add(new admin_setting_configcheckbox('navlinkcoursesections', new lang_string('navlinkcoursesections', 'admin'), new lang_string('navlinkcoursesections_help', 'admin'), 0));
$ADMIN->add('reportplugins', $page);
}
+/// Add all admin tools
+if ($hassiteconfig) {
+ $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
+ $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
+ $CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
+}
+
// Now add various admin tools
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
}
}
-/// Add all admin tools
-if ($hassiteconfig) {
- $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
- $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
- $CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
-}
-
/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
$ADMIN->add('security', $temp);
- // "modulesecurity" settingpage
- $temp = new admin_settingpage('modulesecurity', new lang_string('modulesecurity', 'admin'));
- $temp->add(new admin_setting_configselect('restrictmodulesfor', new lang_string('restrictmodulesfor', 'admin'), new lang_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => new lang_string('nocourses'),
- 'all' => new lang_string('fulllistofcourses'),
- 'requested' => new lang_string('requestedcourses'))));
- $temp->add(new admin_setting_configcheckbox('restrictbydefault', new lang_string('restrictbydefault', 'admin'), new lang_string('configrestrictbydefault', 'admin'), 0));
- $temp->add(new admin_setting_configmultiselect_modules('defaultallowedmodules',
- new lang_string('defaultallowedmodules', 'admin'),
- new lang_string('configdefaultallowedmodules', 'admin')));
- $ADMIN->add('security', $temp);
-
-
-
// "notifications" settingpage
$temp = new admin_settingpage('notifications', new lang_string('notifications', 'admin'));
$temp->add(new admin_setting_configselect('displayloginfailures', new lang_string('displayloginfailures', 'admin'), new lang_string('configdisplayloginfailures', 'admin'), '', array('' => new lang_string('nobody'),
switch (typeField.value) {
case '1': // XMLDB_TYPE_INTEGER
lengthTip.innerHTML = ' 1...20';
+ lengthField.disabled = false;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
break;
case '2': // XMLDB_TYPE_NUMBER
lengthTip.innerHTML = ' 1...20';
+ lengthField.disabled = false;
decimalsTip.innerHTML = ' 0...length or empty';
break;
case '3': // XMLDB_TYPE_FLOAT
lengthTip.innerHTML = ' 1...20 or empty';
+ lengthField.disabled = false;
decimalsTip.innerHTML = ' 0...length or empty';
break;
case '4': // XMLDB_TYPE_CHAR
lengthTip.innerHTML = ' 1...1333'; // Hardcoded, yes!
+ lengthField.disabled = false;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
sequenceField.value = '0';
break;
case '5': // XMLDB_TYPE_TEXT
- lengthTip.innerHTML = ' small, medium, big';
+ lengthTip.innerHTML = '';
+ lengthField.disabled = true;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
defaultField.value = '';
break;
case '6': // XMLDB_TYPE_BINARY
- lengthTip.innerHTML = ' small, medium, big';
+ lengthTip.innerHTML = '';
+ lengthField.disabled = true;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
'numberincorrectlength' => 'tool_xmldb',
'floatincorrectlength' => 'tool_xmldb',
'charincorrectlength' => 'tool_xmldb',
- 'textincorrectlength' => 'tool_xmldb',
- 'binaryincorrectlength' => 'tool_xmldb',
'numberincorrectdecimals' => 'tool_xmldb',
'floatincorrectdecimals' => 'tool_xmldb',
'defaultincorrect' => 'tool_xmldb',
}
}
}
- // Text checks
- if ($type == XMLDB_TYPE_TEXT) {
- if ($length != 'small' &&
- $length != 'medium' &&
- $length != 'big') {
- $errors[] = $this->str['textincorrectlength'];
- }
- if ($default !== NULL && $default !== '') {
- if (substr($default, 0, 1) == "'" ||
- substr($default, -1, 1) == "'") {
- $errors[] = $this->str['defaultincorrect'];
- }
- }
- }
- // Binary checks
- if ($type == XMLDB_TYPE_BINARY) {
- if ($length != 'small' &&
- $length != 'medium' &&
- $length != 'big') {
- $errors[] = $this->str['binaryincorrectlength'];
- }
- }
+ // No text checks
+ // No binary checks
if (!empty($errors)) {
$tempfield = new xmldb_field($name);
}
}
}
- // TODO: Drop this check in Moodle 2.1
- // Intercept loaded structure here and look for ENUM fields
- if (isset($dbdir->xml_file)) {
- if ($structure =& $dbdir->xml_file->getStructure()) {
- if ($tables = $structure->getTables()) {
- foreach ($tables as $table) {
- if ($fields = $table->getFields()) {
- foreach ($fields as $field) {
- if (!empty($field->hasenums)) {
- if ($hithis) {
- $o .= '<tr class="highlight"><td class="error cell" colspan="10">';
- } else {
- $o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">';
- }
- $o .= 'Table ' . $table->getName() . ', field ' . $field->getName() . ' has ENUM info';
- if (!empty($field->hasenumsenabled)) {
- $o .= ' that seems to be active (true). ENUMs support has been dropped in Moodle 2.0, ' .
- ' the XMLDB Editor will delete any ENUM reference next time you save this file' .
- ' and you MUST provide one upgrade block in your code to drop them from DB. See' .
- ' <a href="http://docs.moodle.org/dev/DB_layer_2.0_migration_docs#The_changes">' .
- ' Moodle Docs</a> for more info and examples.';
- } else {
- $o .= ' that seem to be inactive (false). ENUMs support has been dropped in Moodle 2.0,' .
- ' the XMLDB Editor will, simply, delete any ENUM reference next time you save this file.' .
- ' No further action is necessary.';
- }
- $o .= '</td></tr>';
- }
- }
- }
- }
- }
- }
- }
// If there are changes pending to be saved, but the file cannot be written... inform here
if ($dbdir->path_exists &&
file_exists($key . '/install.xml') &&
$optionspacer . 'change_field_precision',
$optionspacer . 'change_field_notnull',
$optionspacer . 'change_field_default',
- $optionspacer . 'drop_enum_from_field', // TODO: Moodle 2.1 - Drop drop_enum_from_field
'Keys',
$optionspacer . 'add_key',
$optionspacer . 'drop_key',
$o.= $this->str['mustselectonefield'];
}
break;
- case 'drop_enum_from_field': // TODO: Moodle 2.1 - Drop drop_enum_from_field
- if ($fieldkeyindexinitial == 'f') { // Only if we have got one field
- $o.= s($this->drop_enum_from_field_php($structure, $tableparam, $fieldkeyindexparam));
- } else {
- $o.= $this->str['mustselectonefield'];
- }
- break;
case 'change_field_default':
if ($fieldkeyindexinitial == 'f') { // Only if we have got one field
$o.= s($this->change_field_default_php($structure, $tableparam, $fieldkeyindexparam));
return $result;
}
- /**
- * This function will generate all the PHP code needed to
- * drop the enum values (check constraint) of one field
- * using XMLDB objects and functions
- *
- * Note this function is here as part of the process of
- * dropping enums completely from Moodle 2.0: MDL-18577
- * and will be out in Moodle 2.1
- * TODO: Moodle 2.1 - Drop drop_enum_from_field_php
- *
- * @param xmldb_structure structure object containing all the info
- * @param string table table name
- * @param string field field name to change its enum
- */
- function drop_enum_from_field_php($structure, $table, $field) {
-
- $result = '';
- // Validate if we can do it
- if (!$table = $structure->getTable($table)) {
- return false;
- }
- if (!$field = $table->getField($field)) {
- return false;
- }
- if ($table->getAllErrors()) {
- return false;
- }
-
- // Add the standard PHP header
- $result .= XMLDB_PHP_HEADER;
-
- // Add contents
- $result .= XMLDB_LINEFEED;
- $result .= ' // Drop list of values (enum) from field ' . $field->getName() . ' on table ' . $table->getName() . XMLDB_LINEFEED;
- $result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
- $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
-
- // Launch the proper DDL
- $result .= XMLDB_LINEFEED;
- $result .= ' // Launch drop of list of values from field ' . $field->getName() . XMLDB_LINEFEED;
- $result .= ' $dbman->drop_enum_from_field($table, $field);' . XMLDB_LINEFEED;
-
- // Add the proper upgrade_xxxx_savepoint call
- $result .= $this->upgrade_savepoint_php ($structure);
-
- // Add standard PHP footer
- $result .= XMLDB_PHP_FOOTER;
-
- return $result;
- }
-
/**
* This function will generate all the PHP code needed to
* change the default of one field using XMLDB objects and functions
$string['aftertable'] = 'After table:';
$string['back'] = 'Back';
$string['backtomainview'] = 'Back to main';
-$string['binaryincorrectlength'] = 'Incorrect length for binary field';
$string['cannotuseidfield'] = 'Cannot insert the "id" field. It is an autonumeric column';
$string['completelogbelow'] = '(see the complete log of the search below)';
$string['confirmdeletefield'] = 'Are you absolutely sure that you want to delete the field:';
$string['table'] = 'Table';
$string['tablenameempty'] = 'The table name cannot be empty';
$string['tables'] = 'Tables';
-$string['textincorrectlength'] = 'Incorrect length for text field';
$string['unload'] = 'Unload';
$string['up'] = 'Up';
$string['view'] = 'View';
$string['auth_dbsybasequotinghelp'] = 'Sybase style single quote escaping - needed for Oracle, MS SQL and some other databases. Do not use for MySQL!';
$string['auth_dbtable'] = 'Name of the table in the database';
$string['auth_dbtable_key'] = 'Table';
-$string['auth_dbtype'] = 'The database type (See the <a href="../lib/adodb/readme.htm#drivers">ADOdb documentation</a> for details)';
+$string['auth_dbtype'] = 'The database type (See the <a href="http://phplens.com/adodb/supported.databases.html" target="_blank">ADOdb documentation</a> for details)';
$string['auth_dbtype_key'] = 'Database';
$string['auth_dbupdatinguser'] = 'Updating user {$a->name} id {$a->id}';
$string['auth_dbuser'] = 'Username with read access to the database';
'visible', 'hiddensections', 'groupmode', 'groupmodeforce',
'defaultgroupingid', 'lang', 'theme',
'timecreated', 'timemodified',
- 'requested', 'restrictmodules',
+ 'requested',
'enablecompletion', 'completionstartonenrol', 'completionnotify'));
$category = new backup_nested_element('category', array('id'), array(
$tag = new backup_nested_element('tag', array('id'), array(
'name', 'rawname'));
- $allowedmodules = new backup_nested_element('allowed_modules');
-
- $module = new backup_nested_element('module', array(), array('modulename'));
-
// attach format plugin structure to $course element, only one allowed
$this->add_plugin_structure('format', $course, false);
$course->add_child($tags);
$tags->add_child($tag);
- $course->add_child($allowedmodules);
- $allowedmodules->add_child($module);
-
// Set the sources
$courserec = $DB->get_record('course', array('id' => $this->task->get_courseid()));
backup_helper::is_sqlparam('course'),
backup::VAR_PARENTID));
- $module->set_source_sql('SELECT m.name AS modulename
- FROM {modules} m
- JOIN {course_allowed_modules} cam ON m.id = cam.module
- WHERE course = ?', array(backup::VAR_COURSEID));
-
// Some annotations
$course->annotate_ids('grouping', 'defaultgroupingid');
* the course record (never inserting)
*/
class restore_course_structure_step extends restore_structure_step {
+ /**
+ * @var bool this gets set to true by {@link process_course()} if we are
+ * restoring an old coures that used the legacy 'module security' feature.
+ * If so, we have to do more work in {@link after_execute()}.
+ */
+ protected $legacyrestrictmodules = false;
+
+ /**
+ * @var array Used when {@link $legacyrestrictmodules} is true. This is an
+ * array with array keys the module names ('forum', 'quiz', etc.). These are
+ * the modules that are allowed according to the data in the backup file.
+ * In {@link after_execute()} we then have to prevent adding of all the other
+ * types of activity.
+ */
+ protected $legacyallowedmodules = array();
protected function define_structure() {
$data->hiddensections = 0;
}
- // Only restrict modules if original course was and target site too for new courses
- $data->restrictmodules = $data->restrictmodules && !empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor == 'all';
+ // Set legacyrestrictmodules to true if the course was resticting modules. If so
+ // then we will need to process restricted modules after execution.
+ $this->legacyrestrictmodules = !empty($data->restrictmodules);
$data->startdate= $this->apply_date_offset($data->startdate);
if ($data->defaultgroupingid) {
}
public function process_allowed_module($data) {
- global $CFG, $DB;
-
$data = (object)$data;
- // only if enabled by admin setting
- if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor == 'all') {
- $available = get_plugin_list('mod');
- $mname = $data->modulename;
- if (array_key_exists($mname, $available)) {
- if ($module = $DB->get_record('modules', array('name' => $mname, 'visible' => 1))) {
- $rec = new stdclass();
- $rec->course = $this->get_courseid();
- $rec->module = $module->id;
- if (!$DB->record_exists('course_allowed_modules', (array)$rec)) {
- $DB->insert_record('course_allowed_modules', $rec);
- }
- }
- }
+ // Backwards compatiblity support for the data that used to be in the
+ // course_allowed_modules table.
+ if ($this->legacyrestrictmodules) {
+ $this->legacyallowedmodules[$data->modulename] = 1;
}
}
protected function after_execute() {
+ global $DB;
+
// Add course related files, without itemid to match
$this->add_related_files('course', 'summary', null);
$this->add_related_files('course', 'legacy', null);
+
+ // Deal with legacy allowed modules.
+ if ($this->legacyrestrictmodules) {
+ $context = context_course::instance($this->get_courseid());
+
+ list($roleids) = get_roles_with_cap_in_context($context, 'moodle/course:manageactivities');
+ list($managerroleids) = get_roles_with_cap_in_context($context, 'moodle/site:config');
+ foreach ($managerroleids as $roleid) {
+ unset($roleids[$roleid]);
+ }
+
+ foreach (get_plugin_list('mod') as $modname => $notused) {
+ if (isset($this->legacyallowedmodules[$modname])) {
+ // Module is allowed, no worries.
+ continue;
+ }
+
+ $capability = 'mod/' . $modname . ':addinstance';
+ foreach ($roleids as $roleid) {
+ assign_capability($capability, CAP_PREVENT, $roleid, $context);
+ }
+ }
+ }
}
}
if ($this->is_circular_reference($dependency->get_dependent_setting())) {
$a = new stdclass();
$a->alreadydependent = $this->name;
- $a->main = $dependentsetting->get_name();
+ $a->main = $dependency->get_dependent_setting()->get_name();
throw new base_setting_exception('setting_circular_reference', $a);
}
$this->dependencies[$dependency->get_dependent_setting()->get_name()] = $dependency;
require_once($CFG->dirroot . '/backup/backup.class.php');
require_once($CFG->dirroot . '/backup/util/settings/base_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/backup_setting.class.php');
+require_once($CFG->dirroot . '/backup/util/settings/setting_dependency.class.php');
require_once($CFG->dirroot . '/backup/util/settings/root/root_backup_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/activity/activity_backup_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/section/section_backup_setting.class.php');
require_once($CFG->dirroot . '/backup/util/settings/course/course_backup_setting.class.php');
+require_once($CFG->dirroot . '/backup/util/ui/backup_ui_setting.class.php');
/*
* setting tests (all)
$this->assertEqual($e->a->alreadydependent, 'test4');
}
+ $bs1 = new mock_base_setting('test1', base_setting::IS_INTEGER, null);
+ $bs2 = new mock_base_setting('test2', base_setting::IS_INTEGER, null);
+ $bs1->register_dependency(new setting_dependency_disabledif_empty($bs1, $bs2));
+ try {
+ // $bs1 is already dependent on $bs2 so this should fail.
+ $bs2->register_dependency(new setting_dependency_disabledif_empty($bs2, $bs1));
+ $this->assertTrue(false, 'base_setting_exception expected');
+ } catch (exception $e) {
+ $this->assertTrue($e instanceof base_setting_exception);
+ $this->assertEqual($e->errorcode, 'setting_circular_reference');
+ $this->assertTrue($e->a instanceof stdclass);
+ $this->assertEqual($e->a->main, 'test1');
+ $this->assertEqual($e->a->alreadydependent, 'test2');
+ }
+
// Create 3 settings and observe between them, last one must
// automatically inherit all the settings defined in the main one
$bs1 = new mock_base_setting('test1', base_setting::IS_INTEGER, null);
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="title"/>
- <FIELD NAME="title" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="userid" NEXT="preferredtitle"/>
+ <FIELD NAME="title" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="userid" NEXT="preferredtitle"/>
<FIELD NAME="preferredtitle" TYPE="char" LENGTH="64" NOTNULL="true" SEQUENCE="false" PREVIOUS="title" NEXT="description"/>
- <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="preferredtitle" NEXT="shared"/>
+ <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="preferredtitle" NEXT="shared"/>
<FIELD NAME="shared" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="description" NEXT="url"/>
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="shared"/>
</FIELDS>
$mform->setDefault('repeats', 1);
$mform->disabledIf('repeats','repeat','notchecked');
- } else if ($repeatedevents > 0) {
+ } else if ($repeatedevents) {
$mform->addElement('hidden', 'repeatid');
$mform->setType('repeatid', PARAM_INT);
$mform->addElement('header', 'repeatedevents', get_string('repeatedevents', 'calendar'));
- $mform->addElement('checkbox', 'repeateditall', null, get_string('repeateditall', 'calendar', $repeatedevents), 'repeat');
- $mform->setDefault('repeateditall', 'checked');
+ $mform->addElement('radio', 'repeateditall', null, get_string('repeateditall', 'calendar', $this->_customdata->event->eventrepeats), 1);
+ $mform->addElement('radio', 'repeateditall', null, get_string('repeateditthis', 'calendar'), 0);
+
+ $mform->setDefault('repeateditall', 1);
}
$ev = new iCalendar_event;
$ev->add_property('uid', $event->id.'@'.$hostaddress);
$ev->add_property('summary', $event->name);
- $ev->add_property('description', $event->description);
+ $ev->add_property('description', clean_param($event->description, PARAM_NOTAGS));
$ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL
$ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified));
$ev->add_property('dtstamp', Bennu::timestamp_to_datetime()); // now
$table = new html_table();
$table->attributes = array('class'=>'calendarmonth calendartable');
+ $time = make_timestamp($calendar->year, $calendar->month);
+ $table->summary = get_string('calendarheading', 'calendar', userdate($time, get_string('strftimemonthyear')));
$table->data = array();
$header = new html_table_row();
// memory limit to something higher.
// The value for the settings should be a valid PHP memory value. e.g. 512M, 1G
//
-// $CFG->extramemorylimit = 1G;
+// $CFG->extramemorylimit = '1G';
//
// The CSS files the Moodle produces can be extremely large and complex, especially
// if you are using a custom theme that builds upon several other themes.
} else {
var current = args.state.get('value');
-
+ var modulename = args.modulename.get('value');
if (current == 1) {
+ var altstr = M.str.completion['completion-alt-manual-y'].replace('{$a}', modulename);
+ var titlestr = M.str.completion['completion-title-manual-y'].replace('{$a}', modulename);
args.state.set('value', 0);
args.image.set('src', M.util.image_url('i/completion-manual-y', 'moodle'));
- args.image.set('alt', M.str.completion['completion-alt-manual-y']);
- args.image.set('title', M.str.completion['completion-title-manual-y']);
+ args.image.set('alt', altstr);
+ args.image.set('title', titlestr);
} else {
+ var altstr = M.str.completion['completion-alt-manual-n'].replace('{$a}', modulename);
+ var titlestr = M.str.completion['completion-title-manual-n'].replace('{$a}', modulename);
args.state.set('value', 1);
args.image.set('src', M.util.image_url('i/completion-manual-n', 'moodle'));
- args.image.set('alt', M.str.completion['completion-alt-manual-n']);
- args.image.set('title', M.str.completion['completion-title-manual-n']);
+ args.image.set('alt', altstr);
+ args.image.set('title', titlestr);
}
}
var completionstate = 0;
var state = null;
var image = null;
+ var modulename = null;
var inputs = Y.Node.getDOMNode(form).getElementsByTagName('input');
for (var i=0; i<inputs.length; i++) {
completionstate = inputs[i].value;
state = Y.one(inputs[i]);
break;
+ case 'modulename':
+ modulename = Y.one(inputs[i]);
+ break;
}
if (inputs[i].type == 'image') {
image = Y.one(inputs[i]);
success: handle_success,
failure: handle_failure
},
- arguments: {state: state, image: image, ajax: ajax}
+ arguments: {state: state, image: image, ajax: ajax, modulename: modulename}
};
Y.use('io-base', function(Y) {
// Prepare course and the editor
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes'=>$CFG->maxbytes, 'trusttext'=>false, 'noclean'=>true);
if (!empty($course)) {
- $allowedmods = array();
- if ($am = $DB->get_records('course_allowed_modules', array('course'=>$course->id))) {
- foreach ($am as $m) {
- $allowedmods[] = $m->module;
- }
- } else {
- // this happens in case we edit course created before enabling module restrictions or somebody disabled everything :-(
- if (empty($course->restrictmodules) and !empty($CFG->defaultallowedmodules)) {
- $allowedmods = explode(',', $CFG->defaultallowedmodules);
- }
- }
- $course->allowedmods = $allowedmods;
//add context for editor
$editoroptions['context'] = $coursecontext;
$course = file_prepare_standard_editor($course, 'summary', $editoroptions, $coursecontext, 'course', 'summary', 0);
$mform->setDefault('completionstartonenrol',0);
}
-//--------------------------------------------------------------------------------
- if (has_capability('moodle/site:config', $systemcontext)) {
- if (((!empty($course->requested) && $CFG->restrictmodulesfor == 'requested') || $CFG->restrictmodulesfor == 'all')) {
- $mform->addElement('header', '', get_string('restrictmodules'));
-
- $options = array();
- $options['0'] = get_string('no');
- $options['1'] = get_string('yes');
- $mform->addElement('select', 'restrictmodules', get_string('restrictmodules'), $options);
- if (!empty($CFG->restrictbydefault)) {
- $mform->setDefault('restrictmodules', 1);
- }
-
- $mods = array(0=>get_string('allownone'));
- $allmods = $DB->get_records_menu('modules', array('visible' => 1),
- 'name', 'id, name');
- foreach ($allmods as $key => $value) {
- // Add module to list unless it cannot be added by users anyway
- if (plugin_supports('mod', $value, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER) !==
- MOD_ARCHETYPE_SYSTEM) {
- $mods[$key] = get_string('pluginname', $value);
- }
- }
- $mform->addElement('select', 'allowedmods', get_string('to'), $mods, array('multiple'=>'multiple', 'size'=>'10'));
- $mform->disabledIf('allowedmods', 'restrictmodules', 'eq', 0);
- // defaults are already in $course
- } else {
- // remove any mod restriction
- $mform->addElement('hidden', 'restrictmodules', 0);
- $mform->setType('restrictmodules', PARAM_INT);
- }
- } else {
- $mform->addElement('hidden', 'restrictmodules');
- $mform->setType('restrictmodules', PARAM_INT);
- if (empty($course->id)) {
- $mform->setConstant('restrictmodules', (int)($CFG->restrictmodulesfor == 'all'));
- } else {
- // keep previous
- $mform->setConstant('restrictmodules', $course->restrictmodules);
- }
- }
-
/// customizable role names in this course
//--------------------------------------------------------------------------------
$mform->addElement('header','rolerenaming', get_string('rolerenaming'));
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
mark_context_dirty('/'.SYSCONTEXTID);
fix_course_sortorder(); // Required to build course_categories.depth and .path.
+ set_config('defaultrequestcategory', $tempcat->id);
}
/// Move a category to a new parent if required
print_category_edit($cat, $displaylist, $parentslist, $depth+1, $up, $down);
}
}
-}
\ No newline at end of file
+}
}
if ($completionicon) {
$imgsrc = $OUTPUT->pix_url('i/completion-'.$completionicon);
- $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion'));
+ $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion', $mod->name));
if ($completion == COMPLETION_TRACKING_MANUAL && !$isediting) {
- $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion'));
+ $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion', $mod->name));
$newstate =
$completiondata->completionstate==COMPLETION_COMPLETE
? COMPLETION_INCOMPLETE
echo "
<form class='togglecompletion$extraclass' method='post' action='".$CFG->wwwroot."/course/togglecompletion.php'><div>
<input type='hidden' name='id' value='{$mod->id}' />
+<input type='hidden' name='modulename' value='".s($mod->name)."' />
<input type='hidden' name='sesskey' value='".sesskey()."' />
<input type='hidden' name='completionstate' value='$newstate' />
<input type='image' src='$imgsrc' alt='$imgalt' title='$imgtitle' />
return false;
}
- $urlbase = "/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey().'&add=';
+ // Retrieve all modules with associated metadata
+ $modules = get_module_metadata($course, $modnames);
+ // We'll sort resources and activities into two lists
$resources = array();
$activities = array();
- foreach($modnames as $modname=>$modnamestr) {
- if (!course_allowed_module($course, $modname)) {
- continue;
- }
+ // We need to add the section section to the link for each module
+ $sectionlink = '§ion=' . $section;
- $libfile = "$CFG->dirroot/mod/$modname/lib.php";
- if (!file_exists($libfile)) {
- continue;
- }
- include_once($libfile);
- $gettypesfunc = $modname.'_get_types';
- if (function_exists($gettypesfunc)) {
+ foreach ($modules as $module) {
+ if (isset($module->types)) {
+ // This module has a subtype
// NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
- if ($types = $gettypesfunc()) {
- $menu = array();
- $atype = null;
- $groupname = null;
- foreach($types as $type) {
- if ($type->typestr === '--') {
- continue;
- }
- if (strpos($type->typestr, '--') === 0) {
- $groupname = str_replace('--', '', $type->typestr);
- continue;
- }
- $type->type = str_replace('&', '&', $type->type);
- if ($type->modclass == MOD_CLASS_RESOURCE) {
- $atype = MOD_CLASS_RESOURCE;
- }
- $menu[$urlbase.$type->type] = $type->typestr;
+ $subtypes = array();
+ foreach ($module->types as $subtype) {
+ $subtypes[$subtype->link . $sectionlink] = $subtype->title;
+ }
+
+ // Sort module subtypes into the list
+ if (!empty($module->title)) {
+ // This grouping has a name
+ if ($module->archetype == MOD_CLASS_RESOURCE) {
+ $resources[] = array($module->title=>$subtypes);
+ } else {
+ $activities[] = array($module->title=>$subtypes);
}
- if (!is_null($groupname)) {
- if ($atype == MOD_CLASS_RESOURCE) {
- $resources[] = array($groupname=>$menu);
- } else {
- $activities[] = array($groupname=>$menu);
- }
+ } else {
+ // This grouping does not have a name
+ if ($module->archetype == MOD_CLASS_RESOURCE) {
+ $resources = array_merge($resources, $subtypes);
} else {
- if ($atype == MOD_CLASS_RESOURCE) {
- $resources = array_merge($resources, $menu);
- } else {
- $activities = array_merge($activities, $menu);
- }
+ $activities = array_merge($activities, $subtypes);
}
}
} else {
- $archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
- if ($archetype == MOD_ARCHETYPE_RESOURCE) {
- $resources[$urlbase.$modname] = $modnamestr;
- } else if ($archetype === MOD_ARCHETYPE_SYSTEM) {
+ // This module has no subtypes
+ if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
+ $resources[$module->link . $sectionlink] = $module->title;
+ } else if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
// System modules cannot be added by user, do not add to dropdown
} else {
- // all other archetypes are considered activity
- $activities[$urlbase.$modname] = $modnamestr;
+ $activities[$module->link . $sectionlink] = $module->title;
}
}
}
}
}
+/**
+ * Retrieve all metadata for the requested modules
+ *
+ * @param object $course The Course
+ * @param array $modnames An array containing the list of modules and their
+ * names
+ * @return array A list of stdClass objects containing metadata about each
+ * module
+ */
+function get_module_metadata($course, $modnames) {
+ global $CFG, $OUTPUT;
+
+ // get_module_metadata will be called once per section on the page and courses may show
+ // different modules to one another
+ static $modlist = array();
+ if (!isset($modlist[$course->id])) {
+ $modlist[$course->id] = array();
+ }
+
+ $return = array();
+ $urlbase = "/course/mod.php?id=$course->id&sesskey=".sesskey().'&add=';
+ foreach($modnames as $modname => $modnamestr) {
+ if (!course_allowed_module($course, $modname)) {
+ continue;
+ }
+ if (isset($modlist[$modname])) {
+ // This module is already cached
+ $return[$modname] = $modlist[$course->id][$modname];
+ continue;
+ }
+
+ // Include the module lib
+ $libfile = "$CFG->dirroot/mod/$modname/lib.php";
+ if (!file_exists($libfile)) {
+ continue;
+ }
+ include_once($libfile);
+
+ // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
+ $gettypesfunc = $modname.'_get_types';
+ if (function_exists($gettypesfunc)) {
+ if ($types = $gettypesfunc()) {
+ $group = new stdClass();
+ $group->name = $modname;
+ $group->icon = $OUTPUT->pix_icon('icon', '', $modname, array('class' => 'icon'));
+ foreach($types as $type) {
+ if ($type->typestr === '--') {
+ continue;
+ }
+ if (strpos($type->typestr, '--') === 0) {
+ $group->title = str_replace('--', '', $type->typestr);
+ continue;
+ }
+ // Set the Sub Type metadata
+ $subtype = new stdClass();
+ $subtype->title = $type->typestr;
+ $subtype->type = str_replace('&', '&', $type->type);
+ $subtype->name = preg_replace('/.*type=/', '', $subtype->type);
+ $subtype->archetype = $type->modclass;
+
+ // The group archetype should match the subtype archetypes and all subtypes
+ // should have the same archetype
+ $group->archetype = $subtype->archetype;
+
+ if (get_string_manager()->string_exists('help' . $subtype->name, $modname)) {
+ $subtype->help = get_string('help' . $subtype->name, $modname);
+ }
+ $subtype->link = $urlbase . $subtype->type;
+ $group->types[] = $subtype;
+ }
+ $modlist[$course->id][$modname] = $group;
+ }
+ } else {
+ $module = new stdClass();
+ $module->title = get_string('modulename', $modname);
+ $module->name = $modname;
+ $module->link = $urlbase . $modname;
+ $module->icon = $OUTPUT->pix_icon('icon', '', $module->name, array('class' => 'icon'));
+ if (get_string_manager()->string_exists('modulename_help', $modname)) {
+ $module->help = get_string('modulename_help', $modname);
+ }
+ $module->archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
+ $modlist[$course->id][$modname] = $module;
+ }
+ $return[$modname] = $modlist[$course->id][$modname];
+ }
+
+ return $return;
+}
+
/**
* Return the course category context for the category with id $categoryid, except
* that if $categoryid is 0, return the system context.
}
}
-function update_restricted_mods($course, $mods) {
- global $DB;
-
-/// Delete all the current restricted list
- $DB->delete_records('course_allowed_modules', array('course'=>$course->id));
-
- if (empty($course->restrictmodules)) {
- return; // We're done
- }
-
-/// Insert the new list of restricted mods
- foreach ($mods as $mod) {
- if ($mod == 0) {
- continue; // this is the 'allow none' option
- }
- $am = new stdClass();
- $am->course = $course->id;
- $am->module = $mod;
- $DB->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)
+ * Is the user allowed to add this type of module to this course?
+ * @param object $course the course settings. Only $course->id is used.
+ * @param string $modname the module name. E.g. 'forum' or 'quiz'.
+ * @return bool whether the current user is allowed to add this type of module to this course.
*/
-
-function course_allowed_module($course,$mod) {
+function course_allowed_module($course, $modname) {
global $DB;
- if (empty($course->restrictmodules)) {
- return true;
+ if (is_numeric($modname)) {
+ throw new coding_exception('Function course_allowed_module no longer
+ supports numeric module ids. Please update your code to pass the module name.');
}
- // Admins and admin-like people who can edit everything can also add anything.
- // Originally there was a course:update test only, but it did not match the test in course edit form
- if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
- return true;
- }
+ $capability = 'mod/' . $modname . ':addinstance';
+ if (!get_capability_info($capability)) {
+ // Debug warning that the capability does not exist, but no more than once per page.
+ static $warned = array();
+ $archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
+ if (!isset($warned[$modname]) && $archetype !== MOD_ARCHETYPE_SYSTEM) {
+ debugging('The module ' . $modname . ' does not define the standard capability ' .
+ $capability , DEBUG_DEVELOPER);
+ $warned[$modname] = 1;
+ }
- if (is_numeric($mod)) {
- $modid = $mod;
- } else if (is_string($mod)) {
- $modid = $DB->get_field('modules', 'id', array('name'=>$mod));
- }
- if (empty($modid)) {
- return false;
+ // If the capability does not exist, the module can always be added.
+ return true;
}
- return $DB->record_exists('course_allowed_modules', array('course'=>$course->id, 'module'=>$modid));
+ $coursecontext = context_course::instance($course->id);
+ return has_capability($capability, $coursecontext);
}
/**
fix_course_sortorder();
- // update module restrictions
- if ($course->restrictmodules) {
- if (isset($data->allowedmods)) {
- update_restricted_mods($course, $data->allowedmods);
- } else {
- if (!empty($CFG->defaultallowedmodules)) {
- update_restricted_mods($course, explode(',', $CFG->defaultallowedmodules));
- }
- }
- }
-
// new context created - better mark it as dirty
mark_context_dirty($context->path);
// Test for and remove blocks which aren't appropriate anymore
blocks_remove_inappropriate($course);
- // update module restrictions
- if (isset($data->allowedmods)) {
- update_restricted_mods($course, $data->allowedmods);
- }
-
// Save any custom role names.
save_local_role_names($course->id, $data);
// Set misc settings
$data->requested = 1;
- if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) {
- $data->restrictmodules = 1;
- }
// Apply course default settings
$data->format = $courseconfig->format;
$cw = get_course_section($section, $course->id);
- if (!course_allowed_module($course, $module->id)) {
+ if (!course_allowed_module($course, $module->name)) {
print_error('moduledisable');
}
$PAGE->set_title("$course->shortname: $strrecentactivity");
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
-echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo", 3);
+echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo", 2);
$mform->display();
$modfullname = $modnames[$cm->modname];
$image = "<img src=\"" . $OUTPUT->pix_url('icon', $cm->modname) . "\" class=\"icon\" alt=\"$modfullname\" />";
- echo "<h4>$image $modfullname".
- " <a href=\"$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id\" $linkformat>$name</a></h4>";
+ echo "<h3>$image $modfullname".
+ " <a href=\"$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id\" $linkformat>$name</a></h3>";
}
} else {
} else {
- echo '<h4><center>' . get_string('norecentactivity') . '</center></h2>';
+ echo '<h3><center>' . get_string('norecentactivity') . '</center></h3>';
}
// checks whether user can do site backup
if (has_capability('moodle/backup:backupcourse', $coursecontext)) {
- echo "<a title=\"".get_string("backup")."\" href=\"../backup/backup.php?id=$course->id\">\n<img".
+ $backupurl = new moodle_url('/backup/backup.php', array('id' => $course->id));
+ echo "<a title=\"".get_string("backup")."\" href=\"".$backupurl."\">\n<img".
" src=\"" . $OUTPUT->pix_url('t/backup') . "\" class=\"iconsmall\" alt=\"".get_string("backup")."\" /></a>\n ";
}
// checks whether user can do restore
if (has_capability('moodle/restore:restorecourse', $coursecontext)) {
- echo "<a title=\"".get_string("restore")."\" href=\"../files/index.php?id=$course->id&wdir=/backupdata\">\n<img".
+ $restoreurl = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id));
+ echo "<a title=\"".get_string("restore")."\" href=\"".$restoreurl."\">\n<img".
" src=\"" . $OUTPUT->pix_url('t/restore') . "\" class=\"iconsmall\" alt=\"".get_string("restore")."\" /></a>\n ";
}
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$lastuserid";
$a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$lastuserid";
$emailmessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
- $subject = get_string("enrolmentnew", '', format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))));
+ $subject = get_string("enrolmentnew", 'enrol', format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))));
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$string['defaultrole_desc'] = 'The role that will be assigned by default if no other role is specified in external table.';
$string['ignorehiddencourses'] = 'Ignore hidden courses';
$string['ignorehiddencourses_desc'] = 'If enabled users will not be enrolled on courses that are set to be unavailable to students.';
+$string['localcategoryfield'] = 'Local category field';
$string['localcoursefield'] = 'Local course field';
$string['localrolefield'] = 'Local role field';
$string['localuserfield'] = 'Local user field';
$string['newcoursetable'] = 'Remote new courses table';
$string['newcoursetable_desc'] = 'Specify of the name of the table that contains list of courses that should be created automatically. Empty means no courses are created.';
-$string['newcoursecategory'] = 'New course category id field';
+$string['newcoursecategory'] = 'New course category field';
$string['newcoursefullname'] = 'New course full name field';
$string['newcourseidnumber'] = 'New course ID number field';
$string['newcourseshortname'] = 'New course short name field';
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
- if ($this->allow_unenrol_user($instance, $ue) && has_capability('enrol/meta:unenrol', $context)) {
+ if ($this->allow_unenrol_user($instance, $ue) && has_capability('enrol/database:unenrol', $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', ''), get_string('unenrol', 'enrol'), $url, array('class'=>'unenrollink', 'rel'=>$ue->id));
}
$idnumber = strtolower($this->get_config('newcourseidnumber'));
$category = strtolower($this->get_config('newcoursecategory'));
+ $localcategoryfield = $this->get_config('localcategoryfield', 'id');
+
$sqlfields = array($fullname, $shortname);
if ($category) {
$sqlfields[] = $category;
}
continue;
}
- if ($category and !$DB->record_exists('course_categories', array('id'=>$fields[$category]))) {
+ if ($category and !$coursecategory = $DB->get_record('course_categories', array($localcategoryfield=>$fields[$category]), 'id')) {
if ($verbose) {
- mtrace(' error: invalid category id, can not create course: '.$fields[$shortname]);
+ mtrace(' error: invalid category '.$localcategoryfield.', can not create course: '.$fields[$shortname]);
}
continue;
}
$course = new stdClass();
$course->fullname = $fields[$fullname];
$course->shortname = $fields[$shortname];
- $course->idnumber = $idnumber ? $fields[$idnumber] : NULL;
- $course->category = $category ? $fields[$category] : NULL;
+ $course->idnumber = $idnumber ? $fields[$idnumber] : '';
+ $course->category = $category ? $coursecategory->id : NULL;
$createcourses[] = $course;
}
}
$options = array('id'=>'id', 'shortname'=>'shortname', 'fullname'=>'fullname');
$settings->add(new admin_setting_configselect('enrol_database/localrolefield', get_string('localrolefield', 'enrol_database'), '', 'shortname', $options));
+ $options = array('id'=>'id', 'idnumber'=>'idnumber');
+ $settings->add(new admin_setting_configselect('enrol_database/localcategoryfield', get_string('localcategoryfield', 'enrol_database'), '', 'id', $options));
$settings->add(new admin_setting_heading('enrol_database_remoteheader', get_string('settingsheaderremote', 'enrol_database'), ''));
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2012022700; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2012031000; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012022300; // Requires this Moodle version
$plugin->component = 'enrol_database'; // Full name of the plugin (used for diagnostics)
//TODO: should we add cron sync?
\ No newline at end of file
$userroles = $this->get_other_users($sort, $direction, $page, $perpage);
$roles = $this->get_all_roles();
- $courseid = $this->get_course()->id;
$context = $this->get_context();
+ $now = time();
+ $extrafields = get_extra_user_fields($context);
$users = array();
foreach ($userroles as $userrole) {
if (!array_key_exists($userrole->id, $users)) {
- $users[$userrole->id] = array(
- 'userid' => $userrole->id,
- 'courseid' => $courseid,
- 'picture' => new user_picture($userrole),
- 'firstname' => fullname($userrole, true),
- 'email' => $userrole->email,
- 'roles' => array()
- );
+ $users[$userrole->id] = $this->prepare_user_for_display($userrole, $extrafields, $now);
}
$a = new stdClass;
$a->role = $roles[$userrole->roleid]->localname;
break;
}
}
+ $users[$userrole->id]['roles'] = array();
$users[$userrole->id]['roles'][$userrole->roleid] = array(
'text' => $roletext,
'unchangeable' => !$changeable
$users = $this->get_users($sort, $direction, $page, $perpage);
$now = time();
- $strnever = get_string('never');
$straddgroup = get_string('addgroup', 'group');
$strunenrol = get_string('unenrol', 'enrol');
$stredit = get_string('edit');
$allroles = $this->get_all_roles();
$assignable = $this->get_assignable_roles();
$allgroups = $this->get_all_groups();
- $courseid = $this->get_course()->id;
$context = $this->get_context();
$canmanagegroups = has_capability('moodle/course:managegroups', $context);
$userdetails = array();
foreach ($users as $user) {
- $details = array(
- 'userid' => $user->id,
- 'courseid' => $courseid,
- 'picture' => new user_picture($user),
- 'firstname' => fullname($user, true),
- 'lastseen' => $strnever,
- 'roles' => array(),
- 'groups' => array(),
- 'enrolments' => array()
- );
- foreach ($extrafields as $field) {
- $details[$field] = $user->{$field};
- }
-
- if ($user->lastaccess) {
- $details['lastseen'] = format_time($now - $user->lastaccess);
- }
+ $details = $this->prepare_user_for_display($user, $extrafields, $now);
// Roles
+ $details['roles'] = array();
foreach ($this->get_user_roles($user->id) as $rid=>$rassignable) {
$details['roles'][$rid] = array('text'=>$allroles[$rid]->localname, 'unchangeable'=>(!$rassignable || !isset($assignable[$rid])));
}
// Users
$usergroups = $this->get_user_groups($user->id);
+ $details['groups'] = array();
foreach($usergroups as $gid=>$unused) {
$details['groups'][$gid] = $allgroups[$gid]->name;
}
// Enrolments
+ $details['enrolments'] = array();
foreach ($this->get_user_enrolments($user->id) as $ue) {
if ($ue->timestart and $ue->timeend) {
$period = get_string('periodstartend', 'enrol', array('start'=>userdate($ue->timestart), 'end'=>userdate($ue->timeend)));
return $userdetails;
}
+ /**
+ * Prepare a user record for display
+ *
+ * This function is called by both {@link get_users_for_display} and {@link get_other_users_for_display} to correctly
+ * prepare user fields for display
+ *
+ * Please note that this function does not check capability for moodle/coures:viewhiddenuserfields
+ *
+ * @param object $user The user record
+ * @param array $extrafields The list of fields as returned from get_extra_user_fields used to determine which
+ * additional fields may be displayed
+ * @param int $now The time used for lastaccess calculation
+ * @return array The fields to be displayed including userid, courseid, picture, firstname, lastseen and any
+ * additional fields from $extrafields
+ */
+ private function prepare_user_for_display($user, $extrafields, $now) {
+ $details = array(
+ 'userid' => $user->id,
+ 'courseid' => $this->get_course()->id,
+ 'picture' => new user_picture($user),
+ 'firstname' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
+ 'lastseen' => get_string('never'),
+ );
+ foreach ($extrafields as $field) {
+ $details[$field] = $user->{$field};
+ }
+
+ if ($user->lastaccess) {
+ $details['lastseen'] = format_time($now - $user->lastaccess);
+ }
+ return $details;
+ }
+
public function get_manual_enrol_buttons() {
$plugins = $this->get_enrolment_plugins();
$buttons = array();
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011112900; // Requires this Moodle version
$plugin->component = 'enrol_manual'; // Full name of the plugin (used for diagnostics)
params['role'] = this.get(UEP.BASE).one('.'+CSS.ENROLMENTOPTION+'.'+CSS.ROLE+' select').get('value');
params['startdate'] = this.get(UEP.BASE).one('.'+CSS.ENROLMENTOPTION+'.'+CSS.STARTDATE+' select').get('value');
params['duration'] = this.get(UEP.BASE).one('.'+CSS.ENROLMENTOPTION+'.'+CSS.DURATION+' select').get('value');
- params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0;
+ if (this.get(UEP.DISABLEGRADEHISTORY) != true) {
+ params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0;
+ } else {
+ params['recovergrades'] = 0;
+ }
Y.io(M.cfg.wwwroot+this.get(UEP.AJAXURL), {
method:'POST',
$table = new course_enrolment_other_users_table($manager, $PAGE);
$PAGE->set_url('/enrol/otherusers.php', $manager->get_url_params()+$table->get_url_params());
-/***
- * Actions will go here
- */
+$userdetails = array (
+ 'picture' => false,
+ 'firstname' => get_string('firstname'),
+ 'lastname' => get_string('lastname'),
+);
+$extrafields = get_extra_user_fields($context);
+foreach ($extrafields as $field) {
+ $userdetails[$field] = get_user_field_name($field);
+}
-/*$fields = array(
- 'userdetails' => array (
- 'picture' => false,
- 'firstname' => get_string('firstname'),
- 'lastname' => get_string('lastname'),
- 'email' => get_string('email')
- ),
- 'lastseen' => get_string('lastaccess'),
- 'role' => array(
- 'roles' => get_string('roles', 'role'),
- 'context' => get_string('context')
- )
-);*/
$fields = array(
- 'userdetails' => array (
- 'picture' => false,
- 'firstname' => get_string('firstname'),
- 'lastname' => get_string('lastname'),
- 'email' => get_string('email')
- ),
+ 'userdetails' => $userdetails,
'lastseen' => get_string('lastaccess'),
'role' => get_string('roles', 'role')
);
+
+// Remove hidden fields if the user has no access
+if (!has_capability('moodle/course:viewhiddenuserfields', $context)) {
+ $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
+ if (isset($hiddenfields['lastaccess'])) {
+ unset($fields['lastseen']);
+ }
+}
+
$table->set_fields($fields, $OUTPUT);
//$users = $manager->get_other_users($table->sort, $table->sortdirection, $table->page, $table->perpage);
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $teacher;
$eventdata->userto = $user;
- $eventdata->subject = get_string("enrolmentnew", '', $shortname);
+ $eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname);
$eventdata->fullmessage = get_string('welcometocoursetext', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $user;
$eventdata->userto = $teacher;
- $eventdata->subject = get_string("enrolmentnew", '', $shortname);
- $eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
+ $eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname);
+ $eventdata->fullmessage = get_string('enrolmentnewuser', 'enrol', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $user;
$eventdata->userto = $admin;
- $eventdata->subject = get_string("enrolmentnew", '', $shortname);
- $eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
+ $eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname);
+ $eventdata->fullmessage = get_string('enrolmentnewuser', 'enrol', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
'group' => get_string('groups', 'group'),
'enrol' => get_string('enrolmentinstances', 'enrol')
);
+
+// Remove hidden fields if the user has no access
+if (!has_capability('moodle/course:viewhiddenuserfields', $context)) {
+ $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
+ if (isset($hiddenfields['lastaccess'])) {
+ unset($fields['lastseen']);
+ }
+ if (isset($hiddenfields['groups'])) {
+ unset($fields['group']);
+ }
+}
+
$table->set_fields($fields, $renderer);
$canassign = has_capability('moodle/role:assign', $manager->get_context());
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolledusers', 'enrol'));
echo $renderer->render($table);
-echo $OUTPUT->footer();
\ No newline at end of file
+echo $OUTPUT->footer();
$hidden = '';
$excluded = '';
$class = '';
+ $classfeedback = '';
// If this is a hidden grade category, hide it completely from the user
if ($type == 'category' && $grade_object->is_hidden() && !$this->canviewhidden && (
/// Actual Grade
$gradeval = $grade_grade->finalgrade;
+ if ($this->showfeedback) {
+ // Copy $class before appending itemcenter as feedback should not be centered
+ $classfeedback = $class;
+ }
$class .= " itemcenter ";
if ($this->showweight) {
$data['weight']['class'] = $class;
// Feedback
if ($this->showfeedback) {
if ($grade_grade->overridden > 0 AND ($type == 'categoryitem' OR $type == 'courseitem')) {
- $data['feedback']['class'] = $class.' feedbacktext';
+ $data['feedback']['class'] = $classfeedback.' feedbacktext';
$data['feedback']['content'] = get_string('overridden', 'grades').': ' . format_text($grade_grade->feedback, $grade_grade->feedbackformat);
} else if (empty($grade_grade->feedback) or (!$this->canviewhidden and $grade_grade->is_hidden())) {
- $data['feedback']['class'] = $class.' feedbacktext';
+ $data['feedback']['class'] = $classfeedback.' feedbacktext';
$data['feedback']['content'] = ' ';
} else {
- $data['feedback']['class'] = $class.' feedbacktext';
+ $data['feedback']['class'] = $classfeedback.' feedbacktext';
$data['feedback']['content'] = format_text($grade_grade->feedback, $grade_grade->feedbackformat);
}
}
.user-grade td.item {border-left: 1px solid gray;border-right: 1px solid gray;}
.user-grade td.excluded {background-color: #666;}
.user-grade td.hidden {color: #aaa;}
-.user-grade td.feedbacktext {max-width:600px;padding:0;}
+.user-grade td.feedbacktext {max-width:600px;padding:2px 2px;}
.pagelayout-report .user-grade .feedbacktext .no-overflow {overflow:auto;padding:0.25em;}
table.user-grade td.feedbacktext {text-align:left;width: 40%;font-size: 0.8em;white-space:normal;}
-table.user-grade td.itemcenter {text-align:center;}
\ No newline at end of file
+table.user-grade td.itemcenter {text-align:center;}
// This script used to support group delete, but that has been moved. In case
// anyone still links to it, let's redirect to the new script.
-if($delete) {
- redirect('delete.php?courseid='.$courseid.'&groups='.$id);
+if ($delete) {
+ debugging('Deleting a group through group/group.php is deprecated and will be removed soon. Please use group/delete.php instead');
+ redirect(new moodle_url('delete.php', array('courseid' => $courseid, 'groups' => $id)));
}
+
if ($id) {
if (!$group = $DB->get_record('groups', array('id'=>$id))) {
print_error('invalidgroupid');
$returnurl = $CFG->wwwroot.'/group/index.php?id='.$course->id.'&group='.$id;
-if ($id and $delete) {
- if (!$confirm) {
- $PAGE->set_title(get_string('deleteselectedgroup', 'group'));
- $PAGE->set_heading($course->fullname . ': '. get_string('deleteselectedgroup', 'group'));
- echo $OUTPUT->header();
- $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
- $optionsno = array('id'=>$courseid);
- $formcontinue = new single_button(new moodle_url('group.php', $optionsyes), get_string('yes'), 'get');
- $formcancel = new single_button(new moodle_url($baseurl, $optionsno), get_string('no'), 'get');
- echo $OUTPUT->confirm(get_string('deletegroupconfirm', 'group', $group->name), $formcontinue, $formcancel);
- echo $OUTPUT->footer();
- die;
-
- } else if (confirm_sesskey()){
- if (groups_delete_group($id)) {
- redirect('index.php?id='.$course->id);
- } else {
- print_error('erroreditgroup', 'group', $returnurl);
- }
- }
-}
-
// Prepare the description editor: We do support files for group descriptions
$editoroptions = array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$course->maxbytes, 'trust'=>false, 'context'=>$context, 'noclean'=>true);
if (!empty($group->id)) {
redirect_if_major_upgrade_required();
+ $urlparams = array();
+ if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 0) {
+ $urlparams['redirect'] = 0;
+ }
+ $PAGE->set_url('/', $urlparams);
+ $PAGE->set_course($SITE);
+
if ($CFG->forcelogin) {
require_login();
} else {
$hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
- $urlparams = array();
- if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 0) {
- $urlparams['redirect'] = 0;
- }
- $PAGE->set_url('/', $urlparams);
- $PAGE->set_course($SITE);
-
/// If the site is currently under maintenance, then print a message
if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
print_maintenance_message();
$string['pathswrongadmindir'] = 'ספריית ה-admin לא קיימת';
$string['phpextension'] = 'הרחבת PHP {$a}';
$string['phpversion'] = 'גירסת PHP';
-$string['phpversionhelp'] = '<p>×\92×\99רסת PHP ×\97×\99×\99×\91ת ×\9c×\94×\99×\95ת ×\9cפ×\97×\95ת 4.3.0 ×\90×\95 5.1.0 (×\91×\92×\99רסאות 5.0.x קיימות מספר בעיות ידועות) </p>
-<p> ×\91×\9eער×\9bת ש×\9c×\9a פ×\95×¢×\9cת ×\9bר×\92×¢ ×\92×\99רסת {$a} </p>
-<p> ×\90ת×\94 ×\97×\99×\99×\91 ×\9cש×\93ר×\92 ×\90ת ×\92×\99רסת ×\94-PHP ש×\9c×\9a ×\90×\95 ×\9c×¢×\91×\95ר ×\9c×\9e×\97ש×\91 ×\9e×\90ר×\97 ×¢×\9d ×¢×\9d ×\92×\99רסת PHP ×\97×\93ש×\94! <br/>
-(×\91×\9eקר×\99×\9d ש×\9c ×\92רסת 5.0.x ת×\95×\9b×\9c ×\92×\9d ×\9cר×\93ת ×\91×\92×\99רס×\94 ×\9c- 4.4.x)
+$string['phpversionhelp'] = '<p>×\92רסת PHP ×\97×\99×\99×\91ת ×\9c×\94×\99×\95ת ×\9cפ×\97×\95ת 4.3.0 ×\90×\95 5.1.0 (×\91×\92רסאות 5.0.x קיימות מספר בעיות ידועות) </p>
+<p> במערכת שלך פועלת כרגע גרסת {$a} </p>
+<p> אתה חייב לשדרג את גרסת ה-PHP שלך או לעבור למחשב מארח עם עם גירסת PHP חדשה! <br/>
+(במקרים של גרסת 5.0.x תוכל גם לרדת בגרסה ל- 4.4.x)
</p>';
$string['welcomep10'] = '{$a->installername} ({$a->installerversion})';
$string['welcomep20'] = 'הינך רואה את עמוד זה מפני שהתקנת והפעלת בהלכה את <strong>{$a->packname} {$a->packversion}</strong>
$string['clianswerno'] = 'n';
$string['cliansweryes'] = 's';
+$string['cliincorrectvalueerror'] = 'Erro. Valor "{$a->value}" incorreto para "{$a->option}"';
$string['cliincorrectvalueretry'] = 'Valor incorreto, por favor tente novamente';
$string['clitypevalue'] = 'valor do tipo';
+$string['clitypevaluedefault'] = 'Escreva o valor. Ou Enter para usar o valor por omissão ({$a}).';
$string['cliunknowoption'] = 'Opções desconhecidas:
{$a}
Por favor use a opção --help';
$string['configdebugpageinfo'] = 'Enable if you want page information printed in page footer.';
$string['configdebugsmtp'] = 'Enable verbose debug information during sending of email messages to SMTP server.';
$string['configdebugvalidators'] = 'Enable if you want to have links to external validator servers in page footer. You may need to create new user with username <em>w3cvalidator</em>, and enable guest access. These changes may allow unauthorized access to server, do not enable on production sites!';
-$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['configdefaulthomepage'] = 'This determines the home page for logged in users';
$string['configdefaultrequestcategory'] = 'Courses requested by users will be automatically placed in this category.';
$string['configdefaultrequestedcategory'] = 'Default category to put courses that were requested into, if they\'re approved.';
$string['configrequestedteachername'] = 'Word for teacher used in requested courses';
$string['configrequestedteachersname'] = 'Word for teachers used in requested courses';
$string['configrequiremodintro'] = 'Disable this option if you do not want to force users to enter description of each activity.';
-$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? Note that this setting only applies to teachers, administrators will still be able to add any activity to a course.';
$string['configrunclamavonupload'] = 'When enabled, clam AV will be used to scan all uploaded files.';
$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['configuserquota'] = 'The maximum number of bytes that a user can store in their own private file area. {$a->bytes} bytes == {$a->displaysize}';
$string['curlrequired'] = 'The cURL PHP extension is now required by Moodle, in order to communicate with Moodle repositories.';
$string['curltimeoutkbitrate'] = 'Bitrate to use when calculating cURL timeouts (Kbps)';
$string['curltimeoutkbitrate_help'] = 'This setting is used to calculate an appropriate timeout during large cURL requests. As part of this calculation an HTTP HEAD request is made to determine the size of the content. Setting this to 0 disables this request from being made.';
+$string['currenttheme'] = 'Current theme';
$string['customcheck'] = 'Other checks';
$string['custommenu'] = 'Custom menu';
$string['custommenuitems'] = 'Custom menu items';
$string['debugstringids'] = 'Show origin of languages strings';
$string['debugstringids_desc'] = 'This option is designed to help translators. When this option is enabled, if you add the parameter strings=1 to a request URL, it will show the language file and string id beside each string that is output.';
$string['debugvalidators'] = 'Show validator links';
-$string['defaultallowedmodules'] = 'Default allowed modules';
$string['defaultcity'] = 'Default city';
$string['defaultcity_help'] = 'A city entered here will be the default city when creating new user accounts.';
$string['defaulthomepage'] = 'Default home page for users';
$string['navshowfrontpagemods_help'] = 'If enabled, front page activities will be shown on the navigation under site pages.';
$string['navshowallcourses'] = 'Show all courses';
$string['navshowcategories'] = 'Show course categories';
+$string['navshowmycoursecategories'] = 'Show my course categories';
+$string['navshowmycoursecategories_help'] = 'If enabled courses in the users my courses branch will be shown in categories.';
$string['neverdeleteruns'] = 'Never delete runs';
$string['nobookmarksforuser'] = 'You do not have any bookmarks.';
$string['nodatabase'] = 'No database';
$string['purgecachesfinished']= 'All caches were purged.';
$string['restorernewroleid'] = 'Restorers\' role in courses';
$string['restorernewroleid_help'] = 'If the user does not already have the permission to manage the newly restored course, the user is automatically assigned this role and enrolled if necessary. Select "None" if you do not want restorers to be able to manage every restored course.';
-$string['restrictbydefault'] = 'Restrict modules by default';
-$string['restrictmodulesfor'] = 'Restrict modules for';
$string['reverseproxy'] = 'Reverse proxy';
$string['riskconfig'] = 'Users could change site configuration and behaviour';
$string['riskconfigshort'] = 'Configuration risk';
$string['sectionerror'] = 'Section error!';
$string['secureforms'] = 'Use additional form security';
$string['security'] = 'Security';
+$string['selectdevice'] = 'Select device';
+$string['selecttheme'] = 'Select theme for {$a} device';
$string['server'] = 'Server';
$string['serverchecks'] = 'Server checks';
$string['serverlimit'] = 'Server limit';
$string['themelist'] = 'Theme list';
$string['themenoselected'] = 'No theme selected';
$string['themeresetcaches'] = 'Clear theme caches';
-$string['themeselect'] = 'Select theme';
+$string['themeselect'] = 'Change theme';
$string['themeselector'] = 'Theme selector';
$string['themesettings'] = 'Theme settings';
$string['therewereerrors'] = 'There were errors in your data';
$string['unicoderecommended'] = 'Storing all your data in Unicode (UTF-8) is recommended. New installations should be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).';
$string['unicoderequired'] = 'It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).';
$string['uninstallplugin'] = 'Uninstall';
+$string['unsettheme'] = 'Unset theme';
$string['unsupported'] = 'Unsupported';
$string['unsuspenduser'] = 'Activate user account';
$string['updateaccounts'] = 'Update existing accounts';
$string['quickdownloadcalendar'] = 'Quick download / subscribe to calendar';
$string['recentupcoming'] = 'Recent and next 60 days';
$string['repeatedevents'] = 'Repeated events';
-$string['repeateditall'] = 'Apply changes to all {$a} events in this repeat series';
+$string['repeateditall'] = 'Also apply changes to the other {$a} events in this repeat series';
$string['repeateditthis'] = 'Apply changes to this event only';
$string['repeatevent'] = 'Repeat this event';
$string['repeatnone'] = 'No repeats';
$string['completion_link'] = 'activity/completion';
$string['completion-alt-auto-enabled'] = 'The system marks this item complete according to conditions';
$string['completion-alt-auto-fail'] = 'Completed (did not achieve pass grade)';
-$string['completion-alt-auto-n'] = 'Not completed';
+$string['completion-alt-auto-n'] = 'Not completed: {$a}';
$string['completion-alt-auto-pass'] = 'Completed (achieved pass grade)';
-$string['completion-alt-auto-y'] = 'Completed';
+$string['completion-alt-auto-y'] = 'Completed: {$a}';
$string['completion-alt-manual-enabled'] = 'Students can manually mark this item complete';
-$string['completion-alt-manual-n'] = 'Not completed; select to mark as complete';
-$string['completion-alt-manual-y'] = 'Completed; select to mark as not complete';
+$string['completion-alt-manual-n'] = 'Not completed: {$a}. Select to mark as complete.';
+$string['completion-alt-manual-y'] = 'Completed: {$a}. Select to mark as not complete.';
$string['completion_automatic'] = 'Show activity as complete when conditions are met';
$string['completiondisabled'] = 'Disabled, not shown in activity settings';
$string['completionexpected'] = 'Expect completed on';
If a blank tick box is shown, a tick will appear automatically when you have completed the activity according to conditions set by the teacher.';
$string['completion_manual'] = 'Students can manually mark the activity as completed';
$string['completion_none'] = 'Do not indicate activity completion';
-$string['completion-title-manual-n'] = 'Mark as complete';
-$string['completion-title-manual-y'] = 'Mark as not complete';
+$string['completion-title-manual-n'] = 'Mark as complete: {$a}';
+$string['completion-title-manual-y'] = 'Mark as not complete: {$a}';
$string['completionnotenabled'] = 'Completion is not enabled';
$string['completionnotenabledforcourse'] = 'Completion is not enabled for this course';
$string['completionnotenabledforsite'] = 'Completion is not enabled for this site';
$string['settingssaved'] = 'Your settings have been saved';
$string['showmessagewindow'] = 'Popup window on new message';
$string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p';
+$string['thisconversation'] = 'this conversation';
$string['timenosee'] = 'Minutes since I was last seen online';
$string['timesent'] = 'Time sent';
$string['touserdoesntexist'] = 'You can not send a message to a user id ({$a}) that doesn\'t exist';
$string['restoreusersprecheck'] = 'Checking user data';
$string['restoreusersprecheckerror'] = 'Some problems were detected when checking user data';
$string['restricted'] = 'Restricted';
-$string['restrictmodules'] = 'Restrict activity modules?';
$string['returningtosite'] = 'Returning to this web site?';
$string['returntooriginaluser'] = 'Return to {$a}';
$string['revert'] = 'Revert';
$site = get_site();
require_login();
+ if (!empty($options['pagelayout'])) {
+ // A specific page layout has been requested.
+ $PAGE->set_pagelayout($options['pagelayout']);
+ } else if ($section === 'upgradesettings') {
+ $PAGE->set_pagelayout('maintenance');
+ } else {
+ $PAGE->set_pagelayout('admin');
+ }
+
$adminroot = admin_get_root(false, false); // settings not required for external pages
$extpage = $adminroot->locate($section, true);
die;
}
- if (!empty($options['pagelayout'])) {
- // A specific page layout has been requested.
- $PAGE->set_pagelayout($options['pagelayout']);
- } else if ($section === 'upgradesettings') {
- $PAGE->set_pagelayout('maintenance');
- } else {
- $PAGE->set_pagelayout('admin');
- }
-
// $PAGE->set_extra_button($extrabutton); TODO
if (!$actualurl) {
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Course completion critieria aggregation
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/completion/data_object.php');
/**
* Course completion critieria aggregation
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_aggregation extends data_object {
- /**
- * DB Table
- * @var string $table
- */
+ /* @var string Database table name that stores completion aggregation information */
public $table = 'course_completion_aggr_methd';
/**
* Array of required table fields, must start with 'id'.
- * @var array $required_fields
+ * Defaults to id, course, criteriatype, method, value
+ * @var array
*/
public $required_fields = array('id', 'course', 'criteriatype', 'method', 'value');
- /**
- * Course id
- * @access public
- * @var int
- */
+ /* @var int Course id */
public $course;
- /**
- * Criteria type this aggregation method applies to, or NULL for overall course aggregation
- * @access public
- * @var int
- */
+ /* @var int Criteria type this aggregation method applies to, or NULL for overall course aggregation */
public $criteriatype;
- /**
- * Aggregation method (COMPLETION_AGGREGATION_* constant)
- * @access public
- * @var int
- */
+ /* @var int Aggregation method (COMPLETION_AGGREGATION_* constant)*/
public $method;
- /**
- * Method value
- * @access public
- * @var mixed
- */
+ /* @var mixed Method value */
public $value;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object instance of data_object or false if none found.
*/
public static function fetch($params) {
return self::fetch_helper('course_completion_aggr_methd', __CLASS__, $params);
/**
* Finds and returns all data_object instances based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
* @return array array of data_object insatnces or false if none found.
/**
* Set the aggregation method
- * @access public
- * @param $method int
- * @return void
+ *
+ * @param int $method One of COMPLETION_AGGREGATION_ALL or COMPLETION_AGGREGATION_ANY
*/
public function setMethod($method) {
$methods = array(
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* Course completion status for a particular user/course
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once($CFG->libdir.'/completion/data_object.php');
+defined('MOODLE_INTERNAL') || die();
+require_once($CFG->libdir.'/completion/data_object.php');
/**
* Course completion status for a particular user/course
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_completion extends data_object {
- /**
- * DB Table
- * @var string $table
- */
+ /* @var string $table Database table name that stores completion information */
public $table = 'course_completions';
- /**
- * Array of required table fields, must start with 'id'.
- * @var array $required_fields
- */
+ /* @var array $required_fields Array of required table fields, must start with 'id'. */
public $required_fields = array('id', 'userid', 'course', 'deleted', 'timenotified',
'timeenrolled', 'timestarted', 'timecompleted', 'reaggregate');
- /**
- * User ID
- * @access public
- * @var int
- */
+ /* @var int $userid User ID */
public $userid;
- /**
- * Course ID
- * @access public
- * @var int
- */
+ /* @var int $course Course ID */
public $course;
- /**
- * Set to 1 if this record has been deleted
- * @access public
- * @var int
- */
+ /* @var int $deleted set to 1 if this record has been deleted */
public $deleted;
- /**
- * Timestamp the interested parties were notified
- * of this user's completion
- * @access public
- * @var int
- */
+ /* @var int Timestamp the interested parties were notified of this user's completion. */
public $timenotified;
- /**
- * Time of course enrolment
- * @see completion_completion::mark_enrolled()
- * @access public
- * @var int
- */
+ /* @var int Time of course enrolment {@link completion_completion::mark_enrolled()} */
public $timeenrolled;
/**
- * Time the user started their course completion
- * @see completion_completion::mark_inprogress()
- * @access public
- * @var int
+ * Time the user started their course completion {@link completion_completion::mark_inprogress()}
+ * @var int
*/
public $timestarted;
- /**
- * Timestamp of course completion
- * @see completion_completion::mark_complete()
- * @access public
- * @var int
- */
+ /* @var int Timestamp of course completion {@link completion_completion::mark_complete()} */
public $timecompleted;
- /**
- * Flag to trigger cron aggregation (timestamp)
- * @access public
- * @var int
- */
+ /* @var int Flag to trigger cron aggregation (timestamp) */
public $reaggregate;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
- * @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @param array $params associative arrays varname = >value
+ * @return data_object instance of data_object or false if none found.
*/
public static function fetch($params) {
$params['deleted'] = null;
/**
* Return status of this completion
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function is_complete() {
return (bool) $this->timecompleted;
*
* If the user is already marked as started, no change will occur
*
- * @access public
- * @param integer $timeenrolled Time enrolled (optional)
- * @return void
+ * @param integer $timeenrolled Time enrolled (optional)
*/
public function mark_enrolled($timeenrolled = null) {
/**
* Mark this user as inprogress in this course
*
- * If the user is already marked as inprogress,
- * the time will not be changed
+ * If the user is already marked as inprogress, the time will not be changed
*
- * @access public
- * @param integer $timestarted Time started (optional)
- * @return void
+ * @param integer $timestarted Time started (optional)
*/
public function mark_inprogress($timestarted = null) {
* This generally happens when the required completion criteria
* in the course are complete.
*
- * @access public
- * @param integer $timecomplete Time completed (optional)
- * @return void
+ * @param integer $timecomplete Time completed (optional)
+ * @return void
*/
public function mark_complete($timecomplete = null) {
* Save course completion status
*
* This method creates a course_completions record if none exists
- * @access public
- * @return void
*/
private function _save() {
-
global $DB;
if ($this->timeenrolled === null) {
$this->reaggregate = 0;
}
- // Make sure timestarted is not null
- if (!$this->timestarted) {
- $this->timestarted = 0;
- }
+ // Make sure timestarted is not null
+ if (!$this->timestarted) {
+ $this->timestarted = 0;
+ }
$this->insert();
}
<?php
-
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* Course completion criteria
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/completion/data_object.php');
require_once($CFG->libdir.'/completion/completion_criteria_completion.php');
-
/**
- * Criteria type constants
- * Primarily for storing criteria type in the database
+ * Self completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
*/
define('COMPLETION_CRITERIA_TYPE_SELF', 1);
+
+/**
+ * Date completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_DATE', 2);
+
+/**
+ * Unenrol completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_UNENROL', 3);
+
+/**
+ * Activity completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_ACTIVITY', 4);
+
+/**
+ * Duration completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_DURATION', 5);
+
+/**
+ * Grade completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_GRADE', 6);
+
+/**
+ * Role completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_ROLE', 7);
+
+/**
+ * Course completion criteria type
+ * Criteria type constant, primarily for storing criteria type in the database.
+ */
define('COMPLETION_CRITERIA_TYPE_COURSE', 8);
/**
/**
* Completion criteria abstract definition
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class completion_criteria extends data_object {
- /**
- * DB Table
- * @var string $table
- */
+
+ /* @var string Database table name that stores completion criteria information */
public $table = 'course_completion_criteria';
/**
* Array of required table fields, must start with 'id'.
- * @var array $required_fields
+ * Defaults to id, course, criteriatype, module, moduleinstane, courseinstance,
+ * enrolperiod, timeend, gradepass, role
+ * @var array
*/
public $required_fields = array('id', 'course', 'criteriatype', 'module', 'moduleinstance', 'courseinstance', 'enrolperiod', 'timeend', 'gradepass', 'role');
- /**
- * Course id
- * @var int
- */
+ /* @var int Course id */
public $course;
/**
* Criteria type
* One of the COMPLETION_CRITERIA_TYPE_* constants
- * @var int
+ * @var int
*/
public $criteriatype;
- /**
- * Module type this criteria relates to (for activity criteria)
- * @var string
- */
+ /* @var string Module type this criteria relates to (for activity criteria) */
public $module;
- /**
- * Course module instance id this criteria relates to (for activity criteria)
- * @var int
- */
+ /* @var int Course module instance id this criteria relates to (for activity criteria) */
public $moduleinstance;
/**
* Period after enrolment completion will be triggered (for period criteria)
- * @var int (days)
+ * The value here is the number of days as an int.
+ * @var int
*/
public $enrolperiod;
/**
* Date of course completion (for date criteria)
- * @var int (timestamp)
+ * This is a timestamp value
+ * @var int
*/
public $date;
- /**
- * Passing grade required to complete course (for grade completion)
- * @var float
- */
+ /* @var float Passing grade required to complete course (for grade completion) */
public $gradepass;
- /**
- * Role ID that has the ability to mark a user as complete (for role completion)
- * @var int
- */
+ /* @var int Role ID that has the ability to mark a user as complete (for role completion) */
public $role;
/**
* Finds and returns all data_object instances based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
* @return array array of data_object insatnces or false if none found.
/**
* Factory method for creating correct class object
- * @static
- * @param array
- * @return object
+ *
+ * @param array $params associative arrays varname=>value
+ * @return completion_criteria
*/
public static function factory($params) {
global $CFG, $COMPLETION_CRITERIA_TYPES;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param mixed $data optional Any additional data that can be used to set default values in the form
+ * @return void
*/
abstract public function config_form_display(&$mform, $data = null);
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param array $data Form data
+ * @return void
*/
abstract public function update_config(&$data);
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param object $completion The user's completion record
+ * @param boolean $mark Optionally set false to not save changes to database
+ * @return boolean
*/
abstract public function review($completion, $mark = true);
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
abstract public function get_title();
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
abstract public function get_title_detailed();
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
abstract public function get_type_title();
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array
*/
abstract public function get_details($completion);
/**
* Return criteria status text for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return string
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return string
*/
public function get_status($completion) {
return $completion->is_complete() ? get_string('yes') : get_string('no');
* Return true if the criteria's current status is different to what is sorted
* in the database, e.g. pending an update
*
- * @param object $completion The user's criteria completion record
+ * @param completion_completion $completion The user's criteria completion record
* @return bool
*/
public function is_pending($completion) {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * This file contains the activity completion criteria type class and any
+ * supporting functions it may require.
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Course completion critieria - completion on activity completion
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_activity extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria [COMPLETION_CRITERIA_TYPE_ACTIVITY] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_ACTIVITY;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return completion_criteria_activity data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_ACTIVITY;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param stdClass $data details of various modules
*/
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_activity['.$data->id.']', ucfirst(self::get_mod_name($data->module)).' - '.$data->name);
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
global $DB;
/**
* Get module instance module type
- * @static
- * @access public
- * @param int $type Module type id
- * @return string
+ *
+ * @param int $type Module type id
+ * @return string
*/
public static function get_mod_name($type) {
static $types;
}
/**
- * Get module instance
- * @access public
- * @return object|false
+ * Gets the module instance from the database and returns it.
+ * If no module instance exists this function returns false.
+ *
+ * @return stdClass|bool
*/
public function get_mod_instance() {
global $DB;
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @return bool
*/
public function review($completion, $mark = true) {
global $DB;
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
return get_string('activitiescompleted', 'completion');
/**
* Return a more detailed criteria title for display in reports
- * @access public
+ *
* @return string
*/
public function get_title_detailed() {
/**
* Return criteria type title for display in reports
- * @access public
+ *
* @return string
*/
public function get_type_title() {
}
/**
- * Find user's who have completed this criteria
- * @access public
- * @return void
+ * Find users who have completed this criteria and mark them accordingly
*/
public function cron() {
global $DB;
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
global $DB, $CFG;
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Completion data for a specific user, course and critieria
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once($CFG->libdir.'/completion/data_object.php');
+defined('MOODLE_INTERNAL') || die();
+require_once($CFG->libdir.'/completion/data_object.php');
/**
* Completion data for a specific user, course and critieria
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_completion extends data_object {
- /**
- * DB Table
- * @var string $table
- */
+ /* @var string Database table that stores completion type criteria */
public $table = 'course_completion_crit_compl';
- /**
- * Array of required table fields, must start with 'id'.
- * @var array $required_fields
- */
+ /* @var array Array of required table fields, must start with 'id'. */
public $required_fields = array('id', 'userid', 'course', 'criteriaid', 'gradefinal', 'rpl', 'deleted', 'unenroled', 'timecompleted');
- /**
- * User ID
- * @access public
- * @var int
- */
+ /* @var int User ID */
public $userid;
- /**
- * Course ID
- * @access public
- * @var int
- */
+ /* @var int course ID */
public $course;
- /**
- * The id of the course completion criteria this completion references
- * @access public
- * @var int
- */
+ /* @var int The id of the course completion criteria this completion references */
public $criteriaid;
- /**
- * The final grade for the user in the course (if completing a grade criteria)
- * @access public
- * @var float
- */
+ /* @var float The final grade for the user in the course (if completing a grade criteria) */
public $gradefinal;
- /**
- * Record of prior learning, leave blank if none
- * @access public
- * @var string
- */
+ /* @var string Record of prior learning, leave blank if none */
public $rpl;
- /**
- * Course deleted flag
- * @access public
- * @var boolean
- */
+ /* @var bool Course deleted flag */
public $deleted;
- /**
- * Timestamp of user unenrolment (if completing a unenrol criteria)
- * @access public
- * @var int (timestamp)
- */
+ /* @var int Timestamp of user unenrolment (if completing a unenrol criteria) */
public $unenroled;
- /**
- * Timestamp of course criteria completion
- * @see completion_criteria_completion::mark_complete()
- * @access public
- * @var int (timestamp)
- */
+ /* @var int Timestamp of course criteria completion {@link completion_criteria_completion::mark_complete()} */
public $timecompleted;
- /**
- * Associated criteria object
- * @access private
- * @var object completion_criteria
- */
+ /* @var completion_criterria Associated criteria object */
private $_criteria;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object instance of data_object or false if none found.
*/
public static function fetch($params) {
$params['deleted'] = null;
/**
* Finds and returns all data_object instances based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
* @return array array of data_object insatnces or false if none found.
/**
* Return status of this criteria completion
- * @access public
- * @return boolean
+ *
+ * @return bool
*/
public function is_complete() {
return (bool) $this->timecompleted;
* Mark this criteria complete for the associated user
*
* This method creates a course_completion_crit_compl record
- * @access public
- * @return void
*/
public function mark_complete() {
// Create record
/**
* Attach a preloaded criteria object to this object
- * @access public
+ *
* @param $criteria object completion_criteria
- * @return void
*/
public function attach_criteria(completion_criteria $criteria) {
$this->_criteria = $criteria;
/**
* Return the associated criteria with this completion
* If nothing attached, load from the db
- * @access public
- * @return object completion_criteria
+ *
+ * @return completion_criteria
*/
public function get_criteria() {
- if (!$this->_criteria)
- {
+ if (!$this->_criteria) {
global $DB;
$params = array(
}
/**
- * Return criteria status text for display in reports
- * @see completion_criteria::get_status()
- * @access public
- * @return string
+ * Return criteria status text for display in reports {@link completion_criteria::get_status()}
+ *
+ * @return string
*/
public function get_status() {
return $this->_criteria->get_status($this);
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * This file contains the course criteria type.
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Course completion critieria - completion on course completion
*
* This course completion criteria depends on another course with
* completion enabled to be marked as complete for this user
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_course extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant */
public $criteriatype = COMPLETION_CRITERIA_TYPE_COURSE;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object instance of data_object or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_COURSE;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodle_form $mform Moodle forms object
+ * @param stdClass $data data used to define default value of the form
*/
public function config_form_display(&$mform, $data = null) {
global $CFG;
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param array $data Form data
*/
public function update_config(&$data) {
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @return bool
*/
public function review($completion, $mark = true) {
global $DB;
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
return get_string('prerequisitescompleted', 'completion');
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
global $DB;
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('prerequisites', 'completion');
/**
* Find user's who have completed this criteria
- * @access public
- * @return void
*/
public function cron() {
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
global $CFG, $DB;
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * This file contains the date criteria type
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
/**
* Course completion critieria - completion on specified date
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_date extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_DATE] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_DATE;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_DATE;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param stdClass $data not used
*/
- public function config_form_display(&$mform, $data = null)
- {
+ public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_date', get_string('enable'));
$mform->addElement('date_selector', 'criteria_date_value', get_string('afterspecifieddate', 'completion'));
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
-
if (!empty($data->criteria_date)) {
$this->course = $data->id;
$this->timeend = $data->criteria_date_value;
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @return bool
*/
- public function review($completion, $mark = true)
- {
+ public function review($completion, $mark = true) {
// If current time is past timeend
if ($this->timeend && $this->timeend < time()) {
if ($mark) {
return true;
}
-
return false;
}
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
return get_string('date');
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
return userdate($this->timeend, '%d-%h-%y');
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('date');
/**
* Return criteria status text for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return string
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return string
*/
public function get_status($completion) {
return $completion->is_complete() ? get_string('yes') : userdate($this->timeend, '%d-%h-%y');
/**
* Find user's who have completed this criteria
- * @access public
- * @return void
*/
public function cron() {
global $DB;
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
$details = array();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Course completion critieria - completion after specific duration from course enrolment
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Course completion critieria - completion after specific duration from course enrolment
+ *
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_duration extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_DURATION] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_DURATION;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_DURATION;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param stdClass $data not used
*/
public function config_form_display(&$mform, $data = null) {
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
-
if (!empty($data->criteria_duration)) {
$this->course = $data->id;
$this->enrolperiod = $data->criteria_duration_days;
/**
* Get the time this user was enroled
- * @param object $completion
- * @return int
+ *
+ * @param completion_completion $completion
+ * @return int
*/
private function get_timeenrolled($completion) {
global $DB;
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @return bool
*/
public function review($completion, $mark = true) {
$timeenrolled = $this->get_timeenrolled($completion);
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
return get_string('enrolmentduration', 'completion');
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
return ceil($this->enrolperiod / (60 * 60 * 24)) . ' days';
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('days', 'completion');
/**
* Return criteria status text for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return string
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return string
*/
public function get_status($completion) {
$timeenrolled = $this->get_timeenrolled($completion);
/**
* Find user's who have completed this criteria
- * @access public
- * @return void
*/
public function cron() {
global $DB;
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
$details = array();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Course completion critieria - completion on achieving course grade
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+defined('MOODLE_INTERNAL') || die();
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->dirroot.'/grade/querylib.php';
/**
* Course completion critieria - completion on achieving course grade
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_grade extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_GRADE] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_GRADE;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
- * @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @param array $params associative array varname => value of various
+ * parameters used to fetch data_object
+ * @return data_object data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_GRADE;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodle_form $mform Moodle forms object
+ * @param stdClass $data containing default values to be set in the form
*/
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_grade', get_string('enable'));
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
/**
* Get user's course grade in this course
- * @static
- * @access private
- * @param object $completion
- * @return float
+ *
+ * @param completion_completion $completion an instance of completion_completion class
+ * @return float
*/
private function get_grade($completion) {
$grade = grade_get_course_grade($completion->userid, $this->course);
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @return bool
*/
public function review($completion, $mark = true) {
// Get user's course grade
/**
* Return criteria title for display in reports
- * @access public
+ *
* @return string
*/
public function get_title() {
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
return (float) $this->gradepass . '% required';
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('grade');
/**
* Return criteria status text for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return string
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return string
*/
public function get_status($completion) {
// Cast as floats to get rid of excess decimal places
/**
* Find user's who have completed this criteria
- * @access public
- * @return void
*/
public function cron() {
global $DB;
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
$details = array();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Course completion critieria - marked by role
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Course completion critieria - marked by role
+ *
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_role extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_ROLE] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_ROLE;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_ROLE;
}
/**
- * Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
- */
+ * Add appropriate form elements to the critieria form
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param stdClass $data used to set default values of the form
+ */
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_role['.$data->id.']', $data->name);
}
}
- /**
+ /**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
/**
* Mark this criteria as complete
- * @access public
- * @param object $completion The user's completion record
- * @return void
+ *
+ * @param completion_completion $completion The user's completion record
*/
public function complete($completion) {
$this->review($completion, true, true);
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @param bool $is_complete Set to false if the criteria has been completed just now.
+ * @return bool
*/
public function review($completion, $mark = true, $is_complete = false) {
// If we are marking this as complete
- if ($is_complete && $mark)
- {
+ if ($is_complete && $mark) {
$completion->completedself = 1;
$completion->mark_complete();
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
global $DB;
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
global $DB;
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('approval', 'completion');
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
$details = array();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Course completion critieria - student self marked
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Course completion critieria - student self marked
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_self extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_SELF] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_SELF;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_SELF;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param stdClass $data Form data
*/
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_self', get_string('enable'));
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
if (!empty($data->criteria_self)) {
/**
* Mark this criteria as complete
- * @access public
- * @param object $completion The user's completion record
- * @return void
+ *
+ * @param completion_completion $completion The user's completion record
*/
public function complete($completion) {
$this->review($completion, true, true);
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @param bool $is_complete set true to mark activity complete.
+ * @return bool
*/
public function review($completion, $mark = true, $is_complete = false) {
// If we are marking this as complete
- if ($is_complete && $mark)
- {
+ if ($is_complete && $mark) {
$completion->completedself = 1;
$completion->mark_complete();
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
return get_string('selfcompletion', 'completion');
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
return $this->get_title();
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('self', 'completion');
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
$details = array();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Course completion critieria - completion on unenrolment
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Course completion critieria - completion on unenrolment
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class completion_criteria_unenrol extends completion_criteria {
- /**
- * Criteria type constant
- * @var int
- */
+ /* @var int Criteria type constant [COMPLETION_CRITERIA_TYPE_UNENROL] */
public $criteriatype = COMPLETION_CRITERIA_TYPE_UNENROL;
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
* @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * @return data_object data_object instance or false if none found.
*/
public static function fetch($params) {
$params['criteriatype'] = COMPLETION_CRITERIA_TYPE_UNENROL;
/**
* Add appropriate form elements to the critieria form
- * @access public
- * @param object $mform Moodle forms object
- * @param mixed $data optional
- * @return void
+ *
+ * @param moodleform $mform Moodle forms object
+ * @param stdClass $data Form data
*/
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_unenrol', get_string('completiononunenrolment','completion'));
/**
* Update the criteria information stored in the database
- * @access public
- * @param array $data Form data
- * @return void
+ *
+ * @param stdClass $data Form data
*/
public function update_config(&$data) {
if (!empty($data->criteria_unenrol)) {
/**
* Review this criteria and decide if the user has completed
- * @access public
- * @param object $completion The user's completion record
- * @param boolean $mark Optionally set false to not save changes to database
- * @return boolean
+ *
+ * @param completion_completion $completion The user's completion record
+ * @param bool $mark Optionally set false to not save changes to database
+ * @return bool
*/
public function review($completion, $mark = true) {
// Check enrolment
/**
* Return criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title() {
return get_string('unenrol', 'enrol');
/**
* Return a more detailed criteria title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_title_detailed() {
return $this->get_title();
/**
* Return criteria type title for display in reports
- * @access public
- * @return string
+ *
+ * @return string
*/
public function get_type_title() {
return get_string('unenrol', 'enrol');
/**
* Return criteria progress details for display in reports
- * @access public
- * @param object $completion The user's completion record
- * @return array
+ *
+ * @param completion_completion $completion The user's completion record
+ * @return array An array with the following keys:
+ * type, criteria, requirement, status
*/
public function get_details($completion) {
$details = array();
$details['criteria'] = get_string('unenrolment', 'completion');
$details['requirement'] = get_string('unenrolingfromcourse', 'completion');
$details['status'] = '';
-
return $details;
}
}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* Cron job for reviewing and aggregating course completion criteria
*
- * @package moodlecore
+ * @package core_completion
+ * @category completion
* @copyright 2009 Catalyst IT Ltd
- * @author Aaron Barnes <aaronb@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once $CFG->libdir.'/completionlib.php';
+defined('MOODLE_INTERNAL') || die();
+require_once($CFG->libdir.'/completionlib.php');
/**
* Update user's course completion statuses
*
- * First update all criteria completions, then
- * aggregate all criteria completions and update
- * overall course completions
- *
- * @return void
+ * First update all criteria completions, then aggregate all criteria completions
+ * and update overall course completions
*/
function completion_cron() {
/**
* Mark users as started if the config option is set
*
- * @return void
+ * @return void
*/
function completion_cron_mark_started() {
global $CFG, $DB;
* Loop through each installed criteria and run the
* cron() method if it exists
*
- * @return void
+ * @return void
*/
function completion_cron_criteria() {
/**
* Aggregate each user's criteria completions
- *
- * @return void
*/
function completion_cron_completions() {
global $DB;
* @param int $method COMPLETION_AGGREGATION_* constant
* @param bool $data Criteria completion status
* @param bool|null $state Aggregation state
- * @return void
*/
function completion_cron_aggregate($method, $data, &$state) {
if ($method == COMPLETION_AGGREGATION_ALL) {
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+/**
+ * Course completion critieria aggregation
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
/**
* A data abstraction object that holds methods and attributes
- * @abstract
+ *
+ * @package core_completion
+ * @category completion
+ * @copyright 2009 Catalyst IT Ltd
+ * @author Aaron Barnes <aaronb@catalyst.net.nz>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class data_object {
- /**
- * Table that the class maps to in the database
- * @var string $table
- */
+
+ /* @var string Table that the class maps to in the database */
public $table;
- /**
- * Array of required table fields, must start with 'id'.
- * @var array $required_fields
- */
+ /* @var array Array of required table fields, must start with 'id'. */
public $required_fields = array('id');
/**
* Array of optional fields with default values - usually long text information that is not always needed.
* If you want to create an instance without optional fields use: new data_object($only_required_fields, false);
- * @var array $optional_fields
+ * @var array
*/
public $optional_fields = array();
- /**
- * The PK.
- * @var int $id
- */
+ /* @var int The primary key */
public $id;
/**
* Constructor. Optionally (and by default) attempts to fetch corresponding row from DB.
+ *
* @param array $params an array with required parameters for this data object.
- * @param boolean $fetch Whether to fetch corresponding row from DB or not,
+ * @param bool $fetch Whether to fetch corresponding row from DB or not,
* optional fields might not be defined if false used
*/
- public function __construct($params=NULL, $fetch=true) {
+ public function __construct($params = null, $fetch = true) {
if (!empty($params) and (is_array($params) or is_object($params))) {
if ($fetch) {
if ($data = $this->fetch($params)) {
/**
* Makes sure all the optional fields are loaded.
+ *
* If id present (==instance exists in db) fetches data from db.
* Defaults are used for new instances.
*/
/**
* Finds and returns a data_object instance based on params.
- * @static abstract
*
- * @param array $params associative arrays varname=>value
- * @return object data_object instance or false if none found.
+ * This function MUST be overridden by all deriving classes.
+ *
+ * @param array $params associative arrays varname => value
+ * @throws coding_exception This function MUST be overridden
+ * @return data_object instance of data_object or false if none found.
*/
public static function fetch($params) {
throw new coding_exception('fetch() method needs to be overridden in each subclass of data_object');
/**
* Finds and returns all data_object instances based on params.
*
- * @param array $params associative arrays varname=>value
+ * This function MUST be overridden by all deriving classes.
+ *
+ * @param array $params associative arrays varname => value
+ * @throws coding_exception This function MUST be overridden
* @return array array of data_object instances or false if none found.
*/
public static function fetch_all($params) {
/**
* Factory method - uses the parameters to retrieve matching instance from the DB.
- * @static final protected
- * @return mixed object instance or false if not found
+ *
+ * @final
+ * @param string $table The table name to fetch from
+ * @param string $classname The class that you want the result instantiated as
+ * @param array $params Any params required to select the desired row
+ * @return object Instance of $classname or false.
*/
protected static function fetch_helper($table, $classname, $params) {
if ($instances = self::fetch_all_helper($table, $classname, $params)) {
/**
* Factory method - uses the parameters to retrieve all matching instances from the DB.
- * @static final protected
+ *
+ * @final
+ * @param string $table The table name to fetch from
+ * @param string $classname The class that you want the result instantiated as
+ * @param array $params Any params required to select the desired row
* @return mixed array of object instances or false if not found
*/
public static function fetch_all_helper($table, $classname, $params) {
/**
* Updates this object in the Database, based on its object variables. ID must be set.
- * @return boolean success
+ *
+ * @return bool success
*/
public function update() {
global $DB;
/**
* Deletes this object from the database.
- * @return boolean success
+ *
+ * @return bool success
*/
public function delete() {
global $DB;
/**
* Returns object with fields and values that are defined in database
+ *
+ * @return stdClass
*/
public function get_record_data() {
$data = new stdClass();
* Records this object in the Database, sets its id to the returned value, and returns that value.
* If successful this function also fetches the new object data from database and stores it
* in object properties.
+ *
* @return int PK ID if successful, false otherwise
*/
public function insert() {
* each variable in turn. If the DB has different data, the db's data is used to update
* the object. This is different from the update() function, which acts on the DB record
* based on the object.
+ *
+ * @return bool True for success, false otherwise.
*/
public function update_from_db() {
if (empty($this->id)) {
/**
* Given an associated array or object, cycles through each key/variable
* and assigns the value to the corresponding variable in this object.
- * @static final
+ *
+ * @final
+ * @param data_object $instance
+ * @param array $params
*/
public static function set_properties(&$instance, $params) {
$params = (array) $params;
* deleted in the database. Default does nothing, can be overridden to
* hook in special behaviour.
*
- * @param bool $deleted
+ * @param bool $deleted Set this to true if it has been deleted.
*/
- function notify_changed($deleted) {
+ public function notify_changed($deleted) {
}
-}
+}
\ No newline at end of file
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Contains a class used for tracking whether activities have been completed
- * by students ('completion')
+ * Contains classes, functions and constants used during the tracking
+ * of activity completion for users.
*
* Completion top-level options (admin setting enablecompletion)
*
- * @package core
- * @subpackage completion
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core_completion
+ * @category completion
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
+/**
+ * Include the required completion libraries
+ */
require_once $CFG->libdir.'/completion/completion_aggregation.php';
require_once $CFG->libdir.'/completion/completion_criteria.php';
require_once $CFG->libdir.'/completion/completion_completion.php';
require_once $CFG->libdir.'/completion/completion_criteria_completion.php';
-/** The completion system is enabled in this site/course */
+/**
+ * The completion system is enabled in this site/course
+ */
define('COMPLETION_ENABLED', 1);
-/** The completion system is not enabled in this site/course */
+/**
+ * The completion system is not enabled in this site/course
+ */
define('COMPLETION_DISABLED', 0);
-// Completion tracking options per-activity (course_modules/completion)
-
-/** Completion tracking is disabled for this activity */
+/**
+ * Completion tracking is disabled for this activity
+ * This is a completion tracking option per-activity (course_modules/completion)
+ */
define('COMPLETION_TRACKING_NONE', 0);
-/** Manual completion tracking (user ticks box) is enabled for this activity */
+
+/**
+ * Manual completion tracking (user ticks box) is enabled for this activity
+ * This is a completion tracking option per-activity (course_modules/completion)
+ */
define('COMPLETION_TRACKING_MANUAL', 1);
-/** Automatic completion tracking (system ticks box) is enabled for this activity */
+/**
+ * Automatic completion tracking (system ticks box) is enabled for this activity
+ * This is a completion tracking option per-activity (course_modules/completion)
+ */
define('COMPLETION_TRACKING_AUTOMATIC', 2);
-// Completion state values (course_modules_completion/completionstate)
-
-/** The user has not completed this activity. */
+/**
+ * The user has not completed this activity.
+ * This is a completion state value (course_modules_completion/completionstate)
+ */
define('COMPLETION_INCOMPLETE', 0);
-/** The user has completed this activity. It is not specified whether they have
- * passed or failed it. */
+/**
+ * The user has completed this activity. It is not specified whether they have
+ * passed or failed it.
+ * This is a completion state value (course_modules_completion/completionstate)
+ */
define('COMPLETION_COMPLETE', 1);
-/** The user has completed this activity with a grade above the pass mark. */
+/**
+ * The user has completed this activity with a grade above the pass mark.
+ * This is a completion state value (course_modules_completion/completionstate)
+ */
define('COMPLETION_COMPLETE_PASS', 2);
-/** The user has completed this activity but their grade is less than the pass mark */
+/**
+ * The user has completed this activity but their grade is less than the pass mark
+ * This is a completion state value (course_modules_completion/completionstate)
+ */
define('COMPLETION_COMPLETE_FAIL', 3);
-// Completion effect changes (used only in update_state)
-
-/** The effect of this change to completion status is unknown. */
+/**
+ * The effect of this change to completion status is unknown.
+ * A completion effect changes (used only in update_state)
+ */
define('COMPLETION_UNKNOWN', -1);
-/** The user's grade has changed, so their new state might be
- * COMPLETION_COMPLETE_PASS or COMPLETION_COMPLETE_FAIL. */
-// TODO Is this useful?
+/**
+ * The user's grade has changed, so their new state might be
+ * COMPLETION_COMPLETE_PASS or COMPLETION_COMPLETE_FAIL.
+ * A completion effect changes (used only in update_state)
+ */
define('COMPLETION_GRADECHANGE', -2);
-// Whether view is required to create an activity (course_modules/completionview)
-
-/** User must view this activity */
+/**
+ * User must view this activity.
+ * Whether view is required to create an activity (course_modules/completionview)
+ */
define('COMPLETION_VIEW_REQUIRED', 1);
-/** User does not need to view this activity */
+/**
+ * User does not need to view this activity
+ * Whether view is required to create an activity (course_modules/completionview)
+ */
define('COMPLETION_VIEW_NOT_REQUIRED', 0);
-// Completion viewed state (course_modules_completion/viewed)
-
-/** User has viewed this activity */
+/**
+ * User has viewed this activity.
+ * Completion viewed state (course_modules_completion/viewed)
+ */
define('COMPLETION_VIEWED', 1);
-/** User has not viewed this activity */
+/**
+ * User has not viewed this activity.
+ * Completion viewed state (course_modules_completion/viewed)
+ */
define('COMPLETION_NOT_VIEWED', 0);
-// Completion cacheing
-
-/** Cache expiry time in seconds (10 minutes) */
+/**
+ * Cache expiry time in seconds (10 minutes)
+ * Completion cacheing
+ */
define('COMPLETION_CACHE_EXPIRY', 10*60);
-// Combining completion condition. This is also the value you should return
-// if you don't have any applicable conditions. Used for activity completion.
-/** Completion details should be ORed together and you should return false if
- none apply */
+/**
+ * Completion details should be ORed together and you should return false if
+ * none apply.
+ */
define('COMPLETION_OR', false);
-/** Completion details should be ANDed together and you should return true if
- none apply */
+/**
+ * Completion details should be ANDed together and you should return true if
+ * none apply
+ */
define('COMPLETION_AND', true);
-// Course completion criteria aggregation methods
-define('COMPLETION_AGGREGATION_ALL', 1);
-define('COMPLETION_AGGREGATION_ANY', 2);
+/**
+ * Course completion criteria aggregation method.
+ */
+define('COMPLETION_AGGREGATION_ALL', 1);
+/**
+ * Course completion criteria aggregation method.
+ */
+define('COMPLETION_AGGREGATION_ANY', 2);
/**
* Does not contain any data, so you can safely construct it multiple times
* without causing any problems.
*
+ * @package core
+ * @category completion
+ * @copyright 2008 Sam Marshall
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- * @package moodlecore
*/
class completion_info {
- /**
- * Course object passed during construction
- * @access private
- * @var object
- */
+
+ /* @var stdClass Course object passed during construction */
private $course;
- /**
- * Course id
- * @access public
- * @var int
- */
+ /* @var int Course id */
public $course_id;
- /**
- * Completion criteria
- * @access private
- * @var array
- * @see completion_info->get_criteria()
- */
+ /* @var array Completion criteria {@link completion_info::get_criteria()} */
private $criteria;
/**
* Return array of aggregation methods
- * @access public
- * @return array
+ * @return array
*/
public static function get_aggregation_methods() {
return array(
- COMPLETION_AGGREGATION_ALL => get_string('all'),
- COMPLETION_AGGREGATION_ANY => get_string('any', 'completion'),
+ COMPLETION_AGGREGATION_ALL => get_string('all'),
+ COMPLETION_AGGREGATION_ANY => get_string('any', 'completion'),
);
}
/**
* Constructs with course details.
*
- * @param object $course Moodle course object. Must have at least ->id, ->enablecompletion
+ * When instantiating a new completion info object you must provide a course
+ * object with at least id, and enablecompletion properties.
+ *
+ * @param stdClass $course Moodle course object.
*/
public function __construct($course) {
$this->course = $course;
/**
* Determines whether completion is enabled across entire site.
*
- * Static function.
- *
- * @global object
- * @return int COMPLETION_ENABLED (true) if completion is enabled for the site,
+ * @return bool COMPLETION_ENABLED (true) if completion is enabled for the site,
* COMPLETION_DISABLED (false) if it's complete
*/
public static function is_enabled_for_site() {
* Checks whether completion is enabled in a particular course and possibly
* activity.
*
- * @global object
- * @uses COMPLETION_DISABLED
- * @uses COMPLETION_ENABLED
- * @param object $cm Course-module object. If not specified, returns the course
+ * @param stdClass|cm_info $cm Course-module object. If not specified, returns the course
* completion enable state.
* @return mixed COMPLETION_ENABLED or COMPLETION_DISABLED (==0) in the case of
* site and course; COMPLETION_TRACKING_MANUAL, _AUTOMATIC or _NONE (==0)
* for a course-module.
*/
- public function is_enabled($cm=null) {
+ public function is_enabled($cm = null) {
global $CFG, $DB;
// First check global completion
/**
* Displays the 'Your progress' help icon, if completion tracking is enabled.
* Just prints the result of display_help_icon().
- * @deprecated Use display_help_icon instead.
- * @return void
+ *
+ * @deprecated since Moodle 2.0 - Use display_help_icon instead.
*/
public function print_help_icon() {
print $this->display_help_icon();
/**
* Returns the 'Your progress' help icon, if completion tracking is enabled.
- * @global object
+ *
* @return string HTML code for help icon, or blank if not needed
*/
public function display_help_icon() {
/**
* Get a course completion for a user
- * @access public
- * @param $user_id int User id
- * @param $criteriatype int Specific criteria type to return
- * @return false|completion_criteria_completion
+ *
+ * @param int $user_id User id
+ * @param int $criteriatype Specific criteria type to return
+ * @return bool|completion_criteria_completion returns false on fail
*/
public function get_completion($user_id, $criteriatype) {
$completions = $this->get_completions($user_id, $criteriatype);
/**
* Get all course criteria's completion objects for a user
- * @access public
- * @param $user_id int User id
- * @param $criteriatype int optional Specific criteria type to return
- * @return array
+ *
+ * @param int $user_id User id
+ * @param int $criteriatype Specific criteria type to return (optional)
+ * @return array
*/
public function get_completions($user_id, $criteriatype = null) {
$criterion = $this->get_criteria($criteriatype);
/**
* Get completion object for a user and a criteria
- * @access public
- * @param $user_id int User id
- * @param $criteria completion_criteria Criteria object
- * @return completion_criteria_completion
+ *
+ * @param int $user_id User id
+ * @param completion_criteria $criteria Criteria object
+ * @return completion_criteria_completion
*/
public function get_user_completion($user_id, $criteria) {
$params = array(
/**
* Check if course has completion criteria set
*
- * @access public
- * @return bool
+ * @return bool Returns true if there are criteria
*/
public function has_criteria() {
$criteria = $this->get_criteria();
return (bool) count($criteria);
}
-
/**
* Get course completion criteria
- * @access public
- * @param $criteriatype int optional Specific criteria type to return
- * @return void
+ *
+ * @param int $criteriatype Specific criteria type to return (optional)
*/
public function get_criteria($criteriatype = null) {
/**
* Get aggregation method
- * @access public
- * @param $criteriatype int optional If none supplied, get overall aggregation method
- * @return int
+ *
+ * @param int $criteriatype If none supplied, get overall aggregation method (optional)
+ * @return int One of COMPLETION_AGGREGATION_ALL or COMPLETION_AGGREGATION_ANY
*/
public function get_aggregation_method($criteriatype = null) {
$params = array(
/**
* Get incomplete course completion criteria
- * @access public
- * @return void
+ *
+ * @return array
*/
public function get_incomplete_criteria() {
$incomplete = array();
/**
* Has the supplied user completed this course
- * @access public
- * @param $user_id int User's id
- * @return boolean
+ *
+ * @param int $user_id User's id
+ * @return boolean
*/
public function is_course_complete($user_id) {
$params = array(
* calling the involved module via modulename_get_completion_state() to check
* module-specific conditions.
*
- * @global object
- * @global object
- * @uses COMPLETION_COMPLETE
- * @uses COMPLETION_INCOMPLETE
- * @uses COMPLETION_COMPLETE_PASS
- * @uses COMPLETION_COMPLETE_FAIL
- * @uses COMPLETION_TRACKING_MANUAL
- * @param object $cm Course-module
+ * @param stdClass|cm_info $cm Course-module
* @param int $possibleresult Expected completion result. If the event that
* has just occurred (e.g. add post) can only result in making the activity
* complete when it wasn't before, use COMPLETION_COMPLETE. If the event that
*
* Internal function. Not private, so we can unit-test it.
*
- * @global object
- * @global object
- * @global object
- * @uses COMPLETION_VIEW_REQUIRED
- * @uses COMPLETION_NOT_VIEWED
- * @uses COMPLETION_INCOMPLETE
- * @uses FEATURE_COMPLETION_HAS_RULES
- * @uses COMPLETION_COMPLETE
- * @uses COMPLETION_AND
- * @param object $cm Activity
+ * @param stdClass|cm_info $cm Activity
* @param int $userid ID of user
- * @param object $current Previous completion information from database
+ * @param stdClass $current Previous completion information from database
* @return mixed
*/
- function internal_get_state($cm, $userid, $current) {
+ public function internal_get_state($cm, $userid, $current) {
global $USER, $DB, $CFG;
// Get user ID
}
-
/**
* Marks a module as viewed.
*
* Note that this function must be called before you print the page header because
* it is possible that the navigation block may depend on it. If you call it after
* printing the header, it shows a developer debug warning.
- * @uses COMPLETION_VIEW_NOT_REQUIRED
- * @uses COMPLETION_VIEWED
- * @uses COMPLETION_COMPLETE
- * @param object $cm Activity
+ *
+ * @param stdClass|cm_info $cm Activity
* @param int $userid User ID or 0 (default) for current user
* @return void
*/
* deciding whether completion information should be 'locked' in the module
* editing form.
*
- * @global object
- * @param object $cm Activity
+ * @param cm_info $cm Activity
* @return int The number of users who have completion data stored for this
* activity, 0 if none
*/
* deciding whether completion information should be 'locked' in the completion
* settings form and activity completion settings.
*
- * @global object
- * @param int $user_id Optionally only get course completion data for a single user
+ * @param int $user_id Optionally only get course completion data for a single user
* @return int The number of users who have completion data stored for this
- * course, 0 if none
+ * course, 0 if none
*/
public function count_course_user_data($user_id = null) {
global $DB;
/**
* Check if this course's completion criteria should be locked
*
- * @return boolean
+ * @return boolean
*/
public function is_course_locked() {
return (bool) $this->count_course_user_data();
* Deletes all course completion completion data.
*
* Intended to be used when unlocking completion criteria settings.
- *
- * @global object
- * @return void
*/
public function delete_course_completion_data() {
global $DB;
*
* Intended for use only when the activity itself is deleted.
*
- * @global object
- * @global object
- * @param object $cm Activity
+ * @param stdClass|cm_info $cm Activity
*/
public function delete_all_state($cm) {
global $SESSION, $DB;
if ($criterion->moduleinstance == $cm->id) {
$acriteria = $criterion;
break;
- }
+ }
}
if ($acriteria) {
* Resetting state of manual tickbox has same result as deleting state for
* it.
*
- * @global object
- * @uses COMPLETION_TRACKING_MANUAL
- * @uses COMPLETION_UNKNOWN
- * @param object $cm Activity
+ * @param stcClass|cm_info $cm Activity
*/
public function reset_all_state($cm) {
global $DB;
* Obtains completion data for a particular activity and user (from the
* session cache if available, or by SQL query)
*
- * @global object
- * @global object
- * @global object
- * @global object
- * @uses COMPLETION_CACHE_EXPIRY
- * @param object $cm Activity; only required field is ->id
+ * @param stcClass|cm_info $cm Activity; only required field is ->id
* @param bool $wholecourse If true (default false) then, when necessary to
* fill the cache, retrieves information from the entire course not just for
* this one activity
* Otherwise the method calls get_fast_modinfo itself.
* @return object Completion data (record from course_modules_completion)
*/
- public function get_data($cm, $wholecourse=false, $userid=0, $modinfo=null) {
+ public function get_data($cm, $wholecourse = false, $userid = 0, $modinfo = null) {
global $USER, $CFG, $SESSION, $DB;
// Get user ID
*
* (Internal function. Not private, so we can unit-test it.)
*
- * @global object
- * @global object
- * @global object
- * @param object $cm Activity
- * @param object $data Data about completion for that user
+ * @param stdClass|cm_info $cm Activity
+ * @param stdClass $data Data about completion for that user
*/
- function internal_set_data($cm, $data) {
+ public function internal_set_data($cm, $data) {
global $USER, $SESSION, $DB;
$transaction = $DB->start_delegated_transaction();
* Obtains a list of activities for which completion is enabled on the
* course. The list is ordered by the section order of those activities.
*
- * @global object
- * @uses COMPLETION_TRACKING_NONE
* @param array $modinfo For unit testing only, supply the value
* here. Otherwise the method calls get_fast_modinfo
* @return array Array from $cmid => $cm of all activities with completion enabled,
return $result;
}
-
/**
* Checks to see if the userid supplied has a tracked role in
* this course
*
- * @param $userid User id
- * @return bool
+ * @param int $userid User id
+ * @return bool
*/
- function is_tracked_user($userid) {
+ public function is_tracked_user($userid) {
global $DB;
$tracked = $this->generate_tracked_user_sql();
return $DB->record_exists_sql($sql, $params);
}
-
/**
* Return number of users whose progress is tracked in this course
*
* Optionally supply a search's where clause, or a group id
*
- * @param string $where Where clause sql
- * @param array $where_params Where clause params
- * @param int $groupid Group id
- * @return int
+ * @param string $where Where clause sql
+ * @param array $where_params Where clause params
+ * @param int $groupid Group id
+ * @return int
*/
- function get_num_tracked_users($where = '', $where_params = array(), $groupid = 0) {
+ public function get_num_tracked_users($where = '', $where_params = array(), $groupid = 0) {
global $DB;
$tracked = $this->generate_tracked_user_sql($groupid);
return $DB->count_records_sql($sql, $params);
}
-
/**
* Return array of users whose progress is tracked in this course
*
* Optionally supply a search's where caluse, group id, sorting, paging
*
- * @param string $where Where clause sql (optional)
- * @param array $where_params Where clause params (optional)
- * @param integer $groupid Group ID to restrict to (optional)
- * @param string $sort Order by clause (optional)
- * @param integer $limitfrom Result start (optional)
- * @param integer $limitnum Result max size (optional)
+ * @param string $where Where clause sql (optional)
+ * @param array $where_params Where clause params (optional)
+ * @param integer $groupid Group ID to restrict to (optional)
+ * @param string $sort Order by clause (optional)
+ * @param integer $limitfrom Result start (optional)
+ * @param integer $limitnum Result max size (optional)
* @param context $extracontext If set, includes extra user information fields
* as appropriate to display for current user in this context
- * @return array
+ * @return array
*/
- function get_tracked_users($where = '', $where_params = array(), $groupid = 0,
+ public function get_tracked_users($where = '', $where_params = array(), $groupid = 0,
$sort = '', $limitfrom = '', $limitnum = '', context $extracontext = null) {
global $DB;
return $users ? $users : array(); // In case it returns false
}
-
/**
* Generate the SQL for finding tracked users in this course
*
* Returns an object containing the sql fragment and an array of
* bound data params.
*
- * @param integer $groupid
- * @return object
+ * @param integer $groupid
+ * @return stdClass With two properties, sql (string), and data (array)
*/
- function generate_tracked_user_sql($groupid = 0) {
+ public function generate_tracked_user_sql($groupid = 0) {
global $CFG;
$return = new stdClass();
* Users are included (in the first array) even if they do not have
* completion progress for any course-module.
*
- * @global object
- * @global object
* @param bool $sortfirstname If true, sort by first name, otherwise sort by
* last name
* @param string $where Where clause sql (optional)
* @param int $start User to start at if paging (optional)
* @param context $extracontext If set, includes extra user information fields
* as appropriate to display for current user in this context
- * @return Object with ->total and ->start (same as $start) and ->users;
+ * @return stdClass with ->total and ->start (same as $start) and ->users;
* an array of user objects (like mdl_user id, firstname, lastname)
* containing an additional ->progress array of coursemoduleid => completionstate
*/
{course_modules} cm
INNER JOIN {course_modules_completion} cmc ON cm.id=cmc.coursemoduleid
WHERE
- cm.course=? AND cmc.userid $insql
- ", $params);
+ cm.course=? AND cmc.userid $insql", $params);
foreach ($rs as $progress) {
$progress = (object)$progress;
$results[$progress->userid]->progress[$progress->coursemoduleid] = $progress;
* been changed. If the changed grade is used to determine completion for
* the course-module, then the completion status will be updated.
*
- * @uses COMPLETION_TRACKING_MANUAL
- * @uses COMPLETION_INCOMPLETE
- * @param object $cm Course-module for item that owns grade
+ * @param stdClass|cm_info $cm Course-module for item that owns grade
* @param grade_item $item Grade item
- * @param object $grade
+ * @param stdClass $grade
* @param bool $deleted
- * @return void
*/
public function inform_grade_changed($cm, $item, $grade, $deleted) {
// Bail out now if completion is not enabled for course-module, it is enabled
*
* Internal function. Not private, so we can unit-test it.
*
- * @uses COMPLETION_INCOMPLETE
- * @uses COMPLETION_COMPLETE_PASS
- * @uses COMPLETION_COMPLETE_FAIL
- * @uses COMPLETION_COMPLETE
- * @param object $item grade_item
- * @param object $grade grade_grade
+ * @param grade_item $item an instance of grade_item
+ * @param grade_grade $grade an instance of grade_grade
* @return int Completion state e.g. COMPLETION_INCOMPLETE
*/
- function internal_get_grade_state($item, $grade) {
+ public function internal_get_grade_state($item, $grade) {
if (!$grade) {
return COMPLETION_INCOMPLETE;
}
* This is to be used only for system errors (things that shouldn't happen)
* and not user-level errors.
*
- * @global object
- * @param string $error Error string (will not be displayed to user unless
- * debugging is enabled)
- * @return void Throws moodle_exception Exception with the error string as debug info
+ * @global type $CFG
+ * @param string $error Error string (will not be displayed to user unless debugging is enabled)
+ * @throws moodle_exception Exception with the error string as debug info
*/
- function internal_systemerror($error) {
+ public function internal_systemerror($error) {
global $CFG;
throw new moodle_exception('err_system','completion',
$CFG->wwwroot.'/course/view.php?id='.$this->course->id,null,$error);
/**
* For testing only. Wipes information cached in user session.
- *
- * @global object
*/
- static function wipe_session_cache() {
+ public static function wipe_session_cache() {
global $SESSION;
unset($SESSION->completioncache);
unset($SESSION->completioncacheuserid);
if ($exceptions) {
list($exceptions, $eparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'ex', false);
$params = $params + $eparams;
- $except = " AND id $exceptions";
+ $select .= " AND id $exceptions";
}
if ($firstinitial) {
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="value"/>
- <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="name"/>
+ <FIELD NAME="value" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="name"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="name"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="plugin"/>
<FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="core" SEQUENCE="false" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="plugin" NEXT="value"/>
- <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="name"/>
+ <FIELD NAME="value" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="name"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="plugin_name"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="userid" NEXT="plugin"/>
<FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" PREVIOUS="timemodified" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="plugin" NEXT="value"/>
- <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="oldvalue"/>
- <FIELD NAME="oldvalue" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="value"/>
+ <FIELD NAME="value" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="oldvalue"/>
+ <FIELD NAME="oldvalue" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="value"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="userid"/>
<FIELD NAME="version" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="plugin or main version if known" PREVIOUS="plugin" NEXT="targetversion"/>
<FIELD NAME="targetversion" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="version of plugin or core specified in version.php at the time of upgrade loggging" PREVIOUS="version" NEXT="info"/>
<FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="targetversion" NEXT="details"/>
- <FIELD NAME="details" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="info" NEXT="backtrace"/>
- <FIELD NAME="backtrace" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="details" NEXT="userid"/>
+ <FIELD NAME="details" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="info" NEXT="backtrace"/>
+ <FIELD NAME="backtrace" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="details" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="backtrace" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="userid"/>
</FIELDS>
<FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" PREVIOUS="sortorder" NEXT="shortname"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="summary"/>
- <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="summaryformat"/>
+ <FIELD NAME="summary" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="summary" NEXT="format"/>
<FIELD NAME="format" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="topics" SEQUENCE="false" PREVIOUS="summaryformat" NEXT="showgrades"/>
<FIELD NAME="showgrades" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="format" NEXT="modinfo"/>
- <FIELD NAME="modinfo" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" PREVIOUS="showgrades" NEXT="newsitems"/>
+ <FIELD NAME="modinfo" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="showgrades" NEXT="newsitems"/>
<FIELD NAME="newsitems" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="modinfo" NEXT="startdate"/>
<FIELD NAME="startdate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="newsitems" NEXT="numsections"/>
<FIELD NAME="numsections" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="startdate" NEXT="marker"/>
<FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" PREVIOUS="lang" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="theme" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated" NEXT="requested"/>
- <FIELD NAME="requested" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timemodified" NEXT="restrictmodules"/>
- <FIELD NAME="restrictmodules" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="requested" NEXT="enablecompletion"/>
- <FIELD NAME="enablecompletion" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = allow use of 'completion' progress-tracking on this course. 0 = disable completion tracking on this course." PREVIOUS="restrictmodules" NEXT="completionstartonenrol"/>
+ <FIELD NAME="requested" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timemodified" NEXT="enablecompletion"/>
+ <FIELD NAME="enablecompletion" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = allow use of 'completion' progress-tracking on this course. 0 = disable completion tracking on this course." PREVIOUS="requested" NEXT="completionstartonenrol"/>
<FIELD NAME="completionstartonenrol" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = allow use of 'activty completion' progress-tracking on this course. 0 = disable activity completion tracking on this course." PREVIOUS="enablecompletion" NEXT="completionnotify"/>
<FIELD NAME="completionnotify" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify users when they complete this course" PREVIOUS="completionstartonenrol"/>
</FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="idnumber"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="description"/>
- <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="descriptionformat"/>
+ <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="descriptionformat"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="description" NEXT="parent"/>
<FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="descriptionformat" NEXT="sortorder"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="parent" NEXT="coursecount"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="role"/>
<FIELD NAME="role" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="ID of the role to receive this notification message when a course has been completed" PREVIOUS="course" NEXT="message"/>
- <FIELD NAME="message" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" COMMENT="HTML formatted message to be sent" PREVIOUS="role" NEXT="timesent"/>
+ <FIELD NAME="message" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="HTML formatted message to be sent" PREVIOUS="role" NEXT="timesent"/>
<FIELD NAME="timesent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="message"/>
</FIELDS>
<KEYS>
<FIELD NAME="customchar2" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general short name" PREVIOUS="customchar1" NEXT="customdec1"/>
<FIELD NAME="customdec1" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7" COMMENT="Custom - general decimal" PREVIOUS="customchar2" NEXT="customdec2"/>
<FIELD NAME="customdec2" TYPE="number" LENGTH="12" NOTNULL="false" SEQUENCE="false" DECIMALS="7" COMMENT="Custom - general decimal" PREVIOUS="customdec1" NEXT="customtext1"/>
- <FIELD NAME="customtext1" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text" PREVIOUS="customdec2" NEXT="customtext2"/>
- <FIELD NAME="customtext2" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text" PREVIOUS="customtext1" NEXT="timecreated"/>
+ <FIELD NAME="customtext1" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text" PREVIOUS="customdec2" NEXT="customtext2"/>
+ <FIELD NAME="customtext2" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Custom - general text" PREVIOUS="customtext1" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="customtext2" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated"/>
</FIELDS>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="section"/>
<FIELD NAME="section" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="course" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="section" NEXT="summary"/>
- <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="summaryformat"/>
+ <FIELD NAME="summary" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="summary" NEXT="sequence"/>
- <FIELD NAME="sequence" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="summaryformat" NEXT="visible"/>
+ <FIELD NAME="sequence" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="summaryformat" NEXT="visible"/>
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" PREVIOUS="sequence"/>
</FIELDS>
<KEYS>
<INDEX NAME="course_section" UNIQUE="false" FIELDS="course, section"/>
</INDEXES>
</TABLE>
- <TABLE NAME="course_request" COMMENT="course requests" PREVIOUS="course_sections" NEXT="course_allowed_modules">
+ <TABLE NAME="course_request" COMMENT="course requests" PREVIOUS="course_sections" NEXT="filter_active">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="fullname"/>
<FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="shortname"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="summary"/>
- <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="summaryformat"/>
+ <FIELD NAME="summary" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="summary" NEXT="reason"/>
- <FIELD NAME="reason" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="summaryformat" NEXT="requester"/>
+ <FIELD NAME="reason" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="summaryformat" NEXT="requester"/>
<FIELD NAME="requester" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="reason" NEXT="password"/>
<FIELD NAME="password" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" PREVIOUS="requester"/>
</FIELDS>
<INDEX NAME="shortname" UNIQUE="false" FIELDS="shortname"/>
</INDEXES>
</TABLE>
- <TABLE NAME="course_allowed_modules" COMMENT="allowed modules foreach course" PREVIOUS="course_request" NEXT="filter_active">
- <FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="course"/>
- <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="module"/>
- <FIELD NAME="module" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="course"/>
- </FIELDS>
- <KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
- </KEYS>
- <INDEXES>
- <INDEX NAME="course" UNIQUE="false" FIELDS="course&qu