X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FEvent.php;h=5f58ebc6755a8ad7b7e4352172dadd8bddf0b8e1;hb=7c31ae578d5ddd411112a2f747255c022d7baa06;hp=7ebe392850ad332fe43c77f04cc84dddca436421;hpb=d9e8af2b9acdd8b6b72290a137bd95a8d3b06e73;p=civicrm-core.git diff --git a/api/v3/Event.php b/api/v3/Event.php index 7ebe392850..5f58ebc675 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -44,17 +44,17 @@ function civicrm_api3_event_create($params) { // Required fields for creating an event if (empty($params['id']) && empty($params['is_template'])) { - civicrm_api3_verify_mandatory($params, NULL, array( + civicrm_api3_verify_mandatory($params, NULL, [ 'start_date', 'title', - array('event_type_id', 'template_id'), - )); + ['event_type_id', 'template_id'], + ]); } // Required fields for creating an event template elseif (empty($params['id']) && !empty($params['is_template'])) { - civicrm_api3_verify_mandatory($params, NULL, array( + civicrm_api3_verify_mandatory($params, NULL, [ 'template_title', - )); + ]); } // Clone event from template @@ -78,7 +78,7 @@ function civicrm_api3_event_create($params) { */ function _civicrm_api3_event_create_spec(&$params) { $params['is_active']['api.default'] = 1; - $params['financial_type_id']['api.aliases'] = array('contribution_type_id'); + $params['financial_type_id']['api.aliases'] = ['contribution_type_id']; $params['is_template']['api.default'] = 0; } @@ -157,7 +157,7 @@ function civicrm_api3_event_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_event_get_spec(&$params) { - $params['financial_type_id']['api.aliases'] = array('contribution_type_id'); + $params['financial_type_id']['api.aliases'] = ['contribution_type_id']; } /** @@ -217,7 +217,6 @@ function _civicrm_api3_event_getisfull(&$event, $event_id) { $event[$event_id]['is_full'] = $event[$event_id]['available_places'] == 0 ? 1 : 0; } - /** * Get event list parameters. * @@ -226,14 +225,14 @@ function _civicrm_api3_event_getisfull(&$event, $event_id) { * @param array $request */ function _civicrm_api3_event_getlist_params(&$request) { - $fieldsToReturn = array('start_date', 'event_type_id', 'title', 'summary'); + $fieldsToReturn = ['start_date', 'event_type_id', 'title', 'summary']; $request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra'])); $request['params']['options']['sort'] = 'start_date DESC'; if (empty($request['params']['id'])) { - $request['params'] += array( + $request['params'] += [ 'is_template' => 0, 'is_active' => 1, - ); + ]; } } @@ -248,20 +247,16 @@ function _civicrm_api3_event_getlist_params(&$request) { * @return array */ function _civicrm_api3_event_getlist_output($result, $request) { - $output = array(); + $output = []; if (!empty($result['values'])) { foreach ($result['values'] as $row) { - $data = array( + $data = [ 'id' => $row[$request['id_field']], 'label' => $row[$request['label_field']], - 'description' => array( - CRM_Core_Pseudoconstant::getLabel( - 'CRM_Event_BAO_Event', - 'event_type_id', - $row['event_type_id'] - ), - ), - ); + 'description' => [ + CRM_Core_Pseudoconstant::getLabel('CRM_Event_BAO_Event', 'event_type_id', $row['event_type_id']), + ], + ]; if (!empty($row['start_date'])) { $data['description'][0] .= ': ' . CRM_Utils_Date::customFormat($row['start_date']); } @@ -272,7 +267,7 @@ function _civicrm_api3_event_getlist_output($result, $request) { $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['id'], 'civicrm_event'); $data['extra']['is_recur'] = FALSE; if ($repeat) { - $data['suffix'] = ts('(%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1])); + $data['suffix'] = ts('(%1 of %2)', [1 => $repeat[0], 2 => $repeat[1]]); $data['extra']['is_recur'] = TRUE; } $output[] = $data;