template->user = Session::get('user'); $this->template->js_bottom = []; } public function action_index() { $body = View::forge('settings/index'); $this->template->body = $body; } public function action_servers() { $this->template->js_bottom = ['plex_alert.js']; $body = View::forge('settings/servers'); $user_id = Session::get('user')->id; $servers = Model_Server::find(function($query) use($user_id) { $query ->where('user_id', $user_id) ; }); $body->set('servers', $servers); $body->set('user', Session::get('user')); $this->template->body = $body; } public function action_libraries() { $body = View::forge('settings/libraries'); $user_id = Session::get('user')->id; $libraries = Model_Library::find(function($query) use($user_id) { $query ->select('library.*') ->join('server', 'LEFT') ->on('server.id', '=','library.server_id' ) ->where('server.user_id', $user_id) ->and_where('server.disable', 0) ; }); $body->set('libraries', $libraries); $this->template->body = $body; } }