コード例 #1
0
ファイル: Session.php プロジェクト: stwns/lasku
 /**
  * Display login form and do login
  */
 public function action_login()
 {
     switch ($this->request->method()) {
         default:
         case 'GET':
             $view = View::factory('session/login');
             $referrer = Session::instance()->get_once('login_referrer');
             $view->set('referrer', $referrer);
             $this->response->body($view);
             break;
         case 'POST':
             $post = $this->request->post();
             $success = Auth::instance()->login($post['email'], $post['password']);
             if ($success) {
                 if ($post['referrer'] != '') {
                     $this->redirect($post['referrer']);
                 } else {
                     $this->redirect('');
                 }
             } else {
                 Lasku::flash("Invalid email/password.", Lasku::FLASH_ERROR);
                 $view = View::factory('session/login');
                 $view->set('referrer', $post['referrer']);
                 $this->response->body($view);
             }
             break;
     }
 }
コード例 #2
0
ファイル: Company.php プロジェクト: stwns/lasku
 /**
  * Delete a client
  * 
  * /client/delete/<id>
  */
 public function action_delete()
 {
     $client = Model::factory('Client');
     $id = $this->request->param('id');
     if (!$client->exists($id)) {
         throw HTTP_Exception::factory(404, 'File not found!');
     }
     $data = $client->load($id, array('name'));
     $rs = $client->delete($id);
     if ($rs) {
         Lasku::flash("Client {$data['name']} is deleted.");
         $this->redirect($this->request->referrer());
     } else {
         Lasku::flash("Error when deleting {$data['nanem']}.", Lasku::FLASH_ERROR);
         $this->redirect($this->request->referrer());
     }
 }
コード例 #3
0
ファイル: header.php プロジェクト: stwns/lasku
<?php

/**
 * Header part of the base template.
 * This file comes as a pair with footer.php.
 */
$browser_names = array('Mozilla Firefox', 'Google Chrome', 'Safari');
$flash = Lasku::flash();
if ($flash != NULL) {
    $flash_class = 'info';
    if (($flash['flags'] & Lasku::FLASH_INFO) == Lasku::FLASH_INFO) {
        $flash_class = 'info';
    }
    if (($flash['flags'] & Lasku::FLASH_WARNING) == Lasku::FLASH_WARNING) {
        $flash_class = 'warning';
    }
    if (($flash['flags'] & Lasku::FLASH_ERROR) == Lasku::FLASH_ERROR) {
        $flash_class = 'error';
    }
}
?>
<noscript>
	<div class="ScreenModalDialog"><div class="wrapper"><div class="inner-wrapper">
		<h1>Have a cup of coffee.</h1>
		<p>
			We're sorry, but JavaScript is required to run this application correctly.
			Please enable JavaScript on your web browser first and try again.
		</p>
	</div></div></div>
</noscript>