/** * Executes the configured tasks. * * @return boolean True if success * @throws Exception If an error occurs */ public function execute() { $conf = Base::parseTS($this->{$this->fieldTSconfig}); if (!isset($conf['client']['html']['catalog']['detail']['url']['config'])) { $conf['client']['html']['catalog']['detail']['url']['config'] = array('plugin' => 'catalog-detail', 'extension' => 'aimeos', 'absoluteUri' => 1); } if ($this->{$this->fieldSenderFrom} != '') { $conf['client']['html']['email']['from-name'] = $this->{$this->fieldSenderFrom}; } if ($this->{$this->fieldSenderEmail} != '') { $conf['client']['html']['email']['from-email'] = $this->{$this->fieldSenderEmail}; } if ($this->{$this->fieldReplyEmail} != '') { $conf['client']['html']['email']['reply-email'] = $this->{$this->fieldReplyEmail}; } if ($this->{$this->fieldPageDetail} != '') { $conf['client']['html']['catalog']['detail']['url']['target'] = $this->{$this->fieldPageDetail}; } if ($this->{$this->fieldContentBaseurl} != '') { $conf['client']['html']['common']['content']['baseurl'] = $this->{$this->fieldContentBaseurl}; } if ($this->{$this->fieldTemplateBaseurl} != '') { $themeDir = $this->{$this->fieldTemplateBaseurl}; if ($themeDir != '' && $themeDir[0] !== '/') { realpath(PATH_site . $themeDir); } $conf['client']['html']['common']['template']['baseurl'] = $this->{$this->fieldTemplateBaseurl}; } Scheduler\Base::initFrontend($this->{$this->fieldPageDetail}); Scheduler\Base::execute($conf, (array) $this->{$this->fieldController}, $this->{$this->fieldSite}); return true; }
/** * 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; }
/** * Executes the configured tasks. * * @return boolean True if success, false if not * @throws Exception If an error occurs */ public function execute() { $sitecodes = (array) $this->{$this->fieldSite}; $controllers = (array) $this->{$this->fieldController}; $tsconfig = $this->{$this->fieldTSconfig}; $conf = Base::parseTS($tsconfig); Scheduler\Base::execute($conf, $controllers, $sitecodes); return true; }
/** * Executes the Aimeos e-mail jobs * * The Aimeos shop system needs some maintenance tasks that must be * regularly executed. Each of these maintenance tasks must be executed for * all shop instances if you have more than one site in your installation. * * @param string $jobs List of job names separated by a space character like "customer/email/watch order/email/payment" * @param string $sites List of sites separated by a space character the jobs should be executed for, e.g. "default unittest" * @param string $tsconfig TypoScript string for individual configuration * @param string $senderFrom Name of the sender in the e-mail * @param string $senderEmail Sender e-mail address * @param string $replyEmail E-Mail address customers can reply to * @param string $detailPid Page ID of the catalog detail page for generating product URLs * @param string $baseUrl URL of the Aimeos uploads directory, e.g. https://yourdomain.tld/uploads/tx_aimeos * @param string $themeDir Absolute path or relative path from to TYPO3 root to the CSS files of the theme directory * @return boolean True on succes */ public function emailCommand($jobs = 'customer/email/watch order/email/delivery order/email/payment', $sites = 'default', $tsconfig = '', $senderFrom = 'Aimeos shop', $senderEmail = '', $replyEmail = '', $detailPid = '', $baseUrl = '', $themeDir = 'typo3conf/ext/aimeos/Resources/Public/Themes/elegance') { Scheduler\Base::initFrontend($detailPid); if ($themeDir != '' && $themeDir[0] !== '/') { $themeDir = realpath(PATH_site . $themeDir); } $conf = Base::parseTS($tsconfig); if (!isset($conf['client']['html']['catalog']['detail']['url']['config'])) { $conf['client']['html']['catalog']['detail']['url']['config'] = array('plugin' => 'catalog-detail', 'extension' => 'aimeos', 'absoluteUri' => 1); } $conf['client']['html']['email']['from-name'] = $senderFrom; $conf['client']['html']['email']['from-email'] = $senderEmail; $conf['client']['html']['email']['reply-email'] = $replyEmail; $conf['client']['html']['common']['content']['baseurl'] = $baseUrl; $conf['client']['html']['common']['template']['baseurl'] = $themeDir; $conf['client']['html']['catalog']['detail']['url']['target'] = $detailPid; Scheduler\Base::execute($conf, explode(' ', $jobs), $sites); return true; }