Permalink
Browse files

Updates to lti plugin & progress on instructor management of course t…

…ools.
  • Loading branch information...
1 parent dbb0fec commit 996b0fd9613de8cdd04d2f42528ad4d343e56993 @scriby scriby committed Sep 16, 2011
@@ -72,10 +72,11 @@ function getOAuthKeyFromHeaders()
return false;
}
-function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret)
+function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret, $body, $request_headers = null)
{
- $request_headers = OAuthUtil::get_headers();
- // print_r($request_headers);
+ if($request_headers == null){
+ $request_headers = OAuthUtil::get_headers();
+ }
// Must reject application/x-www-form-urlencoded
if ($request_headers['Content-type'] == 'application/x-www-form-urlencoded' ) {
@@ -112,7 +113,7 @@ function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret)
throw new Exception("OAuth signature failed: " . $message);
}
- $postdata = file_get_contents('php://input');
+ $postdata = $body;
// echo($postdata);
$hash = base64_encode(sha1($postdata, TRUE));
View
@@ -53,6 +53,4 @@ function basicltiDebugToggle() {
else {
ele.style.display = 'block';
}
-}
-
-alert('a');
+}
View
Oops, something went wrong.
@@ -0,0 +1,93 @@
+<?php
+require_once('../../config.php');
+require_once($CFG->dirroot.'/mod/lti/edit_form.php');
+
+$courseid = required_param('course', PARAM_INT);
+
+require_login($courseid, false);
+$url = new moodle_url('/mod/lti/instructor_edit_tool_type.php');
+$PAGE->set_url($url);
+$PAGE->set_pagelayout('popup');
+
+$action = optional_param('action', null, PARAM_TEXT);
+$typeid = optional_param('typeid', null, PARAM_INT);
+
+if(!empty($typeid)){
+ $type = lti_get_type($typeid);
+ if($type->course != $courseid){
+ throw new Exception('You do not have permissions to edit this tool type.');
+
+ die;
+ }
+}
+
+echo $OUTPUT->header();
+
+$data = data_submitted();
+
+if (confirm_sesskey() && isset($data->submitbutton)) {
+ $type = new stdClass();
+
+ if (isset($id)) {
+ /*$type->id = $id;
+
+ lti_update_type($type, $data);
+ $script = <<<SCRIPT
+ <script type="text/javascript">
+ window.opener.M.mod_lti.editor.updateToolType({$name}, '{$id}');
+
+ window.close();
+ </script>
+SCRIPT;*/
+
+ die;
+ } else {
+ $type->state = LTI_TOOL_STATE_CONFIGURED;
+ $type->course = $COURSE->id;
+
+ $id = lti_add_type($type, $data);
+ $name = json_encode($type->name);
+
+ $script = <<<SCRIPT
+ <script type="text/javascript">
+ window.opener.M.mod_lti.editor.addToolType({$name}, '{$id}');
+
+ window.close();
+ </script>
+SCRIPT;
+
+ echo $script;
+
+ die;
+ }
+} else if(isset($data->cancel)){
+ $script = <<<SCRIPT
+ <script type="text/javascript">
+ window.close();
+ </script>
+SCRIPT;
+
+ echo $script;
+ die;
+}
+
+//Delete action is called via ajax
+if ($action == 'delete'){
+ lti_delete_type($typeid);
+
+ die;
+}
+
+echo $OUTPUT->heading(get_string('toolsetup', 'lti'));
+
+if($action == 'add') {
+ $form = new mod_lti_edit_types_form();
+ $form->display();
+} else if($action == 'edit'){
+ $form = new mod_lti_edit_types_form();
+ $type = lti_get_type_type_config($typeid);
+ $form->set_data($type);
+ $form->display();
+}
+
+echo $OUTPUT->footer();
Oops, something went wrong.

0 comments on commit 996b0fd

Please sign in to comment.