Removing course id field admin setting, making cmidnumber advanced in instructor...
authorChris Scribner <scriby@gmail.com>
Tue, 30 Aug 2011 21:39:28 +0000 (17:39 -0400)
committerChris Scribner <scriby@gmail.com>
Mon, 7 Nov 2011 01:41:46 +0000 (20:41 -0500)
mod/blti/db/install.xml
mod/blti/edit_form.php
mod/blti/lang/en/blti.php
mod/blti/locallib.php
mod/blti/mod_form.php
mod/blti/typessettings.php

index 2836791..2fb5975 100644 (file)
@@ -42,7 +42,7 @@
         <FIELD NAME="tooldomain" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="baseurl" NEXT="state"/>
         <FIELD NAME="state" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="2" SEQUENCE="false" COMMENT="Active = 1, Pending = 2, Rejected = 3" PREVIOUS="tooldomain" NEXT="course"/>
         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="state" NEXT="coursevisible"/>
-        <FIELD NAME="coursevisible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="course" NEXT="createdby"/>
+        <FIELD NAME="coursevisible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="0" PREVIOUS="course" NEXT="createdby"/>
         <FIELD NAME="createdby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="coursevisible" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="createdby" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="timecreated"/>
index 995824d..ef1e7da 100644 (file)
@@ -132,10 +132,6 @@ class mod_blti_edit_types_form extends moodleform{
         $idoptions[0] = get_string('id', 'blti');\r
         $idoptions[1] = get_string('courseid', 'blti');\r
 \r
-        $mform->addElement('select', 'lti_moodle_course_field', get_string('moodle_course_field', 'blti'), $idoptions);\r
-        $mform->setDefault('lti_moodle_course_field', '0');\r
-        \r
-\r
         $mform->addElement('text', 'lti_organizationid', get_string('organizationid', 'blti'));\r
         $mform->setType('lti_organizationid', PARAM_TEXT);\r
 //        $mform->addHelpButton('lti_organizationid', 'organizationid', 'blti');\r
index afc41ef..d607cc8 100644 (file)
@@ -118,7 +118,6 @@ $string['module_class_type'] = 'Moodle module type';
 $string['modulename'] = 'External Tool';\r
 $string['modulenameplural'] = 'basicltis';\r
 $string['modulenamepluralformatted'] = 'Basic LTI Instances';\r
-$string['moodle_course_field'] = 'Course identification field';\r
 $string['never'] = 'Never';\r
 $string['noattempts'] = 'No attempts have been made on this tool instance';\r
 $string['noservers'] = 'No servers found';\r
index 6d32d43..a7e6eb3 100644 (file)
@@ -97,16 +97,12 @@ function blti_view($instance, $makeobject=false) {
     $parms = sign_parameters($requestparams, $endpoint, "POST", $key, $secret, $submittext, $orgid /*, $orgdesc*/);\r
 \r
     $debuglaunch = ( $instance->debuglaunch == 1 );\r
-    if ( $makeobject ) {\r
-        $height = 600;\r
-        \r
-        $content = post_launch_html($parms, $endpoint, $debuglaunch, $height);\r
-    } else {\r
-        $content = post_launch_html($parms, $endpoint, $debuglaunch, false);\r
-    }\r
+    \r
+    $content = post_launch_html($parms, $endpoint, $debuglaunch);\r
+    \r
 //    $cm = get_coursemodule_from_instance("blti", $instance->id);\r
 //    print '<object height='.$height.' width="80%" data="launch.php?id='.$cm->id.'">'.$content.'</object>';\r
-    print $content;\r
+    echo $content;\r
 }\r
 \r
 /**\r
@@ -320,7 +316,8 @@ function blti_filter_get_types() {
 }\r
 \r
 function blti_get_types_for_add_instance(){\r
-    $admintypes = blti_filter_get_types();\r
+    global $DB;\r
+    $admintypes = $DB->get_records('blti_types', array('coursevisible' => 1));\r
     \r
     $types = array();\r
     $types[0] = get_string('automatic', 'blti');\r
@@ -548,12 +545,15 @@ function blti_get_type_type_config($id) {
     if (isset($config['launchcontainer'])) {\r
         $type->lti_launchcontainer = $config['launchcontainer'];\r
     }\r
+    \r
+    if (isset($config['coursevisible'])) {\r
+        $type->lti_coursevisible = $config['coursevisible'];\r
+    }\r
+    \r
     if (isset($config['debuglaunch'])) {\r
         $type->lti_debuglaunch = $config['debuglaunch'];\r
     }\r
-    if (isset($config['moodle_course_field'])) {\r
-            $type->lti_moodle_course_field = $config['moodle_course_field'];\r
-    }\r
+    \r
     if (isset($config['module_class_type'])) {\r
             $type->lti_module_class_type = $config['module_class_type'];\r
     }\r
@@ -644,7 +644,7 @@ function sign_parameters($oldparms, $endpoint, $method, $oauthconsumerkey, $oaut
  * @param $endpoint     URL of the external tool\r
  * @param $debug        Debug (true/false)\r
  */\r
-function post_launch_html($newparms, $endpoint, $debug=false, $height=false) {\r
+function post_launch_html($newparms, $endpoint, $debug=false) {\r
     global $lastbasestring;\r
     \r
     $r = "<form action=\"".$endpoint."\" name=\"ltiLaunchForm\" id=\"ltiLaunchForm\" method=\"post\" encType=\"application/x-www-form-urlencoded\">\n";\r
index 7ec6413..32e4ff9 100644 (file)
@@ -103,6 +103,15 @@ class mod_blti_mod_form extends moodleform_mod {
         $mform->addElement('text', 'toolurl', get_string('launch_url', 'blti'), array('size'=>'64'));\r
         $mform->setType('toolurl', PARAM_TEXT);\r
         \r
+        $launchoptions=array();\r
+        $launchoptions[BLTI_LAUNCH_CONTAINER_DEFAULT] = get_string('default', 'blti');\r
+        $launchoptions[BLTI_LAUNCH_CONTAINER_EMBED] = get_string('embed', 'blti');\r
+        $launchoptions[BLTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS] = get_string('embed_no_blocks', 'blti');\r
+        $launchoptions[BLTI_LAUNCH_CONTAINER_WINDOW] = get_string('new_window', 'blti');\r
+\r
+        $mform->addElement('select', 'launchcontainer', get_string('launchinpopup', 'blti'), $launchoptions);\r
+        $mform->setDefault('launchcontainer', BLTI_LAUNCH_CONTAINER_DEFAULT);\r
+        \r
         $mform->addElement('text', 'resourcekey', get_string('resourcekey', 'blti'));\r
         $mform->setType('resourcekey', PARAM_TEXT);\r
         $mform->setAdvanced('resourcekey');\r
@@ -115,16 +124,6 @@ class mod_blti_mod_form extends moodleform_mod {
         $mform->setType('instructorcustomparameters', PARAM_TEXT);\r
         $mform->setAdvanced('instructorcustomparameters');\r
         \r
-        $launchoptions=array();\r
-        $launchoptions[BLTI_LAUNCH_CONTAINER_DEFAULT] = get_string('default', 'blti');\r
-        $launchoptions[BLTI_LAUNCH_CONTAINER_EMBED] = get_string('embed', 'blti');\r
-        $launchoptions[BLTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS] = get_string('embed_no_blocks', 'blti');\r
-        $launchoptions[BLTI_LAUNCH_CONTAINER_WINDOW] = get_string('new_window', 'blti');\r
-\r
-        $mform->addElement('select', 'launchcontainer', get_string('launchinpopup', 'blti'), $launchoptions);\r
-\r
-        $mform->setDefault('launchcontainer', BLTI_LAUNCH_CONTAINER_DEFAULT);\r
-        \r
 //-------------------------------------------------------------------------------\r
         //$mform->addElement('hidden', 'typeid', $this->typeid);\r
         //$mform->addElement('hidden', 'toolurl', $this->typeconfig['toolurl']);\r
@@ -166,6 +165,8 @@ class mod_blti_mod_form extends moodleform_mod {
 //-------------------------------------------------------------------------------\r
         // add standard elements, common to all modules\r
         $this->standard_coursemodule_elements();\r
+        \r
+        $mform->setAdvanced('cmidnumber');\r
 //-------------------------------------------------------------------------------\r
         // add standard buttons, common to all modules\r
         $this->add_action_buttons();\r
index 670e2a3..e168193 100644 (file)
@@ -79,9 +79,11 @@ if ($data = data_submitted() and confirm_sesskey() and isset($data->submitbutton
     $type->baseurl = $data->lti_toolurl;\r
     $type->tooldomain = blti_get_domain_from_url($data->lti_toolurl);\r
     $type->course = $SITE->id;\r
-    $type->coursevisible = 1;\r
+    $type->coursevisible = !empty($data->lti_coursevisible) ? $data->lti_coursevisible : 0;\r
     $type->timemodified = time();\r
     \r
+    $data->lti_coursevisible = $type->coursevisible;//When not checked, it does not appear in data array. Set it manually.\r
+    \r
     if (isset($id)) {\r
         $type->id = $id;\r
         \r