コード例 #1
1
 /**
  * Returns the HTML code for the controller control.
  *
  * @param array $selected List of site codes that were previously selected by the user
  * @param string|null $filter String that must be part of the controller name
  * @return string HTML code with <option> tags for the select box
  */
 protected function getControllerOptions(array $selected, $filter = null)
 {
     $html = '';
     $aimeos = Base::getAimeos();
     $context = Scheduler\Base::getContext();
     $cntlPaths = $aimeos->getCustomPaths('controller/jobs');
     $langid = 'en';
     if (isset($GLOBALS['BE_USER']->uc['lang']) && $GLOBALS['BE_USER']->uc['lang'] != '') {
         $langid = $GLOBALS['BE_USER']->uc['lang'];
     }
     $localeItem = \MShop_Factory::createManager($context, 'locale')->createItem();
     $localeItem->setLanguageId($langid);
     $context->setLocale($localeItem);
     $controllers = \Controller_Jobs_Factory::getControllers($context, $aimeos, $cntlPaths);
     foreach ($controllers as $name => $controller) {
         if ($filter !== null && strstr($name, $filter) === false) {
             continue;
         }
         $active = in_array($name, $selected) ? 'selected="selected"' : '';
         $title = htmlspecialchars($controller->getDescription(), ENT_QUOTES, 'UTF-8');
         $cntl = htmlspecialchars($controller->getName(), ENT_QUOTES, 'UTF-8');
         $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
         $html .= sprintf('<option value="%1$s" title="%2$s" %3$s>%4$s</option>', $name, $title, $active, $cntl);
     }
     return $html;
 }
コード例 #2
0
 public function testGetControllers()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $list = Controller_Jobs_Factory::getControllers($context, $arcavias, TestHelper::getControllerPaths());
     $this->assertGreaterThan(0, count($list));
     foreach ($list as $key => $object) {
         $this->assertInstanceOf('Controller_Jobs_Interface', $object);
     }
 }
コード例 #3
0
ファイル: JobsCommand.php プロジェクト: nos3/aimeos-symfony2
 /**
  * Configures the command name and description.
  */
 protected function configure()
 {
     $names = '';
     $aimeos = new \Aimeos(array());
     $cntlPaths = $aimeos->getCustomPaths('controller/jobs');
     $controllers = \Controller_Jobs_Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths);
     foreach ($controllers as $key => $controller) {
         $names .= str_pad($key, 30) . $controller->getName() . PHP_EOL;
     }
     $this->setName('aimeos:jobs');
     $this->setDescription('Executes the job controllers');
     $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"');
     $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)');
     $this->setHelp("Available jobs are:\n" . $names);
 }