/** * Single entry point for all JSON admin requests. */ public function doAction() { $context = $this->context->get($this->request); $context = $this->setLocale($context); $cntlPaths = $this->aimeos->get()->getCustomPaths('controller/extjs'); $controller = new \Controller_ExtJS_JsonRpc($context, $cntlPaths); return $controller->process($this->request->getArguments(), 'php://input'); }
/** * Checks if the user with the given ID is in the specified group * * @param string $userid Unique user ID * @param string $groupcode Unique user/customer group code * @return boolean True if user is part of the group, false if not */ public function checkGroup($userid, $groupcode) { $context = $this->context->get(); $group = \Aimeos\MShop\Factory::createManager($context, 'customer/group')->getItem($groupcode); $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); $search = $manager->createSearch(); $expr = array($search->compare('==', 'customer.lists.parentid', $userid), $search->compare('==', 'customer.lists.refid', $group->getId()), $search->compare('==', 'customer.lists.domain', 'customer/group')); $search->setConditions($search->combine('&&', $expr)); $search->setSlice(0, 1); return (bool) count($manager->searchItems($search)); }
/** * 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(); }
/** * 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(); }
/** * Single entry point for all JSON admin requests. */ public function doAction() { $context = $this->context->get(null, 'backend'); $context->setLocale($this->locale->getBackend($context, 'default')); $context->setView($this->viewcontainer->create($context, $this->uriBuilder, array(), $this->request)); $cntlPaths = $this->aimeos->get()->getCustomPaths('controller/extjs'); $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); if (($content = file_get_contents('php://input')) === false) { throw new \Exception('Unable to get request content'); } return $controller->process($this->request->getArguments(), $content); }
/** * Checks if the user with the given ID is in the specified group * * @param string $userid Unique user ID * @param string|array $groupcodes Unique user/customer group codes that are allowed * @return boolean True if user is part of the group, false if not */ public function checkGroup($userid, $groupcodes) { $site = Route::current() ? Route::input('site', Input::get('site', 'default')) : 'default'; $context = $this->context->get(false); $context->setLocale($this->locale->getBackend($context, $site)); $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); $search = $manager->createSearch(); $search->setConditions($search->compare('==', 'customer.group.code', (array) $groupcodes)); $groupItems = $manager->searchItems($search); $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); $search = $manager->createSearch(); $expr = array($search->compare('==', 'customer.lists.parentid', $userid), $search->compare('==', 'customer.lists.refid', array_keys($groupItems)), $search->compare('==', 'customer.lists.domain', 'customer/group')); $search->setConditions($search->combine('&&', $expr)); $search->setSlice(0, 1); return (bool) count($manager->searchItems($search)); }
/** * Returns the resource controller * * @param string $sitecode Unique site code * @return \Aimeos\MShop\Context\Item\Iface Context item */ protected function createClient($sitecode, $resource) { $lang = $this->request->hasArgument('lang') ? $this->request->getArgument('lang') : 'en'; $templatePaths = $this->aimeos->get()->getCustomPaths('admin/jqadm/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->viewbase->create($context, $this->uriBuilder, $templatePaths, $this->request, $lang)); return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); }
/** * 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; }
/** * 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; }