From 26ca0f248b9b1928211714728905049b520d5ad2 Mon Sep 17 00:00:00 2001 From: Michael Sharman Date: Tue, 26 Nov 2013 12:23:25 +1100 Subject: [PATCH] [FEATURE] Added a custom settings modal for the items api (assess) https://app.asana.com/0/8825147419757/8825147419776 --- src/views/modals/settings-items.php | 199 ++++++++++++++++++++++++++++ www/itemsapi.php | 0 www/itemsapi_assess.php | 100 ++++++++++---- 3 files changed, 270 insertions(+), 29 deletions(-) create mode 100644 src/views/modals/settings-items.php create mode 100644 www/itemsapi.php diff --git a/src/views/modals/settings-items.php b/src/views/modals/settings-items.php new file mode 100644 index 00000000..297e8db0 --- /dev/null +++ b/src/views/modals/settings-items.php @@ -0,0 +1,199 @@ + + + diff --git a/www/itemsapi.php b/www/itemsapi.php new file mode 100644 index 00000000..e69de29b diff --git a/www/itemsapi_assess.php b/www/itemsapi_assess.php index 4330a6dc..def66ef7 100644 --- a/www/itemsapi_assess.php +++ b/www/itemsapi_assess.php @@ -6,41 +6,76 @@ include_once '../src/includes/header.php'; $security = array( - "consumer_key" => $consumer_key, - "domain" => $domain, - "timestamp" => $timestamp + 'consumer_key' => $consumer_key, + 'domain' => $domain, + 'timestamp' => $timestamp ); $request = array( - "user_id" => $studentid, - "rendering_type" => "assess", - "name" => "Items API demo - assess activity.", - "state" => "initial", - "activity_id" => "itemsassessdemo", - "session_id" => UUID::generateUuid(), - "course_id" => $courseid, - "items" => array("ccore_video_260_classification", "ccore_parcc_tecr_grade3"), - "type" => "submit_practice", - "config" => array( - "subtitle" => "Walter White", - "navigation" => array( - "show_intro" => true, - "show_itemcount" => true, - "scroll_to_top" => false, - "scroll_to_test" => false + 'activity_id' => 'itemsassessdemo', + 'name' => 'Items API demo - assess activity', + 'rendering_type' => 'assess', + 'state' => 'initial', + 'type' => 'local_practice', + 'course_id' => $courseid, + 'session_id' => UUID::generateUuid(), + 'user_id' => $studentid, + 'items' => array('ccore_video_260_classification', 'ccore_parcc_tecr_grade3'), + 'config' => array( + 'title' => '', + 'subtitle' => 'Walter White', + 'navigation' => array( + 'show_next' => true, + 'show_prev' => true, + 'show_fullscreencontrol' => false, + 'show_progress' => true, + 'show_submit' => false, + 'show_title' => false, + 'show_save' => false, + 'show_calculator' => false, + 'scroll_to_top' => false, + 'scroll_to_test' => false, + 'show_itemcount' => true, + 'toc' => true, + 'transition' => 'slide', + 'transition_speed' => 400 ), - "time" => array( - "max_time" => 1500, - "limit_type" => "soft", - "show_pause" => true, - "warning_time" => 60, - "show_time" => true + 'time' => array( + 'max_time' => 120, + 'limit_type' => 'soft', + 'show_pause' => true, + 'warning_time' => 60, + 'show_time' => true ), - "renderSaveButton" => true, - "ignore_validation" => false + 'ui_style' => 'main', + 'renderSaveButton' => true, + 'ignore_validation' => false ) ); +// Examine the settings modal form post and replace the default +// $request variables. +if (isset($_POST['ui_style'])) { + foreach ($_POST as $key => $value) { + if (is_array($value)) { + foreach ($value as $subkey => $subvalue) { + if ($subvalue === 'true') { + $_POST[$key][$subkey] = true; + } elseif ($subvalue === 'false') { + $_POST[$key][$subkey] = false; + } + } + } else { + if ($value === 'true') { + $_POST[$key] = (bool)$value; + } elseif ($value === 'false') { + $_POST[$key] = false; + } + } + } + $request['config'] = array_replace_recursive($request['config'], $_POST); +} + $RequestHelper = new RequestHelper( 'items', $security, @@ -56,11 +91,16 @@

Items API – Assess

With the flick of a switch make the items into an assessment. Truly write once - use anywhere.

-
@@ -73,4 +113,6 @@ LearnosityItems.init(activity); -