public static function submenu(Context $ctx, $query, array $pathinfo) { AdminPage::checkperm($ctx, $pathinfo); $router = new Router(); $router->poll($ctx); $menu = new AdminMenu($router->getStatic()); if (false === ($submenu = $menu->getSubMenu($ctx))) { throw new PageNotFoundException(); } if (false === ($content = $submenu->getXML($ctx, 'content', array('type' => 'submenu')))) { throw new PageNotFoundException(); } $page = new AdminPage($content); return $page->getResponse($ctx); }
public static function settings(Context $ctx, $query, array $pathinfo) { // Проверяем права, если неверно указан обработчик. if ('AdminPage::serve' != $pathinfo['call']) { if (empty($pathinfo['perms'])) { $pathinfo['perms'] = 'debug'; } AdminPage::checkperm($ctx, $pathinfo); } $name = substr(strrchr($query, '/'), 1); $schema = self::settings_get($ctx, $name); $form = $schema->getForm(); $data = $ctx->config->get('modules/' . $name, array()); $title = $pathinfo['title']; if (empty($form->title)) { $form->title = $title; } $form->action = '?q=modman.rpc&action=configure&module=' . urlencode($name) . '&destination=admin/system/settings'; $form->addControl(new SubmitControl(array('text' => t('Сохранить')))); $result = html::em('content', array('name' => 'form', 'title' => $name, 'mode' => 'config'), $form->getXML(Control::data($data))); $page = new AdminPage($result); return $page->getResponse($ctx); }