public function handleRequest(AphrontRequest $request) { $viewer = $this->getViewer(); $id = $request->getURIData('id'); $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withIDs(array($id))->needProfile(true)->needProfileImage(true)->executeOne(); if (!$user) { return new Aphront404Response(); } $this->setUser($user); $profile = $user->loadUserProfile(); $picture = $user->getProfileImageURI(); $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); $profile_icon = id(new PHUIIconView())->setIcon($profile_icon); $profile_title = $profile->getDisplayTitle(); $header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader(array($profile_icon, $profile_title))->setImage($picture); $actions = $this->buildActionList($user); $properties = $this->buildPropertyView($user); $properties->setActionList($actions); $name = $user->getUsername(); $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties); $nav = $this->getProfileMenu(); $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_MANAGE); $timeline = $this->buildTransactionTimeline($user, new PhabricatorPeopleTransactionQuery()); $timeline->setShouldTerminate(true); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Manage')); return $this->newPage()->setTitle(array(pht('Manage User'), $user->getUsername()))->setNavigation($nav)->setCrumbs($crumbs)->appendChild(array($object_box, $timeline)); }
public function loadHandles(PhabricatorHandleQuery $query, array $handles, array $objects) { foreach ($handles as $phid => $handle) { $user = $objects[$phid]; $realname = $user->getRealName(); $handle->setName($user->getUsername()); $handle->setURI('/p/' . $user->getUsername() . '/'); $handle->setFullName($user->getFullName()); $handle->setImageURI($user->getProfileImageURI()); if ($user->getIsMailingList()) { $handle->setIcon('fa-envelope-o'); $handle->setSubtitle(pht('Mailing List')); } else { $profile = $user->getUserProfile(); $icon_key = $profile->getIcon(); $icon_icon = PhabricatorPeopleIconSet::getIconIcon($icon_key); $subtitle = $profile->getDisplayTitle(); $handle->setIcon($icon_icon)->setSubtitle($subtitle)->setTokenIcon('fa-user'); } $availability = null; if (!$user->isUserActivated()) { $availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED; } else { $until = $user->getAwayUntil(); if ($until) { $availability = PhabricatorObjectHandle::AVAILABILITY_NONE; } } if ($availability) { $handle->setAvailability($availability); } } }
public function handleRequest(AphrontRequest $request) { $viewer = $this->getViewer(); $username = $request->getURIData('username'); $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($username))->needBadges(true)->needProfileImage(true)->needAvailability(true)->executeOne(); if (!$user) { return new Aphront404Response(); } $this->setUser($user); $profile = $user->loadUserProfile(); $picture = $user->getProfileImageURI(); $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); $profile_icon = id(new PHUIIconView())->setIcon($profile_icon); $profile_title = $profile->getDisplayTitle(); $header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader(array($profile_icon, $profile_title))->setImage($picture)->setProfileHeader(true); $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT); if ($can_edit) { $id = $user->getID(); $header->setImageEditURL($this->getApplicationURI("picture/{$id}/")); } $properties = $this->buildPropertyView($user); $name = $user->getUsername(); $feed = $this->buildPeopleFeed($user, $viewer); $feed = id(new PHUIObjectBoxView())->setHeaderText(pht('Recent Activity'))->addClass('project-view-feed')->appendChild($feed); $projects = $this->buildProjectsView($user); $calendar = $this->buildCalendarDayView($user); $badges = $this->buildBadgesView($user); require_celerity_resource('project-view-css'); $home = id(new PHUITwoColumnView())->setHeader($header)->addClass('project-view-home')->setMainColumn(array($properties, $feed))->setSideColumn(array($projects, $calendar, $badges)); $nav = $this->getProfileMenu(); $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_PROFILE); $crumbs = $this->buildApplicationCrumbs(); $crumbs->setBorder(true); return $this->newPage()->setTitle($user->getUsername())->setNavigation($nav)->setCrumbs($crumbs)->appendChild(array($home)); }
protected function getTagContent() { $user = $this->profile; $profile = $user->loadUserProfile(); $picture = $user->getProfileImageURI(); $viewer = $this->viewer; require_celerity_resource('project-card-view-css'); $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); $profile_title = $profile->getDisplayTitle(); $tag = id(new PHUITagView())->setIcon($profile_icon)->setName($profile_title)->addClass('project-view-header-tag')->setType(PHUITagView::TYPE_SHADE); $header = id(new PHUIHeaderView())->setHeader(array($user->getFullName(), $tag))->setUser($viewer)->setImage($picture); $body = array(); $body[] = $this->addItem(pht('User Since'), phabricator_date($profile->getDateCreated(), $viewer)); if (PhabricatorApplication::isClassInstalledForViewer('PhabricatorCalendarApplication', $viewer)) { $body[] = $this->addItem(pht('Availability'), id(new PHUIUserAvailabilityView())->setViewer($viewer)->setAvailableUser($user)); } $badges = $this->buildBadges($user, $viewer); if ($badges) { $badges = id(new PHUIBadgeBoxView())->addItems($badges)->setCollapsed(true); $body[] = phutil_tag('div', array('class' => 'phui-hovercard-body-item hovercard-badges'), $badges); } $body = phutil_tag('div', array('class' => 'project-card-body'), $body); $card = phutil_tag('div', array('class' => 'project-card-inner'), array($header, $body)); return $card; }
public function getDisplayTitle() { $title = $this->getTitle(); if (strlen($title)) { return $title; } $icon_key = $this->getIcon(); return PhabricatorPeopleIconSet::getIconName($icon_key); }
public function handleRequest(AphrontRequest $request) { $response = $this->setupLiveEnvironment(); if ($response) { return $response; } $viewer = $request->getViewer(); $moved = $request->getStr('moved'); $post = $this->getPost(); $blog = $this->getBlog(); $is_live = $this->getIsLive(); $is_external = $this->getIsExternal(); $header = id(new PHUIHeaderView())->setHeader($post->getTitle())->setUser($viewer); if (!$is_external) { $actions = $this->renderActions($post); $header->setPolicyObject($post); $header->setActionList($actions); } $document = id(new PHUIDocumentViewPro())->setHeader($header); if ($moved) { $document->appendChild(id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->appendChild(pht('Post moved successfully.'))); } if ($post->isDraft()) { $document->appendChild(id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Draft Post'))->appendChild(pht('Only you can see this draft until you publish it. ' . 'Use "Publish" to publish this post.'))); } if (!$post->getBlog()) { $document->appendChild(id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_WARNING)->setTitle(pht('Not On A Blog'))->appendChild(pht('This post is not associated with a blog (the blog may have ' . 'been deleted). Use "Move Post" to move it to a new blog.'))); } $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($post, PhamePost::MARKUP_FIELD_BODY)->process(); $document->appendChild(phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY))); $blogger = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withPHIDs(array($post->getBloggerPHID()))->needProfileImage(true)->executeOne(); $blogger_profile = $blogger->loadUserProfile(); $author = phutil_tag('a', array('href' => '/p/' . $blogger->getUsername() . '/'), $blogger->getUsername()); $date = phabricator_datetime($post->getDatePublished(), $viewer); if ($post->isDraft()) { $subtitle = pht('Unpublished draft by %s.', $author); } else { $subtitle = pht('Written by %s on %s.', $author, $date); } $user_icon = $blogger_profile->getIcon(); $user_icon = PhabricatorPeopleIconSet::getIconIcon($user_icon); $user_icon = id(new PHUIIconView())->setIcon($user_icon); $about = id(new PhameDescriptionView())->setTitle($subtitle)->setDescription(array($user_icon, ' ', $blogger_profile->getTitle()))->setImage($blogger->getProfileImageURI())->setImageHref('/p/' . $blogger->getUsername()); $timeline = $this->buildTransactionTimeline($post, id(new PhamePostTransactionQuery())->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); $timeline = phutil_tag_div('phui-document-view-pro-box', $timeline); if ($is_external) { $add_comment = null; } else { $add_comment = $this->buildCommentForm($post); $add_comment = phutil_tag_div('mlb mlt', $add_comment); } list($prev, $next) = $this->loadAdjacentPosts($post); $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($post); $next_view = new PhameNextPostView(); if ($next) { $next_view->setNext($next->getTitle(), $next->getViewURI()); } if ($prev) { $next_view->setPrevious($prev->getTitle(), $prev->getViewURI()); } $document->setFoot($next_view); $crumbs = $this->buildApplicationCrumbs(); $properties = phutil_tag_div('phui-document-view-pro-box', $properties); $page = $this->newPage()->setTitle($post->getTitle())->setPageObjectPHIDs(array($post->getPHID()))->setCrumbs($crumbs)->appendChild(array($document, $about, $properties, $timeline, $add_comment)); if ($is_live) { $page->setShowChrome(false)->setShowFooter(false); } return $page; }