_get_view(); } public function handler() { access::verify_csrf(); $form = $this->_get_form(); if ($form->validate()) { module::set_var("google_analytics", "code", $form->google_analytics_code->inputs["analytics_code"]->value); module::set_var("google_analytics", "owneradmin_hidden", $form->google_analytics_code->inputs["analytics_owneradmin_hidden"]->value); url::redirect("admin/google_analytics"); } print $this->_get_view($form); } private function _get_view($form=null) { $v = new Admin_View("admin.html"); $v->content = new View("admin_google_analytics.html"); $v->content->form = empty($form) ? $this->_get_form() : $form; return $v; } private function _get_form() { $form = new Forge("admin/google_analytics/handler", "", "post", array("id" => "gAdminForm")); $group = $form->group("google_analytics_code"); $group->input("analytics_code")->label(t('Enter the Web-Property-ID given by Google.'))->rules("required")->value(module::get_var("google_analytics", "code")); $group->checkbox("analytics_owneradmin_hidden")->label(t("Omit code for owner and admin")) ->checked(module::get_var("google_analytics", "owneradmin_hidden", false) == 1); $group->submit("submit")->value(t("Save")); return $form; } }