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


PHP ManiphestTask::getID方法代码示例

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


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

示例1: 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;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:25,代码来源:ManiphestTaskDetailController.php

示例2: getAdjacentSubpriority

 /**
  * Get priorities for moving a task before or after another task.
  */
 public static function getAdjacentSubpriority(ManiphestTask $dst, $is_after, $allow_recursion = true)
 {
     $query = id(new ManiphestTaskQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->setOrder(ManiphestTaskQuery::ORDER_PRIORITY)->withPriorities(array($dst->getPriority()))->setLimit(1);
     if ($is_after) {
         $query->setAfterID($dst->getID());
     } else {
         $query->setBeforeID($dst->getID());
     }
     $adjacent = $query->executeOne();
     $base = $dst->getSubpriority();
     $step = (double) (2 << 32);
     // If we find an adjacent task, we average the two subpriorities and
     // return the result.
     if ($adjacent) {
         $epsilon = 0.01;
         // If the adjacent task has a subpriority that is identical or very
         // close to the task we're looking at, we're going to move it and all
         // tasks with the same subpriority a little farther down the subpriority
         // scale.
         if ($allow_recursion && abs($adjacent->getSubpriority() - $base) < $epsilon) {
             $conn_w = $adjacent->establishConnection('w');
             $min = $adjacent->getSubpriority() - $epsilon;
             $max = $adjacent->getSubpriority() + $epsilon;
             // Get all of the tasks with the similar subpriorities to the adjacent
             // task, including the adjacent task itself.
             $query = id(new ManiphestTaskQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPriorities(array($adjacent->getPriority()))->withSubpriorityBetween($min, $max);
             if (!$is_after) {
                 $query->setOrderVector(array('-priority', '-subpriority', '-id'));
             } else {
                 $query->setOrderVector(array('priority', 'subpriority', 'id'));
             }
             $shift_all = $query->execute();
             $shift_last = last($shift_all);
             // Select the most extreme subpriority in the result set as the
             // base value.
             $shift_base = head($shift_all)->getSubpriority();
             // Find the subpriority before or after the task at the end of the
             // block.
             list($shift_pri, $shift_sub) = self::getAdjacentSubpriority($shift_last, $is_after, $allow_recursion = false);
             $delta = $shift_sub - $shift_base;
             $count = count($shift_all);
             $shift = array();
             $cursor = 1;
             foreach ($shift_all as $shift_task) {
                 $shift_target = $shift_base + $cursor / $count * $delta;
                 $cursor++;
                 queryfx($conn_w, 'UPDATE %T SET subpriority = %f WHERE id = %d', $adjacent->getTableName(), $shift_target, $shift_task->getID());
                 // If we're shifting the adjacent task, update it.
                 if ($shift_task->getID() == $adjacent->getID()) {
                     $adjacent->setSubpriority($shift_target);
                 }
                 // If we're shifting the original target task, update the base
                 // subpriority.
                 if ($shift_task->getID() == $dst->getID()) {
                     $base = $shift_target;
                 }
             }
         }
         $sub = ($adjacent->getSubpriority() + $base) / 2;
     } else {
         // Otherwise, we take a step away from the target's subpriority and
         // use that.
         if ($is_after) {
             $sub = $base - $step;
         } else {
             $sub = $base + $step;
         }
     }
     return array($dst->getPriority(), $sub);
 }
开发者ID:miaokuan,项目名称:phabricator,代码行数:73,代码来源:ManiphestTransactionEditor.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: buildPropertyView

 private function buildPropertyView(ManiphestTask $task, PhabricatorCustomFieldList $field_list, array $edges, $handles)
 {
     $viewer = $this->getRequest()->getUser();
     $view = id(new PHUIPropertyListView())->setUser($viewer);
     $source = $task->getOriginalEmailSource();
     if ($source) {
         $subject = '[T' . $task->getID() . '] ' . $task->getTitle();
         $view->addProperty(pht('From Email'), phutil_tag('a', array('href' => 'mailto:' . $source . '?subject=' . $subject), $source));
     }
     $edge_types = array(ManiphestTaskHasRevisionEdgeType::EDGECONST => pht('Differential Revisions'), ManiphestTaskHasMockEdgeType::EDGECONST => pht('Pholio Mocks'));
     $revisions_commits = array();
     $commit_phids = array_keys($edges[ManiphestTaskHasCommitEdgeType::EDGECONST]);
     if ($commit_phids) {
         $commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST;
         $drev_edges = id(new PhabricatorEdgeQuery())->withSourcePHIDs($commit_phids)->withEdgeTypes(array($commit_drev))->execute();
         foreach ($commit_phids as $phid) {
             $revisions_commits[$phid] = $handles->renderHandle($phid)->setShowHovercard(true);
             $revision_phid = key($drev_edges[$phid][$commit_drev]);
             $revision_handle = $handles->getHandleIfExists($revision_phid);
             if ($revision_handle) {
                 $task_drev = ManiphestTaskHasRevisionEdgeType::EDGECONST;
                 unset($edges[$task_drev][$revision_phid]);
                 $revisions_commits[$phid] = hsprintf('%s / %s', $revision_handle->renderHovercardLink($revision_handle->getName()), $revisions_commits[$phid]);
             }
         }
     }
     foreach ($edge_types as $edge_type => $edge_name) {
         if ($edges[$edge_type]) {
             $edge_handles = $viewer->loadHandles(array_keys($edges[$edge_type]));
             $view->addProperty($edge_name, $edge_handles->renderList());
         }
     }
     if ($revisions_commits) {
         $view->addProperty(pht('Commits'), phutil_implode_html(phutil_tag('br'), $revisions_commits));
     }
     $field_list->appendFieldsToPropertyList($task, $viewer, $view);
     if ($view->hasAnyProperties()) {
         return $view;
     }
     return null;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:41,代码来源:ManiphestTaskDetailController.php

示例5: 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;
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:34,代码来源:PhabricatorSearchAttachController.php

示例6: 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;
 }
开发者ID:miaokuan,项目名称:phabricator,代码行数:14,代码来源:ManiphestTaskDetailController.php

示例7: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $files = array();
     $parent_task = null;
     $template_id = null;
     if ($this->id) {
         $task = id(new ManiphestTask())->load($this->id);
         if (!$task) {
             return new Aphront404Response();
         }
     } else {
         $task = new ManiphestTask();
         $task->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
         $task->setAuthorPHID($user->getPHID());
         // These allow task creation with defaults.
         if (!$request->isFormPost()) {
             $task->setTitle($request->getStr('title'));
             $default_projects = $request->getStr('projects');
             if ($default_projects) {
                 $task->setProjectPHIDs(explode(';', $default_projects));
             }
         }
         $file_phids = $request->getArr('files', array());
         if (!$file_phids) {
             // Allow a single 'file' key instead, mostly since Mac OS X urlencodes
             // square brackets in URLs when passed to 'open', so you can't 'open'
             // a URL like '?files[]=xyz' and have PHP interpret it correctly.
             $phid = $request->getStr('file');
             if ($phid) {
                 $file_phids = array($phid);
             }
         }
         if ($file_phids) {
             $files = id(new PhabricatorFile())->loadAllWhere('phid IN (%Ls)', $file_phids);
         }
         $template_id = $request->getInt('template');
         // You can only have a parent task if you're creating a new task.
         $parent_id = $request->getInt('parent');
         if ($parent_id) {
             $parent_task = id(new ManiphestTask())->load($parent_id);
         }
     }
     $errors = array();
     $e_title = true;
     $extensions = ManiphestTaskExtensions::newExtensions();
     $aux_fields = $extensions->getAuxiliaryFieldSpecifications();
     if ($request->isFormPost()) {
         $changes = array();
         $new_title = $request->getStr('title');
         $new_desc = $request->getStr('description');
         $new_status = $request->getStr('status');
         $workflow = '';
         if ($task->getID()) {
             if ($new_title != $task->getTitle()) {
                 $changes[ManiphestTransactionType::TYPE_TITLE] = $new_title;
             }
             if ($new_desc != $task->getDescription()) {
                 $changes[ManiphestTransactionType::TYPE_DESCRIPTION] = $new_desc;
             }
             if ($new_status != $task->getStatus()) {
                 $changes[ManiphestTransactionType::TYPE_STATUS] = $new_status;
             }
         } else {
             $task->setTitle($new_title);
             $task->setDescription($new_desc);
             $changes[ManiphestTransactionType::TYPE_STATUS] = ManiphestTaskStatus::STATUS_OPEN;
             $workflow = 'create';
         }
         $owner_tokenizer = $request->getArr('assigned_to');
         $owner_phid = reset($owner_tokenizer);
         if (!strlen($new_title)) {
             $e_title = 'Required';
             $errors[] = 'Title is required.';
         }
         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');
             }
//.........这里部分代码省略.........
开发者ID:ramons03,项目名称:phabricator,代码行数:101,代码来源:ManiphestTaskEditController.php

示例8: comparePriorityTo

 private function comparePriorityTo(ManiphestTask $other)
 {
     $upri = $this->getPriority();
     $vpri = $other->getPriority();
     if ($upri != $vpri) {
         return $upri - $vpri;
     }
     $usub = $this->getSubpriority();
     $vsub = $other->getSubpriority();
     if ($usub != $vsub) {
         return $usub - $vsub;
     }
     $uid = $this->getID();
     $vid = $other->getID();
     if ($uid != $vid) {
         return $uid - $vid;
     }
     return 0;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:19,代码来源:ManiphestTask.php

示例9: 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;
 }
开发者ID:sethkontny,项目名称:phabricator,代码行数:36,代码来源:PhabricatorSearchAttachController.php

示例10: applyTransactions


//.........这里部分代码省略.........
                 break;
             default:
                 throw new Exception('Unknown action type.');
         }
         $old_cmp = $old;
         $new_cmp = $new;
         if ($value_is_phid_set) {
             // Normalize the old and new values if they are PHID sets so we don't
             // get any no-op transactions where the values differ only by keys,
             // order, duplicates, etc.
             if (is_array($old)) {
                 $old = array_filter($old);
                 $old = array_unique($old);
                 sort($old);
                 $old = array_values($old);
                 $old_cmp = $old;
             }
             if (is_array($new)) {
                 $new = array_filter($new);
                 $new = array_unique($new);
                 $transaction->setNewValue($new);
                 $new_cmp = $new;
                 sort($new_cmp);
                 $new_cmp = array_values($new_cmp);
             }
         }
         if ($old !== null && $old_cmp == $new_cmp) {
             if (count($transactions) > 1 && !$transaction->hasComments()) {
                 // If we have at least one other transaction and this one isn't
                 // doing anything and doesn't have any comments, just throw it
                 // away.
                 unset($transactions[$key]);
                 continue;
             } else {
                 $transaction->setOldValue(null);
                 $transaction->setNewValue(null);
                 $transaction->setTransactionType(ManiphestTransactionType::TYPE_NONE);
             }
         } else {
             switch ($type) {
                 case ManiphestTransactionType::TYPE_NONE:
                     break;
                 case ManiphestTransactionType::TYPE_STATUS:
                     $task->setStatus($new);
                     break;
                 case ManiphestTransactionType::TYPE_OWNER:
                     if ($new) {
                         $handles = id(new PhabricatorObjectHandleData(array($new)))->loadHandles();
                         $task->setOwnerOrdering($handles[$new]->getName());
                     } else {
                         $task->setOwnerOrdering(null);
                     }
                     $task->setOwnerPHID($new);
                     break;
                 case ManiphestTransactionType::TYPE_CCS:
                     $task->setCCPHIDs($new);
                     break;
                 case ManiphestTransactionType::TYPE_PRIORITY:
                     $task->setPriority($new);
                     $pri_changed = true;
                     break;
                 case ManiphestTransactionType::TYPE_ATTACH:
                     $task->setAttached($new);
                     break;
                 case ManiphestTransactionType::TYPE_TITLE:
                     $task->setTitle($new);
                     break;
                 case ManiphestTransactionType::TYPE_DESCRIPTION:
                     $task->setDescription($new);
                     break;
                 case ManiphestTransactionType::TYPE_PROJECTS:
                     $task->setProjectPHIDs($new);
                     break;
                 case ManiphestTransactionType::TYPE_AUXILIARY:
                     $aux_key = $transaction->getMetadataValue('aux:key');
                     $task->setAuxiliaryAttribute($aux_key, $new);
                     break;
                 default:
                     throw new Exception('Unknown action type.');
             }
             $transaction->setOldValue($old);
             $transaction->setNewValue($new);
         }
     }
     if ($pri_changed) {
         $subpriority = ManiphestTransactionEditor::getNextSubpriority($task->getPriority(), null);
         $task->setSubpriority($subpriority);
     }
     $task->save();
     foreach ($transactions as $transaction) {
         $transaction->setTaskID($task->getID());
         $transaction->save();
     }
     $email_to[] = $task->getOwnerPHID();
     $email_cc = array_merge($email_cc, $task->getCCPHIDs());
     $this->publishFeedStory($task, $transactions);
     // TODO: Do this offline via timeline
     PhabricatorSearchManiphestIndexer::indexTask($task);
     $this->sendEmail($task, $transactions, $email_to, $email_cc);
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:101,代码来源:ManiphestTransactionEditor.php

示例11: buildActionView

 private function buildActionView(ManiphestTask $task)
 {
     $viewer = $this->getRequest()->getUser();
     $viewer_phid = $viewer->getPHID();
     $viewer_is_cc = in_array($viewer_phid, $task->getCCPHIDs());
     $id = $task->getID();
     $phid = $task->getPHID();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $task, PhabricatorPolicyCapability::CAN_EDIT);
     $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));
     if ($task->getOwnerPHID() === $viewer_phid) {
         $view->addAction(id(new PhabricatorActionView())->setName(pht('Automatically Subscribed'))->setDisabled(true)->setIcon('fa-check-circle'));
     } else {
         $action = $viewer_is_cc ? 'rem' : 'add';
         $name = $viewer_is_cc ? pht('Unsubscribe') : pht('Subscribe');
         $icon = $viewer_is_cc ? 'fa-minus-circle' : 'fa-plus-circle';
         $view->addAction(id(new PhabricatorActionView())->setName($name)->setHref("/maniphest/subscribe/{$action}/{$id}/")->setRenderAsForm(true)->setUser($viewer)->setIcon($icon));
     }
     $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'));
     $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;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:23,代码来源:ManiphestTaskDetailController.php


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