/** * Construct and process the settings form for this skin, and return the path to the view that should be * rendered. * * @param ETController $sender The page controller. * @return string The path to the settings view to render. */ public function settings($sender) { // Set up the settings form. $form = ETFactory::make("form"); $form->action = URL("admin/plugins"); $form->setValue("server", C("plugin.SMTP.server")); $form->setValue("username", C("plugin.SMTP.username")); $form->setValue("password", C("plugin.SMTP.password")); $form->setValue("port", C("plugin.SMTP.port")); $form->setValue("auth", C("plugin.SMTP.auth")); // If the form was submitted... if ($form->validPostBack("save")) { // Construct an array of config options to write. $config = array(); $config["plugin.SMTP.server"] = $form->getValue("server"); $config["plugin.SMTP.username"] = $form->getValue("username"); $config["plugin.SMTP.password"] = $form->getValue("password"); $config["plugin.SMTP.port"] = $form->getValue("port"); $config["plugin.SMTP.auth"] = $form->getValue("auth"); if (!$form->errorCount()) { // Write the config file. ET::writeConfig($config); $sender->message(T("message.changesSaved"), "success"); $sender->redirect(URL("admin/plugins")); } } $sender->data("smtpSettingsForm", $form); return $this->getView("settings"); }
/** * Construct and process the settings form for this skin, and return the path to the view that should be * rendered. * * @param ETController $sender The page controller. * @return string The path to the settings view to render. */ public function settings($sender) { // Set up the settings form. $form = ETFactory::make("form"); $form->action = URL("admin/appearance"); $form->setValue("primaryColor", C("skin.Doragon.primaryColor")); // If the form was submitted... if ($form->validPostBack("save")) { $this->writeColors($form->getValue("primaryColor")); $sender->message(T("message.changesSaved"), "success autoDismiss"); $sender->redirect(URL("admin/appearance")); } $sender->data("skinSettingsForm", $form); $sender->addJSFile("core/js/lib/farbtastic.js"); return $this->view("settings"); }
/** * Construct and process the settings form for this skin, and return the path to the view that should be * rendered. * * @param ETController $sender The page controller. * @return string The path to the settings view to render. */ public function settings($sender) { // Set up the settings form. $form = ETFactory::make("form"); $form->action = URL("admin/appearance"); $form->setValue("headerColor", C("skin.Default.headerColor")); $form->setValue("bodyColor", C("skin.Default.bodyColor")); $form->setValue("noRepeat", (bool) C("skin.Default.noRepeat")); $form->setValue("bodyImage", (bool) C("skin.Default.bodyImage")); // If the form was submitted... if ($form->validPostBack("save")) { // Construct an array of config options to write. $config = array(); $config["skin.Default.headerColor"] = $form->getValue("headerColor"); $config["skin.Default.bodyColor"] = $form->getValue("bodyColor"); // Upload a body bg image if necessary. if ($form->getValue("bodyImage") and !empty($_FILES["bodyImageFile"]["tmp_name"])) { $config["skin.Default.bodyImage"] = $this->uploadBackgroundImage($form); } elseif (!$form->getValue("bodyImage")) { $config["skin.Default.bodyImage"] = false; } $config["skin.Default.noRepeat"] = (bool) $form->getValue("noRepeat"); if (!$form->errorCount()) { // Write the config file. ET::writeConfig($config); $sender->message(T("message.changesSaved"), "success"); $sender->redirect(URL("admin/appearance")); } } $sender->data("skinSettingsForm", $form); $sender->addCSSFile("core/js/lib/farbtastic/farbtastic.css"); $sender->addJSFile("core/js/lib/farbtastic/farbtastic.js"); return $this->getView("settings"); }