protected function executeImpl(ArrayAdapter $params) { $action = $params->str('action'); $controller = PsProfiler::controller(); switch ($action) { case 'reset': $controller->resetAll(); break; case 'on': $controller->setProfilingEnabled(true); break; case 'off': $controller->setProfilingEnabled(false); break; default: json_error("Unknown action [{$action}]."); } return new AjaxSuccess(); }
public function buildContent() { $navigation = AdminPageNavigation::inst(); $RQ = GetArrayAdapter::inst(); $AL = PsProfiler::controller(); $PARAMS['enabled'] = PROFILING_ENABLED; $mode = null; if ($RQ->has('profiler')) { $mode = self::MODE_PROFILER; $profiler = $RQ->str('profiler'); $PARAMS['profilers'] = $AL->getStats($profiler); $navigation->addPath(self::url(), 'Профайлеры'); $navigation->setCurrent($profiler); } if (!$mode) { $mode = self::MODE_LIST; $PARAMS['profilers'] = $AL->getStats(); $navigation->setCurrent('Профайлеры'); } $PARAMS['mode'] = $mode; echo $this->getFoldedEntity()->fetchTpl($PARAMS); }