| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace Opentalent\OtAdmin\Command;
- use Opentalent\OtAdmin\Controller\SiteController;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Symfony\Component\Console\Style\SymfonyStyle;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Object\ObjectManager;
- /**
- * Display the main informations about the organization's website
- *
- * @package Opentalent\OtAdmin\Command
- */
- class GetSiteInfosCommand extends Command
- {
- /**
- * -- This method is expected by Typo3, do not rename ou remove --
- *
- * Allows to configure the command.
- * Allows to add a description, a help text, and / or define arguments.
- *
- */
- protected function configure()
- {
- $this
- ->setName("ot:site:infos")
- ->setDescription("Display the main informations about the organization's website")
- ->addArgument(
- 'organization_id',
- InputArgument::REQUIRED,
- "The organization's id in the opentalent DB"
- );
- }
- /**
- * -- This method is expected by Typo3, do not rename ou remove --
- *
- * @param InputInterface $input
- * @param OutputInterface $output
- * @throws \Exception
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $org_id = $input->getArgument('organization_id');
- $io = new SymfonyStyle($input, $output);
- $siteController = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
- $infos = $siteController->getSiteInfosAction($org_id);
- $io->title(sprintf("Informations about the organization " . $org_id . ' typo3 website'));
- $headers = [];
- $values = [];
- foreach ($infos as $key => $value) {
- $headers[] = $key;
- $values[] = json_encode(
- str_replace("\"", "'", $value),
- JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
- );
- }
- $io->horizontalTable($headers, [$values]);
- $io->success(sprintf('Informations retrieved'));
- }
- }
|