/** * 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"); }
/** * A render function that will render the specified view inside of the main member "profile" view. (Except * on AJAX/view response types.) * * @param string $view The name of the view to render. * @return void */ public function renderProfile($view = "") { if (!in_array($this->responseType, array(RESPONSE_TYPE_VIEW, RESPONSE_TYPE_AJAX))) { $this->data("view", $view); parent::render("member/profile"); } else { parent::render($view); } }
/** * Rather than just rendering the view passed to this function, we need to render the admin "wrapper" view * and include the specified view within that (except on AJAX/view response types.) * * @param string $view The name of the view to render. * @return void */ public function render($view = "") { $this->data("menu", $this->menu); $this->data("defaultMenu", $this->defaultMenu); if (!in_array($this->responseType, array(RESPONSE_TYPE_VIEW, RESPONSE_TYPE_AJAX))) { $this->data("view", $view); parent::render("admin/index"); } else { parent::render($view); } }
/** * Initialize the skin. * * @param ETController $sender The page controller. * @return void */ public function handler_init($sender) { // source link $sender->addToMenu('statistics', 'myswitch', '<a href="https://github.com/davchezt/MySwitch">MySwitch</a> Skin by DaVchezt'); $sender->addCSSFile((C("esoTalk.https") ? "https" : "http") . "://fonts.googleapis.com/css?family=Open+Sans:400,600"); $sender->addCSSFile("core/skin/base.css", true); $sender->addCSSFile("core/skin/font-awesome.css", true); $sender->addCSSFile($this->resource("styles.css"), true); }