@@ -6,7 +6,7 @@ |
||
6 | 6 | protected $title; |
7 | 7 | protected $controller; |
8 | 8 | |
9 | - public function initialize(){ |
|
9 | + public function initialize() { |
|
10 | 10 | $this->model = "User"; |
11 | 11 | $this->title = "Utilisateurs"; |
12 | 12 | $this->controller = "Users"; |
@@ -6,10 +6,10 @@ |
||
6 | 6 | protected $title; |
7 | 7 | protected $controller; |
8 | 8 | |
9 | - public function initialize(){ |
|
9 | + public function initialize() { |
|
10 | 10 | $this->model = "Index"; |
11 | 11 | $this->title = "Accueil"; |
12 | - $this->controller= "Index"; |
|
12 | + $this->controller = "Index"; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function indexAction() |
@@ -63,9 +63,9 @@ |
||
63 | 63 | 'username' => $config->database->username, |
64 | 64 | 'password' => $config->database->password, |
65 | 65 | 'dbname' => $config->database->dbname, |
66 | - 'options' => array( |
|
67 | - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' |
|
68 | - ) |
|
66 | + 'options' => array( |
|
67 | + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' |
|
68 | + ) |
|
69 | 69 | )); |
70 | 70 | }); |
71 | 71 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * The URL component is used to generate all kind of urls in the application |
22 | 22 | */ |
23 | -$di->set('url', function () use ($config) { |
|
23 | +$di->set('url', function() use ($config) { |
|
24 | 24 | $url = new UrlResolver(); |
25 | 25 | $url->setBaseUri($config->application->baseUri); |
26 | 26 | |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Setting up the view component |
32 | 32 | */ |
33 | -$di->set('view', function () use ($config) { |
|
33 | +$di->set('view', function() use ($config) { |
|
34 | 34 | |
35 | 35 | $view = new View(); |
36 | 36 | |
37 | 37 | $view->setViewsDir($config->application->viewsDir); |
38 | 38 | |
39 | 39 | $view->registerEngines(array( |
40 | - '.volt' => function ($view, $di) use ($config) { |
|
40 | + '.volt' => function($view, $di) use ($config) { |
|
41 | 41 | |
42 | 42 | $volt = new VoltEngine($view, $di); |
43 | 43 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * Database connection is created based in the parameters defined in the configuration file |
59 | 59 | */ |
60 | -$di->set('db', function () use ($config) { |
|
60 | +$di->set('db', function() use ($config) { |
|
61 | 61 | return new DbAdapter(array( |
62 | 62 | 'host' => $config->database->host, |
63 | 63 | 'username' => $config->database->username, |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | }); |
71 | 71 | |
72 | 72 | |
73 | -$di->set('baseUrl', function () use ($config) { |
|
73 | +$di->set('baseUrl', function() use ($config) { |
|
74 | 74 | $baseUrl = $config->application->baseUri; |
75 | 75 | return $baseUrl; |
76 | 76 | }); |
@@ -78,34 +78,34 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * If the configuration specify the use of metadata adapter use it or use memory otherwise |
80 | 80 | */ |
81 | -$di->set('modelsMetadata', function () { |
|
81 | +$di->set('modelsMetadata', function() { |
|
82 | 82 | return new MetaDataAdapter(); |
83 | 83 | }); |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Start the session the first time some component request the session service |
87 | 87 | */ |
88 | -$di->set('session', function () { |
|
88 | +$di->set('session', function() { |
|
89 | 89 | $session = new SessionAdapter(); |
90 | 90 | $session->start(); |
91 | 91 | |
92 | 92 | return $session; |
93 | 93 | }); |
94 | 94 | |
95 | -$di->set("jquery",function(){ |
|
96 | - $jquery= new JsUtils(array("driver"=>"Jquery")); |
|
95 | +$di->set("jquery", function() { |
|
96 | + $jquery = new JsUtils(array("driver"=>"Jquery")); |
|
97 | 97 | $jquery->bootstrap(new Bootstrap()); |
98 | - $jquery->ui(new Ajax\JqueryUI());//optional for JQuery UI |
|
98 | + $jquery->ui(new Ajax\JqueryUI()); //optional for JQuery UI |
|
99 | 99 | return $jquery; |
100 | 100 | }); |
101 | 101 | |
102 | -$di->set('dispatcher', function () { |
|
102 | +$di->set('dispatcher', function() { |
|
103 | 103 | |
104 | 104 | // Create an event manager |
105 | 105 | $eventsManager = new EventsManager(); |
106 | 106 | |
107 | 107 | // Attach a listener for type "dispatch" |
108 | - $eventsManager->attach("dispatch", function ($event, $dispatcher) { |
|
108 | + $eventsManager->attach("dispatch", function($event, $dispatcher) { |
|
109 | 109 | // ... |
110 | 110 | }); |
111 | 111 |
@@ -2,60 +2,60 @@ |
||
2 | 2 | |
3 | 3 | use Phalcon\Mvc\Controller; |
4 | 4 | |
5 | -class ControllerBase extends Controller{ |
|
5 | +class ControllerBase extends Controller { |
|
6 | 6 | |
7 | 7 | protected $model; |
8 | 8 | protected $title; |
9 | 9 | protected $controller; |
10 | 10 | |
11 | - public function afterExecuteRoute($dispatcher){ |
|
11 | + public function afterExecuteRoute($dispatcher) { |
|
12 | 12 | $baseUrl = $this->baseUrl; |
13 | 13 | $this->view->setVar("baseUrl", $baseUrl); |
14 | 14 | $this->view->setVar("controller", $this->controller); |
15 | 15 | $this->view->setVar("title", $this->title); |
16 | 16 | } |
17 | 17 | |
18 | - public function indexAction(){ |
|
19 | - $objects = call_user_func($this->model."::find"); |
|
20 | - $this->view->setVar("objects",$objects); |
|
18 | + public function indexAction() { |
|
19 | + $objects = call_user_func($this->model . "::find"); |
|
20 | + $this->view->setVar("objects", $objects); |
|
21 | 21 | $this->view->pick("main/index"); |
22 | 22 | } |
23 | 23 | |
24 | - public function frmAction($id = NULL){ |
|
24 | + public function frmAction($id = NULL) { |
|
25 | 25 | echo "Pas encore implémenté..."; |
26 | 26 | } |
27 | 27 | |
28 | - public function readAction($id = NULL){ |
|
29 | - if($id != null){ |
|
30 | - $object = call_user_func($this->model.'::find', "id = $id"); |
|
31 | - $this->view->setVar("object",$object); |
|
28 | + public function readAction($id = NULL) { |
|
29 | + if ($id != null) { |
|
30 | + $object = call_user_func($this->model . '::find', "id = $id"); |
|
31 | + $this->view->setVar("object", $object); |
|
32 | 32 | $this->view->pick("main/read"); |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - public function updateAction(){ |
|
36 | + public function updateAction() { |
|
37 | 37 | echo "Pas encore implémenté..."; |
38 | 38 | } |
39 | 39 | |
40 | - public function deleteAction($id = null){ |
|
41 | - $object = call_user_func($this->model.'::findFirst', "id = $id"); |
|
40 | + public function deleteAction($id = null) { |
|
41 | + $object = call_user_func($this->model . '::findFirst', "id = $id"); |
|
42 | 42 | $object->delete(); |
43 | 43 | $this->response->redirect("Index/index"); |
44 | 44 | } |
45 | 45 | |
46 | - public function asAdminAction(){ |
|
46 | + public function asAdminAction() { |
|
47 | 47 | $user = User::findFirst("id=3"); |
48 | 48 | $this->session->set("user", $user); |
49 | 49 | $this->response->redirect("Index/index"); |
50 | 50 | } |
51 | 51 | |
52 | - public function asUserAction(){ |
|
52 | + public function asUserAction() { |
|
53 | 53 | $user = User::findFirst("id=1"); |
54 | 54 | $this->session->set("user", $user); |
55 | 55 | $this->response->redirect("Index/index"); |
56 | 56 | } |
57 | 57 | |
58 | - public function logoutAction(){ |
|
58 | + public function logoutAction() { |
|
59 | 59 | $this->session->destroy(); |
60 | 60 | $this->response->redirect("Index/index"); |
61 | 61 | } |
@@ -1,38 +1,38 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class ProjetsController extends \ControllerBase{ |
|
3 | +class ProjetsController extends \ControllerBase { |
|
4 | 4 | |
5 | 5 | protected $model; |
6 | 6 | protected $title; |
7 | 7 | protected $controller; |
8 | 8 | |
9 | - public function initialize(){ |
|
9 | + public function initialize() { |
|
10 | 10 | $this->model = "Projet"; |
11 | 11 | $this->title = "Projets"; |
12 | 12 | $this->controller = "Projets"; |
13 | 13 | } |
14 | 14 | |
15 | - public function readAction($id = null){ |
|
15 | + public function readAction($id = null) { |
|
16 | 16 | $projet = Projet::findFirst($id); |
17 | 17 | $usecases = Usecase::find("idProjet = $id"); |
18 | 18 | |
19 | 19 | //Calcul le taux de finition du projet en fonction du nombre d'usecases total et du % fini sur chaque usecases. |
20 | 20 | $countUsecases = count($usecases); |
21 | - $totalAvancementFini = $countUsecases*100; |
|
21 | + $totalAvancementFini = $countUsecases * 100; |
|
22 | 22 | $totalAvancementReel = 0; |
23 | 23 | |
24 | - foreach($usecases as $u){ |
|
24 | + foreach ($usecases as $u) { |
|
25 | 25 | $totalAvancementReel = $totalAvancementReel + $u->getAvancement(); |
26 | 26 | } |
27 | - $avancementReel = ($totalAvancementReel / $totalAvancementFini)*100; |
|
28 | - $avancementReel = number_format($avancementReel,1); |
|
27 | + $avancementReel = ($totalAvancementReel / $totalAvancementFini) * 100; |
|
28 | + $avancementReel = number_format($avancementReel, 1); |
|
29 | 29 | |
30 | - $this->view->setVar("projet",$projet); |
|
31 | - $this->view->setVar("usecases",$usecases); |
|
32 | - $this->view->setVar("avancement",$avancementReel); |
|
30 | + $this->view->setVar("projet", $projet); |
|
31 | + $this->view->setVar("usecases", $usecases); |
|
32 | + $this->view->setVar("avancement", $avancementReel); |
|
33 | 33 | |
34 | 34 | //Création de la progressbar |
35 | - $progress= $this->jquery->bootstrap()->htmlProgressbar("progress","info",$avancementReel); |
|
35 | + $progress = $this->jquery->bootstrap()->htmlProgressbar("progress", "info", $avancementReel); |
|
36 | 36 | $progress->showcaption(true); |
37 | 37 | echo $this->jquery->compile($this->view); |
38 | 38 |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return string |
223 | 223 | */ |
224 | - public function getSource(){ |
|
224 | + public function getSource() { |
|
225 | 225 | return 'projet'; |
226 | 226 | } |
227 | 227 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param mixed $parameters |
232 | 232 | * @return Projet[] |
233 | 233 | */ |
234 | - public static function find($parameters = null){ |
|
234 | + public static function find($parameters = null) { |
|
235 | 235 | return parent::find($parameters); |
236 | 236 | } |
237 | 237 | |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | return parent::findFirst($parameters); |
247 | 247 | } |
248 | 248 | |
249 | - public function toString(){ |
|
249 | + public function toString() { |
|
250 | 250 | return $this->nom; |
251 | 251 | } |
252 | 252 | |
253 | 253 | //Return a string containing the principal content of the model |
254 | - public function getPrincipal(){ |
|
255 | - return "Client : ".$this->client->toString()." <br/> Desciption : ".$this->description; |
|
254 | + public function getPrincipal() { |
|
255 | + return "Client : " . $this->client->toString() . " <br/> Desciption : " . $this->description; |
|
256 | 256 | } |
257 | 257 | } |
@@ -188,7 +188,7 @@ |
||
188 | 188 | return parent::findFirst($parameters); |
189 | 189 | } |
190 | 190 | |
191 | - public function toString(){ |
|
192 | - return $this->libelle."(".$this->avancement.")"; |
|
191 | + public function toString() { |
|
192 | + return $this->libelle . "(" . $this->avancement . ")"; |
|
193 | 193 | } |
194 | 194 | } |
@@ -219,7 +219,7 @@ |
||
219 | 219 | return parent::findFirst($parameters); |
220 | 220 | } |
221 | 221 | |
222 | - public function toString(){ |
|
223 | - return $this->nom."(".$this->avancement.")"; |
|
222 | + public function toString() { |
|
223 | + return $this->nom . "(" . $this->avancement . ")"; |
|
224 | 224 | } |
225 | 225 | } |
@@ -158,13 +158,13 @@ |
||
158 | 158 | $this->hasMany('id', 'Usecase', 'idDev', array('alias' => 'Usecases')); |
159 | 159 | } |
160 | 160 | |
161 | - public function toString(){ |
|
162 | - return $this->identite."(".$this->mail.")"; |
|
161 | + public function toString() { |
|
162 | + return $this->identite . "(" . $this->mail . ")"; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | //Return a string containing the principal content of the model |
166 | - public function getPrincipal(){ |
|
167 | - return "Identité : ".$this->identite." <br/> Email : ".$this->mail; |
|
166 | + public function getPrincipal() { |
|
167 | + return "Identité : " . $this->identite . " <br/> Email : " . $this->mail; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 |