MDL-20534 lti: B14 - Implementing "show description on course page"
This commit is contained in:
@@ -77,8 +77,8 @@ class backup_lti_activity_structure_step extends backup_activity_structure_step
|
||||
'instructorchoiceallowsetting',
|
||||
'grade',
|
||||
'instructorcustomparameters',
|
||||
'showtitle',
|
||||
'showdescription'
|
||||
'showtitlelaunch',
|
||||
'showdescriptionlaunch'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/lti/db" VERSION="20111018" COMMENT="XMLDB file for Moodle mod/lti"
|
||||
<XMLDB PATH="mod/lti/db" VERSION="20111116" COMMENT="XMLDB file for Moodle mod/lti"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@@ -26,10 +26,10 @@
|
||||
<FIELD NAME="launchcontainer" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" COMMENT="Launch external tool in a pop-up" PREVIOUS="grade" NEXT="resourcekey"/>
|
||||
<FIELD NAME="resourcekey" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="launchcontainer" NEXT="password"/>
|
||||
<FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="resourcekey" NEXT="debuglaunch"/>
|
||||
<FIELD NAME="debuglaunch" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Enable the debug-style launch which pauses before auto-submit" PREVIOUS="password" NEXT="showtitle"/>
|
||||
<FIELD NAME="showtitle" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="debuglaunch" NEXT="showdescription"/>
|
||||
<FIELD NAME="showdescription" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="showtitle" NEXT="servicesalt"/>
|
||||
<FIELD NAME="servicesalt" TYPE="char" LENGTH="40" NOTNULL="false" SEQUENCE="false" PREVIOUS="showdescription" NEXT="icon"/>
|
||||
<FIELD NAME="debuglaunch" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Enable the debug-style launch which pauses before auto-submit" PREVIOUS="password" NEXT="showtitlelaunch"/>
|
||||
<FIELD NAME="showtitlelaunch" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="debuglaunch" NEXT="showdescriptionlaunch"/>
|
||||
<FIELD NAME="showdescriptionlaunch" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="showtitlelaunch" NEXT="servicesalt"/>
|
||||
<FIELD NAME="servicesalt" TYPE="char" LENGTH="40" NOTNULL="false" SEQUENCE="false" PREVIOUS="showdescriptionlaunch" NEXT="icon"/>
|
||||
<FIELD NAME="icon" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="servicesalt" NEXT="secureicon"/>
|
||||
<FIELD NAME="secureicon" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="icon"/>
|
||||
</FIELDS>
|
||||
@@ -95,4 +95,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
@@ -64,6 +64,20 @@ function xmldb_lti_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if($oldversion < 2011111600){
|
||||
//Rename showdescription to showdescriptionlaunch to not conflict with setting from core Moodle
|
||||
//Rename showtitle as well to be consistent
|
||||
$table = new xmldb_table('lti');
|
||||
$field = new xmldb_field('showtitle', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'debuglaunch');
|
||||
|
||||
$dbman->rename_field($table, $field, 'showtitlelaunch');
|
||||
|
||||
$field = new xmldb_field('showdescription', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'showtitlelaunch');
|
||||
$dbman->rename_field($table, $field, 'showdescriptionlaunch');
|
||||
|
||||
upgrade_mod_savepoint(true, 2011111600, 'lti');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+13
-5
@@ -63,6 +63,7 @@ function lti_supports($feature) {
|
||||
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;
|
||||
}
|
||||
@@ -117,12 +118,12 @@ function lti_update_instance($lti, $mform) {
|
||||
$lti->timemodified = time();
|
||||
$lti->id = $lti->instance;
|
||||
|
||||
if (!isset($lti->showtitle)) {
|
||||
$lti->showtitle = 0;
|
||||
if (!isset($lti->showtitlelaunch)) {
|
||||
$lti->showtitlelaunch = 0;
|
||||
}
|
||||
|
||||
if (!isset($lti->showdescription)) {
|
||||
$lti->showdescription = 0;
|
||||
if (!isset($lti->showdescriptionlaunch)) {
|
||||
$lti->showdescriptionlaunch = 0;
|
||||
}
|
||||
|
||||
if (!isset($lti->grade)) {
|
||||
@@ -175,7 +176,7 @@ function lti_get_coursemodule_info($coursemodule) {
|
||||
require_once($CFG->dirroot.'/mod/lti/locallib.php');
|
||||
|
||||
if (!$lti = $DB->get_record('lti', array('id' => $coursemodule->instance),
|
||||
'icon, secureicon')) {
|
||||
'icon, secureicon, intro, introformat, name')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -188,7 +189,14 @@ function lti_get_coursemodule_info($coursemodule) {
|
||||
} else if (!empty($lti->icon)) {
|
||||
$info->iconurl = new moodle_url($lti->icon);
|
||||
}
|
||||
|
||||
if ($coursemodule->showdescription) {
|
||||
// Convert intro to html. Do not filter cached version, filters run at display time.
|
||||
$info->content = format_module_intro('lti', $lti, $coursemodule->id, false);
|
||||
}
|
||||
|
||||
$info->name = $lti->name;
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
+16
-7
@@ -69,14 +69,23 @@ class mod_lti_mod_form extends moodleform_mod {
|
||||
// Adding the optional "intro" and "introformat" pair of fields
|
||||
$this->add_intro_editor(false, get_string('basicltiintro', 'lti'));
|
||||
$mform->setAdvanced('introeditor');
|
||||
|
||||
$mform->addElement('checkbox', 'showtitle', ' ', ' ' . get_string('display_name', 'lti'));
|
||||
$mform->setAdvanced('showtitle');
|
||||
$mform->addHelpButton('showtitle', 'display_name', 'lti');
|
||||
|
||||
$mform->addElement('checkbox', 'showdescription', ' ', ' ' . get_string('display_description', 'lti'));
|
||||
|
||||
//Display the label to the right of the checkbox so it looks better & matches rest of the form
|
||||
$coursedesc = $mform->getElement('showdescription');
|
||||
if(!empty($coursedesc)){
|
||||
$coursedesc->setText(' ' . $coursedesc->getLabel());
|
||||
$coursedesc->setLabel(' ');
|
||||
}
|
||||
|
||||
$mform->setAdvanced('showdescription');
|
||||
$mform->addHelpButton('showdescription', 'display_description', 'lti');
|
||||
|
||||
$mform->addElement('checkbox', 'showtitlelaunch', ' ', ' ' . get_string('display_name', 'lti'));
|
||||
$mform->setAdvanced('showtitlelaunch');
|
||||
$mform->addHelpButton('showtitlelaunch', 'display_name', 'lti');
|
||||
|
||||
$mform->addElement('checkbox', 'showdescriptionlaunch', ' ', ' ' . get_string('display_description', 'lti'));
|
||||
$mform->setAdvanced('showdescriptionlaunch');
|
||||
$mform->addHelpButton('showdescriptionlaunch', 'display_description', 'lti');
|
||||
|
||||
// Tool settings
|
||||
$tooltypes = $mform->addElement('select', 'typeid', get_string('external_tool_type', 'lti'), array());
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$module->version = 2011111400;;
|
||||
$module->version = 2011111600;;
|
||||
$module->requires = 2011110200; // Requires this Moodle version
|
||||
$module->cron = 0;
|
||||
$module->component = 'mod_lti';
|
||||
|
||||
+2
-2
@@ -100,12 +100,12 @@ $PAGE->set_heading($course->fullname);
|
||||
// Print the page header
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($lti->showtitle) {
|
||||
if ($lti->showtitlelaunch) {
|
||||
// Print the main part of the page
|
||||
echo $OUTPUT->heading(format_string($lti->name));
|
||||
}
|
||||
|
||||
if ($lti->showdescription && $lti->intro) {
|
||||
if ($lti->showdescriptionlaunch && $lti->intro) {
|
||||
echo $OUTPUT->box($lti->intro, 'generalbox description', 'intro');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user