Path: blob/master/src/applications/maniphest/command/ManiphestStatusEmailCommand.php
12256 views
<?php12final class ManiphestStatusEmailCommand3extends ManiphestEmailCommand {45public function getCommand() {6return 'status';7}89public function getCommandSyntax() {10return '**!status** //status//';11}1213public function getCommandSummary() {14return pht('Change the status of a task.');15}1617public function getCommandDescription() {18$names = ManiphestTaskStatus::getTaskStatusMap();19$keywords = ManiphestTaskStatus::getTaskStatusKeywordsMap();2021$table = array();22$table[] = '| '.pht('Status').' | '.pht('Keywords');23$table[] = '|---|---|';24foreach ($keywords as $status => $words) {25if (ManiphestTaskStatus::isDisabledStatus($status)) {26continue;27}2829$words = implode(', ', $words);30$table[] = '| '.$names[$status].' | '.$words;31}32$table = implode("\n", $table);3334return pht(35"To change the status of a task, specify the desired status, like ".36"`%s`. This table shows the configured names for statuses.\n\n%s\n\n".37"If you specify an invalid status, the command is ignored. This ".38"command has no effect if you do not specify a status.\n\n".39"To quickly close a task, see `%s`.",40'!status invalid',41$table,42'!close');43}4445public function buildTransactions(46PhabricatorUser $viewer,47PhabricatorApplicationTransactionInterface $object,48PhabricatorMetaMTAReceivedMail $mail,49$command,50array $argv) {51$xactions = array();5253$target = phutil_utf8_strtolower(head($argv));54$status = null;5556$keywords = ManiphestTaskStatus::getTaskStatusKeywordsMap();57foreach ($keywords as $key => $words) {58foreach ($words as $word) {59if ($word == $target) {60$status = $key;61break;62}63}64}6566if ($status === null) {67return array();68}6970if (ManiphestTaskStatus::isDisabledStatus($status)) {71return array();72}7374$xactions[] = $object->getApplicationTransactionTemplate()75->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE)76->setNewValue($status);7778return $xactions;79}8081}828384