@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | return in_array($permission_name, self::permissions_names_for($op)); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public static function query_retrieve($filters=[], $options=[]) : SelectInterface |
|
| 21 | + public static function query_retrieve($filters = [], $options = []) : SelectInterface |
|
| 22 | 22 | { |
| 23 | 23 | $options['eager'] = false; |
| 24 | - $ret = parent::query_retrieve($filters,$options); |
|
| 24 | + $ret = parent::query_retrieve($filters, $options); |
|
| 25 | 25 | $eager_params = []; |
| 26 | - $eager_params[Permission::table_name()]=Permission::table_alias(); |
|
| 27 | - $eager_params[Operator::table_name()]=Operator::table_alias(); |
|
| 28 | - $eager_params[ACL::table_name()]=ACL::table_alias(); |
|
| 26 | + $eager_params[Permission::table_name()] = Permission::table_alias(); |
|
| 27 | + $eager_params[Operator::table_name()] = Operator::table_alias(); |
|
| 28 | + $eager_params[ACL::table_name()] = ACL::table_alias(); |
|
| 29 | 29 | |
| 30 | 30 | $ret->eager($eager_params); |
| 31 | 31 | |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | $res = self::any(['operator_id'=>$op->operator_id()]); |
| 38 | 38 | |
| 39 | 39 | $permission_ids = []; |
| 40 | - foreach($res as $r) |
|
| 41 | - $permission_ids[]=$r->get('permission_id'); |
|
| 40 | + foreach ($res as $r) |
|
| 41 | + $permission_ids[] = $r->get('permission_id'); |
|
| 42 | 42 | |
| 43 | 43 | $ret = Permission::filter(['ids'=>$permission_ids]); |
| 44 | 44 | return $ret; |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $operator_with_perms = get_class($op)::exists($op->operator_id()); |
| 50 | 50 | // $operator_with_perms = get_class($op)::retrieve($operator_with_perms); |
| 51 | - if(is_null($operator_with_perms)) |
|
| 51 | + if (is_null($operator_with_perms)) |
|
| 52 | 52 | return []; |
| 53 | 53 | |
| 54 | - return explode(',',$operator_with_perms->get('permission_names')); |
|
| 54 | + return explode(',', $operator_with_perms->get('permission_names')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public static function allow_in(OperatorInterface $op, Permission $p) |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | return $this->get('language_code');
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public static function query_retrieve($filters=[], $options=[]) : SelectInterface |
|
| 69 | + public static function query_retrieve($filters = [], $options = []) : SelectInterface |
|
| 70 | 70 | {
|
| 71 | 71 | $Query = static::table()->select(); |
| 72 | - if(isset($options['eager']) && $options['eager'] === true) |
|
| 72 | + if (isset($options['eager']) && $options['eager'] === true) |
|
| 73 | 73 | {
|
| 74 | 74 | $Query->group_by('id');
|
| 75 | 75 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | $Query->select_also(["GROUP_CONCAT(DISTINCT kadro_permission.id) as permission_ids", "GROUP_CONCAT(DISTINCT kadro_permission.name) as permission_names"]); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if(isset($filters['model']) && !empty($filters['model'])) |
|
| 81 | + if (isset($filters['model']) && !empty($filters['model'])) |
|
| 82 | 82 | {
|
| 83 | - $Query->join([static::otm('t'), static::otm('a')],[[static::otm('a'),static::otm('k'), 't_from','id']], 'INNER');
|
|
| 83 | + $Query->join([static::otm('t'), static::otm('a')], [[static::otm('a'), static::otm('k'), 't_from', 'id']], 'INNER');
|
|
| 84 | 84 | $Query->aw_fields_eq(['model_id' => $filters['model']->get_id(), 'model_type' => get_class($filters['model'])::model_type()], static::otm('a'));
|
| 85 | 85 | } |
| 86 | 86 | |
@@ -52,39 +52,39 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - public static function query_retrieve($filter=[], $options=[]) : SelectInterface |
|
| 55 | + public static function query_retrieve($filter = [], $options = []) : SelectInterface |
|
| 56 | 56 | { |
| 57 | 57 | |
| 58 | 58 | $searchable_fields = [self::ISO_NAME, self::ISO_3, self::ISO_2B, self::ISO_2T, self::ISO_1]; |
| 59 | 59 | |
| 60 | 60 | $Query = static::table()->select(); |
| 61 | 61 | |
| 62 | - if(isset($filter['name'])) |
|
| 62 | + if (isset($filter['name'])) |
|
| 63 | 63 | { |
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if(isset($filter['code'])) |
|
| 67 | + if (isset($filter['code'])) |
|
| 68 | 68 | { |
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if(isset($filter['term'])) |
|
| 72 | + if (isset($filter['term'])) |
|
| 73 | 73 | { |
| 74 | 74 | $Query->aw_filter_content(['term' => $filter['term'], 'fields' => $searchable_fields], $Query->table_label(), 'OR'); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if(isset($filter['requires_authority']) && isset(self::ISO_SETS[$filter['requires_authority']])) |
|
| 77 | + if (isset($filter['requires_authority']) && isset(self::ISO_SETS[$filter['requires_authority']])) |
|
| 78 | 78 | { |
| 79 | 79 | $Query->aw_not_empty($filter['requires_authority']); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(isset($filter['types'])) |
|
| 82 | + if (isset($filter['types'])) |
|
| 83 | 83 | { |
| 84 | 84 | $wc = sprintf('AND Type IN (\'%s\') ', implode('\', \'', array_keys(self::types()))); |
| 85 | 85 | $Query->and_where($wc); |
| 86 | 86 | } |
| 87 | - if(isset($filter['scopes'])) |
|
| 87 | + if (isset($filter['scopes'])) |
|
| 88 | 88 | { |
| 89 | 89 | $wc = sprintf('AND Scope IN (\'%s\') ', implode('\', \'', array_keys(self::scopes()))); |
| 90 | 90 | $Query->and_where($wc); |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | return $Query; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public static function search_language($term, $authority=null) |
|
| 102 | + public static function search_language($term, $authority = null) |
|
| 103 | 103 | { |
| 104 | 104 | $rows = self::query_retrieve(['term' => $term, 'requires_authority' => $authority])->ret_ass(); |
| 105 | 105 | $ret = []; |
| 106 | - foreach($rows as $row) |
|
| 106 | + foreach ($rows as $row) |
|
| 107 | 107 | $ret[$row[self::ISO_3]] = $row[self::ISO_NAME]; |
| 108 | 108 | |
| 109 | 109 | return $ret; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $Query->aw_eq(self::ISO_3, $code); |
| 116 | 116 | $rows = $Query->ret_col(); |
| 117 | 117 | |
| 118 | - if(isset($rows[0])) // only 1 result |
|
| 118 | + if (isset($rows[0])) // only 1 result |
|
| 119 | 119 | return current($rows); |
| 120 | 120 | |
| 121 | 121 | return null; // no results |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | return false; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public static function query_retrieve($filters=[], $options=[]) : SelectInterface |
|
| 23 | + public static function query_retrieve($filters = [], $options = []) : SelectInterface |
|
| 24 | 24 | { |
| 25 | 25 | $Query = static::table()->select(); |
| 26 | 26 | $Query->order_by(['kategorio', 'ASC']); |