content = new View("admin_sharephoto.html"); $view->content->sharephoto_form = $this->_get_admin_form(); print $view; } public function saveprefs() { // Prevent Cross Site Request Forgery access::verify_csrf(); $form = $this->_get_admin_form(); // Figure out which boxes where checked $shareOpts_array = Input::instance()->post("ShareOptions"); $IconsButton = false; $HTMLLinksButton = false; for ($i = 0; $i < count($shareOpts_array); $i++) { if ($shareOpts_array[$i] == "Icons") { $IconsButton = true; } if ($shareOpts_array[$i] == "HTMLLinks") { $HTMLLinksButton = true; } } // Save Settings. module::set_var("sharephoto", "Icons", $IconsButton); module::set_var("sharephoto", "HTMLLinks", $HTMLLinksButton); message::success(t("Your Selection Has Been Saved.")); // Load Admin page. $view = new Admin_View("admin.html"); $view->content = new View("admin_sharephoto.html"); $view->content->sharephoto_form = $form; print $view; } private function _get_admin_form() { // New Form. $form = new Forge("admin/sharephoto/saveprefs", "", "post", array("id" => "g-sharephoto-adminForm")); // Select what to show on the Photo page. $shareTypes["Icons"] = array(t("Show Icons   "), module::get_var("sharephoto", "Icons")); $shareTypes["HTMLLinks"] = array(t("Show HTML Links"), module::get_var("sharephoto", "HTMLLinks")); // Checkboxes $add_links = $form->group("SharePhoto"); $add_links->checklist("ShareOptions") ->options($shareTypes); // Save button $add_links->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; } }