public static function menuIsActive() { if (!Session::getNested('active_menu', 'menu_id')) { // destroy session // Session::destroy(); // // create error message Session::add('feedback_errors', ErrorMessage::get('MENU_NOT_ACTIVE')); // redirect to menu selection screen header('Location: ' . URL_WITH_INDEX_FILE . 'menumanager/managemenus'); exit; } }
/** * Runs validation on login-form input fields * * @param array $postData * @return boolean */ public function validateLoginForm($postData) { if (empty($postData['username']) or empty($postData['password'])) { Session::add('feedback_errors', ErrorMessage::get('ERROR_FIELD_IS_EMPTY')); return false; } else { // attempt to retrieve username and password from database by selecting a row using client supplied username $dbResult = $this->retrieveCredentials($postData['username']); // a row containing client supplied username was found and the client supplied password matches the bcrypt hash of the password from the database if ($dbResult and password_verify($postData['password'], $dbResult['password'])) { // store account id to session Session::set('account_id', $dbResult['account_id']); return true; } else { Session::add('feedback_errors', ErrorMessage::get('ERROR_INVALID_CREDENTIALS')); return false; } } }
public function createSignage($parameter) { // store recipe id in the session of the recipe item that client wants to generate signage for Session::set('recipe_generate_signage', $parameter); // create message letting user know that they have been redirected Session::add('feedback_errors', ErrorMessage::get('GENERATE_SIGNAGE_FOR_RECIPE')); // redirect user to signage Helper::redirect('signagegenerator/premade'); }
/** * Sets the menu as active by storing menu name in session * @return [type] [description] */ public function activateMenu($parameter) { // instantiate model $MenuManagerModel = new MenuManagerModel(); // retrieve data $menuName = $MenuManagerModel->retrieveMenuName($parameter); // flatten array by one level $menuName = call_user_func_array('array_merge', $menuName); Session::set('active_menu', $menuName); Session::add('feedback_errors', ErrorMessage::get('MENU_ACTIVATED')); Helper::redirect('menumanager/managemenus'); }