]> jfr.im git - z_archive/KronOS.git/blame - application/controllers/control.php
Added 'core apps' code, so credits can no longer be removed in DB - under KronOS...
[z_archive/KronOS.git] / application / controllers / control.php
CommitLineData
3cf8917d
JR
1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3/* TODO: error handling */
c1828c8b 4/* TODO: check that requesting user == app-session user */
3cf8917d
JR
5
6class Control extends CI_Controller {
7
8 public function __construct() {
9 parent::__construct();
10 $this->load->model('user');
536db703 11 $this->load->model('msession');
3cf8917d
JR
12 }
13
14 public function index() {
15 }
16
c1828c8b 17 public function open($aid, $core=NULL) {
3cf8917d 18 if ($this->user->is_logged_in()) {
c1828c8b
JR
19 if ($aid == -1) {
20 // core app!
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);
24 } else {
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);
28 }
3cf8917d
JR
29 } else {
30 $this->json->error('Not logged in.');
31 }
32 }
33
34 public function act($iid, $action) {
536db703 35// return $this->msession->getAppInst($iid)->act($action);
3cf8917d
JR
36 }
37
38 public function close($iid) {
536db703 39 $this->msession->closeApp($iid);
3cf8917d
JR
40 }
41}
42?>