当前位置: 首页>>代码示例>>PHP>>正文


PHP ManiphestTask::getProjectPHIDs方法代码示例

本文整理汇总了PHP中ManiphestTask::getProjectPHIDs方法的典型用法代码示例。如果您正苦于以下问题:PHP ManiphestTask::getProjectPHIDs方法的具体用法?PHP ManiphestTask::getProjectPHIDs怎么用?PHP ManiphestTask::getProjectPHIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ManiphestTask的用法示例。


在下文中一共展示了ManiphestTask::getProjectPHIDs方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderSingleTask

 protected function renderSingleTask(ManiphestTask $task)
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $phids = $task->getProjectPHIDs();
     if ($task->getOwnerPHID()) {
         $phids[] = $task->getOwnerPHID();
     }
     $handles = id(new PhabricatorHandleQuery())->setViewer($user)->withPHIDs($phids)->execute();
     $view = id(new ManiphestTaskListView())->setUser($user)->setShowSubpriorityControls(!$request->getStr('ungrippable'))->setShowBatchControls(true)->setHandles($handles)->setTasks(array($task));
     return $view;
 }
开发者ID:miaokuan,项目名称:phabricator,代码行数:12,代码来源:ManiphestController.php

示例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));
     }
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:13,代码来源:ManiphestTaskProject.php

示例3: indexTask

 public static function indexTask(ManiphestTask $task)
 {
     $doc = new PhabricatorSearchAbstractDocument();
     $doc->setPHID($task->getPHID());
     $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_TASK);
     $doc->setDocumentTitle($task->getTitle());
     $doc->setDocumentCreated($task->getDateCreated());
     $doc->setDocumentModified($task->getDateModified());
     $doc->addField(PhabricatorSearchField::FIELD_BODY, $task->getDescription());
     $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $task->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $task->getDateCreated());
     if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $task->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_TASK, time());
     }
     $transactions = id(new ManiphestTransaction())->loadAllWhere('taskID = %d', $task->getID());
     $current_ccs = $task->getCCPHIDs();
     $touches = array();
     $owner = null;
     $ccs = array();
     foreach ($transactions as $transaction) {
         if ($transaction->hasComments()) {
             $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $transaction->getComments());
         }
         $author = $transaction->getAuthorPHID();
         // Record the most recent time they touched this object.
         $touches[$author] = $transaction->getDateCreated();
         switch ($transaction->getTransactionType()) {
             case ManiphestTransactionType::TYPE_OWNER:
                 $owner = $transaction;
                 break;
             case ManiphestTransactionType::TYPE_CCS:
                 // For users who are still CC'd, record the first time they were
                 // added to CC.
                 foreach ($transaction->getNewValue() as $added_cc) {
                     if (in_array($added_cc, $current_ccs)) {
                         if (empty($ccs[$added_cc])) {
                             $ccs[$added_cc] = $transaction->getDateCreated();
                         }
                     }
                 }
                 break;
         }
     }
     foreach ($task->getProjectPHIDs() as $phid) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_PROJECT, $phid, PhabricatorPHIDConstants::PHID_TYPE_PROJ, $task->getDateModified());
         // Bogus.
     }
     if ($owner && $owner->getNewValue()) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $owner->getNewValue(), PhabricatorPHIDConstants::PHID_TYPE_USER, $owner->getDateCreated());
     } else {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, ManiphestTaskOwner::OWNER_UP_FOR_GRABS, PhabricatorPHIDConstants::PHID_TYPE_MAGIC, $owner ? $owner->getDateCreated() : $task->getDateCreated());
     }
     foreach ($touches as $touch => $time) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_TOUCH, $touch, PhabricatorPHIDConstants::PHID_TYPE_USER, $time);
     }
     // We need to load handles here since non-users may subscribe (mailing
     // lists, e.g.)
     $handles = id(new PhabricatorObjectHandleData(array_keys($ccs)))->loadHandles();
     foreach ($ccs as $cc => $time) {
         $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, $handles[$cc]->getPHID(), $handles[$cc]->getType(), $time);
     }
     self::reindexAbstractDocument($doc);
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:62,代码来源:PhabricatorSearchManiphestIndexer.php

示例4: 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 has been removed from the card's project
     // list, we are going to remove it from the board completely.
     $project_map = array_fuse($task->getProjectPHIDs());
     $remove_card = empty($project_map[$column->getProjectPHID()]);
     $positions = id(new PhabricatorProjectColumnPositionQuery())->setViewer($viewer)->withColumns(array($column))->execute();
     $task_phids = mpull($positions, 'getObjectPHID');
     $column_tasks = id(new ManiphestTaskQuery())->setViewer($viewer)->withPHIDs($task_phids)->execute();
     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);
     // TODO: This should just use HandlePool once we get through the EditEngine
     // transition.
     $owner = null;
     if ($task->getOwnerPHID()) {
         $owner = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs(array($task->getOwnerPHID()))->executeOne();
     }
     $tasks = id(new ProjectBoardTaskCard())->setViewer($viewer)->setTask($task)->setOwner($owner)->setCanEdit(true)->getItem();
     $payload = array('tasks' => $tasks, 'data' => $data);
     return id(new AphrontAjaxResponse())->setContent($payload);
 }
开发者ID:fuding,项目名称:phabricator,代码行数:40,代码来源:ManiphestEditEngine.php

示例5: buildTransactions

 private function buildTransactions($actions, ManiphestTask $task)
 {
     $value_map = array();
     $type_map = array('add_comment' => PhabricatorTransactions::TYPE_COMMENT, 'assign' => ManiphestTransaction::TYPE_OWNER, 'status' => ManiphestTransaction::TYPE_STATUS, 'priority' => ManiphestTransaction::TYPE_PRIORITY, 'add_project' => ManiphestTransaction::TYPE_PROJECTS, 'remove_project' => ManiphestTransaction::TYPE_PROJECTS, 'add_ccs' => ManiphestTransaction::TYPE_CCS, 'remove_ccs' => ManiphestTransaction::TYPE_CCS);
     $edge_edit_types = array('add_project' => true, 'remove_project' => true, 'add_ccs' => true, 'remove_ccs' => true);
     $xactions = array();
     foreach ($actions as $action) {
         if (empty($type_map[$action['action']])) {
             throw new Exception("Unknown batch edit action '{$action}'!");
         }
         $type = $type_map[$action['action']];
         // Figure out the current value, possibly after modifications by other
         // batch actions of the same type. For example, if the user chooses to
         // "Add Comment" twice, we should add both comments. More notably, if the
         // user chooses "Remove Project..." and also "Add Project...", we should
         // avoid restoring the removed project in the second transaction.
         if (array_key_exists($type, $value_map)) {
             $current = $value_map[$type];
         } else {
             switch ($type) {
                 case PhabricatorTransactions::TYPE_COMMENT:
                     $current = null;
                     break;
                 case ManiphestTransaction::TYPE_OWNER:
                     $current = $task->getOwnerPHID();
                     break;
                 case ManiphestTransaction::TYPE_STATUS:
                     $current = $task->getStatus();
                     break;
                 case ManiphestTransaction::TYPE_PRIORITY:
                     $current = $task->getPriority();
                     break;
                 case ManiphestTransaction::TYPE_PROJECTS:
                     $current = $task->getProjectPHIDs();
                     break;
                 case ManiphestTransaction::TYPE_CCS:
                     $current = $task->getCCPHIDs();
                     break;
             }
         }
         // Check if the value is meaningful / provided, and normalize it if
         // necessary. This discards, e.g., empty comments and empty owner
         // changes.
         $value = $action['value'];
         switch ($type) {
             case PhabricatorTransactions::TYPE_COMMENT:
                 if (!strlen($value)) {
                     continue 2;
                 }
                 break;
             case ManiphestTransaction::TYPE_OWNER:
                 if (empty($value)) {
                     continue 2;
                 }
                 $value = head($value);
                 if ($value === ManiphestTaskOwner::OWNER_UP_FOR_GRABS) {
                     $value = null;
                 }
                 break;
             case ManiphestTransaction::TYPE_PROJECTS:
                 if (empty($value)) {
                     continue 2;
                 }
                 break;
             case ManiphestTransaction::TYPE_CCS:
                 if (empty($value)) {
                     continue 2;
                 }
                 break;
         }
         // If the edit doesn't change anything, go to the next action. This
         // check is only valid for changes like "owner", "status", etc, not
         // for edge edits, because we should still apply an edit like
         // "Remove Projects: A, B" to a task with projects "A, B".
         if (empty($edge_edit_types[$action['action']])) {
             if ($value == $current) {
                 continue;
             }
         }
         // Apply the value change; for most edits this is just replacement, but
         // some need to merge the current and edited values (add/remove project).
         switch ($type) {
             case PhabricatorTransactions::TYPE_COMMENT:
                 if (strlen($current)) {
                     $value = $current . "\n\n" . $value;
                 }
                 break;
             case ManiphestTransaction::TYPE_PROJECTS:
             case ManiphestTransaction::TYPE_CCS:
                 $remove_actions = array('remove_project' => true, 'remove_ccs' => true);
                 $is_remove = isset($remove_actions[$action['action']]);
                 $current = array_fill_keys($current, true);
                 $value = array_fill_keys($value, true);
                 $new = $current;
                 $did_something = false;
                 if ($is_remove) {
                     foreach ($value as $phid => $ignored) {
                         if (isset($new[$phid])) {
                             unset($new[$phid]);
                             $did_something = true;
//.........这里部分代码省略.........
开发者ID:denghp,项目名称:phabricator,代码行数:101,代码来源:ManiphestBatchEditController.php

示例6: buildTransactions

 private function buildTransactions($actions, ManiphestTask $task)
 {
     $value_map = array();
     $type_map = array('add_comment' => ManiphestTransactionType::TYPE_NONE, 'assign' => ManiphestTransactionType::TYPE_OWNER, 'status' => ManiphestTransactionType::TYPE_STATUS, 'priority' => ManiphestTransactionType::TYPE_PRIORITY, 'add_project' => ManiphestTransactionType::TYPE_PROJECTS, 'remove_project' => ManiphestTransactionType::TYPE_PROJECTS);
     $xactions = array();
     foreach ($actions as $action) {
         if (empty($type_map[$action['action']])) {
             throw new Exception("Unknown batch edit action '{$action}'!");
         }
         $type = $type_map[$action['action']];
         // Figure out the current value, possibly after modifications by other
         // batch actions of the same type. For example, if the user chooses to
         // "Add Comment" twice, we should add both comments. More notably, if the
         // user chooses "Remove Project..." and also "Add Project...", we should
         // avoid restoring the removed project in the second transaction.
         if (array_key_exists($type, $value_map)) {
             $current = $value_map[$type];
         } else {
             switch ($type) {
                 case ManiphestTransactionType::TYPE_NONE:
                     $current = null;
                     break;
                 case ManiphestTransactionType::TYPE_OWNER:
                     $current = $task->getOwnerPHID();
                     break;
                 case ManiphestTransactionType::TYPE_STATUS:
                     $current = $task->getStatus();
                     break;
                 case ManiphestTransactionType::TYPE_PRIORITY:
                     $current = $task->getPriority();
                     break;
                 case ManiphestTransactionType::TYPE_PROJECTS:
                     $current = $task->getProjectPHIDs();
                     break;
             }
         }
         // Check if the value is meaningful / provided, and normalize it if
         // necessary. This discards, e.g., empty comments and empty owner
         // changes.
         $value = $action['value'];
         switch ($type) {
             case ManiphestTransactionType::TYPE_NONE:
                 if (!strlen($value)) {
                     continue 2;
                 }
                 break;
             case ManiphestTransactionType::TYPE_OWNER:
                 if (empty($value)) {
                     continue 2;
                 }
                 $value = head($value);
                 if ($value === ManiphestTaskOwner::OWNER_UP_FOR_GRABS) {
                     $value = null;
                 }
                 break;
             case ManiphestTransactionType::TYPE_PROJECTS:
                 if (empty($value)) {
                     continue 2;
                 }
                 break;
         }
         // If the edit doesn't change anything, go to the next action.
         if ($value == $current) {
             continue;
         }
         // Apply the value change; for most edits this is just replacement, but
         // some need to merge the current and edited values (add/remove project).
         switch ($type) {
             case ManiphestTransactionType::TYPE_NONE:
                 if (strlen($current)) {
                     $value = $current . "\n\n" . $value;
                 }
                 break;
             case ManiphestTransactionType::TYPE_PROJECTS:
                 $is_remove = $action['action'] == 'remove_project';
                 $current = array_fill_keys($current, true);
                 $value = array_fill_keys($value, true);
                 $new = $current;
                 $did_something = false;
                 if ($is_remove) {
                     foreach ($value as $phid => $ignored) {
                         if (isset($new[$phid])) {
                             unset($new[$phid]);
                             $did_something = true;
                         }
                     }
                 } else {
                     foreach ($value as $phid => $ignored) {
                         if (empty($new[$phid])) {
                             $new[$phid] = true;
                             $did_something = true;
                         }
                     }
                 }
                 if (!$did_something) {
                     continue 2;
                 }
                 $value = array_keys($new);
                 break;
         }
//.........这里部分代码省略.........
开发者ID:relrod,项目名称:phabricator,代码行数:101,代码来源:ManiphestBatchEditController.php

示例7: processRequest


//.........这里部分代码省略.........
         foreach ($aux_fields as $aux_field) {
             $aux_field->setValueFromRequest($request);
             if ($aux_field->isRequired() && !strlen($aux_field->getValue())) {
                 $errors[] = $aux_field->getLabel() . ' is required.';
                 $aux_field->setError('Required');
             }
             if (strlen($aux_field->getValue())) {
                 try {
                     $aux_field->validate();
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                     $aux_field->setError('Invalid');
                 }
             }
         }
         if ($errors) {
             $task->setPriority($request->getInt('priority'));
             $task->setOwnerPHID($owner_phid);
             $task->setCCPHIDs($request->getArr('cc'));
             $task->setProjectPHIDs($request->getArr('projects'));
         } else {
             if ($request->getInt('priority') != $task->getPriority()) {
                 $changes[ManiphestTransactionType::TYPE_PRIORITY] = $request->getInt('priority');
             }
             if ($owner_phid != $task->getOwnerPHID()) {
                 $changes[ManiphestTransactionType::TYPE_OWNER] = $owner_phid;
             }
             if ($request->getArr('cc') != $task->getCCPHIDs()) {
                 $changes[ManiphestTransactionType::TYPE_CCS] = $request->getArr('cc');
             }
             $new_proj_arr = $request->getArr('projects');
             $new_proj_arr = array_values($new_proj_arr);
             sort($new_proj_arr);
             $cur_proj_arr = $task->getProjectPHIDs();
             $cur_proj_arr = array_values($cur_proj_arr);
             sort($cur_proj_arr);
             if ($new_proj_arr != $cur_proj_arr) {
                 $changes[ManiphestTransactionType::TYPE_PROJECTS] = $new_proj_arr;
             }
             if ($files) {
                 $file_map = mpull($files, 'getPHID');
                 $file_map = array_fill_keys($file_map, array());
                 $changes[ManiphestTransactionType::TYPE_ATTACH] = array(PhabricatorPHIDConstants::PHID_TYPE_FILE => $file_map);
             }
             $content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_WEB, array('ip' => $request->getRemoteAddr()));
             $template = new ManiphestTransaction();
             $template->setAuthorPHID($user->getPHID());
             $template->setContentSource($content_source);
             $transactions = array();
             foreach ($changes as $type => $value) {
                 $transaction = clone $template;
                 $transaction->setTransactionType($type);
                 $transaction->setNewValue($value);
                 $transactions[] = $transaction;
             }
             if ($aux_fields) {
                 $task->loadAndAttachAuxiliaryAttributes();
                 foreach ($aux_fields as $aux_field) {
                     $transaction = clone $template;
                     $transaction->setTransactionType(ManiphestTransactionType::TYPE_AUXILIARY);
                     $aux_key = $aux_field->getAuxiliaryKey();
                     $transaction->setMetadataValue('aux:key', $aux_key);
                     $transaction->setNewValue($aux_field->getValueForStorage());
                     $transactions[] = $transaction;
                 }
             }
开发者ID:ramons03,项目名称:phabricator,代码行数:67,代码来源:ManiphestTaskEditController.php

示例8: 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));
 }
开发者ID:truSense,项目名称:phabricator,代码行数:50,代码来源:ManiphestEditEngine.php

示例9: 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.
     $descendant_projects = id(new PhabricatorProjectQuery())->setViewer($viewer)->withAncestorProjectPHIDs(array($column->getProjectPHID()))->execute();
     $board_phids = mpull($descendant_projects, 'getPHID', 'getPHID');
     $board_phids[$column->getProjectPHID()] = $column->getProjectPHID();
     $project_map = array_fuse($task->getProjectPHIDs());
     $remove_card = !array_intersect_key($board_phids, $project_map);
     $positions = id(new PhabricatorProjectColumnPositionQuery())->setViewer($viewer)->withBoardPHIDs(array($column->getProjectPHID()))->withColumnPHIDs(array($column->getPHID()))->execute();
     $task_phids = mpull($positions, 'getObjectPHID');
     $column_tasks = id(new ManiphestTaskQuery())->setViewer($viewer)->withPHIDs($task_phids)->needProjectPHIDs(true)->execute();
     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);
     // TODO: This should just use HandlePool once we get through the EditEngine
     // transition.
     $owner = null;
     if ($task->getOwnerPHID()) {
         $owner = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs(array($task->getOwnerPHID()))->executeOne();
     }
     $handle_phids = $task->getProjectPHIDs();
     $handle_phids = array_fuse($handle_phids);
     $handle_phids = array_diff_key($handle_phids, $board_phids);
     $project_handles = $viewer->loadHandles($handle_phids);
     $project_handles = iterator_to_array($project_handles);
     $projects = $request->getArr('projectPHIDs');
     $project = $this->getSprintProjectforTask($viewer, $projects);
     $tasks = id(new SprintBoardTaskCard())->setViewer($viewer)->setProject($project)->setProjectHandles($project_handles)->setTask($task)->setOwner($owner)->setCanEdit(true)->getItem();
     $tasks->addClass('phui-workcard');
     $payload = array('tasks' => $tasks, 'data' => $data);
     return id(new AphrontAjaxResponse())->setContent($payload);
 }
开发者ID:kanarip,项目名称:phabricator-extensions-Sprint,代码行数:55,代码来源:SprintManiphestEditEngine.php

示例10: publishFeedStory

 private function publishFeedStory(ManiphestTask $task, array $transactions)
 {
     assert_instances_of($transactions, 'ManiphestTransaction');
     $actions = array(ManiphestAction::ACTION_UPDATE);
     $comments = null;
     foreach ($transactions as $transaction) {
         if ($transaction->hasComments()) {
             $comments = $transaction->getComments();
         }
         switch ($transaction->getTransactionType()) {
             case ManiphestTransactionType::TYPE_OWNER:
                 $actions[] = ManiphestAction::ACTION_ASSIGN;
                 break;
             case ManiphestTransactionType::TYPE_STATUS:
                 if ($task->getStatus() != ManiphestTaskStatus::STATUS_OPEN) {
                     $actions[] = ManiphestAction::ACTION_CLOSE;
                 } else {
                     if ($this->isCreate($transactions)) {
                         $actions[] = ManiphestAction::ACTION_CREATE;
                     }
                 }
                 break;
             default:
                 break;
         }
     }
     $action_type = ManiphestAction::selectStrongestAction($actions);
     $owner_phid = $task->getOwnerPHID();
     $actor_phid = head($transactions)->getAuthorPHID();
     $author_phid = $task->getAuthorPHID();
     id(new PhabricatorFeedStoryPublisher())->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_MANIPHEST)->setStoryData(array('taskPHID' => $task->getPHID(), 'transactionIDs' => mpull($transactions, 'getID'), 'ownerPHID' => $owner_phid, 'action' => $action_type, 'comments' => $comments, 'description' => $task->getDescription()))->setStoryTime(time())->setStoryAuthorPHID($actor_phid)->setRelatedPHIDs(array_merge(array_filter(array($task->getPHID(), $author_phid, $actor_phid, $owner_phid)), $task->getProjectPHIDs()))->publish();
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:32,代码来源:ManiphestTransactionEditor.php


注:本文中的ManiphestTask::getProjectPHIDs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。