Initializes provided context.

@param Context $context
492008
public function initializeContext(Context $context)
    {
        if (!$context instanceof CollectionAwareContextInterface) {
            return;
        }
        $context->setTerminalCollection($this->collection);
        $context->setTerminalDefaultAlias($this->defaultAlias);
    }
783448
public function setContext(RequestContext $context)
    {
        $this->context = $context;

        foreach ($this->router as $router) {
            $router->setContext($context);
        }
    }
1238877
protected function init() {
        $this->context = \context_system::instance();
        $this->data['crud'] = 'u';
        $this->data['edulevel'] = self::LEVEL_OTHER;
        $this->data['objecttable'] = 'external_services';
    }
339982
public function hasContext($context)
    {
        if ($this->contextConfiguration && array_key_exists($context, $this->contextConfiguration)) {
            return true;
        }

        return false;
    }
473421
public function initializeAvailableProxyClasses(ApplicationContext $context = null)
    {
        if ($context === null) {
            return;
        }

        $proxyClasses = @include(FLOW_PATH_TEMPORARY_BASE . '/' . (string)$context . '/AvailableProxyClasses.php');
        if ($proxyClasses !== false) {
            $this->availableProxyClasses = $proxyClasses;
        }
    }
675065
public function set_context($context) {
        if ($context === null) {
            // Extremely ugly hack which sets context to some value in order to prevent warnings,
            // use only for core error handling!!!!
            if (!$this->_context) {
                $this->_context = context_system::instance();
            }
            return;
        }
        // Ideally we should set context only once.
        if (isset($this->_context) && $context->id !== $this->_context->id) {
            $current = $this->_context->contextlevel;
            if ($current == CONTEXT_SYSTEM or $current == CONTEXT_COURSE) {
                // Hmm - not ideal, but it might produce too many warnings due to the design of require_login.
            } else if ($current == CONTEXT_MODULE and ($parentcontext = $context->get_parent_context()) and
                $this->_context->id == $parentcontext->id) {
                // Hmm - most probably somebody did require_login() and after that set the block context.
            } else {
                // We do not want devs to do weird switching of context levels on the fly because we might have used
                // the context already such as in text filter in page title.
                debugging("Coding problem: unsupported modification of PAGE->context from {$current} to {$context->contextlevel}");
            }
        }

        $this->_context = $context;
    }
694752
protected function init() {
        $this->context = \context_system::instance();
        $this->data['objecttable'] = 'post';
        $this->data['crud'] = 'd';
        $this->data['edulevel'] = self::LEVEL_PARTICIPATING;
    }
829531
public void initialize()
    {
        //
        // Register the ControlBeanContext provider on all new context instances.
        //
        addService(org.apache.beehive.controls.api.context.ControlBeanContext.class, CONTROL_BEAN_CONTEXT_PROVIDER);
    }
183684
public void initialize(Context context) {
    if (!isInitialized) {
      initializePicasso(context);
      initializeData(context);
      isInitialized = true;
    }
  }
115321
public static void init(@NonNull final Context context, IInnerImageSetter innerImageSetter,
        Class<? extends ImageView> imageClazz) {
        if (sInitialized) {
            return;
        }
        //noinspection ConstantConditions
        Preconditions.checkArgument(context != null, "context should not be null");
        Preconditions
            .checkArgument(innerImageSetter != null, "innerImageSetter should not be null");
        Preconditions.checkArgument(imageClazz != null, "imageClazz should not be null");
        TangramViewMetrics.initWith(context.getApplicationContext());
        ImageUtils.sImageClass = imageClazz;
        ImageUtils.setImageSetter(innerImageSetter);
        sInitialized = true;
    }
470977
public function init($options=[], $context=null)
    {
        $this->url=$options['url']??static::SG()->_SERVER['REQUEST_URI'];
        $this->key=$options['key']??$this->key;
        $this->page_size=$options['page_size']??$this->page_size;
        
        $this->handel_get_url=$options['rewrite']??$this->handel_get_url;
        
        $this->current_page=$options['current']??intval(static::SG()->_GET[$this->key]??1);
        $this->current_page=$this->current_page>1?$this->current_page:1;
    }
105521
private void init(Context context) {
        setDialogWindowAttributes();
        // Listen for the backpress in order to dismiss the dialog with animation
        setOnKeyListener(new OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface arg0, int keyCode, KeyEvent event) {
                if (keyCode == KeyEvent.KEYCODE_BACK) {
                    slideClose();
                }
                return true;
            }
        });
    }
18330
public static function load($context = '')
    {
        if (empty($context)) {
            $context = self::$defaultContext;
        }
        if ($context[0] !== '\\') {
            // Short context name (must be formatted into class name).
            $context = self::$contextPrefix . $context;
        }
        if (! class_exists($context)) {
            throw @new LoaderException(
                'Specified context ("' . $context . '") does not exist.',
                $context
            );
        }
        self::$loadedContext = $context;
        self::$KEYWORDS = $context::$KEYWORDS;
    }
1036730
protected function initContexts()
    {
        if (empty($this->contexts)) {
            throw new CException('PaymentManager.contexts cannot be empty.');
        }
        foreach ($this->contexts as $name => $config) {
            if (!isset($config['class'])) {
                $config['class'] = 'PaymentContext';
            }
            if (!isset($config['name'])) {
                $config['name'] = $name;
            }
            $context = Yii::createComponent($config);
            if (!($context instanceof PaymentContext)) {
                throw new CException('Payment context must be an instance of PaymentContext.');
            }
            $this->_contexts[$name] = $context;
        }
    }
214919
protected function _beforeInsert(DatabaseContext $context)
    {
        $mixer = $this->getMixer();
        $table = $mixer instanceof DatabaseRowInterface ?  $mixer->getTable() : $mixer;

        if($this->hasProperty('created_by') && empty($this->created_by)) {
            $this->created_by  = (int) $this->getObject('user')->getId();
        }

        if($this->hasProperty('created_on') && (empty($this->created_on) || $this->created_on == $table->getDefault('created_on'))) {
            $this->created_on  = gmdate('Y-m-d H:i:s');
        }
    }
77852
protected function setContext( KernelAwareContext $context )
    {
        $this->context = $context;
        $this->kernel = $context->getKernel();
    }
14987
public function executeRules(Context $context)
    {
        foreach ($this->rules as $rule) {
            $rule->execute($context);
        }
    }