getBackend() public method

Returns the locale item for the current request
public getBackend ( Aimeos\MShop\Context\Item\Iface $context, string $site ) : Aimeos\MShop\Locale\Item\Iface
$context Aimeos\MShop\Context\Item\Iface Context object
$site string Unique site code
return Aimeos\MShop\Locale\Item\Iface Locale item object
Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
 /**
  * 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));
 }
Esempio n. 3
0
 /**
  * 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);
 }