本文整理汇总了PHP中ManiphestTaskPriority类的典型用法代码示例。如果您正苦于以下问题:PHP ManiphestTaskPriority类的具体用法?PHP ManiphestTaskPriority怎么用?PHP ManiphestTaskPriority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ManiphestTaskPriority类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItem
public function getItem()
{
$task = $this->getTask();
$owner = $this->getOwner();
$can_edit = $this->getCanEdit();
$viewer = $this->getViewer();
$color_map = ManiphestTaskPriority::getColorMap();
$bar_color = idx($color_map, $task->getPriority(), 'grey');
$card = id(new PHUIObjectItemView())->setObject($task)->setUser($viewer)->setObjectName('T' . $task->getID())->setHeader($task->getTitle())->setGrippable($can_edit)->setHref('/T' . $task->getID())->addSigil('project-card')->setDisabled($task->isClosed())->setMetadata(array('objectPHID' => $task->getPHID()))->addAction(id(new PHUIListItemView())->setName(pht('Edit'))->setIcon('fa-pencil')->addSigil('edit-project-card')->setHref('/maniphest/task/edit/' . $task->getID() . '/'))->setBarColor($bar_color);
if ($owner) {
$card->addHandleIcon($owner, $owner->getName());
}
$cover_file = $this->getCoverImageFile();
if ($cover_file) {
$card->setCoverImage($cover_file->getBestURI());
}
if ($task->isClosed()) {
$icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
$icon = id(new PHUIIconView())->setIcon($icon . ' grey');
$card->addAttribute($icon);
$card->setBarColor('grey');
}
$project_handles = $this->getProjectHandles();
if ($project_handles) {
$tag_list = id(new PHUIHandleTagListView())->setSlim(true)->setHandles($project_handles);
$card->addAttribute($tag_list);
}
return $card;
}
示例2: initializeNewTask
public static function initializeNewTask(PhabricatorUser $actor)
{
$app = id(new PhabricatorApplicationQuery())->setViewer($actor)->withClasses(array('PhabricatorManiphestApplication'))->executeOne();
$view_policy = $app->getPolicy(ManiphestDefaultViewCapability::CAPABILITY);
$edit_policy = $app->getPolicy(ManiphestDefaultEditCapability::CAPABILITY);
return id(new ManiphestTask())->setStatus(ManiphestTaskStatus::getDefaultStatus())->setPriority(ManiphestTaskPriority::getDefaultPriority())->setAuthorPHID($actor->getPHID())->setViewPolicy($view_policy)->setEditPolicy($edit_policy)->setSpacePHID($actor->getDefaultSpacePHID())->attachProjectPHIDs(array())->attachSubscriberPHIDs(array());
}
示例3: renderActionEffectDescription
protected function renderActionEffectDescription($type, $data)
{
switch ($type) {
case self::DO_PRIORITY:
return pht('Changed task priority to "%s".', ManiphestTaskPriority::getTaskPriorityName($data));
}
}
示例4: newTableRow
protected function newTableRow($phid, $object, $trace)
{
$viewer = $this->getViewer();
if ($object) {
$status = $object->getStatus();
$priority = $object->getPriority();
$status_icon = ManiphestTaskStatus::getStatusIcon($status);
$status_name = ManiphestTaskStatus::getTaskStatusName($status);
$priority_color = ManiphestTaskPriority::getTaskPriorityColor($priority);
if ($object->isClosed()) {
$priority_color = 'grey';
}
$status = array(id(new PHUIIconView())->setIcon($status_icon, $priority_color), ' ', $status_name);
$owner_phid = $object->getOwnerPHID();
if ($owner_phid) {
$assigned = $viewer->renderHandle($owner_phid);
} else {
$assigned = phutil_tag('em', array(), pht('None'));
}
$link = phutil_tag('a', array('href' => $object->getURI()), $object->getTitle());
$link = array($object->getMonogram(), ' ', $link);
} else {
$status = null;
$assigned = null;
$link = $viewer->renderHandle($phid);
}
return array($trace, $status, $assigned, $link);
}
示例5: execute
protected function execute(ConduitAPIRequest $request)
{
$task = new ManiphestTask();
$task->setPriority(ManiphestTaskPriority::getDefaultPriority());
$task->setAuthorPHID($request->getUser()->getPHID());
$this->applyRequest($task, $request, $is_new = true);
return $this->buildTaskInfoDictionary($task);
}
示例6: buildResults
private function buildResults()
{
$results = array();
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
foreach ($priority_map as $value => $name) {
$results[$value] = id(new PhabricatorTypeaheadResult())->setIcon(ManiphestTaskPriority::getTaskPriorityIcon($value))->setPHID($value)->setName($name);
}
return $results;
}
示例7: getEditorValue
public function getEditorValue(PhabricatorUser $viewer, $value)
{
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
$value_map = array();
foreach ($value as $priority) {
$value_map[$priority] = idx($priority_map, $priority, $priority);
}
return $value_map;
}
示例8: execute
protected function execute(ConduitAPIRequest $request)
{
$task_id = $request->getValue('task_id');
$task = id(new ManiphestTask())->load($task_id);
if (!$task) {
throw new ConduitException('ERR_BAD_TASK');
}
$result = array('id' => $task->getID(), 'phid' => $task->getPHID(), 'authorPHID' => $task->getAuthorPHID(), 'ownerPHID' => $task->getAuthorPHID(), 'ccPHIDs' => $task->getCCPHIDs(), 'status' => $task->getStatus(), 'priority' => ManiphestTaskPriority::getTaskPriorityName($task->getPriority()), 'title' => $task->getTitle(), 'description' => $task->getDescription(), 'projectPHIDs' => $task->getProjectPHIDs(), 'uri' => PhabricatorEnv::getProductionURI('/T' . $task->getID()));
return $result;
}
示例9: render
public function render()
{
$handles = $this->handles;
require_celerity_resource('maniphest-task-summary-css');
$list = new PHUIObjectItemListView();
if ($this->noDataString) {
$list->setNoDataString($this->noDataString);
} else {
$list->setNoDataString(pht('No tasks.'));
}
$status_map = ManiphestTaskStatus::getTaskStatusMap();
$color_map = ManiphestTaskPriority::getColorMap();
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
if ($this->showBatchControls) {
Javelin::initBehavior('maniphest-list-editor');
}
foreach ($this->tasks as $task) {
$item = id(new PHUIObjectItemView())->setUser($this->getUser())->setObject($task)->setObjectName('T' . $task->getID())->setHeader($task->getTitle())->setHref('/T' . $task->getID());
if ($task->getOwnerPHID()) {
$owner = $handles[$task->getOwnerPHID()];
$item->addByline(pht('Assigned: %s', $owner->renderLink()));
}
$status = $task->getStatus();
$pri = idx($priority_map, $task->getPriority());
$status_name = idx($status_map, $task->getStatus());
$tooltip = pht('%s, %s', $status_name, $pri);
$icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
$color = idx($color_map, $task->getPriority(), 'grey');
if ($task->isClosed()) {
$item->setDisabled(true);
$color = 'grey';
}
$item->setStatusIcon($icon . ' ' . $color, $tooltip);
$item->addIcon('none', phabricator_datetime($task->getDateModified(), $this->getUser()));
if ($this->showSubpriorityControls) {
$item->setGrippable(true);
}
if ($this->showSubpriorityControls || $this->showBatchControls) {
$item->addSigil('maniphest-task');
}
$project_handles = array_select_keys($handles, array_reverse($task->getProjectPHIDs()));
$item->addAttribute(id(new PHUIHandleTagListView())->setLimit(4)->setNoDataString(pht('No Projects'))->setSlim(true)->setHandles($project_handles));
$item->setMetadata(array('taskID' => $task->getID()));
if ($this->showBatchControls) {
$href = new PhutilURI('/maniphest/task/edit/' . $task->getID() . '/');
if (!$this->showSubpriorityControls) {
$href->setQueryParam('ungrippable', 'true');
}
$item->addAction(id(new PHUIListItemView())->setIcon('fa-pencil')->addSigil('maniphest-edit-task')->setHref($href));
}
$list->addItem($item);
}
return $list;
}
示例10: render
public function render()
{
if (!$this->user) {
throw new Exception("Call setUser() before rendering!");
}
$task = $this->task;
$handles = $this->handles;
require_celerity_resource('maniphest-task-summary-css');
$classes = array(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW => 'pri-unbreak', ManiphestTaskPriority::PRIORITY_TRIAGE => 'pri-triage', ManiphestTaskPriority::PRIORITY_HIGH => 'pri-high', ManiphestTaskPriority::PRIORITY_NORMAL => 'pri-normal', ManiphestTaskPriority::PRIORITY_LOW => 'pri-low', ManiphestTaskPriority::PRIORITY_WISH => 'pri-wish');
$pri_class = idx($classes, $task->getPriority());
return '<table class="maniphest-task-summary">' . '<tr>' . '<td class="maniphest-task-number ' . $pri_class . '">' . 'T' . $task->getID() . '</td>' . '<td class="maniphest-task-status">' . ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN ? 'Open' : 'Closed') . '</td>' . '<td class="maniphest-task-owner">' . ($task->getOwnerPHID() ? $handles[$task->getOwnerPHID()]->renderLink() : '<em>None</em>') . '</td>' . '<td class="maniphest-task-name">' . phutil_render_tag('a', array('href' => '/T' . $task->getID()), phutil_escape_html($task->getTitle())) . '</td>' . '<td class="maniphest-task-priority">' . ManiphestTaskPriority::getTaskPriorityName($task->getPriority()) . '</td>' . '<td class="maniphest-task-updated">' . phabricator_datetime($task->getDateModified(), $this->user) . '</td>' . '</tr>' . '</table>';
}
示例11: loadResults
public function loadResults()
{
$viewer = $this->getViewer();
$raw_query = $this->getRawQuery();
$results = array();
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
foreach ($priority_map as $value => $name) {
// NOTE: $value is not a PHID but is unique. This'll work.
$results[] = id(new PhabricatorTypeaheadResult())->setPHID($value)->setName($name);
}
return $results;
}
示例12: processRequest
public function processRequest()
{
$this->requireApplicationCapability(ManiphestBulkEditCapability::CAPABILITY);
$request = $this->getRequest();
$user = $request->getUser();
$task_ids = $request->getArr('batch');
$tasks = id(new ManiphestTaskQuery())->setViewer($user)->withIDs($task_ids)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->execute();
$actions = $request->getStr('actions');
if ($actions) {
$actions = json_decode($actions, true);
}
if ($request->isFormPost() && is_array($actions)) {
foreach ($tasks as $task) {
$field_list = PhabricatorCustomField::getObjectFields($task, PhabricatorCustomField::ROLE_EDIT);
$field_list->readFieldsFromStorage($task);
$xactions = $this->buildTransactions($actions, $task);
if ($xactions) {
// TODO: Set content source to "batch edit".
$editor = id(new ManiphestTransactionEditor())->setActor($user)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($task, $xactions);
}
}
$task_ids = implode(',', mpull($tasks, 'getID'));
return id(new AphrontRedirectResponse())->setURI('/maniphest/?ids=' . $task_ids);
}
$handles = ManiphestTaskListView::loadTaskHandles($user, $tasks);
$list = new ManiphestTaskListView();
$list->setTasks($tasks);
$list->setUser($user);
$list->setHandles($handles);
$template = new AphrontTokenizerTemplateView();
$template = $template->render();
$projects_source = new PhabricatorProjectDatasource();
$mailable_source = new PhabricatorMetaMTAMailableDatasource();
$owner_source = new PhabricatorTypeaheadOwnerDatasource();
require_celerity_resource('maniphest-batch-editor');
Javelin::initBehavior('maniphest-batch-editor', array('root' => 'maniphest-batch-edit-form', 'tokenizerTemplate' => $template, 'sources' => array('project' => array('src' => $projects_source->getDatasourceURI(), 'placeholder' => $projects_source->getPlaceholderText()), 'owner' => array('src' => $owner_source->getDatasourceURI(), 'placeholder' => $owner_source->getPlaceholderText(), 'limit' => 1), 'cc' => array('src' => $mailable_source->getDatasourceURI(), 'placeholder' => $mailable_source->getPlaceholderText())), 'input' => 'batch-form-actions', 'priorityMap' => ManiphestTaskPriority::getTaskPriorityMap(), 'statusMap' => ManiphestTaskStatus::getTaskStatusMap()));
$form = new AphrontFormView();
$form->setUser($user);
$form->setID('maniphest-batch-edit-form');
foreach ($tasks as $task) {
$form->appendChild(phutil_tag('input', array('type' => 'hidden', 'name' => 'batch[]', 'value' => $task->getID())));
}
$form->appendChild(phutil_tag('input', array('type' => 'hidden', 'name' => 'actions', 'id' => 'batch-form-actions')));
$form->appendChild(phutil_tag('p', array(), pht('These tasks will be edited:')));
$form->appendChild($list);
$form->appendChild(id(new AphrontFormInsetView())->setTitle('Actions')->setRightButton(javelin_tag('a', array('href' => '#', 'class' => 'button green', 'sigil' => 'add-action', 'mustcapture' => true), pht('Add Another Action')))->setContent(javelin_tag('table', array('sigil' => 'maniphest-batch-actions', 'class' => 'maniphest-batch-actions-table'), '')))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Update Tasks'))->addCancelButton('/maniphest/'));
$title = pht('Batch Editor');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title);
$form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Batch Edit Tasks'))->setForm($form);
return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $title, 'device' => false));
}
示例13: getItem
public function getItem()
{
$task = $this->getTask();
$owner = $this->getOwner();
$can_edit = $this->getCanEdit();
$color_map = ManiphestTaskPriority::getColorMap();
$bar_color = idx($color_map, $task->getPriority(), 'grey');
$card = id(new PHUIObjectItemView())->setObjectName('T' . $task->getID())->setHeader($task->getTitle())->setGrippable($can_edit)->setHref('/T' . $task->getID())->addSigil('project-card')->setDisabled($task->isClosed())->setMetadata(array('objectPHID' => $task->getPHID()))->addAction(id(new PHUIListItemView())->setName(pht('Edit'))->setIcon('fa-pencil')->addSigil('edit-project-card')->setHref('/maniphest/task/edit/' . $task->getID() . '/'))->setBarColor($bar_color);
if ($owner) {
$card->addAttribute($owner->renderLink());
}
return $card;
}
示例14: buildResults
private function buildResults()
{
$results = array();
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
foreach ($priority_map as $value => $name) {
$result = id(new PhabricatorTypeaheadResult())->setIcon(ManiphestTaskPriority::getTaskPriorityIcon($value))->setPHID($value)->setName($name)->addAttribute(pht('Priority'));
if (ManiphestTaskPriority::isDisabledPriority($value)) {
$result->setClosed(pht('Disabled'));
}
$results[$value] = $result;
}
return $results;
}
示例15: renderHovercard
public function renderHovercard(PhabricatorHovercardView $hovercard, PhabricatorObjectHandle $handle, $task, $data)
{
$viewer = $this->getViewer();
$hovercard->setTitle($task->getMonogram())->setDetail($task->getTitle());
$owner_phid = $task->getOwnerPHID();
if ($owner_phid) {
$owner = $viewer->renderHandle($owner_phid);
} else {
$owner = phutil_tag('em', array(), pht('None'));
}
$hovercard->addField(pht('Assigned To'), $owner);
$hovercard->addField(pht('Priority'), ManiphestTaskPriority::getTaskPriorityName($task->getPriority()));
$hovercard->addTag(ManiphestView::renderTagForTask($task));
}