]>
jfr.im git - z_archive/KronOS.git/blob - application/controllers/control.php
1 <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
3 /* TODO: error handling */
4 /* TODO: check that requesting user == app-session user */
6 class Control
extends CI_Controller
{
8 public function __construct() {
10 $this->load
->model('user');
11 $this->load
->model('msession');
14 public function index() {
17 public function open($aid, $core=NULL) {
18 if ($this->user
->is_logged_in()) {
21 $instance = $this->msession
->openCoreApp($core);
22 $repl = array('id' => $instance->iid(), 'name' => $instance->appName(), 'title' => $instance->windowTitle(), 'interior' => $instance->windowContents());
23 $this->json
->reply($repl);
25 $instance = $this->msession
->openApp($aid);
26 $repl = array('id' => $instance->iid(), 'name' => $instance->appName(), 'title' => $instance->windowTitle(), 'interior' => $instance->windowContents());
27 $this->json
->reply($repl);
30 $this->json
->error('Not logged in.');
34 public function act($iid, $action) {
35 $this->json
->reply($this->msession
->getAppInst($iid)->act($action));
38 public function scripts($aid) {
39 $this->output
->set_output(call_user_func(array($this->msession
->getAppClass($aid), 'scripts'), $aid));
42 public function close($iid) {
43 $this->msession
->closeApp($iid);