public function __construct($id, $is_active, PFUser $user, array $projects) { parent::__construct($id, $is_active); $this->projects = $projects; $this->has_projects = count($projects) > 0; $this->label = $GLOBALS['Language']->getText('include_menu', 'projects'); $this->filter_project = $GLOBALS['Language']->getText('include_menu', 'filter_project'); $this->menu_projects_text = $GLOBALS['Language']->getText('include_menu', 'projects'); $this->browse_projects_text = $GLOBALS['Language']->getText('include_menu', 'browse_projects'); $this->register_new_proj = $GLOBALS['Language']->getText('include_menu', 'register_new_proj'); $this->is_trove_cat_enabled = ForgeConfig::get('sys_use_trove'); $this->is_project_registration_enabled = ForgeConfig::get('sys_use_project_registration', true); $this->display_only_trovemap = $this->is_trove_cat_enabled && !$this->is_project_registration_enabled && !$this->projects; $this->display_dropdown = !$this->display_only_trovemap && $user->isLoggedIn(); }
private function container(array $params, ProjectManager $project_manager, PFUser $current_user) { $project_tabs = null; $project_name = null; $project_link = null; $project_is_public = null; $project_privacy = null; $sidebar_collapsable = false; if (!empty($params['group'])) { $this->show_sidebar = true; $project = ProjectManager::instance()->getProject($params['group']); $project_tabs = $this->getProjectTabs($params, $project); $project_name = $project->getPublicName(); $project_link = $this->getProjectLink($project); $project_is_public = $project->isPublic(); $project_privacy = $this->getProjectPrivacy($project); $sidebar_collapsable = !$current_user->isAnonymous() && $current_user->isLoggedIn() ? true : false; } $this->render('container', new FlamingParrot_ContainerPresenter($this->breadcrumbs, $this->force_breadcrumbs, $this->toolbar, $project_name, $project_link, $project_is_public, $project_privacy, $project_tabs, $this->_feedback, $this->_getFeedback(), $this->getForgeVersion(), $sidebar_collapsable)); $this->keyboardModal(); }
public function user_is_logged_in() { return $this->user->isLoggedIn(); }
private function addMyItem(FlamingParrot_NavBarItemPresentersCollection $collection) { if ($this->user->isLoggedIn()) { $collection->addItem(new FlamingParrot_NavBarItemLinkPresenter('my', $this->isNavBarItemActive(array('/my/', '/widgets/')), '/my/', $GLOBALS['Language']->getText('menu', 'my_personal_page'))); } }
/** * Returns true if the toggler should be displayed * * @param PFUser $user The user * @param string $id the id of the toggler * @param bool $default if we don't know, return $default * * @return bool */ public static function shouldBeDisplayed(PFUser $user, $id, $default) { if ($user->isLoggedIn()) { $should_be_displayed = $user->getPreference('toggle_' . $id); //TODO: DRY 'toggle_'. $id if ($should_be_displayed !== false) { return $should_be_displayed; } } return $default; }