mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-38106 mod_lesson: Add introduction field
This commit is contained in:
parent
6597413d41
commit
d83891729a
@ -9,6 +9,8 @@
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" />
|
||||
<FIELD NAME="practice" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="modattempts" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="usepassword" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
@ -188,4 +190,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
@ -78,7 +78,19 @@ function xmldb_lesson_upgrade($oldversion) {
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014091001) {
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
|
||||
// Conditionally launch add field.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_mod_savepoint(true, 2014091001, 'lesson');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -738,14 +738,26 @@ function lesson_get_extra_capabilities() {
|
||||
*/
|
||||
function lesson_supports($feature) {
|
||||
switch($feature) {
|
||||
case FEATURE_GROUPS: return false;
|
||||
case FEATURE_GROUPINGS: return false;
|
||||
case FEATURE_MOD_INTRO: return false;
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
case FEATURE_GRADE_OUTCOMES: return true;
|
||||
case FEATURE_BACKUP_MOODLE2: return true;
|
||||
default: return null;
|
||||
case FEATURE_GROUPS:
|
||||
return false;
|
||||
case FEATURE_GROUPINGS:
|
||||
return false;
|
||||
case FEATURE_GROUPMEMBERSONLY:
|
||||
return true;
|
||||
case FEATURE_MOD_INTRO:
|
||||
return true;
|
||||
case FEATURE_COMPLETION_TRACKS_VIEWS:
|
||||
return true;
|
||||
case FEATURE_GRADE_HAS_GRADE:
|
||||
return true;
|
||||
case FEATURE_GRADE_OUTCOMES:
|
||||
return true;
|
||||
case FEATURE_BACKUP_MOODLE2:
|
||||
return true;
|
||||
case FEATURE_SHOW_DESCRIPTION:
|
||||
return true;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,8 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$config = get_config('lesson');
|
||||
|
||||
$mform->addElement('header', 'general', get_string('general', 'form'));
|
||||
|
||||
/** Legacy slideshow width element to maintain backwards compatibility */
|
||||
@ -89,6 +90,7 @@ class mod_lesson_mod_form extends moodleform_mod {
|
||||
}
|
||||
$mform->addRule('name', null, 'required', null, 'client');
|
||||
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$this->add_intro_editor($config->requiremodintro);
|
||||
|
||||
// Appearance.
|
||||
$mform->addElement('header', 'appearancehdr', get_string('appearance'));
|
||||
|
@ -66,4 +66,6 @@ if ($ADMIN->fulltree) {
|
||||
$defaultnextpages[LESSON_UNANSWEREDPAGE] = get_string("showanunansweredpage", "lesson");
|
||||
$settings->add(new admin_setting_configselect('lesson_defaultnextpage', get_string('actionaftercorrectanswer','lesson'),
|
||||
get_string('configactionaftercorrectanswer', 'lesson'), 0, $defaultnextpages));
|
||||
}
|
||||
$settings->add(new admin_setting_configcheckbox('lesson/requiremodintro',
|
||||
get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1));
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2014091001; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version
|
||||
$plugin->component = 'mod_lesson'; // Full name of the plugin (used for diagnostics)
|
||||
$plugin->cron = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user