private function renderPeoplePage(PhabricatorProject $project, PhabricatorProjectProfile $profile) { $affiliations = $project->loadAffiliations(); $phids = mpull($affiliations, 'getUserPHID'); $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $affiliated = array(); foreach ($affiliations as $affiliation) { $user = $handles[$affiliation->getUserPHID()]->renderLink(); $role = phutil_escape_html($affiliation->getRole()); $affiliated[] = '<li>' . $user . ' — ' . $role . '</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>'; }
private function setTransactionOldValue(PhabricatorProject $project, PhabricatorProjectTransaction $xaction) { $type = $xaction->getTransactionType(); switch ($type) { case PhabricatorProjectTransactionType::TYPE_NAME: $xaction->setOldValue($project->getName()); break; case PhabricatorProjectTransactionType::TYPE_STATUS: $xaction->setOldValue($project->getStatus()); break; case PhabricatorProjectTransactionType::TYPE_MEMBERS: $affils = $project->loadAffiliations(); $project->attachAffiliations($affils); $old_value = mpull($affils, 'getUserPHID'); $old_value = array_values($old_value); $xaction->setOldValue($old_value); $new_value = $xaction->getNewValue(); $new_value = array_filter($new_value); $new_value = array_unique($new_value); $new_value = array_values($new_value); $xaction->setNewValue($new_value); break; default: throw new Exception("Unknown transaction type '{$type}'!"); } return $this; }