lib/controllers/AppController.php
public function actionRefresh()
    {
        $refreshed = [];
        Yii::$app->response->baseInstructions['requests'] = &$refreshed;
        Yii::$app->response->forceInstructions = true;
        Yii::$app->response->task = 'status';

        if (empty($_POST['requests'])) {
            return;
        }
        $baseInstrictions = (isset($_POST['baseInstructions']) ? $_POST['baseInstructions'] : []);
        foreach ($_POST['requests'] as $requestId => $request) {
            $refreshed[$requestId] = false;
            $instructions = $baseInstrictions;
            if (isset($request['instructions'])) {
                $instructions = array_merge($instructions, $request['instructions']);
            }
            if (empty($instructions['type']) || empty($instructions['type'])) {
                continue;
            }
            if (isset($request['state'])) {
                foreach ($request['state'] as $key => $value) {
                    Yii::$app->webState->set($key, $value);
                }
            }

            if (isset($instructions['objectId'])) {
                $object = Yii::$app->request->object = Registry::getObject($instructions['objectId']);
                if (!$object) {
                    $refreshed[$requestId] = ['error' => 'Invalid object ' . $instructions['objectId'] . ''];
                    continue;
                }
                $type = $object->objectType;
            }

            $settings = (isset($instructions['settings'])) ? $instructions['settings'] : [];
            switch ($instructions['type']) {
                case 'widget':
                    $widget = false;
                    if (isset($object)) {
                        $widgets = $object->objectTypeItem->widgets;
                        if (isset($widgets[$instructions['systemId']])) {
                            $widget = $widgets[$instructions['systemId']]->object;
                        }
                    } else {
                        $widget = Yii::$app->collectors['widgets']->getOne($instructions['systemId']);
                    }
                    if (!$widget) {
                        $refreshed[$requestId] = ['error' => 'Unknown widget'];

                        return;
                    }
                    $widgetObject = $widget->object;
                    if (isset($instructions['section'])
                        && ($sectionItem = Yii::$app->collectors['sections']->getOne($instructions['section']))
                        && ($section = $sectionItem->object)) {
                        $widgetObject->attachDecorator($section->widgetDecoratorClass);
                        $widgetObject->section = $section;
                    }
                    $widgetObject->owner = $widget->owner;
                    $refreshed[$requestId] = ['content' => $widgetObject->generate()];
                break;
            }
        }
    }
public function actionRefresh()
    {
        $refreshed = [];
        Yii::$app->response->baseInstructions['requests'] = &$refreshed;
        Yii::$app->response->forceInstructions = true;
        Yii::$app->response->task = 'status';

        if (empty($_POST['requests'])) {
            return;
        }
        $baseInstrictions = (isset($_POST['baseInstructions']) ? $_POST['baseInstructions'] : []);
        foreach ($_POST['requests'] as $requestId => $request) {
            $refreshed[$requestId] = false;
            $instructions = $baseInstrictions;
            if (isset($request['instructions'])) {
                $instructions = array_merge($instructions, $request['instructions']);
            }
            if (empty($instructions['type']) || empty($instructions['type'])) {
                continue;
            }
            if (isset($request['state'])) {
                foreach ($request['state'] as $key => $value) {
                    Yii::$app->webState->set($key, $value);
                }
            }

            if (isset($instructions['objectId'])) {
                $object = Yii::$app->request->object = Registry::getObject($instructions['objectId']);
                if (!$object) {
                    $refreshed[$requestId] = ['error' => 'Invalid object ' . $instructions['objectId'] . ''];
                    continue;
                }
                $type = $object->objectType;
            }

            $settings = (isset($instructions['settings'])) ? $instructions['settings'] : [];
            switch ($instructions['type']) {
                case 'widget':
                    $widget = false;
                    if (isset($object)) {
                        $widgets = $object->objectTypeItem->widgets;
                        if (isset($widgets[$instructions['systemId']])) {
                            $widget = $widgets[$instructions['systemId']]->object;
                        }
                    } else {
                        $widget = Yii::$app->collectors['widgets']->getOne($instructions['systemId']);
                    }
                    if (!$widget) {
                        $refreshed[$requestId] = ['error' => 'Unknown widget'];

                        return;
                    }
                    $widgetObject = $widget->object;
                    if (isset($instructions['section'])
                        && ($sectionItem = Yii::$app->collectors['sections']->getOne($instructions['section']))
                        && ($section = $sectionItem->object)) {
                        $widgetObject->attachDecorator($section->widgetDecoratorClass);
                        $widgetObject->section = $section;
                    }
                    $widgetObject->owner = $widget->owner;
                    $refreshed[$requestId] = ['content' => $widgetObject->generate()];
                break;
            }
        }
    }
public function actionRefresh ( ) { $ refreshed = [ ] ; Yii :: $ app -> response -> baseInstructions [ 'requests' ] = & $ refreshed ; Yii :: $ app -> response -> forceInstructions = true ; Yii :: $ app -> response -> task = 'status' ; if ( empty ( $ _POST [ 'requests' ] ) ) { return ; } $ baseInstrictions = ( isset ( $ _POST [ 'baseInstructions' ] ) ? $ _POST [ 'baseInstructions' ] : [ ] ) ; foreach ( $ _POST [ 'requests' ] as $ requestId => $ request ) { $ refreshed [ $ requestId ] = false ; $ instructions = $ baseInstrictions ; if ( isset ( $ request [ 'instructions' ] ) ) { $ instructions = array_merge ( $ instructions , $ request [ 'instructions' ] ) ; } if ( empty ( $ instructions [ 'type' ] ) || empty ( $ instructions [ 'type' ] ) ) { continue ; } if ( isset ( $ request [ 'state' ] ) ) { foreach ( $ request [ 'state' ] as $ key => $ value ) { Yii :: $ app -> webState -> set ( $ key , $ value ) ; } } if ( isset ( $ instructions [ 'objectId' ] ) ) { $ object = Yii :: $ app -> request -> object = Registry :: getObject ( $ instructions [ 'objectId' ] ) ; if ( ! $ object ) { $ refreshed [ $ requestId ] = [ 'error' => 'Invalid object ' . $ instructions [ 'objectId' ] . '' ] ; continue ; } $ type = $ object -> objectType ; } $ settings = ( isset ( $ instructions [ 'settings' ] ) ) ? $ instructions [ 'settings' ] : [ ] ; switch ( $ instructions [ 'type' ] ) { case 'widget' : $ widget = false ; if ( isset ( $ object ) ) { $ widgets = $ object -> objectTypeItem -> widgets ; if ( isset ( $ widgets [ $ instructions [ 'systemId' ] ] ) ) { $ widget = $ widgets [ $ instructions [ 'systemId' ] ] -> object ; } } else { $ widget = Yii :: $ app -> collectors [ 'widgets' ] -> getOne ( $ instructions [ 'systemId' ] ) ; } if ( ! $ widget ) { $ refreshed [ $ requestId ] = [ 'error' => 'Unknown widget' ] ; return ; } $ widgetObject = $ widget -> object ; if ( isset ( $ instructions [ 'section' ] ) && ( $ sectionItem = Yii :: $ app -> collectors [ 'sections' ] -> getOne ( $ instructions [ 'section' ] ) ) && ( $ section = $ sectionItem -> object ) ) { $ widgetObject -> attachDecorator ( $ section -> widgetDecoratorClass ) ; $ widgetObject -> section = $ section ; } $ widgetObject -> owner = $ widget -> owner ; $ refreshed [ $ requestId ] = [ 'content' => $ widgetObject -> generate ( ) ] ; break ; } } }
[[@doctodo method_description:actionRefresh]].

@return [[@doctodo return_type:actionRefresh]] [[@doctodo return_description:actionRefresh]]
[[ @doctodo method_description : actionRefresh ]] .