jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Controllers/] [DispatcherController.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3namespace Phem\Controllers;
4 
5use Phem\Environment\Application;
6use Phem\Environment\ApplicationException;
7use Phem\Environment\EnvironmentManager;
8use Phem\Environment\Message;
9 
10/**
11 *
12 * @author kubapet
13 */
14class DispatcherController extends SimpleViewController
15{
16 
17 public function login($username, $password)
18 {
19 if (($username != null) && ($password != null))
20 {
21 $ap = EnvironmentManager::getAuthenticationProvider();
22 $user = $ap->authenticate($username, $password);
23 if ($user != null)
24 {
25 EnvironmentManager::getSession()->setVar(ROOT_NAMESPACE . ".loggedUser", $user->getUsername());
26 
27 /*$msg = new Message();
28 $msg->setFromUsr($user->getUsername());
29 $msg->setSubject('Příchod uživatele ' . $user->getUsername());
30 
31 try
32 {
33 Application::notify($msg);
34 }
35 catch (ApplicationException $ex)
36 {
37 
38 }*/
39 
40 $this->redirectToController = DEFAULT_CONTROLLER;
41 $this->redirectToTask = DEFAULT_TASK;
42 return;
43 }
44 }
45 
46 $lb = EnvironmentManager::getLinkBuilder();
47 $this->getModel()->set("formAction", $lb->link(array("controller" => "Dispatcher", "task" => "login")));
48 $this->template = "@Phem/login.twig";
49 }
50 
51 public function logout()
52 {
53 EnvironmentManager::getSession()->setVar(ROOT_NAMESPACE . ".loggedUser", null);
54 $this->renderTemplate = false;
55 $this->redirectToController = "Disparcher";
56 $this->redirectToTask = "login";
57 return;
58 }
59 
60 public function showAccessDenied()
61 {
62 
63 }
64 
65}

Powered by WebSVN 2.2.1