@@ -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 () { |
|
| 95 | +$di->set("jquery", function() { |
|
| 96 | 96 | $jquery = new JsUtils(array("driver" => "Jquery")); |
| 97 | 97 | $jquery->bootstrap(new Bootstrap()); |
| 98 | 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 | |
@@ -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() |
@@ -3,10 +3,10 @@ |
||
| 3 | 3 | class MessagesController extends ControllerBase |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public function initialize(){ |
|
| 6 | + public function initialize() { |
|
| 7 | 7 | $this->model = "Message"; |
| 8 | 8 | $this->title = "Messages"; |
| 9 | - $this->controller= "Messages"; |
|
| 9 | + $this->controller = "Messages"; |
|
| 10 | 10 | |
| 11 | 11 | } |
| 12 | 12 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setImage($image){ |
|
| 102 | + public function setImage($image) { |
|
| 103 | 103 | $this->image = $image; |
| 104 | 104 | return $this; |
| 105 | 105 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | return $this->mail; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - public function getImage(){ |
|
| 127 | + public function getImage() { |
|
| 128 | 128 | return $this->image; |
| 129 | 129 | } |
| 130 | 130 | /** |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | $this->hasMany('id', 'Usecase', 'idDev', array('alias' => 'Usecases')); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function toString(){ |
|
| 171 | - return $this->identite."(".$this->mail.")"; |
|
| 170 | + public function toString() { |
|
| 171 | + return $this->identite . "(" . $this->mail . ")"; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | //Return a string containing the principal content of the model |
| 175 | - public function getPrincipal(){ |
|
| 176 | - return "Identité : ".$this->identite." <br/> Email : ".$this->mail; |
|
| 175 | + public function getPrincipal() { |
|
| 176 | + return "Identité : " . $this->identite . " <br/> Email : " . $this->mail; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -300,9 +300,9 @@ |
||
| 300 | 300 | $img = $this->getImage(); |
| 301 | 301 | $type = getImageSize($img); // [] if you don't have exif you could use getImageSize() |
| 302 | 302 | $allowedTypes = array( |
| 303 | - 1, // [] gif |
|
| 304 | - 2, // [] jpg |
|
| 305 | - 3, // [] png |
|
| 303 | + 1, // [] gif |
|
| 304 | + 2, // [] jpg |
|
| 305 | + 3, // [] png |
|
| 306 | 306 | 6 // [] bmp |
| 307 | 307 | ); |
| 308 | 308 | if (!in_array($type, $allowedTypes)) { |
@@ -249,7 +249,7 @@ |
||
| 249 | 249 | return parent::findFirst($parameters); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - public function toString(){ |
|
| 252 | + public function toString() { |
|
| 253 | 253 | return $this->content; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -14,21 +14,21 @@ |
||
| 14 | 14 | $this->controller = "Usecases"; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function updateAction($id=null){ |
|
| 17 | + public function updateAction($id = null) { |
|
| 18 | 18 | parent::updateAction(); |
| 19 | 19 | $this->response->redirect("Projets/read/$id/2"); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function deleteAction($id = null){ |
|
| 22 | + public function deleteAction($id = null) { |
|
| 23 | 23 | $object = Usecase::findFirst("id = $id"); |
| 24 | 24 | $codeUseCase = $object->getCode(); |
| 25 | 25 | $taches = Tache::find("codeUseCase = '$codeUseCase'"); |
| 26 | 26 | //Deletion des taches liés avant deletion de la UseCase |
| 27 | - foreach($taches as $t){ |
|
| 27 | + foreach ($taches as $t) { |
|
| 28 | 28 | $t->delete(); |
| 29 | 29 | } |
| 30 | 30 | $object->delete(); |
| 31 | - $this->response->redirect($_SERVER['HTTP_REFERER']."/2"); |
|
| 31 | + $this->response->redirect($_SERVER['HTTP_REFERER'] . "/2"); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -5,24 +5,24 @@ |
||
| 5 | 5 | protected $title; |
| 6 | 6 | protected $controller; |
| 7 | 7 | |
| 8 | - public function initialize(){ |
|
| 8 | + public function initialize() { |
|
| 9 | 9 | $this->model = "Acl"; |
| 10 | 10 | $this->title = "Acl"; |
| 11 | - $this->controller= "Acl"; |
|
| 11 | + $this->controller = "Acl"; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public function frmAction(){ |
|
| 14 | + public function frmAction() { |
|
| 15 | 15 | $typesUser = TypeUser::find(); |
| 16 | 16 | $operations = Operation::find(); |
| 17 | 17 | $ressources = Ressource::find(); |
| 18 | 18 | |
| 19 | - $this->view->setVar("operations",$operations); |
|
| 20 | - $this->view->setVar("ressources",$ressources); |
|
| 21 | - $this->view->setVar("typesUser",$typesUser); |
|
| 19 | + $this->view->setVar("operations", $operations); |
|
| 20 | + $this->view->setVar("ressources", $ressources); |
|
| 21 | + $this->view->setVar("typesUser", $typesUser); |
|
| 22 | 22 | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function updateAction(){ |
|
| 25 | + public function updateAction() { |
|
| 26 | 26 | parent::updateAction(); |
| 27 | 27 | $this->response->redirect("$this->controller/index"); |
| 28 | 28 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $this->view->setVar("title", $this->title); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function frmAction(){ |
|
| 26 | + public function frmAction() { |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->view->setVar("object", $object); |
| 67 | 67 | $this->view->pick("main/read"); |
| 68 | 68 | } |
| 69 | - }else{ |
|
| 69 | + } else { |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | public function soloUpdateAction() |
| 111 | 111 | { |
| 112 | 112 | if ($this->verifyAccessAction($this->controller, "write")) { |
| 113 | - if($this->session->has("user") && ($this->session->get("user")->getId() == $this->request->getPost('pk', 'int')) || $this->session->get("user")->getIdTypeUser() == 0){ |
|
| 113 | + if ($this->session->has("user") && ($this->session->get("user")->getId() == $this->request->getPost('pk', 'int')) || $this->session->get("user")->getIdTypeUser() == 0) { |
|
| 114 | 114 | $name = $this->request->getPost('name', 'string'); |
| 115 | 115 | //Créer la fonction variable 'set' en fonction du name en POST |
| 116 | 116 | $func = 'set' . ucfirst($name); |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $aclsBdd = Acl::find(); |
| 177 | 177 | foreach ($aclsBdd as $aclBdd) { |
| 178 | - $typeUserBdd = TypeUser::findFirst("id = ".$aclBdd->getIdTypeUser()); |
|
| 179 | - $ressourceBdd = Ressource::findFirst("id = ".$aclBdd->getIdRessource()); |
|
| 180 | - $operationBdd = Operation::findFirst("id = ".$aclBdd->getIdOperation()); |
|
| 178 | + $typeUserBdd = TypeUser::findFirst("id = " . $aclBdd->getIdTypeUser()); |
|
| 179 | + $ressourceBdd = Ressource::findFirst("id = " . $aclBdd->getIdRessource()); |
|
| 180 | + $operationBdd = Operation::findFirst("id = " . $aclBdd->getIdOperation()); |
|
| 181 | 181 | $acl->allow($typeUserBdd->getLibelle(), $ressourceBdd->getLibelle(), $operationBdd->getOperation()); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | public function verifyAccessAction($activeResource, $activeOperation) { |
| 188 | - if($this->session->has("user")){ |
|
| 188 | + if ($this->session->has("user")) { |
|
| 189 | 189 | $user = $this->session->get("user"); |
| 190 | - $typeUser = TypeUser::findFirst("id = ".$user->getIdTypeUser()); |
|
| 190 | + $typeUser = TypeUser::findFirst("id = " . $user->getIdTypeUser()); |
|
| 191 | 191 | $typeUserSession = $user->getIdTypeUser(); |
| 192 | 192 | $acl = $this->loadAclAction($typeUserSession); |
| 193 | 193 | if ($acl->isAllowed($typeUser->getLibelle(), $activeResource, $activeOperation)) { |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | } else { |
| 196 | 196 | return 0; |
| 197 | 197 | } |
| 198 | - }else{ |
|
| 198 | + } else { |
|
| 199 | 199 | return 0; |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| 204 | - public function moreAction(){ |
|
| 204 | + public function moreAction() { |
|
| 205 | 205 | $this->view->pick("main/more"); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -267,27 +267,27 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
| 270 | - public function isAdmin($userId){ |
|
| 270 | + public function isAdmin($userId) { |
|
| 271 | 271 | $user = User::findFirst($userId); |
| 272 | - if($user->getTypeUser() == 0){ |
|
| 272 | + if ($user->getTypeUser() == 0) { |
|
| 273 | 273 | return true; |
| 274 | - }else{ |
|
| 274 | + } else { |
|
| 275 | 275 | return false; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - public function isActual($user){ |
|
| 280 | - if($this->session->has("user") || $user == $this->session->get("user")->getId()){ |
|
| 279 | + public function isActual($user) { |
|
| 280 | + if ($this->session->has("user") || $user == $this->session->get("user")->getId()) { |
|
| 281 | 281 | return true; |
| 282 | - }else{ |
|
| 282 | + } else { |
|
| 283 | 283 | return false; |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - public function isAdminAndActual($user){ |
|
| 288 | - if($this->isAdmin($user) || $this->isActual($user)){ |
|
| 287 | + public function isAdminAndActual($user) { |
|
| 288 | + if ($this->isAdmin($user) || $this->isActual($user)) { |
|
| 289 | 289 | return true; |
| 290 | - }else{ |
|
| 290 | + } else { |
|
| 291 | 291 | return false; |
| 292 | 292 | } |
| 293 | 293 | } |