/** * Main action that returns a json-object like * { * 'js_function.sub_function': data, * 'anotherjs_function.sub_function': moredata * } * This action is called by STUDIP.JSUpdater.poll and the result processed * the internal STUDIP.JSUpdater.process method */ public function get_action() { $data = UpdateInformation::getInformation(); $data = array_merge($data, $this->coreInformation()); $data = studip_utf8encode($data); $this->set_content_type('application/json;charset=utf-8'); $this->render_text(json_encode($data)); }
function test_setgetinformation() { $old_data = array('test' => "TestValue"); UpdateInformation::setInformation("test.myfunc", $old_data); UpdateInformation::setInformation("test.myfunc2", "strangedata"); $new_data = UpdateInformation::getInformation(); $this->assertInternalType("array", $new_data); $this->assertInternalType("array", $new_data['test.myfunc']); $this->assertInternalType("string", $new_data['test.myfunc2']); $this->assertEquals("TestValue", $new_data['test.myfunc']['test']); $this->assertEquals("strangedata", $new_data['test.myfunc2']); }