@@ -58,15 +58,15 @@ |
||
| 58 | 58 | |
| 59 | 59 | private function trim_request_data() |
| 60 | 60 | { |
| 61 | - array_walk_recursive($_GET, function (&$value) { |
|
| 61 | + array_walk_recursive($_GET, function(&$value) { |
|
| 62 | 62 | $value = trim($value); |
| 63 | 63 | }); |
| 64 | - array_walk_recursive($_REQUEST, function (&$value) { |
|
| 64 | + array_walk_recursive($_REQUEST, function(&$value) { |
|
| 65 | 65 | $value = trim($value); |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | 68 | if ($this->router()->submits()) { |
| 69 | - array_walk_recursive($_POST, function (&$value) { |
|
| 69 | + array_walk_recursive($_POST, function(&$value) { |
|
| 70 | 70 | $value = trim($value); |
| 71 | 71 | }); |
| 72 | 72 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace HexMakina\kadro\Controllers; |
| 4 | 4 | |
| 5 | -use HexMakina\kadro\Auth\{Operator,Permission,ACL}; |
|
| 5 | +use HexMakina\kadro\Auth\{Operator, Permission, ACL}; |
|
| 6 | 6 | use HexMakina\kadro\Auth\AccessRefusedException; |
| 7 | 7 | use HexMakina\BlackBox\Auth\OperatorInterface; |
| 8 | 8 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // MVC Cascade |
| 28 | - $target_controller = $this->get('Controllers\\' . $router->targetController()); |
|
| 28 | + $target_controller = $this->get('Controllers\\'.$router->targetController()); |
|
| 29 | 29 | |
| 30 | 30 | if ($target_controller->requiresOperator()) { |
| 31 | 31 | if (is_null($operator_id = $this->get('HexMakina\BlackBox\StateAgentInterface')->operatorId())) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->logger()->notice('PAGE_CHECKIN_WELCOME', [$operator->name()]); |
| 73 | 73 | $this->router()->hop(); |
| 74 | 74 | } catch (\Exception $e) { |
| 75 | - $this->logger()->warning('KADRO_operator_' . $e->getMessage()); |
|
| 75 | + $this->logger()->warning('KADRO_operator_'.$e->getMessage()); |
|
| 76 | 76 | $this->router()->hop('checkin'); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $ret = $this->modelType(); |
| 59 | 59 | |
| 60 | 60 | if (!is_null($suffix)) { |
| 61 | - $ret .= '_' . $suffix; |
|
| 61 | + $ret .= '_'.$suffix; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return $ret; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | if (is_null($this->model_class_name)) { |
| 105 | 105 | preg_match(LeMarchand::RX_MVC, get_called_class(), $m); |
| 106 | - $this->model_class_name = $this->get('Models\\' . $m[2] . '::class'); |
|
| 106 | + $this->model_class_name = $this->get('Models\\'.$m[2].'::class'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | return $this->model_class_name; |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | $this->viewport('listing_fields', $listing_fields); |
| 168 | 168 | $this->viewport('listing_template', $listing_template); |
| 169 | 169 | |
| 170 | - $this->viewport('route_new', $this->router()->hyp($class_name::model_type() . '_new')); |
|
| 171 | - $this->viewport('route_export', $this->router()->hyp($class_name::model_type() . '_export')); |
|
| 170 | + $this->viewport('route_new', $this->router()->hyp($class_name::model_type().'_new')); |
|
| 171 | + $this->viewport('route_export', $this->router()->hyp($class_name::model_type().'_export')); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function copy() |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | { |
| 200 | 200 | $this->errors = $model->save($this->operator()->getId()); // returns [errors] |
| 201 | 201 | if (empty($this->errors())) { |
| 202 | - $this->logger()->notice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_' . get_class($model)::model_type() . '_INSTANCE')])); |
|
| 202 | + $this->logger()->notice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_'.get_class($model)::model_type().'_INSTANCE')])); |
|
| 203 | 203 | return $model; |
| 204 | 204 | } |
| 205 | 205 | foreach ($this->errors() as $field => $error_msg) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | public function before_edit() |
| 213 | 213 | { |
| 214 | 214 | if (!is_null($this->router()->params('id')) && is_null($this->load_model)) { |
| 215 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->modelClassName()::model_type() . '_INSTANCE')])); |
|
| 215 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->modelClassName()::model_type().'_INSTANCE')])); |
|
| 216 | 216 | $this->router()->hop($this->modelClassName()::model_type()); |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | public function destroy_confirm() |
| 232 | 232 | { |
| 233 | 233 | if (is_null($this->load_model)) { |
| 234 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
| 234 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
| 235 | 235 | $this->router()->hop($this->model_type); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | public function before_destroy() // default: checks for load_model and immortality, hops back to object on failure |
| 244 | 244 | { |
| 245 | 245 | if (is_null($this->load_model)) { |
| 246 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
| 246 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
| 247 | 247 | $this->router()->hop($this->model_type); |
| 248 | 248 | } elseif ($this->load_model->immortal()) { |
| 249 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
| 249 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
| 250 | 250 | $this->router()->hop($this->route_model($this->load_model)); |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -258,10 +258,10 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | if ($this->load_model->destroy($this->operator()->getId()) === false) { |
| 261 | - $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', ['' . $this->load_model])); |
|
| 261 | + $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model])); |
|
| 262 | 262 | $this->routeBack($this->load_model); |
| 263 | 263 | } else { |
| 264 | - $this->logger()->notice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
| 264 | + $this->logger()->notice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
| 265 | 265 | $this->routeBack($this->model_type); |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | public function collection_to_csv($collection, $filename) |
| 286 | 286 | { |
| 287 | 287 | // TODO use Format/File/CSV class to generate file |
| 288 | - $file_path = $this->get('settings.export.directory') . $filename . '.csv'; |
|
| 288 | + $file_path = $this->get('settings.export.directory').$filename.'.csv'; |
|
| 289 | 289 | $fp = fopen($file_path, 'w'); |
| 290 | 290 | |
| 291 | 291 | $header = false; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | public function route_new(ModelInterface $model): string |
| 324 | 324 | { |
| 325 | - return $this->router()->hyp(get_class($model)::model_type() . '_new'); |
|
| 325 | + return $this->router()->hyp(get_class($model)::model_type().'_new'); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | public function route_list(ModelInterface $model): string |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | { |
| 335 | 335 | $route_params = []; |
| 336 | 336 | |
| 337 | - $route_name = get_class($model)::model_type() . '_'; |
|
| 337 | + $route_name = get_class($model)::model_type().'_'; |
|
| 338 | 338 | if ($model->isNew()) { |
| 339 | 339 | $route_name .= 'new'; |
| 340 | 340 | } else { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | //-- router |
| 28 | 28 | $router = self::$box->get('HexMakina\BlackBox\RouterInterface'); |
| 29 | - $router->addRoutes(require(__DIR__ . '/routes.php')); |
|
| 29 | + $router->addRoutes(require(__DIR__.'/routes.php')); |
|
| 30 | 30 | |
| 31 | 31 | //-- session |
| 32 | 32 | $StateAgent = self::$box->get('HexMakina\BlackBox\StateAgentInterface'); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | self::$box->get('\Smarty')->assign('lezer', $lezer); |
| 52 | 52 | self::$box->get('\Smarty')->assign('language', $language); |
| 53 | 53 | |
| 54 | - setcookie('lang', $language, time() + (365 * 24 * 60 * 60), "/", ""); |
|
| 54 | + setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", ""); |
|
| 55 | 55 | |
| 56 | 56 | return self::$box; |
| 57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $setting = 'settings.default.charset'; |
| 63 | 63 | if (is_string(self::$box->get($setting))) { |
| 64 | 64 | ini_set('default_charset', self::$box->get($setting)); |
| 65 | - header('Content-type: text/html; charset=' . strtolower(self::$box->get($setting))); |
|
| 65 | + header('Content-type: text/html; charset='.strtolower(self::$box->get($setting))); |
|
| 66 | 66 | } else { |
| 67 | 67 | throw new \UnexpectedValueException($setting); |
| 68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // ---- parametroj:linguo |
| 71 | 71 | $setting = 'settings.default.language'; |
| 72 | 72 | if (is_string(self::$box->get($setting))) { |
| 73 | - putenv('LANG=' . self::$box->get($setting)); |
|
| 73 | + putenv('LANG='.self::$box->get($setting)); |
|
| 74 | 74 | setlocale(LC_ALL, self::$box->get($setting)); |
| 75 | 75 | } else { |
| 76 | 76 | throw new \UnexpectedValueException($setting); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | foreach (self::$box->get('settings.smarty.template_extra_directories') as $i => $template_dir) { |
| 95 | 95 | $smarty->addTemplateDir($template_dir); |
| 96 | 96 | } |
| 97 | - $smarty->addTemplateDir(__DIR__ . '/Views/'); //kadro templates |
|
| 97 | + $smarty->addTemplateDir(__DIR__.'/Views/'); //kadro templates |
|
| 98 | 98 | |
| 99 | 99 | $setting = 'settings.smarty.compiled_path'; |
| 100 | 100 | if (is_string(self::$box->get($setting))) { |
@@ -50,12 +50,12 @@ |
||
| 50 | 50 | |
| 51 | 51 | public static function enhance_query_retrieve($Query, $filters, $options) |
| 52 | 52 | { |
| 53 | - $Query->autoJoin([ACL::table(),'ACL'], null, 'LEFT OUTER'); |
|
| 53 | + $Query->autoJoin([ACL::table(), 'ACL'], null, 'LEFT OUTER'); |
|
| 54 | 54 | $permission_alias = $Query->autoJoin([Permission::table(), 'permission'], null, 'LEFT OUTER'); |
| 55 | 55 | |
| 56 | 56 | $permission_ids_and_names = []; |
| 57 | - $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'id', $permission_alias . '_ids'); |
|
| 58 | - $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'name', $permission_alias . '_names'); |
|
| 57 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'id', $permission_alias.'_ids'); |
|
| 58 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'name', $permission_alias.'_names'); |
|
| 59 | 59 | $Query->selectAlso($permission_ids_and_names); |
| 60 | 60 | |
| 61 | 61 | $Query->selectAlso(['operator.name as operator_name', 'operator.active as operator_active']); |