Completed
Push — Projets ( 4109c3...54d1e1 )
by Hugo
05:44
created

UsersController::readAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 15
rs 9.4286
cc 2
eloc 11
nc 2
nop 1
1
<?php
2
3
class UsersController extends ControllerBase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    protected $model;
6
    protected $title;
7
    protected $controller;
8
9
    public function initialize()
10
    {
11
        $this->model = "User";
12
        $this->title = "Utilisateurs";
13
        $this->controller = "Users";
14
    }
15
16
    public function readAction($id = null)
17
    {
18
        $user = User::findFirst($id);
19
        $usecases = Usecase::find("idDev=$id");
20
        $projets = array();
21
        foreach ($usecases as $u) {
22
            $projets[$u->getProjet()->getId()] = $u->getProjet();
23
        }
24
        $projetsCree = Projet::find("idClient = $id");
25
26
        $this->view->setVar("user", $user);
27
        $this->view->setVar("projets", $projets);
28
        $this->view->setVar("projetsCree", $projetsCree);
29
        $this->view->setVar("usecases", $usecases);
30
    }
31
}
32
33