diff --git a/mod/lti/backup/moodle2/backup_lti_stepslib.php b/mod/lti/backup/moodle2/backup_lti_stepslib.php index 3be251468f5..c9c2a243488 100644 --- a/mod/lti/backup/moodle2/backup_lti_stepslib.php +++ b/mod/lti/backup/moodle2/backup_lti_stepslib.php @@ -77,8 +77,8 @@ class backup_lti_activity_structure_step extends backup_activity_structure_step 'instructorchoiceallowsetting', 'grade', 'instructorcustomparameters', - 'showtitle', - 'showdescription' + 'showtitlelaunch', + 'showdescriptionlaunch' ) ); diff --git a/mod/lti/db/install.xml b/mod/lti/db/install.xml index 4d62cb08dbc..2df3df50e7b 100644 --- a/mod/lti/db/install.xml +++ b/mod/lti/db/install.xml @@ -1,5 +1,5 @@ - @@ -26,10 +26,10 @@ - - - - + + + + @@ -95,4 +95,4 @@ - + \ No newline at end of file diff --git a/mod/lti/db/upgrade.php b/mod/lti/db/upgrade.php index 99f9deb8739..c00f872f8af 100644 --- a/mod/lti/db/upgrade.php +++ b/mod/lti/db/upgrade.php @@ -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; } diff --git a/mod/lti/lib.php b/mod/lti/lib.php index 58531628792..5ddda0c8dfd 100644 --- a/mod/lti/lib.php +++ b/mod/lti/lib.php @@ -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; } diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index c588e39b5af..fb1b9af7507 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -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()); diff --git a/mod/lti/version.php b/mod/lti/version.php index 9eb1e6d3ca8..499854d4666 100644 --- a/mod/lti/version.php +++ b/mod/lti/version.php @@ -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'; diff --git a/mod/lti/view.php b/mod/lti/view.php index 0697df62d89..350c68e8c13 100644 --- a/mod/lti/view.php +++ b/mod/lti/view.php @@ -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'); }