@@ -30,33 +30,33 @@ discard block |
||
| 30 | 30 | * @param string $cname |
| 31 | 31 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 32 | 32 | */ |
| 33 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 33 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - Framework::includeJS('.','et2_widget_owner','calendar'); |
|
| 37 | - Framework::includeCSS('calendar','calendar'); |
|
| 36 | + Framework::includeJS('.', 'et2_widget_owner', 'calendar'); |
|
| 37 | + Framework::includeCSS('calendar', 'calendar'); |
|
| 38 | 38 | |
| 39 | 39 | $bo = new calendar_bo(); |
| 40 | 40 | |
| 41 | 41 | $form_name = self::form_name($cname, $this->id, $expand); |
| 42 | 42 | |
| 43 | - $value =& self::get_array(self::$request->content, $form_name); |
|
| 43 | + $value = & self::get_array(self::$request->content, $form_name); |
|
| 44 | 44 | |
| 45 | 45 | if (!is_array(self::$request->sel_options[$form_name])) |
| 46 | 46 | { |
| 47 | 47 | self::$request->sel_options[$form_name] = array(); |
| 48 | 48 | } |
| 49 | - $sel_options =& self::$request->sel_options[$form_name]; |
|
| 49 | + $sel_options = & self::$request->sel_options[$form_name]; |
|
| 50 | 50 | |
| 51 | 51 | // Get user accounts, formatted nicely for grouping and matching |
| 52 | 52 | // the ajax call calendar_uiforms->ajax_owner() - users first |
| 53 | 53 | $accounts = array(); |
| 54 | 54 | $list = array('accounts', 'owngroups'); |
| 55 | - foreach($list as $type) |
|
| 55 | + foreach ($list as $type) |
|
| 56 | 56 | { |
| 57 | 57 | $account_options = array('account_type' => $type); |
| 58 | - $accounts_type = Api\Accounts::link_query('',$account_options); |
|
| 59 | - if($type == 'accounts') |
|
| 58 | + $accounts_type = Api\Accounts::link_query('', $account_options); |
|
| 59 | + if ($type == 'accounts') |
|
| 60 | 60 | { |
| 61 | 61 | $accounts_type = array_intersect_key($accounts_type, $GLOBALS['egw']->acl->get_grants('calendar')); |
| 62 | 62 | } |
@@ -73,25 +73,25 @@ discard block |
||
| 73 | 73 | array_keys($accounts), $accounts |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - if(!is_array($value)) |
|
| 76 | + if (!is_array($value)) |
|
| 77 | 77 | { |
| 78 | 78 | // set value with an empty string only if sel options are not |
| 79 | 79 | // loaded, for example: setting calendar owner via URL when |
| 80 | 80 | // calendar app is not yet loaded. |
| 81 | - $value = !empty($sel_options) ? array(): explode(',', $value); |
|
| 81 | + $value = !empty($sel_options) ? array() : explode(',', $value); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Add external owners that a select account widget will not find |
| 85 | - foreach($value as &$owner) |
|
| 85 | + foreach ($value as &$owner) |
|
| 86 | 86 | { |
| 87 | 87 | $label = self::get_owner_label($owner); |
| 88 | 88 | $info = array(); |
| 89 | - if(!is_numeric($owner)) |
|
| 89 | + if (!is_numeric($owner)) |
|
| 90 | 90 | { |
| 91 | - $resource = $bo->resources[substr($owner, 0,1)]; |
|
| 92 | - if($resource['info'] && !($info = $bo->resource_info($owner))) |
|
| 91 | + $resource = $bo->resources[substr($owner, 0, 1)]; |
|
| 92 | + if ($resource['info'] && !($info = $bo->resource_info($owner))) |
|
| 93 | 93 | { |
| 94 | - continue; // ignore that resource, we would get a PHP Fatal: Unsupported operand types |
|
| 94 | + continue; // ignore that resource, we would get a PHP Fatal: Unsupported operand types |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | else if (!in_array($owner, array_keys($accounts))) |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param array $content |
| 115 | 115 | * @param array &$validated=array() validated content |
| 116 | 116 | */ |
| 117 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 117 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 118 | 118 | { |
| 119 | 119 | $form_name = self::form_name($cname, $this->id, $expand); |
| 120 | 120 | |
| 121 | 121 | if (!$this->is_readonly($cname, $form_name)) |
| 122 | 122 | { |
| 123 | - $value = $value_in =& self::get_array($content, $form_name); |
|
| 124 | - if(!is_array($value)) |
|
| 123 | + $value = $value_in = & self::get_array($content, $form_name); |
|
| 124 | + if (!is_array($value)) |
|
| 125 | 125 | { |
| 126 | 126 | $value = Array($value); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 129 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 130 | 130 | if (true) $valid = $value; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public static function ajax_owner($id = null) |
| 139 | 139 | { |
| 140 | 140 | // Handle a request for a single ID |
| 141 | - if($id) |
|
| 141 | + if ($id) |
|
| 142 | 142 | { |
| 143 | 143 | $label = self::get_owner_label($id); |
| 144 | 144 | Api\Json\Response::get()->data($label); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $options = array('start' => 0, 'num_rows' => 50, |
| 153 | 153 | // Filter accounts out of addressbook |
| 154 | 154 | 'filter' => array('account_id' => null)) + |
| 155 | - array_diff_key($_REQUEST, array_flip(array('menuaction','query'))); |
|
| 155 | + array_diff_key($_REQUEST, array_flip(array('menuaction', 'query'))); |
|
| 156 | 156 | $results = array(); |
| 157 | 157 | |
| 158 | 158 | // Contacts matching accounts the user does not have permission for cause |
@@ -160,14 +160,14 @@ discard block |
||
| 160 | 160 | // we remove those contacts |
| 161 | 161 | $remove_contacts = array(); |
| 162 | 162 | |
| 163 | - $resources = array_merge(array('' => $bo->resources['']),$bo->resources); |
|
| 164 | - foreach($resources as $type => $data) |
|
| 163 | + $resources = array_merge(array('' => $bo->resources['']), $bo->resources); |
|
| 164 | + foreach ($resources as $type => $data) |
|
| 165 | 165 | { |
| 166 | 166 | $mapped = array(); |
| 167 | 167 | $_results = array(); |
| 168 | 168 | |
| 169 | 169 | // Handle Api\Accounts seperately |
| 170 | - if($type == '') |
|
| 170 | + if ($type == '') |
|
| 171 | 171 | { |
| 172 | 172 | $account_options = $options + array('account_type' => 'both'); |
| 173 | 173 | $_results += $remove_contacts = Api\Accounts::link_query($query, $account_options); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // Use standard link registry |
| 186 | 186 | else if ($data['app'] && Link::get_registry($data['app'], 'query')) |
| 187 | 187 | { |
| 188 | - $_results = Link::query($data['app'], $query,$options); |
|
| 188 | + $_results = Link::query($data['app'], $query, $options); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // There are always special cases |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | return (stripos($element, $query) !== false); |
| 201 | 201 | } |
| 202 | 202 | ); |
| 203 | - foreach($lists as $list_id => $list) |
|
| 203 | + foreach ($lists as $list_id => $list) |
|
| 204 | 204 | { |
| 205 | 205 | $_results[$list_id] = array( |
| 206 | 206 | 'label' => $list, |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | break; |
| 211 | 211 | } |
| 212 | - if(!$_results) |
|
| 212 | + if (!$_results) |
|
| 213 | 213 | { |
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - foreach(array_unique($_results, SORT_REGULAR) as $id => $title) |
|
| 217 | + foreach (array_unique($_results, SORT_REGULAR) as $id => $title) |
|
| 218 | 218 | { |
| 219 | - if($id && $title) |
|
| 219 | + if ($id && $title) |
|
| 220 | 220 | { |
| 221 | 221 | // Magicsuggest uses id, not value. |
| 222 | 222 | $value = array( |
@@ -225,14 +225,14 @@ discard block |
||
| 225 | 225 | 'label' => $title, |
| 226 | 226 | 'app' => lang($data['app']) |
| 227 | 227 | ); |
| 228 | - if(is_array($value['label'])) |
|
| 228 | + if (is_array($value['label'])) |
|
| 229 | 229 | { |
| 230 | 230 | $value = array_merge($value, $value['label']); |
| 231 | 231 | } |
| 232 | 232 | $mapped[] = $value; |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | - if(count($mapped)) |
|
| 235 | + if (count($mapped)) |
|
| 236 | 236 | { |
| 237 | 237 | $results = array_merge($results, $mapped); |
| 238 | 238 | } |
@@ -253,24 +253,24 @@ discard block |
||
| 253 | 253 | public static function get_owner_label($id) |
| 254 | 254 | { |
| 255 | 255 | static $bo; |
| 256 | - if(!$bo) $bo = new calendar_bo(); |
|
| 256 | + if (!$bo) $bo = new calendar_bo(); |
|
| 257 | 257 | |
| 258 | 258 | $id = ''.$id; |
| 259 | - if(!is_numeric($id)) |
|
| 259 | + if (!is_numeric($id)) |
|
| 260 | 260 | { |
| 261 | - $resource = $bo->resources[substr($id, 0,1)]; |
|
| 262 | - $label = Link::title($resource['app'], substr($id,1)); |
|
| 261 | + $resource = $bo->resources[substr($id, 0, 1)]; |
|
| 262 | + $label = Link::title($resource['app'], substr($id, 1)); |
|
| 263 | 263 | |
| 264 | 264 | // Could not get via link, try via resources info |
| 265 | - if($label === false) |
|
| 265 | + if ($label === false) |
|
| 266 | 266 | { |
| 267 | - $info = ExecMethod($resource['info'], substr($id,1)); |
|
| 267 | + $info = ExecMethod($resource['info'], substr($id, 1)); |
|
| 268 | 268 | $label = $info[0]['name']; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | else |
| 272 | 272 | { |
| 273 | - $label = Link::title('api-accounts',$id); |
|
| 273 | + $label = Link::title('api-accounts', $id); |
|
| 274 | 274 | } |
| 275 | 275 | return $label; |
| 276 | 276 | } |