| |
231 |
231 |
[util::json::object::create \ |
| |
232 |
232 |
[list schema [util::json::object::create $schema] \ |
| |
233 |
233 |
data [util::json::object::create $data]]]] |
| |
234 |
234 |
|
| |
235 |
235 |
} |
| |
236 |
236 |
|
| |
237 |
237 |
ad_proc -private scorm_player::rte_api::cmi_POST { |
| |
238 |
238 |
-id:required |
| |
239 |
239 |
-user_id:required |
| |
240 |
240 |
-data:required |
| |
241 |
241 |
} { |
| |
242 |
242 |
Process a POST cmi operation. This takes a JSON string as data, parses it, and |
| |
243 |
243 |
stores the data into the database. This is where the persistent storage of RTE |
| |
244 |
244 |
tracking information takes place. The datamodel structure is defined in |
| |
245 |
245 |
rte-api-init.tcl |
| |
246 |
246 |
} { |
| |
247 |
247 |
|
| |
248 |
248 |
# Browse mode allows one to navigate through a course without generating tracking |
| |
249 |
249 |
# data. Useful for checking out a course before making it public. |
| |
250 |
250 |
|
| |
251 |
|
if { [db_string get_lesson_mode {}] eq "browse"] } { |
| |
|
251 |
if { [db_string get_lesson_mode {}] eq "browse" } { |
| |
252 |
252 |
return |
| |
253 |
253 |
} |
| |
254 |
254 |
|
| |
255 |
255 |
foreach {table table_data} [util::json::object::get_values $data] { |
| |
256 |
256 |
set data_rows($table) {} |
| |
257 |
257 |
foreach row [util::json::array::get_values $table_data] { |
| |
258 |
258 |
lappend data_rows($table) [util::json::array::get_values $row] |
| |
259 |
259 |
} |
| |
260 |
260 |
} |
| |
261 |
261 |
|
| |
262 |
262 |
# Now for each table insert each row in the data structure, massaging special |
| |
263 |
263 |
# values and ignoring read-only columns in the process. Note that this process |
| |
264 |
264 |
# is sensitive to the ordering of the schema defined in our init file. |
| |
265 |
265 |
|
| |
266 |
266 |
foreach table [array names data_rows] { |
| |
267 |
267 |
set attributes [nsv_get scorm_schema ${table}_table] |
| |
268 |
268 |
|
| |
269 |
269 |
# This is a bit brute-force, we're going to walk the attributes and munge |
| |
270 |
270 |
# special columns and drop out read-only columns dynamically for each row. |
| |
271 |
271 |
# While it would be possible to go after this in a more sophisticated way, |