public function before() { parent::before(); $this->add_style("/assets/admin/css/style.css"); $query = DB::select()->from('roles')->join('user_roles', "LEFT")->on('user_roles.role_id', '=', 'roles.id')->join('users', "LEFT")->on('user_roles.user_id', '=', 'users.id')->where('users.id', '=', $this->user->id)->and_where('roles.role_name', '=', 'admin'); $res = $query->as_object()->execute(); if ($res->count() <= 0) { $this->request->redirect("/"); } $this->_main_menu = array('stimulus' => new Model_Ui_Menuitem("Stimulus", "/admin/stimulus/index"), 'genres' => new Model_Ui_Menuitem("Genres", "/admin/genres/index"), 'user' => new Model_Ui_Menuitem("Users", "/admin/user/index"), 'channels' => new Model_Ui_Menuitem("Channels", "/admin/channels/index"), 'terms' => new Model_Ui_Menuitem("Terms", "/admin/terms/index"), 'userroles' => new Model_Ui_Menuitem("Role Management", "/admin/userroles/index"), 'pages' => new Model_Ui_Menuitem("General Pages", "/admin/pages/index")); if (isset($this->_main_menu[$this->request->controller()])) { $this->_main_menu[$this->request->controller()]->active = true; } }
/** Implementing the Gating of functions based on the non signed in actions */ public function before() { parent::before(); if (in_array($this->request->action(), $this->_non_auth_actions)) { if ($this->user != null) { $this->request->redirect(SIGNED_IN_HOME); } } else { if ($this->user == null) { $this->request->redirect("/user/login"); } else { $this->info_message = '<p style="background:#DDDDDD;padding:10px;">Here is where you can upload all your other creative work in any format - Audio, Video, Images or Text. This will be your online creative portfolio on Qyuki Earlybirds. Why wait, start showcasing your creative side, right here. <br/><br/> <span style="font-size:12px">Please note: If you\'d like to respond to any of the creative challenges, go to "Challenges", click on "View" to see the details and then click on the "Participate" button to submit your entry.</span></p>'; } } }