/** * Show admin page */ public function admin_action($action = 'list') { $this->hookAdminMenu(); switch ($action) { case 'settings': $form = new Form(array('#name' => 'user.admin.settings', 'title' => array('label' => icon('user') . ' ' . t('Настройки регистрации')), 'registration' => array('type' => 'checkbox', 'value' => config('user.register.active'), 'label' => t('Регистрация разрешена')), 'verification' => array('type' => 'checkbox', 'value' => config('user.register.verification'), 'label' => t('Подтверждение регистрации по электронной почте')), 'save' => array())); if ($result = $form->result()) { $this->set('user.register.active', $result->registration); $this->set('user.register.verification', $result->verification); flash_success('Настройки сохранены!'); reload(); } $form->show(); break; default: $q = $this->input->get('q'); $tpl = new Template('Search/templates/form'); $tpl->action = l('/admin/users/'); $q && ($tpl->value = $q); $tpl->show('info'); Db_ORM::skipClear(); $list = new User_List(array('name' => 'admin.users', 'base' => l('/admin/user/'), 'per_page' => config('Admin.user.per_page', 20), 'render' => FALSE)); $fields = $list->getFields(); $list->setFields($fields); $list->show(); } }
/** * Set skip db reset before object init */ public static function skipClear($set = TRUE) { self::$skipClear = $set; }