protected function init(MvcEvent $e) { parent::init($e); $this->helper = new SearchHelper($e, $this->id, $this->engine); // FIXME should this use a broker? Can't work out how (or why) $this->fm = new FlashMessenger(); }
protected function init(MvcEvent $e) { parent::init($e); $this->helper = new SearchHelper($e, $this->id, $this->engine); $this->flashMessenger = new FlashMessenger(); }
protected function init() { parent::init(); $this->helper = new SearchHelper($this->event, $this->id, $this->engine); }
public function init(MvcEvent $e) { // make the username the query $this->request->replaceParam("query", $this->request->getSessionData('username')); parent::init($e); }
/** * (non-PHPdoc) * @see Application\Controller.SearchController::init() */ public function init() { // inital oauth request // @todo: this needs to be folded into the authentication framework or something? if ($this->request->getParam("oauth_consumer_key")) { $key = $this->registry->getConfig('BLTI_KEY', true); $secret = $this->registry->getConfig('BLTI_SECRET', true); $lti = new Lti\Basic($key, $secret); // extract course id $this->course_id = $lti->getID(); $this->request->setParam('course_id', $this->course_id); // save in session for subsequent actions $this->request->setSessionData('course_id', $this->course_id); $this->request->setSessionObject("lti_" . $this->course_id, $lti); $user = $this->request->getUser(); // this is the first time user has come during this session if ($this->request->getSessionData('reading_list_user') == null) { $datamap = new Users(); $user_id = $lti->getUserID(); // the lms user id $username = $datamap->getUserFromLti($user_id); // see if user is already in our database // we don't know this user if ($username == "") { // and they have not logged in if (!$user->isAuthenticated()) { return $this->redirectToLogin(); // send them to login } else { $datamap->associateUserWithLti($user->username, $user_id); // register them for next time } } else { // swap username $user->username = $username; // register them in session and such for single sign on $auth_factory = new AuthenticationFactory(); $auth_factory->getAuthenticationObject($this->request)->register($user); } // and make sure we keep track of that here for subsequent requests $this->request->setSessionData('reading_list_user', $user_id); } } // subsequent requests with course_id in URL $course_id = $this->request->getParam('course_id'); if ($course_id != "") { $this->course_id = $course_id; // add value from saved lti session @todo make this universal or something $session_id = 'lti_' . $course_id; if ($this->request->existsInSessionData($session_id)) { $lti = $this->request->getSessionObject($session_id); $this->response->setVariable('resource_link_title', $lti->getParam('resource_link_title')); $this->response->setVariable('resource_link_description', $lti->getParam('resource_link_description')); } } // save lti in the response $lti = $this->request->getSessionObject("lti_" . $this->course_id); $this->response->setVariable('lti', $lti); parent::init(); // display helpers $this->helper = new ListHelper($this->event, $this->id, $this->engine); $this->response->setVariable('course_nav', $this->helper->getNavigation()); }