public static function applyLeaveProject(PhabricatorProject $project, PhabricatorUser $user) { $members = array_fill_keys($project->getMemberPHIDs(), true); unset($members[$user->getPHID()]); $members = array_keys($members); self::applyOneTransaction($project, $user, PhabricatorProjectTransactionType::TYPE_MEMBERS, $members); }
private function buildPropertyListView(PhabricatorProject $project, PhabricatorActionListView $actions) { $request = $this->getRequest(); $viewer = $request->getUser(); $this->loadHandles(array_merge($project->getMemberPHIDs(), $project->getWatcherPHIDs())); $view = id(new PHUIPropertyListView())->setUser($viewer)->setObject($project)->setActionList($actions); $hashtags = array(); foreach ($project->getSlugs() as $slug) { $hashtags[] = id(new PHUITagView())->setType(PHUITagView::TYPE_OBJECT)->setName('#' . $slug->getSlug()); } $view->addProperty(pht('Hashtags'), phutil_implode_html(' ', $hashtags)); $view->addProperty(pht('Members'), $project->getMemberPHIDs() ? $this->renderHandlesForPHIDs($project->getMemberPHIDs(), ',') : phutil_tag('em', array(), pht('None'))); $view->addProperty(pht('Watchers'), $project->getWatcherPHIDs() ? $this->renderHandlesForPHIDs($project->getWatcherPHIDs(), ',') : phutil_tag('em', array(), pht('None'))); $field_list = PhabricatorCustomField::getObjectFields($project, PhabricatorCustomField::ROLE_VIEW); $field_list->appendFieldsToPropertyList($project, $viewer, $view); return $view; }
private function renderPeoplePage(PhabricatorProject $project, PhabricatorProjectProfile $profile) { $member_phids = $project->getMemberPHIDs(); $handles = id(new PhabricatorObjectHandleData($member_phids))->loadHandles(); $affiliated = array(); foreach ($handles as $phids => $handle) { $affiliated[] = '<li>' . $handle->renderLink() . '</li>'; } if ($affiliated) { $affiliated = '<ul>' . implode("\n", $affiliated) . '</ul>'; } else { $affiliated = '<p><em>No one is affiliated with this project.</em></p>'; } return '<div class="phabricator-profile-info-group">' . '<h1 class="phabricator-profile-info-header">People</h1>' . '<div class="phabricator-profile-info-pane">' . $affiliated . '</div>' . '</div>'; }