]>
Commit | Line | Data |
---|---|---|
4d35980c | 1 | <?php // if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
9da25e7e | 2 | |
4d35980c | 3 | class Core { |
2c98ae78 JR |
4 | protected $CI; |
5 | ||
6 | public function __construct() { | |
7 | $this->CI =& get_instance(); | |
8 | $this->CI->load->model('user'); | |
9 | } | |
10 | ||
aa7d56f6 | 11 | public function get_menu() { |
2c98ae78 | 12 | /*$menu = array( |
45f2e649 CS |
13 | 'Desktop' => '#', |
14 | 'App' => '#', | |
db626555 | 15 | 'Logout' => 'javascript:wos.logout();void(0);', |
3372001f | 16 | 'GitHub' => 'https://github.com/mustis/KronOS' |
2c98ae78 | 17 | );*/ |
ff79bc64 JR |
18 | $menu = array( |
19 | 'Apps' => array(), | |
20 | 'System' => array(), | |
21 | ); | |
2c98ae78 JR |
22 | |
23 | $ulev = $this->CI->user->level(); | |
7b1c4752 | 24 | if ($ulev == 'operator') $chklevel = "a.access = 'user' OR a.access = 'operator'"; |
2c98ae78 JR |
25 | elseif ($ulev == 'manager') $chklevel = "1"; // full access -> always true |
26 | else $chklevel = "a.access = 'user'"; // fallback | |
27 | ||
28 | $sql = 'SELECT c.catname AS category, a.appname AS appname, a.aid AS appid FROM categories AS c, apps AS a WHERE c.cid = a.parent AND ('.$chklevel.')'; | |
29 | $q = $this->CI->db->query($sql); | |
30 | foreach ($q->result() as $row) { | |
ff79bc64 | 31 | $menu['Apps'][$row->category][$row->appname] = 'javascript:wos.openApp('.$row->appid.');void(0);'; |
2c98ae78 JR |
32 | } |
33 | ||
ff79bc64 JR |
34 | ksort($menu['Apps']); |
35 | foreach ($menu['Apps'] as $key => &$cat) { | |
2c98ae78 JR |
36 | if (is_array($cat)) { |
37 | ksort($cat); | |
38 | } | |
39 | } | |
40 | ||
41 | $menu['System'] = array( | |
3ff0a8dd CS |
42 | 'About KronOS' => 'javascript:wos.credits();void(0);', |
43 | // 'About KronOS' => 'javascript:wos.openCoreApp("credits");void(0);', | |
2c98ae78 JR |
44 | 'Preferences' => 'javascript:wos.openCoreApp("account");void(0);', |
45 | 'Logout' => 'javascript:wos.logout();void(0);', | |
aa7d56f6 | 46 | ); |
2c98ae78 | 47 | |
9d2ed0ce CS |
48 | return $menu; |
49 | } | |
50 | public function get_login() { | |
51 | $login_modal = ' | |
f32cf3e2 | 52 | <div id="loginModal" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
9d2ed0ce CS |
53 | <div class="modal-header"> |
54 | <h3 id="myModalLabel">Login</h3> | |
55 | </div> | |
db626555 | 56 | <form class="form-horizontal" method="post" action="javascript:wos.submitLogin();void(0);"> |
f32cf3e2 | 57 | <div class="modal-body"> |
7d24cfef | 58 | <div class="messagebody"> |
f32cf3e2 | 59 | </div> |
9d2ed0ce | 60 | <div class="control-group"> |
b539b4d3 | 61 | <label class="control-label" for="inputUsername">Username</label> |
9d2ed0ce | 62 | <div class="controls"> |
7b1c4752 | 63 | <input type="text" id="inputUsername" placeholder="Username" tabindex="1"> |
9d2ed0ce CS |
64 | </div> |
65 | </div> | |
66 | <div class="control-group"> | |
67 | <label class="control-label" for="inputPassword">Password</label> | |
68 | <div class="controls"> | |
7b1c4752 | 69 | <input type="password" id="inputPassword" placeholder="Password" tabindex="2"> |
9d2ed0ce CS |
70 | </div> |
71 | </div> | |
7b1c4752 | 72 | <!-- |
9d2ed0ce CS |
73 | <div class="control-group"> |
74 | <div class="controls"> | |
75 | <label class="checkbox"> | |
76 | <input type="checkbox"> Remember me | |
77 | </label> | |
78 | </div> | |
79 | </div> | |
7b1c4752 | 80 | --> |
f32cf3e2 CS |
81 | </div> |
82 | <div class="modal-footer"> | |
7b1c4752 | 83 | <button type="submit" class="btn btn-primary" tabindex="3">Login</button> |
f32cf3e2 CS |
84 | </div> |
85 | </form> | |
9d2ed0ce CS |
86 | </div>'; |
87 | return $login_modal; | |
aa7d56f6 CS |
88 | } |
89 | } | |
90 | ?> |