File: D:/HostingSpaces/SBogers13/rie-jeanne.nl/wwwroot/kms/app/controllers/c_login.class.php
<?php
/**
* c_login.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 3/20/13
*/
class Login extends Controller
{
public function __construct()
{
parent::__construct();
}
/*
* Shows the login form
*/
public function index()
{
/*
* Create Submit Button and send data to the view
*/
$sbm = new Button(array('type'=>'submit','name'=>'login_submit','label'=>'login'));
$sbm->addClasses(array('blue'));
$this->View->setData('submit',$sbm->display(FALSE));
/*
* Set Page Title
*/
$this->View->setData('page_title','Login Form | ' . SITE_NAME);
$this->View->setData('body_id','body_login');
$this->View->setData('background','<div id="background"><img src="' . IMAGE_ROOT . 'static/water.jpg" alt="Komma Mediadesign" /></div>');
/*
* Render the View
*/
$this->View->render('login/v_form');
}
/*
* Validates the login form and sends a message.
*/
public function validate()
{
if($this->Model->validate())
{
$msg = 'Success!';
$this->Alert->set($msg,'success');
}
else
{
$e = $this->Model->getErrors();
$this->Alert->set($e,'error');
}
$this->Functions->redirect(LANG_ROOT);
}
/*
* Log out
*/
public function logOut()
{
$this->Model->logOut();
$this->Alert->set('Log out success','success');
$this->Functions->redirect(LANG_ROOT);
}
}