| @@ -22,7 +22,7 @@ | ||
| 22 | 22 | |
| 23 | 23 | public function event_label() | 
| 24 | 24 |      { | 
| 25 | - return '' . $this; | |
| 25 | + return ''.$this; | |
| 26 | 26 | } | 
| 27 | 27 | |
| 28 | 28 | public static function today($format = Dato::FORMAT) | 
| @@ -13,7 +13,7 @@ discard block | ||
| 13 | 13 | namespace HexMakina\kadro\Controllers; | 
| 14 | 14 | |
| 15 | 15 | use HexMakina\Crudites\Crudites; | 
| 16 | -use HexMakina\kadro\Auth\{ACL,AccessRefusedException}; | |
| 16 | +use HexMakina\kadro\Auth\{ACL, AccessRefusedException}; | |
| 17 | 17 | |
| 18 | 18 | class Operator extends \HexMakina\kadro\Controllers\ORM | 
| 19 | 19 |  { | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | public function dashboard() | 
| 57 | 57 |      { | 
| 58 | 58 | $real_operator_class = get_class($this->operator()); | 
| 59 | -        $this->viewport('users', $real_operator_class::filter([], ['order_by' => [null,'username', 'ASC']])); | |
| 59 | +        $this->viewport('users', $real_operator_class::filter([], ['order_by' => [null, 'username', 'ASC']])); | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | public function destroy() | 
| @@ -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))) { | 
| @@ -3,7 +3,7 @@ discard block | ||
| 3 | 3 | namespace HexMakina\kadro; | 
| 4 | 4 | |
| 5 | 5 | use HexMakina\BlackBox\ORM\ModelInterface; | 
| 6 | -use HexMakina\Marker\{Form,Element}; | |
| 6 | +use HexMakina\Marker\{Form, Element}; | |
| 7 | 7 | |
| 8 | 8 | class TableToForm | 
| 9 | 9 |  { | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 |                      $form_field = new Element('div', $form_field, ['class' => $group_class]); | 
| 83 | 83 | } | 
| 84 | 84 | } | 
| 85 | - $ret .= PHP_EOL . $form_field; | |
| 85 | + $ret .= PHP_EOL.$form_field; | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | return $ret; | 
| @@ -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']); | 
| @@ -4,7 +4,7 @@ discard block | ||
| 4 | 4 | |
| 5 | 5 | use HexMakina\BlackBox\Database\SelectInterface; | 
| 6 | 6 | use HexMakina\BlackBox\Auth\OperatorInterface; | 
| 7 | -use HexMakina\TightORM\{TightModel,RelationManyToMany}; | |
| 7 | +use HexMakina\TightORM\{TightModel, RelationManyToMany}; | |
| 8 | 8 | |
| 9 | 9 | class Operator extends TightModel implements OperatorInterface | 
| 10 | 10 |  { | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 |          if (isset($filters['model']) && !empty($filters['model'])) { | 
| 94 | -            $Query->join([static::otm('t'), static::otm('a')], [[static::otm('a'),static::otm('k'), 't_from','id']], 'INNER'); | |
| 94 | +            $Query->join([static::otm('t'), static::otm('a')], [[static::otm('a'), static::otm('k'), 't_from', 'id']], 'INNER'); | |
| 95 | 95 |              $Query->whereFieldsEQ(['model_id' => $filters['model']->getId(), 'model_type' => get_class($filters['model'])::model_type()], static::otm('a')); | 
| 96 | 96 | } | 
| 97 | 97 | |
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | public function hasPermission($p): bool | 
| 147 | 147 |      { | 
| 148 | 148 | // new instances or inactive operators, none shall pass | 
| 149 | -        if ($this->isNew() === true || $this->isActive()  === false) { | |
| 149 | +        if ($this->isNew() === true || $this->isActive() === false) { | |
| 150 | 150 | return false; | 
| 151 | 151 | } | 
| 152 | 152 | |
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace HexMakina\kadro\Controllers; | 
| 4 | 4 | |
| 5 | -use Psr\Container\{ContainerInterface,ContainerExceptionInterface,NotFoundExceptionInterface}; | |
| 5 | +use Psr\Container\{ContainerInterface, ContainerExceptionInterface, NotFoundExceptionInterface}; | |
| 6 | 6 | use HexMakina\BlackBox\RouterInterface; | 
| 7 | 7 | use HexMakina\BlackBox\Controllers\BaseControllerInterface; | 
| 8 | 8 | use Psr\Log\LoggerInterface; | 
| @@ -51,9 +51,9 @@ discard block | ||
| 51 | 51 |          $this->viewport('user_messages', $this->get('HexMakina\BlackBox\StateAgentInterface')->messages()); | 
| 52 | 52 | |
| 53 | 53 |          $this->viewport('web_root', $this->router()->webRoot()); | 
| 54 | -        $this->viewport('view_path', $this->router()->filePath() . $this->get('settings.smarty.template_path') . 'app/'); | |
| 55 | -        $this->viewport('view_url', $this->router()->webRoot() . $this->get('settings.smarty.template_path')); | |
| 56 | -        $this->viewport('images_url', $this->router()->webRoot() . $this->get('settings.smarty.template_path') . 'images/'); | |
| 54 | +        $this->viewport('view_path', $this->router()->filePath().$this->get('settings.smarty.template_path').'app/'); | |
| 55 | +        $this->viewport('view_url', $this->router()->webRoot().$this->get('settings.smarty.template_path')); | |
| 56 | +        $this->viewport('images_url', $this->router()->webRoot().$this->get('settings.smarty.template_path').'images/'); | |
| 57 | 57 | |
| 58 | 58 |          foreach ($this->viewport() as $template_var_name => $value) { | 
| 59 | 59 | $smarty->assign($template_var_name, $value); | 
| @@ -83,8 +83,8 @@ discard block | ||
| 83 | 83 | // 1. check for custom template in the current controller directory | 
| 84 | 84 |              $templates ['custom_3'] = sprintf('%s/%s.html', $controller_template_path, $custom_template); | 
| 85 | 85 | // 2. check for custom template formatted as controller/view | 
| 86 | - $templates ['custom_2'] = $custom_template . '.html'; | |
| 87 | - $templates ['custom_1'] = '_layouts/' . $custom_template . '.html'; | |
| 86 | + $templates ['custom_2'] = $custom_template.'.html'; | |
| 87 | + $templates ['custom_1'] = '_layouts/'.$custom_template.'.html'; | |
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 |          if (!empty($this->router()->targetMethod())) { | 
| @@ -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; | 
| @@ -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()->operatorId()); // 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()->operatorId()) === 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 { |