function setupView() { $view = $this->getView(); $view->assign('controller', Pfw_Request::getParam('controller')); if (self::is_logged_in()) { # gettng user with profile photo Pfw_Loader::loadModel('User'); $user = User::Q()->where(array('this.id = %s', Pfw_Session::get('login_id')))->exec(); $logged_in_user = $user[0]; $view->assign('logged_in_user', $logged_in_user); $view->assign('is_logged_in', true); } }
function createAction() { $project = new Project(); $project->name = $_REQUEST['project_name']; $project->description = $_REQUEST['project_desc']; $project->dt_created = mysql_time(); $project->created_by = Pfw_Session::get('login_id'); try { $project->save(); } catch (Exception $e) { error_log("Caught exception with [" . $e->getMessage() . "]"); } $this->redirect("/home"); return; }
/** * Internal method to clear all alerts/notices with optional field. * * @param const $type self::TYPE_ERROR or self::TYPE_NOTICE * @param string $field */ protected static function clear($type, $field) { self::assertInitialized(); $alerts = Pfw_Session::get(self::SESSION_KEY); if (!empty($alerts)) { if (null !== field) { self::deleteWithFieldFromArray($alerts[$type], $field); } else { $alerts[$type] = array(); } Pfw_Sesssion::set(self::SESSION_KEY, $alerts); } if (null !== $field) { self::deleteWithFieldFromArray(self::$alerts[$type], $field); } else { self::$alerts[$type] = array(); } }