3 class User
extends AOOSModule
5 private $_accesLevel = null;
6 private $_levels = array(
12 private $_groups = array();
14 private $_username = "Guest";
15 private $_password = null;
16 private $_email = null;
18 private $_loggedIn = false;
20 public function show() {
21 if (!$this->loggedIn()) {
22 $r = $this->core()->getModule("Reciever");
23 if (!$r->getModel("POST")) {
26 Brugernavn: <input type="text" name="USERNAME" /><br />
27 Kodeord: <input type="text" name="PASSWORD" /><br />
28 <input type="submit" value"Login">
32 require_once("UserHandler.php");
33 $handler = new UserHandler($this->core());
34 $m = $r->getModel("POST");
36 array_pop($m->getColumn("USERNAME")),
37 array_pop($m->getColumn("PASSWORD"))
43 public function setUsername($username)
45 $this->_username
= $username;
49 public function setPassword($password)
51 $this->_password
= $password;
55 public function setEmail($email)
57 $this->_email
= $email;
61 public function username() { return $this->_username
; }
62 public function password() { return $this->_password
; }
63 public function email() { return $this->_email
; }
65 public function addToGroup($group) {
66 $this->_groups
[] = $group;
70 public function setGroups($groups) {
71 $this->_groups
= $groups;
75 public function checkGroup($group) {
76 if (!in_array($group, $this->_groups
)) {
82 public function setLevel($level) {
83 $this->_accessLevel
= $level;
87 public function checkLevel($level) {
88 if ($this->_levels
[$level] > $this->_accessLevel
) {
94 public function setLoggedIn($state) {
95 if (!is_bool($state)) {
96 throw new AOOSException($this->core(), $this->tr("not_bool"), "", true, 1);
99 $this->_loggedIn
= $state;
102 public function loggedIn() {
103 return $this->_loggedIn
;