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
 public function getContents()
 {
     //          if(Configuration::get('attempt_counter') == null || Configuration::get('attempt_counter') === '0')
     //        {
     //            Configuration::set('attempt_counter',0);
     //        }
     Application::addStylesheet("css/login.css");
     Application::$template = "login.tpl";
     Application::setTitle("Login");
     if ($_SESSION["logged_in"]) {
         Application::redirect("/");
     }
     $form = new Form();
     $form->setRenderer("default");
     $username = new TextField("Username", "username");
     $form->add($username);
     $password = new PasswordField("Password", "password");
     $password->setEncrypted(false);
     $form->add($password);
     $form->setSubmitValue("Login");
     $form->setValidatorCallback("{$this->getClassName()}::callback");
     $form->setShowClear(false);
     return $form->render();
 }
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()));
 }