Ejemplo n.º 1
0
 /**
  * Returns the output of the client and adds the header.
  *
  * @param string $clientName Html client name
  * @return string HTML code for inserting into the HTML body
  */
 protected function getOutput($clientName)
 {
     $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates');
     $context = $this->context->get($this->request);
     $langid = $context->getLocale()->getLanguageId();
     $view = $this->viewContainer->create($context, $this->uriBuilder, $tmplPaths, $this->request, $langid);
     $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
     $client->setView($view);
     $client->process();
     $this->view->assign('aimeos_component_header', (string) $client->getHeader());
     return $client->getBody();
 }
Ejemplo n.º 2
0
 /**
  * Returns the output of the client and adds the header.
  *
  * @param Client_Html_Interface $client Html client object
  * @return string HTML code for inserting into the HTML body
  */
 protected function getOutput($clientName)
 {
     $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html');
     $context = $this->context->get($this->request);
     $langid = $context->getLocale()->getLanguageId();
     $view = $this->viewContainer->create($context->getConfig(), $this->uriBuilder, $tmplPaths, $this->request, $langid);
     $client = \Client_Html_Factory::createClient($context, $tmplPaths, $clientName);
     $client->setView($view);
     $client->process();
     // $this->response->addAdditionalHeaderData( (string) $client->getHeader() );
     return $client->getBody();
 }
Ejemplo n.º 3
0
 /**
  * Creates a new configuration object.
  *
  * @param integer $type Configuration type ("frontend" or "backend")
  * @return \Aimeos\MW\Config\Iface Configuration object
  */
 public function get($type = 'frontend')
 {
     $configPaths = $this->aimeos->get()->getConfigPaths();
     $config = new \Aimeos\MW\Config\PHPArray(array(), $configPaths);
     if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
         $config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:'));
     }
     $config = new \Aimeos\MW\Config\Decorator\Memory($config, $this->config->get('shop'));
     if (($conf = $this->config->get('shop.' . $type, array())) !== array()) {
         $config = new \Aimeos\MW\Config\Decorator\Memory($config, $conf);
     }
     return $config;
 }
Ejemplo n.º 4
0
 /**
  * Returns the generated view including the HTML code
  *
  * @param string $content Content from admin client
  */
 protected function getHtml($content)
 {
     $version = $this->aimeos->getVersion();
     $content = str_replace(['{type}', '{version}'], ['Flow', $version], $content);
     $this->view->assign('content', $content);
     return $this->view->render('index');
 }
Ejemplo n.º 5
0
 /**
  * Creates new translation objects.
  *
  * @param array $languageIds List of two letter ISO language IDs
  * @return \Aimeos\MW\Translation\Iface[] List of translation objects
  */
 public function get(array $languageIds)
 {
     $i18nPaths = $this->aimeos->get()->getI18nPaths();
     foreach ($languageIds as $langid) {
         if (!isset($this->i18n[$langid])) {
             $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $langid, array('disableNotices' => true));
             if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
                 $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $this->config->get('shop.apc_prefix', 'laravel:'));
             }
             if ($this->config->has('shop.i18n.' . $langid)) {
                 $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $this->config->get('shop.i18n.' . $langid));
             }
             $this->i18n[$langid] = $i18n;
         }
     }
     return $this->i18n;
 }
Ejemplo n.º 6
0
 /**
  * Creates a list of all available translations.
  *
  * @return string JSON encoded list of language IDs with labels
  */
 protected function getJsonLanguages()
 {
     $result = array();
     foreach ($this->aimeos->get()->getI18nList('admin') as $id) {
         $result[] = array('id' => $id, 'label' => $id);
     }
     return json_encode($result);
 }
Ejemplo n.º 7
0
 /**
  * Returns the body and header sections created by the clients configured for the given page name.
  *
  * @param string $pageName Name of the configured page
  * @return array Associative list with body and header output separated by client name
  */
 public function getSections($pageName)
 {
     $context = $this->context->get();
     $langid = $context->getLocale()->getLanguageId();
     $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html');
     $view = $this->view->create($context->getConfig(), $tmplPaths, $langid);
     $pagesConfig = $this->config->get('shop.page', array());
     $result = array('aibody' => array(), 'aiheader' => array());
     if (isset($pagesConfig[$pageName])) {
         foreach ((array) $pagesConfig[$pageName] as $clientName) {
             $client = \Client_Html_Factory::createClient($context, $tmplPaths, $clientName);
             $client->setView(clone $view);
             $client->process();
             $result['aibody'][$clientName] = $client->getBody();
             $result['aiheader'][$clientName] = $client->getHeader();
         }
     }
     return $result;
 }
Ejemplo n.º 8
0
 /**
  * Creates new translation objects.
  *
  * @param array $languageIds List of two letter ISO language IDs
  * @return \MW_Translation_Interface[] List of translation objects
  */
 public function get(array $languageIds)
 {
     $i18nPaths = $this->aimeos->get()->getI18nPaths();
     foreach ($languageIds as $langid) {
         if (!isset($this->i18n[$langid])) {
             $i18n = new \MW_Translation_Zend2($i18nPaths, 'gettext', $langid, array('disableNotices' => true));
             $apc = (bool) (isset($this->settings['flow']['apc']['enable']) ? $this->settings['flow']['apc']['enable'] : false);
             $prefix = (string) (isset($this->settings['flow']['apc']['prefix']) ? $this->settings['flow']['apc']['prefix'] : 'flow:');
             if (function_exists('apc_store') === true && $apc == true) {
                 $i18n = new \MW_Translation_Decorator_APC($i18n, $prefix);
             }
             if (isset($this->settings['i18n'][$langid])) {
                 $i18n = new \MW_Translation_Decorator_Memory($i18n, $this->settings['i18n'][$langid]);
             }
             $this->i18n[$langid] = $i18n;
         }
     }
     return $this->i18n;
 }
Ejemplo n.º 9
0
 /**
  * Returns the Aimeos object.
  *
  * @return \Aimeos\Bootstrap Aimeos object
  */
 public function get($type = 'frontend')
 {
     $this->settings['resource']['db']['host'] = $this->resource['host'];
     $this->settings['resource']['db']['database'] = $this->resource['dbname'];
     $this->settings['resource']['db']['username'] = $this->resource['user'];
     $this->settings['resource']['db']['password'] = $this->resource['password'];
     $configPaths = $this->aimeos->get()->getConfigPaths();
     $config = new \Aimeos\MW\Config\PHPArray(array(), $configPaths);
     $apc = (bool) (isset($this->settings['flow']['apc']['enable']) ? $this->settings['flow']['apc']['enable'] : false);
     $prefix = (string) (isset($this->settings['flow']['apc']['prefix']) ? $this->settings['flow']['apc']['prefix'] : 'flow:');
     if (function_exists('apc_store') === true && $apc === true) {
         $config = new \Aimeos\MW\Config\Decorator\APC($config, $prefix);
     }
     $config = new \Aimeos\MW\Config\Decorator\Memory($config, $this->settings);
     if (isset($this->settings[$type])) {
         $config = new \Aimeos\MW\Config\Decorator\Memory($config, $this->settings[$type]);
     }
     return $config;
 }
Ejemplo n.º 10
0
 /**
  * Returns the resource controller
  *
  * @param string $sitecode Unique site code
  * @param string Resource location, e.g. "product/stock/wareshouse"
  * @param string $lang Language code
  * @return \Aimeos\Admin\JsonAdm\Iface JsonAdm client
  */
 protected function createClient($sitecode, $resource, $lang)
 {
     $lang = $lang ? $lang : 'en';
     $templatePaths = $this->aimeos->get()->getCustomPaths('admin/jsonadm/templates');
     $context = $this->context->get(null, 'backend');
     $context->setI18n($this->i18n->get(array($lang, 'en')));
     $context->setLocale($this->locale->getBackend($context, $sitecode));
     $context->setView($this->viewContainer->create($context, $this->uriBuilder, $templatePaths, $this->request, $lang));
     return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource);
 }
Ejemplo n.º 11
0
 /**
  * Returns the body and header sections created by the clients configured for the given page name.
  *
  * @param \TYPO3\Flow\Mvc\RequestInterface $request Request object
  * @param string $pageName Name of the configured page
  * @return array Associative list with body and header output separated by client name
  */
 public function getSections(\TYPO3\Flow\Mvc\RequestInterface $request, $pageName)
 {
     $this->uriBuilder->setRequest($request);
     $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates');
     $pagesConfig = $this->settings['page'];
     $result = array('aibody' => array(), 'aiheader' => array());
     $context = $this->context->get($request);
     $langid = $context->getLocale()->getLanguageId();
     $view = $this->view->create($context, $this->uriBuilder, $tmplPaths, $request, $langid);
     $context->setView($view);
     if (isset($pagesConfig[$pageName])) {
         foreach ((array) $pagesConfig[$pageName] as $clientName) {
             $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
             $client->setView(clone $view);
             $client->process();
             $varName = str_replace('/', '_', $clientName);
             $result['aibody'][$varName] = $client->getBody();
             $result['aiheader'][$varName] = $client->getHeader();
         }
     }
     return $result;
 }
Ejemplo n.º 12
0
 /**
  * Creates a new configuration object.
  *
  * @return \MW_Config_Interface Configuration object
  */
 protected function getConfig()
 {
     $this->settings['resource']['db']['host'] = $this->resource['host'];
     $this->settings['resource']['db']['database'] = $this->resource['dbname'];
     $this->settings['resource']['db']['username'] = $this->resource['user'];
     $this->settings['resource']['db']['password'] = $this->resource['password'];
     $configPaths = $this->aimeos->get()->getConfigPaths('mysql');
     $config = new \MW_Config_Array($this->settings, $configPaths);
     $apc = (bool) (isset($this->settings['flow']['apc']['enable']) ? $this->settings['flow']['apc']['enable'] : false);
     $prefix = (string) (isset($this->settings['flow']['apc']['prefix']) ? $this->settings['flow']['apc']['prefix'] : 'flow:');
     if (function_exists('apc_store') === true && $apc == true) {
         $config = new \MW_Config_Decorator_APC($config, $prefix);
     }
     return $config;
 }
Ejemplo n.º 13
0
 /**
  * Creates a list of all available translations.
  *
  * @param \MShop_Context_Item_Interface $context Context object
  * @return array List of language IDs with labels
  */
 protected function getJsonLanguages(\MShop_Context_Item_Interface $context)
 {
     $paths = $this->aimeos->get()->getI18nPaths();
     $langs = array();
     if (!isset($paths['client/extjs'])) {
         return json_encode(array());
     }
     foreach ($paths['client/extjs'] as $path) {
         $iter = new \DirectoryIterator($path);
         foreach ($iter as $file) {
             $name = $file->getFilename();
             if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) {
                 $langs[$name] = null;
             }
         }
     }
     return json_encode($this->getLanguages($context, array_keys($langs)));
 }