1 | <?php |
||
5 | class ProjetsController extends \ControllerBase |
||
|
|||
6 | { |
||
7 | |||
8 | protected $model; |
||
9 | protected $title; |
||
10 | protected $controller; |
||
11 | |||
12 | public function initialize() |
||
18 | |||
19 | public function indexAction($message = null) |
||
20 | { |
||
21 | $projets = Projet::find(); |
||
22 | $this->view->setVar("projets", $projets); |
||
23 | |||
24 | $dialog = $this->jquery->bootstrap()->htmlModal("modal", "Ajouter un nouveau projet", "test"); |
||
25 | $buttonFrm = $this->jquery->bootstrap()->htmlButton("btFrm", "Nouveau"); |
||
26 | $dialog->addCancelButton(); |
||
27 | $clients = User::find(); |
||
28 | $dialog->renderContent($this->view, "projets", "frm", array("clients" => $clients)); |
||
29 | |||
30 | $buttonFrm->onClick($dialog->jsShow()); |
||
31 | |||
32 | $this->jquery->compile($this->view); |
||
33 | } |
||
34 | |||
35 | public function updateAction() |
||
36 | { |
||
37 | //Retrouve l'id du dernier projet créer (En theorie celui qui vient d'être créé) |
||
38 | $projet = Projet::findFirst(array( |
||
39 | "order" => "id DESC" |
||
40 | )); |
||
41 | $idproj = $projet->getId(); |
||
42 | $this->response->redirect("Projets/read/$idproj"); |
||
43 | } |
||
44 | |||
45 | public function readAction($id = null) |
||
46 | { |
||
47 | $url = new Url(); |
||
48 | $projet = Projet::findFirst($id); |
||
49 | $usecases = Usecase::find("idProjet = $id"); |
||
50 | $messages = Message::find("idProjet = $id"); |
||
51 | $colorTexte = "black"; |
||
52 | |||
53 | $color = $projet->getDominantColor(); |
||
54 | |||
55 | //Si jamais la couleur retournée est noire, alors change sa couleur en gris clair |
||
56 | if ($color["r"] == 0 && $color["g"] == 0 && $color["b"] == 0) { |
||
57 | $color["r"] = 240; |
||
58 | $color["g"] = 240; |
||
59 | $color["b"] = 240; |
||
60 | //Sinon si la couleur est trop sombre change l'écriture en blanc pour qu'elle sois visible |
||
61 | } elseif ($color["r"] < 120 || $color["g"] < 120 || $color["b"] < 120) { |
||
62 | $colorTexte = "white"; |
||
63 | $color["r"] += 70; |
||
64 | $color["g"] += 70; |
||
65 | $color["b"] += 70; |
||
66 | } |
||
67 | |||
68 | $avancementReel = $this->avancementReel($usecases); |
||
69 | |||
70 | //Passage des différentes variables |
||
71 | $this->view->setVar("colorTexte", $colorTexte); |
||
72 | $this->view->setVar("color", $color); |
||
73 | $this->view->setVar("projet", $projet); |
||
74 | $this->view->setVar("messages", $messages); |
||
75 | $this->view->setVar("usecases", $usecases); |
||
76 | $this->view->setVar("avancement", $avancementReel); |
||
77 | |||
78 | //Création de la progressbar |
||
79 | $progress = $this->jquery->bootstrap()->htmlProgressbar("progress", "info", $avancementReel); |
||
80 | $progress->showcaption(true); |
||
81 | $this->jquery->get("Projets/resume/$id", "#contentProjet"); |
||
82 | //Creation des évenements onClick et des éléments sur le menu |
||
83 | $this->jquery->getOnClick("#menu1", "Projets/resume/$id", "#contentProjet"); |
||
84 | $this->jquery->getOnClick("#menu2", "Projets/contributors/$id", "#contentProjet"); |
||
85 | $this->jquery->getOnClick("#menu3", "Projets/usecases/$id", "#contentProjet"); |
||
86 | $this->jquery->getOnClick("#menu5", "Projets/messages/$id", "#contentProjet"); |
||
87 | |||
88 | //Xeditable |
||
89 | $this->jquery->exec("$('#nom').editable()", true); |
||
90 | $this->jquery->exec("$('#image').editable()", true); |
||
91 | |||
92 | //Compilation de Jquery dans la vue |
||
93 | $this->jquery->compile($this->view); |
||
94 | } |
||
95 | |||
96 | public function messagesAction($id = null) |
||
108 | |||
109 | public function resumeAction($id = null) |
||
110 | { |
||
111 | $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
||
146 | |||
147 | |||
148 | public function usecasesAction($id = null) |
||
160 | |||
161 | public function contributorsAction($id = null) |
||
179 | |||
180 | //Calcule le taux d'avancement total d'un projet |
||
181 | public function avancementReel($usecases) |
||
196 | |||
197 | } |
||
198 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.