Отрисовка блока корзины

@param Eresus_Event_Render $event
14356
public function clientOnPageRender(Eresus_Event_Render $event)
    {
        $page = Eresus_Kernel::app()->getPage();

        $page->linkJsLib('jquery', 'cookie');
        $page->linkScripts($this->urlCode . 'api.js');

        $block = $this->clientRenderBlock();
        $html = str_ireplace('$(cart)', $block, $event->getText());

        $event->setText($html);
    }
147952
protected function detachRows($event)
    {
        if (\is_array($event->component->rows)) {
            foreach ($event->component->rows as $row) {
                if (isset($row->modelParent, $row->modelChild)) {
                    //Получаем id прилинкованных данных
                    $getLink = $event->model->getLink($row->modelChild)->get();

                    //Удаляем связи
                    $event->model->linkQuery($row->modelChild)->delete();

                    //Удаляем поля в modelChild если у поля указана опция setDeleteIfNoLink и больше связей к этому материалу нет
                    if ($row->deleteIfNoLink) {
                        //Проверяем остались ли связи до modelChild от modelParent
                        foreach ($getLink as $link) {
                            $linkModel = new Link();
                            if (! $linkModel::whereIdChild($link->id)->whereModelChild($row->modelChild)->first()) {
                                $modelChild = new $row->modelChild();
                                $modelChild->whereId($link->id)->delete();
                            }
                        }
                    }
                }
            }
        }
    }
597547
public function clientOnURLSplit(Eresus_Event_UrlSectionFound $event)
    {
        $rootUrl = Eresus_Kernel::app()->getLegacyKernel()->root;
        $this->level++;
        $item = $event->getSectionInfo();
        $item['url'] = $rootUrl . ('main/' == $event->getUrl() ? '' : $event->getUrl());
        $item['parents'] = explode('/', $event->getUrl());
        array_pop($item['parents']);
        $this->path[] = $item;
    }
494338
public function beforeRender(Event $event)
    {
        $request = $this->_request();

        if (empty($request->getParam('paging'))) {
            return;
        }

        $controller = $this->_controller();

        list(, $modelClass) = pluginSplit($controller->modelClass);

        if (!array_key_exists($modelClass, $request->getParam('paging'))) {
            return;
        }

        $pagination = $request->getParam('paging')[$modelClass];
        if (empty($pagination)) {
            return;
        }

        $controller->set('_pagination', $this->_getJsonApiPaginationResponse($pagination));
    }
537245
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->set('type', $this->type);
        $this->set('title', $this->type['name']);
    }
1110684
public function adminRender(Eresus_CMS_Request $request)
    {
        $this->linkAdminResources();
        $html = parent::adminRender($request);
        return $html;
    }
24108
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->response->getStatusCode($this->httpStatusCode);

        if (200 != $this->httpStatusCode) {
            $this->responseStatus = $this->responseFormat['statusNokText'];
        }

        $response = [
            $this->responseFormat['statusKey'] => $this->responseStatus
        ];

        if (!empty($this->apiResponse)) {
            $response[$this->responseFormat['resultKey']] = $this->apiResponse;
        }

        $this->set('response', $response);
        $this->set('responseFormat', $this->responseFormat);

        return null;
    }
1097666
public function beforeRender(Event $event) {
		/** @var \Cake\Controller\Controller $controller */
		$controller = $event->getSubject();

		if (!$controller->getRequest()->is('ajax')) {
			return null;
		}

		$headerKey = $this->getConfig('headerKey');
		if (!$headerKey) {
			return null;
		}

		$ajaxMessages = array_merge_recursive(
			(array)$controller->getRequest()->getSession()->consume('Flash'),
			(array)Configure::consume('TransientFlash')
		);

		$array = [];
		foreach ($ajaxMessages as $key => $stack) {
			foreach ($stack as $message) {
				$array[$key][] = [
					'message' => $message['message'],
					'type' => $message['type'],
					'params' => $message['params']
				];
			}
		}

		// The header can be read with JavaScript and the flash messages can be displayed
		$this->getController()->setResponse($controller->getResponse()->withHeader($headerKey, json_encode($array)));
	}
804075
protected function handle(Event $event)
    {
        $method = $this->getApplyMethod($event);
        if (!method_exists($this, $method)) {
            return;
        }
        $this->$method($event);
    }
589851
private function clientRenderItem()
    {
        /* @var TClientUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $id = intval($page->topic);

        if ($id != $page->topic)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }

        /* @var Gallery_Entity_Table_Image $table */
        $table = ORM::getTable($this, 'Image');
        /* @var Gallery_Entity_Image $image */
        $image = $table->find($id);

        if (!$image || !$image->active)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }

        // Данные для подстановки в шаблон
        $data = array();
        $data['this'] = $this;
        $data['page'] = $page;
        $data['Eresus'] = Eresus_CMS::getLegacyKernel();
        $data['image'] = $image;
        if ($this->settings['useGroups'])
        {
            $data['album'] = new Gallery_AlbumGrouped($page->id);
        }
        else
        {
            $data['album'] = new Gallery_Album($page->id);
        }
        $data['album']->setCurrent($data['image']);

        // Создаём экземпляр шаблона
        $tmpl = $this->templates()->client('image.html');

        // Компилируем шаблон и данные
        $html = $tmpl->compile($data);

        return $html;
    }
325619
public static function execute(Event $event) {
    $composer = $event->getComposer();
    $handler = new static(
      $composer->getPackage(),
      $composer->getLocker()
    );
    $encoder = new IniEncoder();
    $make = $handler->make();
    $core = $handler->makeCore($make);
    file_put_contents('drupal-org-core.make', $encoder->encode($core));
    file_put_contents('drupal-org.make', $encoder->encode($make));
  }
534982
function render_edit($item)
    {
        if ($item['name'] === '')
        {
            Eresus_Kernel::app()->getPage()->addErrorMessage(
                sprintf(errFormFieldHasNoName, $item['type'], $this->form['name']));
        }
        $result = "\t\t".'<tr><td class="formLabel">'.$item['label'].'</td><td><input type="text" name="'.$item['name'].'" value="'.EncodeHTML($item['value']).'"'.(empty($item['maxlength'])?'':' maxlength="'.$item['maxlength'].'"').$this->attrs($item).' />'.$item['comment']."</td></tr>\n";
        return $result;
    }
43161
function render_html($item)
    {
        if ($item['name'] === '')
        {
            Eresus_Kernel::app()->getPage()->addErrorMessage(
                sprintf(errFormFieldHasNoName, $item['type'], $this->form['name']));
        }

        $result = '';
        $extension = Eresus_CMS::getLegacyKernel()->extensions->load(
            'forms',
            'html',
            isset($item['html_extension']) ? $item['html_extension'] : null
        );
        if ($extension) $result = $extension->forms_html($this, $item);

        return $result;
    }
1150455
public function runHelper(Event $event) {
		
		$options = $event->getOptions();
		
		$KSSHelper = new Helper($options);
		$KSSHelper->run();
		
	}
609492
public function dispatchEvent($event) {
		$type = $event->getType();
		if (isset($this->eventsListeners[$type])) {
			for ($j = 0; $j < count($this->eventsListeners[$type]); $j++) {
				list($plugin, $action) = explode(':', $this->eventsListeners[$type][$j]);
				//加载plugin && 调用action
				//echo $type.'<br/>';
				$this->app->runPluginAction($plugin, $action, $event);
			}
		}
		
	}
1212638
public function addAction()
    {
        $req = Eresus_CMS::getLegacyKernel()->request;

        if ('POST' == $req['method'])
        {
            $menu = new Menus_Entity_Menu();
            $menu->name = arg('name', 'word');
            $menu->caption = arg('caption', 'dbsafe');
            $menu->active = true;
            $menu->root = arg('root', 'int');
            $menu->rootLevel = arg('rootLevel', 'int');
            $menu->invisible = arg('invisible', 'int');
            $menu->expandLevelAuto = arg('expandLevelAuto', 'int');
            $menu->expandLevelMax = arg('expandLevelMax', 'int');
            $menu->dropDown = arg('dropDown', 'int');
            $menu->template = arg('template', 'dbsafe');

            /** @var Menus_Entity_Table_Menu $table */
            $table = $menu->getTable();
            if (is_null($table->findByName($menu->name)))
            {
                $table->persist($menu);
                HTTP::redirect('admin.php?mod=ext-menus');
            }
            else
            {
                ErrorMessage('Меню с таким именем уже есть');
            }
        }
        else
        {
            $menu = null;
        }

        $form = new EresusForm($this->plugin->templates()->adminPath('form.html', false));
        $form->setValue('sections', $this->adminSectionBranch());
        $form->setValue('action', 'create');
        $form->setValue('menu', $menu);
        $html = $form->compile();

        return $html;
    }
53443
public function render(Eresus_CMS_Request $request)
    {
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, 'starting...');

        try
        {
            $this->init();

            $plugins = Eresus_Plugin_Registry::getInstance();

            $response = $plugins->clientRenderContent($request);
            if (!($response instanceof Eresus_HTTP_Response))
            {
                Eresus_Kernel::log(__METHOD__, LOG_DEBUG, 'got string content');
                $content = new Eresus_CMS_Page_Content($this, $response);
                $response = $this->createPageForContent($content);
            }
        }
        catch (Eresus_CMS_Exception $e)
        {
            Eresus_Kernel::log(__METHOD__, LOG_NOTICE, '%s: "%s"', get_class($e), $e->getMessage());
            $httpStatusCode = $e->getHttpException()->getCode();
            $content = new Eresus_CMS_Page_Content($this,
                $e->getMessage() ?: Eresus_HTTP_Response::getStatusText($httpStatusCode));
            $response = $this->createPageForContent($content, $httpStatusCode);
        }

        // TODO: Обратная совместимость (убрать)
        $response->setContent($this->replaceMacros($response->getContent()));

        $event = new Eresus_Event_Response($response);
        Eresus_Kernel::app()->getEventDispatcher()->dispatch('cms.client.response', $event);

        return $response;
    }