public function __construct() { parent::__construct(); $this->name = strtolower(preg_replace('/Layout$/', '', get_class($this))); $user_id = Session::uid(); $user = User::find($user_id); $this->currentUser['id'] = $user_id; $this->currentUser['username'] = $user_id ? $user->getUsername() : ''; $this->currentUser['nickname'] = $user_id ? $user->getNickname() : ''; $this->currentUser['is_runner'] = empty($_SESSION['is_runner']) ? false : true; $this->currentUser['runningProjects'] = json_encode($user->getProjectsAsRunner()); $this->currentUser['is_payer'] = empty($_SESSION['is_payer']) ? false : true; $this->currentUser['is_admin'] = !$user->getIs_admin() ? false : true; if ($user_id) { Utils::initUserById($user_id); $user->findUserById($user_id); $this->currentUser['budget'] = array('feeSums' => Fee::getSums(), 'totalManaged' => money_format('$ %i', $user->getTotalManaged()), 'remainingFunds' => money_format('$ %i', $user->setRemainingFunds()), 'allocated' => money_format('$ %i', $user->getAllocated()), 'submitted' => money_format('$ %i', $user->getSubmitted()), 'paid' => money_format('$ %i', $user->getPaid()), 'transfered' => money_format('$ %i', $user->getTransfered()), 'transfersDetails' => $user->getBudgetTransfersDetails(), 'available' => $user->getBudget()); $this->currentUser['can'] = array('addProject' => $user->getIs_admin() || $user->isRunner() || $user->isPaypalVerified()); $this->currentUser['is_internal'] = $user->isInternal(); $this->currentUser['budgetAuthorized'] = strpos(BUDGET_AUTHORIZED_USERS, "," . $user_id . ",") !== false; } }
/** * Constructor method */ public function __construct() { parent::__construct(); $this->name = strtolower(preg_replace('/View$/', '', get_class($this))); $this->loadGlobals(); }