Example #1
0
 /**
  * The default page which shows the login form.
  * @see lib/controllers/Controller#getContents()
  */
 public function getContents()
 {
     Application::addStylesheet("css/login.css");
     Application::$template = "login.tpl";
     Application::setTitle("Login");
     if ($_SESSION["logged_in"]) {
         Application::redirect(Application::getLink("/"));
     }
     $form = new Form();
     $form->setRenderer("default");
     $username = new TextField("Username", "username");
     $form->add($username);
     $password = new PasswordField("Password", "password");
     $form->add($password);
     $form->setSubmitValue("Login");
     $form->setCallback("{$this->getClassName()}::callback", $this);
     return $form->render();
 }
Example #2
0
 /**
  * A method which allows the user to change their password if they are
  * logging in for the forst time.
  * @return unknown_type
  */
 public function change_password()
 {
     Application::addStylesheet("css/login.css");
     Application::$template = "login.tpl";
     Application::setTitle("Change Password");
     $text = null;
     $form = new Form();
     $form->setRenderer("default");
     $password = new PasswordField("Password", "password");
     $password->setEncrypted(false);
     $form->add($password);
     $passwordRetype = new PasswordField("Retype Password", "password2");
     $passwordRetype->setEncrypted(false);
     $form->add($passwordRetype);
     $form->setCallback($this->getClassName() . "::change_password_callback", null);
     $form->setShowClear(false);
     $form = $form->render();
     if ($_SESSION['user_status'] == "2") {
         $text = "<h2>Change Password</h2>" . "<p>It appears that this is the first time you are logging in. " . "Please change your password.</p> {$form}";
     } else {
         $text = "<h2>Change Password</h2>" . "<p>Your current password has expired. Please enter a new password. Please note that your password must be 6 characters or more and must contain at least one lowecase letter and a number.<br/>&nbsp</p>" . "{$form}";
     }
     return $text;
 }
Example #3
0
 /**
  * Provides all the necessary forms needed to start an update.
  * @param $params
  * @return string
  */
 public function import()
 {
     $this->label = "Import " . $this->label;
     $form = new Form();
     $form->add(Element::create("UploadField", "File", "file", "Select the file you want to upload."), Element::create("Checkbox", "Break on errors", "break_on_errors", "", "1")->setValue("1"));
     $form->addAttribute("style", "width:50%");
     $form->setCallback($this->getClassName() . '::importCallback', $this);
     $form->setSubmitValue('Import Data');
     return $this->arbitraryTemplate(Application::getWyfHome('model_controller/import.tpl'), array('form' => $form->render(), 'template' => "{$this->path}/export/csv?template=yes"));
 }
Example #4
0
 /**
  * Provides all the necessary forms needed to start an update.
  * @param $params
  * @return string
  */
 public function import()
 {
     $this->label = "Import " . $this->label;
     $entity = $this->model->getEntity();
     $path = $this->urlPath;
     $form = new Form();
     $form->setRenderer('default');
     $form->add(Element::create("HTMLBox", "This import utility would assist you to import new {$entity} into your database. You are expected to upload a CSV file which contains the data you want to import." . " <p>Please click <a href='{$path}/export/csv?template=yes'>here</a> to download a template csv file.</p>"), Element::create("UploadField", "File", "file", "Select the file you want to upload."));
     $form->addAttribute("style", "width:50%");
     $form->setCallback($this->getClassName() . '::importCallback', $this);
     $form->setSubmitValue('Import Data');
     return $this->arbitraryTemplate(Application::getWyfHome('utils/model_controller/templates/import.tpl'), array('form' => $form->render()));
 }