Appends the pagination information to the JSON or XML output

@param \Cake\Event\Event $event Event
@return void
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));
    }
301067
protected function recordActivity($event)
    {
        $this->activity()->create([
            'user_id' => auth()->id(),
            'type' => $this->getActivityType($event)
        ]);
    }
569677
public function addEvent(EventMessage $event)
    {
        $this->events[] = $event;
        if (stristr($event->getEventList(), 'complete') !== false
            || stristr($event->getName(), 'complete') !== false
            || stristr($event->getName(), 'DBGetResponse') !== false
        ) {
            $this->completed = true;
        }
    }
217162
protected function outputFormatTableEvent(array $events)
    {
        $header = array(
            $this->text('Text'),
            $this->text('Type'),
            $this->text('Severity'),
            $this->text('Created')
        );

        $rows = array();

        foreach ($events as $item) {
            $text = empty($item['translatable']) ? $item['text'] : $this->text($item['text']);
            $rows[] = array(
                $this->truncate($text, 50),
                $this->text($item['type']),
                $this->text($item['severity']),
                $this->date($item['created']),
            );
        }

        $this->outputFormatTable($rows, $header);
    }
10223
public function beforeRender(Event $event): void
    {
        $this->setJson('isAjax', $this->_controller->request->is('ajax'));
        $this->setJson('isMobile', $this->_controller->request->is('mobile'));
        $this->setBoth('isDialog', $this->_controller->request->is('dialog'));
        $this->setBoth('isJson', $this->_controller->request->is('json'));
        $this->setJson('debug', Configure::read('debug'));

        $ssl = false;
        if (env('HTTPS') || $this->_controller->request->is('ssl') || $this->_controller->request->env('HTTP_X_FORWARDED_PROTO') == 'https') {
            $ssl = true;
        }

        $appData = array(
            'jsonData' => $this->_jsonData,
            'webroot' => 'http' . ($ssl ? 's' : '') . '://' . env('HTTP_HOST') . $this->_controller->request->webroot,
            'url' => $this->_controller->request->url,
            // 'controller' => $this->_controller->name,
            // 'action' => $this->_controller->request->action,
            // 'plugin' => $this->_controller->request->plugin,
            'request' => array(
                'query' => $this->_controller->request->query,
                'pass' => $this->_controller->request->params['pass'],
                'plugin' => $this->_controller->request->plugin,
                'controller' => Inflector::underscore($this->_controller->name),
                'action' => $this->_controller->request->action
            )
        );

        // merge in the additional frontend data
        $appData = Hash::merge($appData, $this->_additionalAppData);
        $this->_controller->set('frontendData', $appData);
        $this->_controller->set('closeDialog', $this->_closeDialog);
    }
832258
public static function onFlushContent(Event $event)
    {
        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }

        $page = $content->getMainNode();
        if (null === $page) {
            return;
        }

        $newEvent = new Event($page, $content);
        $newEvent->setDispatcher($event->getDispatcher());
        self::onFlushPage($newEvent);
    }
1080037
public function beforeRender(Event $event)
    {
        if ($this->_controller()->getName() === 'Error') {
            return;
        }

        if (!empty($event->getSubject()->entity)) {
            $this->_entity = $event->getSubject()->entity;
        }

        if ($this->associations === null) {
            $this->associations = $this->_associations(array_keys($this->_getRelatedModels()));
        }

        $this->ensureConfig();

        $this->beforeRenderFormType();
        $this->beforeRenderIndexType();
        $this->beforeRenderSiteTitle();
        $this->beforeRenderUtilityNavigation();
        $this->beforeRenderSidebarNavigation();

        $controller = $this->_controller();
        $controller->set('actionConfig', $this->_action()->getConfig());
        $controller->set('title', $this->_getPageTitle());
        $controller->set('breadcrumbs', $this->_getBreadcrumbs());

        $associations = $this->associations;
        $controller->set(compact('associations'));

        $fields = $this->_scaffoldFields($associations);
        $controller->set('fields', $fields);
        $controller->set('formTabGroups', $this->_getFormTabGroups($fields));

        $controller->set('blacklist', $this->_blacklist());
        $controller->set('actions', $this->_getControllerActions());
        $controller->set('bulkActions', $this->_getBulkActions());
        $controller->set('viewblocks', $this->_getViewBlocks());
        $controller->set('actionGroups', $this->_getActionGroups());
        $controller->set($this->_getPageVariables());
    }
1114730
public static function dump(Event $event)
    {
        $packages = array_keys($event->getComposer()->getPackage()->getRequires());
        if (!$packages) {
            return;
        }
    }
922430
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->set('detect', $this->detect);
    }
780049
public static function onPreUpdate(Event $event)
    {
        $page = $event->getTarget();
        $eventArgs = $event->getEventArgs();
        $updateParents = false;
        $new = $old = null;

        $pageCountModifier = -1;
        if ($eventArgs instanceof PreUpdateEventArgs) {
            if ($page instanceof Page && $eventArgs->hasChangedField('_section')) {
                $old = $eventArgs->getOldValue('_section');
                $new = $eventArgs->getNewValue('_section');

                if ($new->getUid() === $page->getUid()) {
                    return;
                }
                $updateParents = true;
            }

            if ($page instanceof Page && $eventArgs->hasChangedField('_state')) {
                if ($page->getParent() !== null) {
                    if ($eventArgs->getNewValue('_state') >= 4) {
                        $old = $page->getParent()->getSection();
                        if (!$page->isLeaf()) {
                            $pageCountModifier = 0;
                        }
                    } else {
                        $new = $page->getParent()->getSection();
                    }
                    $updateParents = true;
                }
            }

            if ($page instanceof Section && $eventArgs->hasChangedField('_parent')) {
                $old = $eventArgs->getOldValue('_parent');
                $new = $eventArgs->getNewValue('_parent');
                $updateParents = true;
            }

            if ($updateParents) {
                $em = $event->getApplication()->getEntityManager();

                self::setSectionHasChildren($em, $old, $pageCountModifier);
                self::setSectionHasChildren($em, $new, +1);
            }
        }
    }
1340925
public function dispatch(Event $event) {

		$this->lastEvent = $event;
		$eventName = $event->getName();

		if (isset($this->registry[$eventName])) {

			foreach ($this->getSortedRegistry($eventName) as $listener) {
				call_user_func($listener, $event);
			}
			
		}

	}
205117
protected function _write($event)
    {
        // $output = '<table cellspacing="10">';
        $output = '<tr>';
        $output .= '<td style="color:%color%;text-align:right;padding-right:1em">%priorityName%</td>';
        $output .= '<td style="color:%color%;text-align:right;padding-right:1em">%memory%</td>';
        $output .= '<td style="color:%color%;">%message%</td></tr>'; // (%priority%)
        $event['color'] = '#C9C9C9';
        // Count errors
        if ($event['priority'] < 7) {
            $event['color'] = 'green';
        }
        if ($event['priority'] < 6) {
            $event['color'] = '#fd9600';
        }
        if ($event['priority'] < 5) {
            $event['color'] = 'red';
            $this->_errors++;
        }

        if ($event['priority'] == ZFDebug_Controller_Plugin_Debug_Plugin_Log::ZFLOG) {
            $event['priorityName'] = $event['message']['time'];
            $event['memory'] = $event['message']['memory'];
            $event['message'] = $event['message']['message'];
        } else {
            // self::$_lastEvent = null;
            $event['message'] = $event['priorityName'] .': '. $event['message'];
            $event['priorityName'] = '&nbsp;';
            $event['memory'] = '&nbsp;';
        }
        foreach ($event as $name => $value) {
            if ('message' == $name) {
                $measure = '&nbsp;';
                if ((is_object($value) && !method_exists($value,'__toString'))) {
                    $value = gettype($value);
                } elseif (is_array($value)) {
                    $measure = $value[0];
                    $value = $value[1];
                }
            }
            $output = str_replace("%$name%", $value, $output);
        }
        $this->_messages[] = $output;
    }
750795
private function captureStepEvent(Event $event)
    {
        if ($event instanceof AfterStepTested) {
            $this->afterStepTestedEvents[$event->getStep()->getLine()] = $event;
        }
        if ($event instanceof AfterStepSetup) {
            $this->afterStepSetupEvents[$event->getStep()->getLine()] = $event;
        }
    }
1080875
public function onAfterRespond(Event $event)
    {
        /** @var ResponseInterface $response */
        $response = $event['response'];

        if (strpos($response->getHeaderLine('Content-Type'), 'html') === false) {
            DebuggerHelper::disableConsole();
        }
    }
951499
public function beforeRender(\Cake\Event\Event $event)
    {
        $this->_beforeRender($event);
        $this->Breadcrumb
            ->push('/admin/user/manage')
            ->push(__d('user', 'Virtual Fields'), '#');
    }
1164318
final public function dispatch(Event $event): void
    {
        if (!$event instanceof ReceivedEvent && $this->discriminator->shouldEnqueue($event)) {
            $this->queue->send($event);
        }

        if ($event instanceof ReceivedEvent) {
            $event = $event->getOriginalEvent();
        }

        $this->wrappedEventBus->dispatch($event);
    }
1248461
public function addEvent($event, $eventParams)
    {
        // check if valid rule usage for object_type_id
        $this->validateRule("Events", $event);
        // get required parameters for specific rule
        $requiredParams = Events::GetRequiredParams($event);
        // checking for missing and invalid types for each parameter
        $check_params = $this->_checkParams($requiredParams, $eventParams);
        // if no missing or invalid rule parameters
        if ($check_params)
        {
            $value = $this->_formatParams($eventParams);
            $rule = $event . "(" . $value . ")";
            $this->_events[] = $rule;

            return $this->_events;
        }
        return false;
    }