Returns the current context.

@param array Multi-dimensional associative list of key/value pairs
@return MShop_Context_Item_Interface Context object
194181
public static function getContext( array $conf = array() )
	{
		$config = Aimeos\Base::getConfig( $conf );
		$context = Aimeos\Base::getContext( $config );


		$langManager = \Aimeos\MShop::create( $context, 'locale/language' );
		$search = $langManager->createSearch( true );

		$expr = array();
		$expr[] = $search->getConditions();
		$expr[] = $search->compare( '==', 'locale.language.id', 'en' ); // default language

		if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && $GLOBALS['BE_USER']->uc['lang'] != '' ) { // BE language
			$expr[] = $search->compare( '==', 'locale.language.id', $GLOBALS['BE_USER']->uc['lang'] );
		}

		$search->setConditions( $search->combine( '||', $expr ) );
		$langids = array_keys( $langManager->searchItems( $search ) );

		$i18n = Aimeos\Base::getI18n( $langids, ( isset( $conf['i18n'] ) ? (array) $conf['i18n'] : array() ) );
		$context->setI18n( $i18n );


		$tmplPaths = Aimeos\Base::getAimeos()->getCustomPaths( 'controller/jobs/templates' );
		$view = Aimeos\Base::getView( $context, self::getUriBuilder(), $tmplPaths );
		$context->setView( $view );

		$context->setEditor( 'scheduler' );

		return $context;
	}
267560
public function get_child_contexts() {
        global $DB;

        debugging('Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!');

        // Just get all the contexts except for CONTEXT_SYSTEM level
        // and hope we don't OOM in the process - don't cache
        $sql = "SELECT c.*
                  FROM {context} c
                 WHERE contextlevel > ".CONTEXT_SYSTEM;
        $records = $DB->get_records_sql($sql);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }
123962
final protected static function get_context_structure() {
        return array(
            'contextid' => new external_value(PARAM_INT, 'The context id', VALUE_OPTIONAL),
            'contextlevel' => new external_value(PARAM_ALPHA, 'The context level', VALUE_OPTIONAL),
            'instanceid' => new external_value(PARAM_INT, 'The Instance id', VALUE_OPTIONAL),
        );
    }
43965
protected function getData(array $context)
    {
        $data = [];
        switch ($context['action']) {
            case 'UPDATE':
                $diff = $this->diff($context['old'], $context['new']);
                foreach ($diff as $item) {
                    list($k, $old, $new) = $item;
                    if (isset($context['new'][$k])) {
                        $data[$k] = [$old, $new];
                    }
                }
                break;
            case 'INSERT':
                foreach ($context['new'] as $k => $val) {
                    $data[$k] = [null, $val];
                }
                break;
            case 'DELETE':
                foreach ($context['old'] as $k => $val) {
                    $data[$k] = [$val, null];
                }
                break;
        }

        return $data;
    }
787137
protected function get_key_from_position() {
        $keylist = array_keys($this->contextlists);
        if (isset($keylist[$this->iteratorposition])) {
            return $keylist[$this->iteratorposition];
        }

        return null;
    }
934925
public function get_contexts() : array {
        $contexts = [];
        foreach ($this->contextids as $contextid) {
            // It is possible that this context has been deleted and we now have subsequent calls being made with this
            // contextlist. Exceptions here will stop the further processing of this component and that is why we are
            // doing a try catch.
            try {
                $contexts[] = \context::instance_by_id($contextid);
            } catch (\Exception $e) {
                // Remove this context.
                unset($this->contextids[$this->iteratorposition]);
            }
        }

        return $contexts;
    }
827104
final protected function getContext() : array
    {
        $context = [
            'request' => empty($this->contexts['request']) ? $this->generateRequest() : $this->contexts['request']
        ];

        // Add User Context
        if (empty($this->contexts['user']) === false) {
            $context['user'] = $this->contexts['user'];
        }

        // Add Custom Context
        if (empty($this->contexts['custom']) === false) {
            $context['custom'] = $this->contexts['custom'];
        }

        // Add Tags Context
        if (empty($this->contexts['tags']) === false) {
            $context['tags'] = $this->contexts['tags'];
        }

        return $context;
    }
1232213
public function get_context() {
        if ($this->itemtype == 'mod') {
            $modinfo = get_fast_modinfo($this->courseid);
            // Sometimes the course module cache is out of date and needs to be rebuilt.
            if (!isset($modinfo->instances[$this->itemmodule][$this->iteminstance])) {
                rebuild_course_cache($this->courseid, true);
                $modinfo = get_fast_modinfo($this->courseid);
            }
            // Even with a rebuilt cache the module does not exist. This means the
            // database is in an invalid state - we will log an error and return
            // the course context but the calling code should be updated.
            if (!isset($modinfo->instances[$this->itemmodule][$this->iteminstance])) {
                mtrace(get_string('moduleinstancedoesnotexist', 'error'));
                $context = \context_course::instance($this->courseid);
            } else {
                $cm = $modinfo->instances[$this->itemmodule][$this->iteminstance];
                $context = \context_module::instance($cm->id);
            }
        } else {
            $context = \context_course::instance($this->courseid);
        }
        return $context;
    }
487447
public function getContext()
    {
        return array_filter(array(
            'subject' => $this->getSubject(),
            'from' => $this->addressToString((array) $this->getSender()),
            'to' => $this->addressToString((array) $this->getRecipients()),
            'cc' => $this->addressToString((array) $this->getCc()),
            'bcc' => $this->addressToString((array) $this->getBcc())
        ));
    }
3709
public function current()
    {
        $keys = array_keys($this->items);
        $var = $this->items[$keys[$this->index]];

        return $var;
    }
45121
public function get_context() {
        if ($this->usercontext === null) {
            $this->usercontext = \context_user::instance($this->user->id);
        }
        return $this->usercontext;
    }
245664
protected function getContext()
	{
		$context=array();
		if($this->logUser && ($user=Yii::app()->getComponent('user',false))!==null)
			$context[]='User: '.$user->getName().' (ID: '.$user->getId().')';

		if($this->dumper==='var_export' || $this->dumper==='print_r')
		{
			foreach($this->logVars as $name)
				if(($value=$this->getGlobalsValue($name))!==null)
					$context[]="\${$name}=".call_user_func($this->dumper,$value,true);
		}
		else
		{
			foreach($this->logVars as $name)
				if(($value=$this->getGlobalsValue($name))!==null)
					$context[]="\${$name}=".call_user_func($this->dumper,$value);
		}

		return implode("\n\n",$context);
	}
251175
private function getCurrentItem()
    {
        // Hack for weird initialization logic
        if (!$this->currentItem) {
            $key = $this->getCurrentKey();
            $this->currentItem = $this->getItemStorage()->get($key);
        }

        return $this->currentItem;
    }
537312
public function getContext()
    {
        if (!isset($this->context)) {
            $this->context = new RequestContext();
            $this->context->fromRequest($this->getRequest());
        }

        return $this->context;
    }
571485
public function getContext()
    {
        $context = new KViewContextTemplate();
        $context->setSubject($this);
        $context->setData($this->_data);
        $context->setLayout($this->getLayout());

        return $context;
    }
533586
public function get_context() : \context {
        if ($this->get('contextid')) {
            return \context::instance_by_id($this->get('contextid'));
        } else if ($this->get('instanceid')) {
            return $this->get_field()->get_handler()->get_instance_context($this->get('instanceid'));
        } else {
            // Context is not yet known (for example, entity is not yet created).
            return \context_system::instance();
        }
    }
1308641
public function current()
    {
        $map = $this->__getSerialisablePropertyMap();
        $mapKeys = array_keys($map);
        return $map[$mapKeys[$this->iteratorPosition]];
    }