Permalink
Browse files

MDL-20534 lti: B14 - Implementing "show description on course page"

  • Loading branch information...
1 parent 6be90ce commit b07878ec7d756d045789c4ce7cd71584fb278950 @scriby scriby committed Nov 16, 2011
@@ -77,8 +77,8 @@ protected function define_structure() {
'instructorchoiceallowsetting',
'grade',
'instructorcustomparameters',
- 'showtitle',
- 'showdescription'
+ 'showtitlelaunch',
+ 'showdescriptionlaunch'
)
);
View
@@ -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>
View
@@ -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;
}
View
@@ -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;
}
View
@@ -69,14 +69,23 @@ public function definition() {
// Adding the optional "intro" and "introformat" pair of fields
$this->add_intro_editor(false, get_string('basicltiintro', 'lti'));
$mform->setAdvanced('introeditor');
+
+ //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('&nbsp');
+ }
+
+ $mform->setAdvanced('showdescription');
- $mform->addElement('checkbox', 'showtitle', '&nbsp;', ' ' . get_string('display_name', 'lti'));
- $mform->setAdvanced('showtitle');
- $mform->addHelpButton('showtitle', 'display_name', 'lti');
+ $mform->addElement('checkbox', 'showtitlelaunch', '&nbsp;', ' ' . get_string('display_name', 'lti'));
+ $mform->setAdvanced('showtitlelaunch');
+ $mform->addHelpButton('showtitlelaunch', 'display_name', 'lti');
- $mform->addElement('checkbox', 'showdescription', '&nbsp;', ' ' . get_string('display_description', 'lti'));
- $mform->setAdvanced('showdescription');
- $mform->addHelpButton('showdescription', 'display_description', 'lti');
+ $mform->addElement('checkbox', 'showdescriptionlaunch', '&nbsp;', ' ' . 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());
View
@@ -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';
View
@@ -100,12 +100,12 @@
// 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');
}

0 comments on commit b07878e

Please sign in to comment.