<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"/>
$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
$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
$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
}\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
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
* @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
$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
$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
//-------------------------------------------------------------------------------\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
$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