/** * Run the command * @param InputInterface $input Input * @param OutputInterface $output Output * @return bool */ public function execute(InputInterface $input, OutputInterface $output) { while ($board = $this->selectBoard($input, $output)) { $output->writeln(''); $output->writeln("<info>{$board['name']}</info>"); $lists = HelperCommand::getCachedLists($output); $boardLists = $lists['lists'][$board['id']]; foreach ($boardLists as $id => $listData) { $output->writeln("\t{$listData['name']}"); } $output->writeln(''); } $output->writeln(''); return true; }
/** * Run the command * @param InputInterface $input Input * @param OutputInterface $output Output * @return bool */ public function execute(InputInterface $input, OutputInterface $output) { $trello = HelperCommand::getTrelloClient($output); $boardKey = $input->getArgument('boardKey'); $config = HelperCommand::getConfig(); if (empty($config['boards'][$boardKey])) { $output->writeln("<error>Board not in config</error>"); return false; } $boardConfig = $config['boards'][$boardKey]; $cachedBoards = HelperCommand::getCachedBoards($output); $cachedLists = HelperCommand::getCachedLists($output); $boardLists = $cachedLists[$boardKey]; $lists = []; $cards = []; foreach ($boardLists as $listKey => $listData) { $lists[$listKey] = $listData['name']; $cards[$listKey] = []; } $trelloCards = $trello->getBoard($boardKey)->getCards(); foreach ($trelloCards as $card) { if (!array_key_exists($card->idList, $lists)) { continue; } $cards[$card->idList][] = ['id' => $card->id, 'url' => $card->shortUrl, 'name' => $card->name]; } $send = ''; foreach ($cards as $list => $listCards) { $send .= "<h3>{$lists[$list]}</h3>"; foreach ($listCards as $card) { $send .= "<a href='{$card['url']}' style='margin-left:30px'>{$card['name']}</a><br/>"; } } echo $send; $transport = new \Swift_SendmailTransport(); $mail = new \Swift_Mailer($transport); $message = \Swift_Message::newInstance(); $message->setSubject('Trello:'); $message->addFrom($boardConfig['email'][0]); $message->addTo($boardConfig['email'][0]); $message->addPart($send, 'text/html'); $mail->send($message); return true; }
/** * Run the command * @param InputInterface $input Input * @param OutputInterface $output Output * @return bool */ public function execute(InputInterface $input, OutputInterface $output) { $boards = HelperCommand::getCachedBoards($output); $lists = HelperCommand::getCachedLists($output); $boardKey = $input->getArgument('boardKey'); if ($boardKey) { $this->boardKey = $boardKey; } if (!array_key_exists($boardKey, $boards)) { $output->writeln("<error>" . HelperCommand::ERROR_BOARDS . "</error>"); return false; } $output->writeln("<info>Lists for '{$boards[$boardKey]['name']}'</info>"); $boardLists = $lists['lists'][$this->boardKey]; foreach ($boardLists as $id => $listData) { $output->writeln("\t{$listData['name']}"); } $output->writeln(''); return true; }