本文整理汇总了PHP中ManiphestTask::getPHID方法的典型用法代码示例。如果您正苦于以下问题:PHP ManiphestTask::getPHID方法的具体用法?PHP ManiphestTask::getPHID怎么用?PHP ManiphestTask::getPHID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManiphestTask
的用法示例。
在下文中一共展示了ManiphestTask::getPHID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performMerge
private function performMerge(ManiphestTask $task, PhabricatorObjectHandle $handle, array $phids)
{
$user = $this->getRequest()->getUser();
$response = id(new AphrontReloadResponse())->setURI($handle->getURI());
$phids = array_fill_keys($phids, true);
unset($phids[$task->getPHID()]);
// Prevent merging a task into itself.
if (!$phids) {
return $response;
}
$targets = id(new ManiphestTaskQuery())->setViewer($user)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->withPHIDs(array_keys($phids))->needSubscriberPHIDs(true)->needProjectPHIDs(true)->execute();
if (empty($targets)) {
return $response;
}
$editor = id(new ManiphestTransactionEditor())->setActor($user)->setContentSourceFromRequest($this->getRequest())->setContinueOnNoEffect(true)->setContinueOnMissingFields(true);
$cc_vector = array();
// since we loaded this via a generic object query, go ahead and get the
// attach the subscriber and project phids now
$task->attachSubscriberPHIDs(PhabricatorSubscribersQuery::loadSubscribersForPHID($task->getPHID()));
$task->attachProjectPHIDs(PhabricatorEdgeQuery::loadDestinationPHIDs($task->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST));
$cc_vector[] = $task->getSubscriberPHIDs();
foreach ($targets as $target) {
$cc_vector[] = $target->getSubscriberPHIDs();
$cc_vector[] = array($target->getAuthorPHID(), $target->getOwnerPHID());
$merged_into_txn = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_INTO)->setNewValue($task->getPHID());
$editor->applyTransactions($target, array($merged_into_txn));
}
$all_ccs = array_mergev($cc_vector);
$all_ccs = array_filter($all_ccs);
$all_ccs = array_unique($all_ccs);
$add_ccs = id(new ManiphestTransaction())->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)->setNewValue(array('=' => $all_ccs));
$merged_from_txn = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_FROM)->setNewValue(mpull($targets, 'getPHID'));
$editor->applyTransactions($task, array($add_ccs, $merged_from_txn));
return $response;
}
示例2: updateTaskProjects
public static function updateTaskProjects(ManiphestTask $task)
{
$dao = new ManiphestTaskProject();
$conn = $dao->establishConnection('w');
$sql = array();
foreach ($task->getProjectPHIDs() as $project_phid) {
$sql[] = qsprintf($conn, '(%s, %s)', $task->getPHID(), $project_phid);
}
queryfx($conn, 'DELETE FROM %T WHERE taskPHID = %s', $dao->getTableName(), $task->getPHID());
if ($sql) {
queryfx($conn, 'INSERT INTO %T (taskPHID, projectPHID) VALUES %Q', $dao->getTableName(), implode(', ', $sql));
}
}
示例3: performMerge
private function performMerge(ManiphestTask $task, PhabricatorObjectHandle $handle, array $phids)
{
$user = $this->getRequest()->getUser();
$response = id(new AphrontReloadResponse())->setURI($handle->getURI());
$phids = array_fill_keys($phids, true);
unset($phids[$task->getPHID()]);
// Prevent merging a task into itself.
if (!$phids) {
return $response;
}
$targets = id(new ManiphestTaskQuery())->setViewer($user)->withPHIDs(array_keys($phids))->execute();
if (empty($targets)) {
return $response;
}
$editor = id(new ManiphestTransactionEditor())->setActor($user)->setContentSourceFromRequest($this->getRequest())->setContinueOnNoEffect(true)->setContinueOnMissingFields(true);
$cc_vector = array();
$cc_vector[] = $task->getCCPHIDs();
foreach ($targets as $target) {
$cc_vector[] = $target->getCCPHIDs();
$cc_vector[] = array($target->getAuthorPHID(), $target->getOwnerPHID());
$merged_into_txn = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_INTO)->setNewValue($task->getPHID());
$editor->applyTransactions($target, array($merged_into_txn));
}
$all_ccs = array_mergev($cc_vector);
$all_ccs = array_filter($all_ccs);
$all_ccs = array_unique($all_ccs);
$add_ccs = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_CCS)->setNewValue($all_ccs);
$merged_from_txn = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_FROM)->setNewValue(mpull($targets, 'getPHID'));
$editor->applyTransactions($task, array($add_ccs, $merged_from_txn));
return $response;
}
示例4: updateTaskSubscribers
public static function updateTaskSubscribers(ManiphestTask $task)
{
$dao = new ManiphestTaskSubscriber();
$conn = $dao->establishConnection('w');
$sql = array();
$subscribers = $task->getCCPHIDs();
$subscribers[] = $task->getOwnerPHID();
$subscribers = array_unique($subscribers);
foreach ($subscribers as $subscriber_phid) {
$sql[] = qsprintf($conn, '(%s, %s)', $task->getPHID(), $subscriber_phid);
}
queryfx($conn, 'DELETE FROM %T WHERE taskPHID = %s', $dao->getTableName(), $task->getPHID());
if ($sql) {
queryfx($conn, 'INSERT INTO %T (taskPHID, subscriberPHID) VALUES %Q', $dao->getTableName(), implode(', ', $sql));
}
}
示例5: buildActionView
private function buildActionView(ManiphestTask $task)
{
$viewer = $this->getRequest()->getUser();
$id = $task->getID();
$phid = $task->getPHID();
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $task, PhabricatorPolicyCapability::CAN_EDIT);
$view = id(new PhabricatorActionListView())->setUser($viewer)->setObject($task);
$view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Task'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("/task/edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$view->addAction(id(new PhabricatorActionView())->setName(pht('Merge Duplicates In'))->setHref("/search/attach/{$phid}/TASK/merge/")->setWorkflow(true)->setIcon('fa-compress')->setDisabled(!$can_edit)->setWorkflow(true));
$edit_config = id(new ManiphestEditEngine())->setViewer($viewer)->loadDefaultEditConfiguration();
$can_create = (bool) $edit_config;
if ($can_create) {
$form_key = $edit_config->getIdentifier();
$edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))->setQueryParam('parent', $id)->setQueryParam('template', $id)->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus());
$edit_uri = $this->getApplicationURI($edit_uri);
} else {
// TODO: This will usually give us a somewhat-reasonable error page, but
// could be a bit cleaner.
$edit_uri = "/task/edit/{$id}/";
$edit_uri = $this->getApplicationURI($edit_uri);
}
$view->addAction(id(new PhabricatorActionView())->setName(pht('Create Subtask'))->setHref($edit_uri)->setIcon('fa-level-down')->setDisabled(!$can_create)->setWorkflow(!$can_create));
$view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Blocking Tasks'))->setHref("/search/attach/{$phid}/TASK/blocks/")->setWorkflow(true)->setIcon('fa-link')->setDisabled(!$can_edit)->setWorkflow(true));
return $view;
}
示例6: buildCurtain
private function buildCurtain(ManiphestTask $task, PhabricatorEditEngine $edit_engine)
{
$viewer = $this->getViewer();
$id = $task->getID();
$phid = $task->getPHID();
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $task, PhabricatorPolicyCapability::CAN_EDIT);
$curtain = $this->newCurtainView($task);
$curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Task'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("/task/edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$edit_config = $edit_engine->loadDefaultEditConfiguration();
$can_create = (bool) $edit_config;
$can_reassign = $edit_engine->hasEditAccessToTransaction(ManiphestTransaction::TYPE_OWNER);
if ($can_create) {
$form_key = $edit_config->getIdentifier();
$edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))->setQueryParam('parent', $id)->setQueryParam('template', $id)->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus());
$edit_uri = $this->getApplicationURI($edit_uri);
} else {
// TODO: This will usually give us a somewhat-reasonable error page, but
// could be a bit cleaner.
$edit_uri = "/task/edit/{$id}/";
$edit_uri = $this->getApplicationURI($edit_uri);
}
$subtask_item = id(new PhabricatorActionView())->setName(pht('Create Subtask'))->setHref($edit_uri)->setIcon('fa-level-down')->setDisabled(!$can_create)->setWorkflow(!$can_create);
$relationship_list = PhabricatorObjectRelationshipList::newForObject($viewer, $task);
$submenu_actions = array($subtask_item, ManiphestTaskHasParentRelationship::RELATIONSHIPKEY, ManiphestTaskHasSubtaskRelationship::RELATIONSHIPKEY, ManiphestTaskMergeInRelationship::RELATIONSHIPKEY, ManiphestTaskCloseAsDuplicateRelationship::RELATIONSHIPKEY);
$task_submenu = $relationship_list->newActionSubmenu($submenu_actions)->setName(pht('Edit Related Tasks...'))->setIcon('fa-anchor');
$curtain->addAction($task_submenu);
$relationship_submenu = $relationship_list->newActionMenu();
if ($relationship_submenu) {
$curtain->addAction($relationship_submenu);
}
$owner_phid = $task->getOwnerPHID();
$author_phid = $task->getAuthorPHID();
$handles = $viewer->loadHandles(array($owner_phid, $author_phid));
if ($owner_phid) {
$image_uri = $handles[$owner_phid]->getImageURI();
$image_href = $handles[$owner_phid]->getURI();
$owner = $viewer->renderHandle($owner_phid)->render();
$content = phutil_tag('strong', array(), $owner);
$assigned_to = id(new PHUIHeadThingView())->setImage($image_uri)->setImageHref($image_href)->setContent($content);
} else {
$assigned_to = phutil_tag('em', array(), pht('None'));
}
$curtain->newPanel()->setHeaderText(pht('Assigned To'))->appendChild($assigned_to);
$author_uri = $handles[$author_phid]->getImageURI();
$author_href = $handles[$author_phid]->getURI();
$author = $viewer->renderHandle($author_phid)->render();
$content = phutil_tag('strong', array(), $author);
$date = phabricator_date($task->getDateCreated(), $viewer);
$content = pht('%s, %s', $content, $date);
$authored_by = id(new PHUIHeadThingView())->setImage($author_uri)->setImageHref($author_href)->setContent($content);
$curtain->newPanel()->setHeaderText(pht('Authored By'))->appendChild($authored_by);
return $curtain;
}
示例7: buildCurtain
private function buildCurtain(ManiphestTask $task, PhabricatorEditEngine $edit_engine)
{
$viewer = $this->getViewer();
$id = $task->getID();
$phid = $task->getPHID();
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $task, PhabricatorPolicyCapability::CAN_EDIT);
$curtain = $this->newCurtainView($task);
$curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Task'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("/task/edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$curtain->addAction(id(new PhabricatorActionView())->setName(pht('Merge Duplicates In'))->setHref("/search/attach/{$phid}/TASK/merge/")->setWorkflow(true)->setIcon('fa-compress')->setDisabled(!$can_edit)->setWorkflow(true));
$edit_config = $edit_engine->loadDefaultEditConfiguration();
$can_create = (bool) $edit_config;
$can_reassign = $edit_engine->hasEditAccessToTransaction(ManiphestTransaction::TYPE_OWNER);
if ($can_create) {
$form_key = $edit_config->getIdentifier();
$edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))->setQueryParam('parent', $id)->setQueryParam('template', $id)->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus());
$edit_uri = $this->getApplicationURI($edit_uri);
} else {
// TODO: This will usually give us a somewhat-reasonable error page, but
// could be a bit cleaner.
$edit_uri = "/task/edit/{$id}/";
$edit_uri = $this->getApplicationURI($edit_uri);
}
$curtain->addAction(id(new PhabricatorActionView())->setName(pht('Create Subtask'))->setHref($edit_uri)->setIcon('fa-level-down')->setDisabled(!$can_create)->setWorkflow(!$can_create));
$curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Blocking Tasks'))->setHref("/search/attach/{$phid}/TASK/blocks/")->setWorkflow(true)->setIcon('fa-link')->setDisabled(!$can_edit)->setWorkflow(true));
$owner_phid = $task->getOwnerPHID();
$author_phid = $task->getAuthorPHID();
$handles = $viewer->loadHandles(array($owner_phid, $author_phid));
if ($owner_phid) {
$image_uri = $handles[$owner_phid]->getImageURI();
$image_href = $handles[$owner_phid]->getURI();
$owner = $viewer->renderHandle($owner_phid)->render();
$content = phutil_tag('strong', array(), $owner);
$assigned_to = id(new PHUIHeadThingView())->setImage($image_uri)->setImageHref($image_href)->setContent($content);
} else {
$assigned_to = phutil_tag('em', array(), pht('None'));
}
$curtain->newPanel()->setHeaderText(pht('Assigned To'))->appendChild($assigned_to);
$author_uri = $handles[$author_phid]->getImageURI();
$author_href = $handles[$author_phid]->getURI();
$author = $viewer->renderHandle($author_phid)->render();
$content = phutil_tag('strong', array(), $author);
$date = phabricator_date($task->getDateCreated(), $viewer);
$content = pht('%s, %s', $content, $date);
$authored_by = id(new PHUIHeadThingView())->setImage($author_uri)->setImageHref($author_href)->setContent($content);
$curtain->newPanel()->setHeaderText(pht('Authored By'))->appendChild($authored_by);
return $curtain;
}
示例8: performMerge
private function performMerge(ManiphestTask $task, PhabricatorObjectHandle $handle, array $phids)
{
$user = $this->getRequest()->getUser();
$response = id(new AphrontReloadResponse())->setURI($handle->getURI());
$phids = array_fill_keys($phids, true);
unset($phids[$task->getPHID()]);
// Prevent merging a task into itself.
if (!$phids) {
return $response;
}
$targets = id(new ManiphestTaskQuery())->setViewer($user)->withPHIDs(array_keys($phids))->execute();
if (empty($targets)) {
return $response;
}
$editor = id(new ManiphestTransactionEditor())->setActor($user)->setContentSourceFromRequest($this->getRequest())->setContinueOnNoEffect(true)->setContinueOnMissingFields(true);
$task_names = array();
$merge_into_name = 'T' . $task->getID();
$cc_vector = array();
$cc_vector[] = $task->getCCPHIDs();
foreach ($targets as $target) {
$cc_vector[] = $target->getCCPHIDs();
$cc_vector[] = array($target->getAuthorPHID(), $target->getOwnerPHID());
$close_task = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_STATUS)->setNewValue(ManiphestTaskStatus::getDuplicateStatus());
$merge_comment = id(new ManiphestTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new ManiphestTransactionComment())->setContent("✘ Merged into {$merge_into_name}."));
$editor->applyTransactions($target, array($close_task, $merge_comment));
$task_names[] = 'T' . $target->getID();
}
$all_ccs = array_mergev($cc_vector);
$all_ccs = array_filter($all_ccs);
$all_ccs = array_unique($all_ccs);
$task_names = implode(', ', $task_names);
$add_ccs = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_CCS)->setNewValue($all_ccs);
$merged_comment = id(new ManiphestTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new ManiphestTransactionComment())->setContent("◀ Merged tasks: {$task_names}."));
$editor->applyTransactions($task, array($add_ccs, $merged_comment));
return $response;
}
示例9: getColumnMap
private function getColumnMap(ManiphestTask $task)
{
$phid = $task->getPHID();
if (!$phid) {
return array();
}
$board_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($phid, PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
if (!$board_phids) {
return array();
}
$viewer = $this->getViewer();
$layout_engine = id(new PhabricatorBoardLayoutEngine())->setViewer($viewer)->setBoardPHIDs($board_phids)->setObjectPHIDs(array($task->getPHID()))->executeLayout();
$map = array();
foreach ($board_phids as $board_phid) {
$in_columns = $layout_engine->getObjectColumns($board_phid, $phid);
$in_columns = mpull($in_columns, null, 'getPHID');
$all_columns = $layout_engine->getColumns($board_phid);
if (!$all_columns) {
// This could be a project with no workboard, or a project the viewer
// does not have permission to see.
continue;
}
$board = head($all_columns)->getProject();
$options = array();
foreach ($all_columns as $column) {
$name = $column->getDisplayName();
$is_hidden = $column->isHidden();
$is_selected = isset($in_columns[$column->getPHID()]);
// Don't show hidden, subproject or milestone columns in this map
// unless the object is currently in the column.
$skip_column = $is_hidden || $column->getProxyPHID();
if ($skip_column) {
if (!$is_selected) {
continue;
}
}
if ($is_hidden) {
$name = pht('(%s)', $name);
}
if ($is_selected) {
$name = pht("● %s", $name);
} else {
$name = pht("○ %s", $name);
}
$option = array('key' => $column->getPHID(), 'label' => $name, 'selected' => (bool) $is_selected);
$options[] = $option;
}
$map[] = array('label' => $board->getDisplayName(), 'options' => $options);
}
$map = isort($map, 'label');
$map = array_values($map);
return $map;
}
示例10: buildCardResponse
private function buildCardResponse(ManiphestTask $task)
{
$controller = $this->getController();
$request = $controller->getRequest();
$viewer = $request->getViewer();
$column_phid = $request->getStr('columnPHID');
$order = $request->getStr('order');
$column = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withPHIDs(array($column_phid))->executeOne();
if (!$column) {
return new Aphront404Response();
}
// If the workboard's project and all descendant projects have been removed
// from the card's project list, we are going to remove it from the board
// completely.
// TODO: If the user did something sneaky and changed a subproject, we'll
// currently leave the card where it was but should really move it to the
// proper new column.
$board_phid = $column->getProjectPHID();
$descendant_projects = id(new PhabricatorProjectQuery())->setViewer($viewer)->withAncestorProjectPHIDs(array($column->getProjectPHID()))->execute();
$board_phids = mpull($descendant_projects, 'getPHID', 'getPHID');
$board_phids[$board_phid] = $board_phid;
$project_map = array_fuse($task->getProjectPHIDs());
$remove_card = !array_intersect_key($board_phids, $project_map);
// TODO: Maybe the caller should pass a list of visible task PHIDs so we
// know which ones we need to reorder? This is a HUGE overfetch.
$objects = id(new ManiphestTaskQuery())->setViewer($viewer)->withEdgeLogicPHIDs(PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, PhabricatorQueryConstraint::OPERATOR_ANCESTOR, array($board_phids))->setViewer($viewer)->execute();
$objects = mpull($objects, null, 'getPHID');
$layout_engine = id(new PhabricatorBoardLayoutEngine())->setViewer($viewer)->setBoardPHIDs(array($board_phid))->setObjectPHIDs(array_keys($objects))->executeLayout();
$positions = $layout_engine->getColumnObjectPositions($board_phid, $column_phid);
$column_phids = $layout_engine->getColumnObjectPHIDs($board_phid, $column_phid);
$column_tasks = array_select_keys($objects, $column_phids);
if ($order == PhabricatorProjectColumn::ORDER_NATURAL) {
// TODO: This is a little bit awkward, because PHP and JS use
// slightly different sort order parameters to achieve the same
// effect. It would be good to unify this a bit at some point.
$sort_map = array();
foreach ($positions as $position) {
$sort_map[$position->getObjectPHID()] = array(-$position->getSequence(), $position->getID());
}
} else {
$sort_map = mpull($column_tasks, 'getPrioritySortVector', 'getPHID');
}
$data = array('removeFromBoard' => $remove_card, 'sortMap' => $sort_map);
$rendering_engine = id(new PhabricatorBoardRenderingEngine())->setViewer($viewer)->setObjects(array($task))->setExcludedProjectPHIDs($board_phids);
$card = $rendering_engine->renderCard($task->getPHID());
$item = $card->getItem();
$item->addClass('phui-workcard');
$payload = array('tasks' => $item, 'data' => $data);
return id(new AphrontAjaxResponse())->setContent(array('tasks' => $item, 'data' => $data));
}
示例11: performMerge
private function performMerge(ManiphestTask $task, PhabricatorObjectHandle $handle, array $phids)
{
$user = $this->getRequest()->getUser();
$response = id(new AphrontReloadResponse())->setURI($handle->getURI());
$phids = array_fill_keys($phids, true);
unset($phids[$task->getPHID()]);
// Prevent merging a task into itself.
if (!$phids) {
return $response;
}
$targets = id(new ManiphestTask())->loadAllWhere('phid in (%Ls) ORDER BY id ASC', array_keys($phids));
if (empty($targets)) {
return $response;
}
$editor = new ManiphestTransactionEditor();
$task_names = array();
$merge_into_name = 'T' . $task->getID();
$cc_vector = array();
$cc_vector[] = $task->getCCPHIDs();
foreach ($targets as $target) {
$cc_vector[] = $target->getCCPHIDs();
$cc_vector[] = array($target->getAuthorPHID(), $target->getOwnerPHID());
$close_task = id(new ManiphestTransaction())->setAuthorPHID($user->getPHID())->setTransactionType(ManiphestTransactionType::TYPE_STATUS)->setNewValue(ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE)->setComments("✘ Merged into {$merge_into_name}.");
$editor->applyTransactions($target, array($close_task));
$task_names[] = 'T' . $target->getID();
}
$all_ccs = array_mergev($cc_vector);
$all_ccs = array_filter($all_ccs);
$all_ccs = array_unique($all_ccs);
$task_names = implode(', ', $task_names);
$add_ccs = id(new ManiphestTransaction())->setAuthorPHID($user->getPHID())->setTransactionType(ManiphestTransactionType::TYPE_CCS)->setNewValue($all_ccs)->setComments("◀ Merged tasks: {$task_names}.");
$editor->applyTransactions($task, array($add_ccs));
return $response;
}
示例12: getTaskProjects
private function getTaskProjects(ManiphestTask $task)
{
$project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($task->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
sort($project_phids);
return $project_phids;
}
示例13: buildActionView
private function buildActionView(ManiphestTask $task)
{
$viewer = $this->getRequest()->getUser();
$id = $task->getID();
$phid = $task->getPHID();
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $task, PhabricatorPolicyCapability::CAN_EDIT);
$can_create = $viewer->isLoggedIn();
$view = id(new PhabricatorActionListView())->setUser($viewer)->setObject($task)->setObjectURI($this->getRequest()->getRequestURI());
$view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Task'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("/task/edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$view->addAction(id(new PhabricatorActionView())->setName(pht('Merge Duplicates In'))->setHref("/search/attach/{$phid}/TASK/merge/")->setWorkflow(true)->setIcon('fa-compress')->setDisabled(!$can_edit)->setWorkflow(true));
$view->addAction(id(new PhabricatorActionView())->setName(pht('Create Subtask'))->setHref($this->getApplicationURI("/task/create/?parent={$id}"))->setIcon('fa-level-down')->setDisabled(!$can_create)->setWorkflow(!$can_create));
$view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Blocking Tasks'))->setHref("/search/attach/{$phid}/TASK/blocks/")->setWorkflow(true)->setIcon('fa-link')->setDisabled(!$can_edit)->setWorkflow(true));
return $view;
}
示例14: buildCardResponse
private function buildCardResponse(ManiphestTask $task)
{
$controller = $this->getController();
$request = $controller->getRequest();
$viewer = $request->getViewer();
$column_phid = $request->getStr('columnPHID');
$visible_phids = $request->getStrList('visiblePHIDs');
if (!$visible_phids) {
$visible_phids = array();
}
$column = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withPHIDs(array($column_phid))->executeOne();
if (!$column) {
return new Aphront404Response();
}
$board_phid = $column->getProjectPHID();
$object_phid = $task->getPHID();
return id(new PhabricatorBoardResponseEngine())->setViewer($viewer)->setBoardPHID($board_phid)->setObjectPHID($object_phid)->setVisiblePHIDs($visible_phids)->buildResponse();
}
示例15: newMergeIntoTransactions
protected function newMergeIntoTransactions(ManiphestTask $task)
{
return array(id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_MERGED_INTO)->setNewValue($task->getPHID()));
}