@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | abstract public function get($prop_name); |
| 15 | 15 | |
| 16 | - public function operator(OperatorInterface $setter=null) |
|
| 16 | + public function operator(OperatorInterface $setter = null) |
|
| 17 | 17 | { |
| 18 | - if(!is_null($setter)) |
|
| 18 | + if (!is_null($setter)) |
|
| 19 | 19 | $this->operator = $setter; |
| 20 | 20 | |
| 21 | - if(is_null($this->operator)) |
|
| 21 | + if (is_null($this->operator)) |
|
| 22 | 22 | { |
| 23 | 23 | $extract_attempt = self::extract(new Operator(), $this, true); |
| 24 | 24 | if (!is_null($extract_attempt)) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(is_null($this->operator) && !empty($this->get('operator_id'))) |
|
| 35 | + if (is_null($this->operator) && !empty($this->get('operator_id'))) |
|
| 36 | 36 | $this->operator = Operator::exists($this->get('operator_id')); |
| 37 | 37 | |
| 38 | 38 | return $this->operator; |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public static function enhance_query_retrieve($Query, $filters, $options) |
| 43 | 43 | { |
| 44 | - $Query->autoJoin([ACL::table(),'ACL'], null, 'LEFT OUTER'); |
|
| 44 | + $Query->autoJoin([ACL::table(), 'ACL'], null, 'LEFT OUTER'); |
|
| 45 | 45 | $permission_alias = $Query->autoJoin([Permission::table(), 'permission'], null, 'LEFT OUTER'); |
| 46 | 46 | |
| 47 | 47 | $permission_ids_and_names = []; |
| 48 | - $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'id', $permission_alias . '_ids'); |
|
| 49 | - $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'name', $permission_alias . '_names'); |
|
| 48 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'id', $permission_alias.'_ids'); |
|
| 49 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'name', $permission_alias.'_names'); |
|
| 50 | 50 | $Query->selectAlso($permission_ids_and_names); |
| 51 | 51 | |
| 52 | 52 | $Query->selectAlso(['operator.name as operator_name', 'operator.active as operator_active']); |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function operator(OperatorInterface $setter=null) |
| 17 | 17 | { |
| 18 | - if(!is_null($setter)) |
|
| 19 | - $this->operator = $setter; |
|
| 18 | + if(!is_null($setter)) { |
|
| 19 | + $this->operator = $setter; |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | if(is_null($this->operator)) |
| 22 | 23 | { |
@@ -32,8 +33,9 @@ discard block |
||
| 32 | 33 | } |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | - if(is_null($this->operator) && !empty($this->get('operator_id'))) |
|
| 36 | - $this->operator = Operator::exists($this->get('operator_id')); |
|
| 36 | + if(is_null($this->operator) && !empty($this->get('operator_id'))) { |
|
| 37 | + $this->operator = Operator::exists($this->get('operator_id')); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | return $this->operator; |
| 39 | 41 | } |
@@ -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()->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 { |