Classes/Controller/AbstractController.php
protected function getContextBackend( $templatePath = 'admin/jqadm/templates', $withView = true )
	{
		if( !isset( $this->contextBE ) )
		{
			$lang = 'en';
			$site = 'default';

			if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && $GLOBALS['BE_USER']->uc['lang'] != '' ) {
				$lang = $GLOBALS['BE_USER']->uc['lang'];
			}

			if( $this->request->hasArgument( 'lang' )
				&& ( $value = $this->request->getArgument( 'lang' ) ) != ''
			) {
				$lang = $value;
			}

			if( $this->request->hasArgument( 'site' )
				&& ( $value = $this->request->getArgument( 'site' ) ) != ''
			) {
				$site = $value;
			}

			$config = Base::getConfig( (array) $this->settings );
			$context = Base::getContext( $config );

			$locale = Base::getLocaleBackend( $context, $site );
			$context->setLocale( $locale );

			$i18n = Base::getI18n( array( $lang, 'en' ), $config->get( 'i18n', array() ) );
			$context->setI18n( $i18n );

			if( $withView )
			{
				$paths = self::$aimeos->getCustomPaths( $templatePath );
				$view = Base::getView( $context, $this->uriBuilder, $paths, $this->request, $lang, false );
				$context->setView( $view );
			}

			$this->contextBE = $context;
		}

		return $this->contextBE;
	}
protected function getContextBackend( $templatePath = 'admin/jqadm/templates', $withView = true )
	{
		if( !isset( $this->contextBE ) )
		{
			$lang = 'en';
			$site = 'default';

			if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && $GLOBALS['BE_USER']->uc['lang'] != '' ) {
				$lang = $GLOBALS['BE_USER']->uc['lang'];
			}

			if( $this->request->hasArgument( 'lang' )
				&& ( $value = $this->request->getArgument( 'lang' ) ) != ''
			) {
				$lang = $value;
			}

			if( $this->request->hasArgument( 'site' )
				&& ( $value = $this->request->getArgument( 'site' ) ) != ''
			) {
				$site = $value;
			}

			$config = Base::getConfig( (array) $this->settings );
			$context = Base::getContext( $config );

			$locale = Base::getLocaleBackend( $context, $site );
			$context->setLocale( $locale );

			$i18n = Base::getI18n( array( $lang, 'en' ), $config->get( 'i18n', array() ) );
			$context->setI18n( $i18n );

			if( $withView )
			{
				$paths = self::$aimeos->getCustomPaths( $templatePath );
				$view = Base::getView( $context, $this->uriBuilder, $paths, $this->request, $lang, false );
				$context->setView( $view );
			}

			$this->contextBE = $context;
		}

		return $this->contextBE;
	}
protected function getContextBackend ( $ templatePath = 'admin/jqadm/templates' , $ withView = true ) { if ( ! isset ( $ this -> contextBE ) ) { $ lang = 'en' ; $ site = 'default' ; if ( isset ( $ GLOBALS [ 'BE_USER' ] -> uc [ 'lang' ] ) && $ GLOBALS [ 'BE_USER' ] -> uc [ 'lang' ] != '' ) { $ lang = $ GLOBALS [ 'BE_USER' ] -> uc [ 'lang' ] ; } if ( $ this -> request -> hasArgument ( 'lang' ) && ( $ value = $ this -> request -> getArgument ( 'lang' ) ) != '' ) { $ lang = $ value ; } if ( $ this -> request -> hasArgument ( 'site' ) && ( $ value = $ this -> request -> getArgument ( 'site' ) ) != '' ) { $ site = $ value ; } $ config = Base :: getConfig ( ( array ) $ this -> settings ) ; $ context = Base :: getContext ( $ config ) ; $ locale = Base :: getLocaleBackend ( $ context , $ site ) ; $ context -> setLocale ( $ locale ) ; $ i18n = Base :: getI18n ( array ( $ lang , 'en' ) , $ config -> get ( 'i18n' , array ( ) ) ) ; $ context -> setI18n ( $ i18n ) ; if ( $ withView ) { $ paths = self :: $ aimeos -> getCustomPaths ( $ templatePath ) ; $ view = Base :: getView ( $ context , $ this -> uriBuilder , $ paths , $ this -> request , $ lang , false ) ; $ context -> setView ( $ view ) ; } $ this -> contextBE = $ context ; } return $ this -> contextBE ; }
Returns the context item for backend operations

@param array $templatePaths List of paths to the view templates
@param boolean $withView True to add view to context object, false for no view
@return \Aimeos\MShop\Context\Item\Iface Context item
Returns the context item for backend operations