aboutsummaryrefslogtreecommitdiff
path: root/w/class/controller.php
blob: 6eab6e40ab7d438061271f7aac1913d0ede3c1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

class Controller extends Application
{

    protected $user;
    protected $usermanager;
    protected $templates;

	public function __construct() {
        parent::__construct();
        $this->setuser();        
        $this->settemplate();        
	}



    public function setuser()
    {
        $this->usermanager = new Modeluser;        
        $this->user = $this->usermanager->readsession();
    }

    public function settemplate()
    {
        $this->templates = new League\Plates\Engine(Model::TEMPLATES_DIR);
    }
    
    public function useriseditor()
    {
        if ($this->user->level() >= $this->usermanager::EDITOR) {
            echo '<h3>Editor access</h3>';
            return true;
        } else {
            echo '<h3>Not enought rights to see more...</h3>';
            return false;
        }
    }





    public function redirect($url)
    {
        header('Location: ' . $url);
    }



}





?>