[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/sms/management/ -> PhabricatorSMSManagementListOutboundWorkflow.php (source)

   1  <?php
   2  
   3  final class PhabricatorSMSManagementListOutboundWorkflow
   4    extends PhabricatorSMSManagementWorkflow {
   5  
   6    protected function didConstruct() {
   7      $this
   8        ->setName('list-outbound')
   9        ->setSynopsis('List outbound sms messages sent by Phabricator.')
  10        ->setExamples(
  11          '**list-outbound**')
  12        ->setArguments(
  13          array(
  14            array(
  15              'name'    => 'limit',
  16              'param'   => 'N',
  17              'default' => 100,
  18              'help'    =>
  19                'Show a specific number of sms messages (default 100).',
  20            ),
  21          ));
  22    }
  23  
  24    public function execute(PhutilArgumentParser $args) {
  25      $console = PhutilConsole::getConsole();
  26      $viewer = $this->getViewer();
  27  
  28      $sms_messages = id(new PhabricatorSMS())->loadAllWhere(
  29        '1 = 1 ORDER BY id DESC LIMIT %d',
  30        $args->getArg('limit'));
  31  
  32      if (!$sms_messages) {
  33        $console->writeErr("%s\n", pht('No sent sms.'));
  34        return 0;
  35      }
  36  
  37      $table = id(new PhutilConsoleTable())
  38        ->setShowHeader(false)
  39        ->addColumn('id',     array('title' => 'ID'))
  40        ->addColumn('status', array('title' => 'Status'))
  41        ->addColumn('recv',   array('title' => 'Recipient'));
  42  
  43      foreach (array_reverse($sms_messages) as $sms) {
  44        $table->addRow(array(
  45          'id'     => $sms->getID(),
  46          'status' => $sms->getSendStatus(),
  47          'recv'   => $sms->getToNumber(),
  48        ));
  49      }
  50  
  51      $table->draw();
  52      return 0;
  53    }
  54  
  55  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1