Commit ae58a997 authored by mattwire's avatar mattwire
Browse files

Convert to short array syntax

parent cfb858c3
...@@ -39,7 +39,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -39,7 +39,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* *
* @var array * @var array
*/ */
public static $_openedPanes = array(); public static $_openedPanes = [];
/** /**
* The various search modes. * The various search modes.
...@@ -103,11 +103,11 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -103,11 +103,11 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
) { ) {
$this->_params = &$params; $this->_params = &$params;
if ($this->_params == NULL) { if ($this->_params == NULL) {
$this->_params = array(); $this->_params = [];
} }
if ($returnProperties === self::NO_RETURN_PROPERTIES) { if ($returnProperties === self::NO_RETURN_PROPERTIES) {
$this->_returnProperties = array(); $this->_returnProperties = [];
} }
elseif (empty($returnProperties)) { elseif (empty($returnProperties)) {
$this->_returnProperties = self::defaultReturnProperties(); $this->_returnProperties = self::defaultReturnProperties();
...@@ -138,7 +138,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -138,7 +138,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* @param $operator * @param $operator
*/ */
public function setOperator($operator) { public function setOperator($operator) {
$validOperators = array('AND', 'OR'); $validOperators = ['AND', 'OR'];
if (!in_array($operator, $validOperators)) { if (!in_array($operator, $validOperators)) {
$operator = 'AND'; $operator = 'AND';
} }
...@@ -153,16 +153,16 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -153,16 +153,16 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* This sort-of duplicates $mode in a confusing way. Probably not by design. * This sort-of duplicates $mode in a confusing way. Probably not by design.
*/ */
public function initialize($apiEntity = NULL) { public function initialize($apiEntity = NULL) {
$this->_select = array(); $this->_select = [];
$this->_element = array(); $this->_element = [];
$this->_tables = array(); $this->_tables = [];
$this->_whereTables = array(); $this->_whereTables = [];
$this->_where = array(); $this->_where = [];
$this->_qill = array(); $this->_qill = [];
$this->_options = array(); $this->_options = [];
$this->_cfIDs = array(); $this->_cfIDs = [];
$this->_paramLookup = array(); $this->_paramLookup = [];
$this->_having = array(); $this->_having = [];
$this->_customQuery = NULL; $this->_customQuery = NULL;
...@@ -206,7 +206,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -206,7 +206,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
$cfID = CRM_Core_BAO_CustomField::getKeyID($value[0]); $cfID = CRM_Core_BAO_CustomField::getKeyID($value[0]);
if ($cfID) { if ($cfID) {
if (!array_key_exists($cfID, $this->_cfIDs)) { if (!array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array(); $this->_cfIDs[$cfID] = [];
} }
// Set wildcard value based on "and/or" selection // Set wildcard value based on "and/or" selection
foreach ($this->_params as $key => $param) { foreach ($this->_params as $key => $param) {
...@@ -219,7 +219,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -219,7 +219,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
} }
if (!array_key_exists($value[0], $this->_paramLookup)) { if (!array_key_exists($value[0], $this->_paramLookup)) {
$this->_paramLookup[$value[0]] = array(); $this->_paramLookup[$value[0]] = [];
} }
if ($value[0] !== 'group') { if ($value[0] !== 'group') {
// Just trying to unravel how group interacts here! This whole function is weird. // Just trying to unravel how group interacts here! This whole function is weird.
...@@ -282,7 +282,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -282,7 +282,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
if ($cfID) { if ($cfID) {
// add to cfIDs array if not present // add to cfIDs array if not present
if (!array_key_exists($cfID, $this->_cfIDs)) { if (!array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array(); $this->_cfIDs[$cfID] = [];
} }
} }
} }
...@@ -291,7 +291,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -291,7 +291,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
// this is a custom field with range search enabled, so we better check for two/from values // this is a custom field with range search enabled, so we better check for two/from values
if (!empty($this->_paramLookup[$name . '_from'])) { if (!empty($this->_paramLookup[$name . '_from'])) {
if (!array_key_exists($cfID, $this->_cfIDs)) { if (!array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array(); $this->_cfIDs[$cfID] = [];
} }
foreach ($this->_paramLookup[$name . '_from'] as $pID => $p) { foreach ($this->_paramLookup[$name . '_from'] as $pID => $p) {
// search in the cdID array for the same grouping // search in the cdID array for the same grouping
...@@ -303,14 +303,14 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -303,14 +303,14 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
} }
} }
if (!$fnd) { if (!$fnd) {
$p[2] = array('from' => $p[2]); $p[2] = ['from' => $p[2]];
$this->_cfIDs[$cfID][] = $p; $this->_cfIDs[$cfID][] = $p;
} }
} }
} }
if (!empty($this->_paramLookup[$name . '_to'])) { if (!empty($this->_paramLookup[$name . '_to'])) {
if (!array_key_exists($cfID, $this->_cfIDs)) { if (!array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array(); $this->_cfIDs[$cfID] = [];
} }
foreach ($this->_paramLookup[$name . '_to'] as $pID => $p) { foreach ($this->_paramLookup[$name . '_to'] as $pID => $p) {
// search in the cdID array for the same grouping // search in the cdID array for the same grouping
...@@ -322,7 +322,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -322,7 +322,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
} }
} }
if (!$fnd) { if (!$fnd) {
$p[2] = array('to' => $p[2]); $p[2] = ['to' => $p[2]];
$this->_cfIDs[$cfID][] = $p; $this->_cfIDs[$cfID][] = $p;
} }
} }
...@@ -356,8 +356,8 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -356,8 +356,8 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* @return string * @return string
*/ */
public function whereClause($apiEntity = NULL) { public function whereClause($apiEntity = NULL) {
$this->_where[0] = array(); $this->_where[0] = [];
$this->_qill[0] = array(); $this->_qill[0] = [];
if (!empty($this->_params)) { if (!empty($this->_params)) {
foreach (array_keys($this->_params) as $id) { foreach (array_keys($this->_params) as $id) {
...@@ -372,8 +372,8 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -372,8 +372,8 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
//CRM_Contact_BAO_Query_Hook::singleton()->alterSearchQuery($this, 'where'); //CRM_Contact_BAO_Query_Hook::singleton()->alterSearchQuery($this, 'where');
} }
$clauses = array(); $clauses = [];
$andClauses = array(); $andClauses = [];
$validClauses = 0; $validClauses = 0;
if (!empty($this->_where)) { if (!empty($this->_where)) {
...@@ -457,7 +457,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -457,7 +457,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
$tempTable[$k . ".$key"] = $key; $tempTable[$k . ".$key"] = $key;
} }
ksort($tempTable); ksort($tempTable);
$newTables = array(); $newTables = [];
foreach ($tempTable as $key) { foreach ($tempTable as $key) {
$newTables[$key] = $tables[$key]; $newTables[$key] = $tables[$key];
} }
...@@ -511,9 +511,9 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -511,9 +511,9 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
} }
// pane name to table mapper // pane name to table mapper
$panesMapper = array( $panesMapper = [
ts('Events') => 'civicrm_event', ts('Events') => 'civicrm_event',
); ];
CRM_Contact_BAO_Query_Hook::singleton()->getPanesMapper($panesMapper); CRM_Contact_BAO_Query_Hook::singleton()->getPanesMapper($panesMapper);
foreach (array_keys($this->_whereTables) as $table) { foreach (array_keys($this->_whereTables) as $table) {
...@@ -534,9 +534,9 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -534,9 +534,9 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* Associative array of contribution fields * Associative array of contribution fields
*/ */
public static function &getFields($checkPermission = TRUE) { public static function &getFields($checkPermission = TRUE) {
return array ( return [
'event_title' => 'event_title' =>
array ( [
'name' => 'title', 'name' => 'title',
'type' => 2, 'type' => 2,
'title' => 'Event Title', 'title' => 'Event Title',
...@@ -553,12 +553,12 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -553,12 +553,12 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
'bao' => 'CRM_Event_BAO_Event', 'bao' => 'CRM_Event_BAO_Event',
'localizable' => 1, 'localizable' => 1,
'html' => 'html' =>
array ( [
'type' => 'Text', 'type' => 'Text',
), ],
), ],
'event_start_date' => 'event_start_date' =>
array ( [
'name' => 'start_date', 'name' => 'start_date',
'type' => 12, 'type' => 12,
'title' => 'Event Start Date', 'title' => 'Event Start Date',
...@@ -573,13 +573,13 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -573,13 +573,13 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
'bao' => 'CRM_Event_BAO_Event', 'bao' => 'CRM_Event_BAO_Event',
'localizable' => 0, 'localizable' => 0,
'html' => 'html' =>
array ( [
'type' => 'Select Date', 'type' => 'Select Date',
'formatType' => 'activityDateTime', 'formatType' => 'activityDateTime',
), ],
), ],
'event_end_date' => 'event_end_date' =>
array ( [
'name' => 'end_date', 'name' => 'end_date',
'type' => 12, 'type' => 12,
'title' => 'Event End Date', 'title' => 'Event End Date',
...@@ -594,12 +594,12 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -594,12 +594,12 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
'bao' => 'CRM_Event_BAO_Event', 'bao' => 'CRM_Event_BAO_Event',
'localizable' => 0, 'localizable' => 0,
'html' => 'html' =>
array ( [
'type' => 'Select Date', 'type' => 'Select Date',
'formatType' => 'activityDateTime', 'formatType' => 'activityDateTime',
), ],
), ],
); ];
} }
/** /**
...@@ -720,7 +720,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -720,7 +720,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
$thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event'); $thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
if ($thisEventHasParent) { if ($thisEventHasParent) {
$getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event'); $getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event');
$allEventIds = array(); $allEventIds = [];
foreach ($getAllConnections as $key => $val) { foreach ($getAllConnections as $key => $val) {
$allEventIds[] = $val['id']; $allEventIds[] = $val['id'];
} }
...@@ -739,11 +739,11 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -739,11 +739,11 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
case 'event_type_id': case 'event_type_id':
case 'event_title': case 'event_title':
$qillName = $name; $qillName = $name;
if (in_array($name, array( if (in_array($name, [
'event_id', 'event_id',
'event_title', 'event_title',
'event_is_public', 'event_is_public',
) ]
) )
) { ) {
$name = str_replace('event_', '', $name); $name = str_replace('event_', '', $name);
...@@ -755,8 +755,8 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -755,8 +755,8 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
if (!array_key_exists($qillName, $fields)) { if (!array_key_exists($qillName, $fields)) {
break; break;
} }
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Event', $name, $value, $op, array('check_permission' => $checkPermission)); list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Event', $name, $value, $op, ['check_permission' => $checkPermission]);
$query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value)); $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]);
return; return;
} }
} }
...@@ -924,7 +924,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -924,7 +924,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
// ideally this code would be removed as it appears to be to support CRM-1203 // ideally this code would be removed as it appears to be to support CRM-1203
// and passing in the required returnProperties from the url would // and passing in the required returnProperties from the url would
// make more sense that globally applying the requirements of one form. // make more sense that globally applying the requirements of one form.
if (($this->_returnProperties != array('contact_id'))) { if (($this->_returnProperties != ['contact_id'])) {
$this->_select['group_contact_id'] = "$tbName.id as group_contact_id"; $this->_select['group_contact_id'] = "$tbName.id as group_contact_id";
$this->_element['group_contact_id'] = 1; $this->_element['group_contact_id'] = 1;
$this->_select['status'] = "$tbName.status as status"; $this->_select['status'] = "$tbName.status as status";
...@@ -969,7 +969,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -969,7 +969,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
$this->filterRelatedContacts($from, $where, $having); $this->filterRelatedContacts($from, $where, $having);
} }
return array($select, $from, $where, $having); return [$select, $from, $where, $having];
} }
/** /**
...@@ -1034,7 +1034,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1034,7 +1034,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
return NULL; return NULL;
} }
$sort = is_string($sort) ? $sort : $sort->orderBy(); $sort = is_string($sort) ? $sort : $sort->orderBy();
$present = array(); $present = [];
foreach ($this->_pseudoConstantsSelect as $name => $value) { foreach ($this->_pseudoConstantsSelect as $name => $value) {
if (!empty($value['table'])) { if (!empty($value['table'])) {
...@@ -1060,7 +1060,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1060,7 +1060,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
$this->_fromClause = $this->_fromClause . $presentClause; $this->_fromClause = $this->_fromClause . $presentClause;
$this->_simpleFromClause = $this->_simpleFromClause . $presentSimpleFromClause; $this->_simpleFromClause = $this->_simpleFromClause . $presentSimpleFromClause;
return array($presentClause, $presentSimpleFromClause); return [$presentClause, $presentSimpleFromClause];
} }
/** /**
...@@ -1085,7 +1085,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1085,7 +1085,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
*/ */
protected function prepareOrderBy($sort, $sortByChar, $sortOrder, $additionalFromClause) { protected function prepareOrderBy($sort, $sortByChar, $sortOrder, $additionalFromClause) {
$order = NULL; $order = NULL;
$orderByArray = array(); $orderByArray = [];
$config = CRM_Core_Config::singleton(); $config = CRM_Core_Config::singleton();
if ($config->includeOrderByClause) { if ($config->includeOrderByClause) {
if ($sort) { if ($sort) {
...@@ -1114,7 +1114,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1114,7 +1114,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
} }
} }
if (!$order && empty($orderByArray)) { if (!$order && empty($orderByArray)) {
return array($order, $additionalFromClause); return [$order, $additionalFromClause];
} }
// Remove this here & add it at the end for simplicity. // Remove this here & add it at the end for simplicity.
$order = trim(str_replace('ORDER BY', '', $order)); $order = trim(str_replace('ORDER BY', '', $order));
...@@ -1137,7 +1137,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1137,7 +1137,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
$cfID = CRM_Core_BAO_CustomField::getKeyID($field); $cfID = CRM_Core_BAO_CustomField::getKeyID($field);
// add to cfIDs array if not present // add to cfIDs array if not present
if (!empty($cfID) && !array_key_exists($cfID, $this->_cfIDs)) { if (!empty($cfID) && !array_key_exists($cfID, $this->_cfIDs)) {
$this->_cfIDs[$cfID] = array(); $this->_cfIDs[$cfID] = [];
$this->_customQuery = new CRM_Core_BAO_CustomQuery($this->_cfIDs, TRUE, $this->_locationSpecificCustomFields); $this->_customQuery = new CRM_Core_BAO_CustomQuery($this->_cfIDs, TRUE, $this->_locationSpecificCustomFields);
$this->_customQuery->query(); $this->_customQuery->query();
$this->_select = array_merge($this->_select, $this->_customQuery->_select); $this->_select = array_merge($this->_select, $this->_customQuery->_select);
...@@ -1157,9 +1157,9 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1157,9 +1157,9 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
&& isset($pseudoConstantMetadata['pseudoconstant']['optionGroupName']) && isset($pseudoConstantMetadata['pseudoconstant']['optionGroupName'])
&& $field === CRM_Utils_Array::value('optionGroupName', $pseudoConstantMetadata['pseudoconstant']) && $field === CRM_Utils_Array::value('optionGroupName', $pseudoConstantMetadata['pseudoconstant'])
) { ) {
$sortedOptions = $pseudoConstantMetadata['bao']::buildOptions($pseudoConstantMetadata['pseudoField'], NULL, array( $sortedOptions = $pseudoConstantMetadata['bao']::buildOptions($pseudoConstantMetadata['pseudoField'], NULL, [
'orderColumn' => 'label', 'orderColumn' => 'label',
)); ]);
$order = str_replace("$field $direction", "field({$pseudoConstantMetadata['pseudoField']}," . implode(',', array_keys($sortedOptions)) . ") $direction", $order); $order = str_replace("$field $direction", "field({$pseudoConstantMetadata['pseudoField']}," . implode(',', array_keys($sortedOptions)) . ") $direction", $order);
} }
//CRM-12565 add "`" around $field if it is a pseudo constant //CRM-12565 add "`" around $field if it is a pseudo constant
...@@ -1178,11 +1178,11 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1178,11 +1178,11 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
// clause. But this magic helper which forgivingly reescapes ORDER BY. // clause. But this magic helper which forgivingly reescapes ORDER BY.
// Note: $sortByChar implies that $order was hard-coded/trusted, so it can do funky things. // Note: $sortByChar implies that $order was hard-coded/trusted, so it can do funky things.
if ($sortByChar) { if ($sortByChar) {
return array(' ORDER BY ' . $order, $additionalFromClause); return [' ORDER BY ' . $order, $additionalFromClause];
} }
if ($order) { if ($order) {
$order = CRM_Utils_Type::escape($order, 'MysqlOrderBy'); $order = CRM_Utils_Type::escape($order, 'MysqlOrderBy');
return array(' ORDER BY ' . $order, $additionalFromClause); return [' ORDER BY ' . $order, $additionalFromClause];
} }
} }
...@@ -1193,13 +1193,13 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1193,13 +1193,13 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* @return array|null * @return array|null
*/ */
public static function defaultReturnProperties($includeCustomFields = TRUE) { public static function defaultReturnProperties($includeCustomFields = TRUE) {
$properties = array( $properties = [
'event_id' => 1, 'event_id' => 1,
'event_title' => 1, 'event_title' => 1,
'event_start_date' => 1, 'event_start_date' => 1,
'event_end_date' => 1, 'event_end_date' => 1,
'event_type' => 1, 'event_type' => 1,
); ];
if ($includeCustomFields) { if ($includeCustomFields) {
// also get all the custom event properties // also get all the custom event properties
...@@ -1218,30 +1218,30 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1218,30 +1218,30 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* @param CRM_Core_Form $form * @param CRM_Core_Form $form
*/ */
public static function buildSearchForm(&$form) { public static function buildSearchForm(&$form) {
$form->addEntityRef('event_id', ts('Event Name'), array( $form->addEntityRef('event_id', ts('Event Name'), [
'entity' => 'event', 'entity' => 'event',
'placeholder' => ts('- any -'), 'placeholder' => ts('- any -'),
'multiple' => 1, 'multiple' => 1,
'select' => array('minimumInputLength' => 0), 'select' => ['minimumInputLength' => 0],
) ]
); );
$form->addEntityRef('event_type_id', ts('Event Type'), array( $form->addEntityRef('event_type_id', ts('Event Type'), [
'entity' => 'option_value', 'entity' => 'option_value',
'placeholder' => ts('- any -'), 'placeholder' => ts('- any -'),
'select' => array('minimumInputLength' => 0), 'select' => ['minimumInputLength' => 0],
'api' => array( 'api' => [
'params' => array('option_group_id' => 'event_type'), 'params' => ['option_group_id' => 'event_type'],
), ],
) ]
); );
CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE); CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE);
$form->addElement('hidden', 'event_date_range_error'); $form->addElement('hidden', 'event_date_range_error');
$form->addFormRule(array('CRM_AdvancedEvents_BAO_Query', 'formRule'), $form); $form->addFormRule(['CRM_AdvancedEvents_BAO_Query', 'formRule'], $form);
$form->addElement('checkbox', "event_include_repeating_events", NULL, ts('Include all events in the %1 series', array(1 => '<em>%1</em>'))); $form->addElement('checkbox', "event_include_repeating_events", NULL, ts('Include all events in the %1 series', [1 => '<em>%1</em>']));
self::addCustomFormFields($form, array('Event')); self::addCustomFormFields($form, ['Event']);
$form->assign('validCiviEvent', TRUE); $form->assign('validCiviEvent', TRUE);
} }
...@@ -1258,7 +1258,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query { ...@@ -1258,7 +1258,7 @@ class CRM_AdvancedEvents_BAO_Query extends CRM_Core_BAO_Query {
* @return bool|array * @return bool|array
*/ */
public static function formRule($fields, $files, $form) { public static function formRule($fields, $files, $form) {
$errors = array(); $errors = [];
if ((empty($fields['event_start_date_low']) || empty($fields['event_end_date_high']))) { if ((empty($fields['event_start_date_low']) || empty($fields['event_end_date_high']))) {
return TRUE; return TRUE;
......
...@@ -39,32 +39,32 @@ require_once 'packages/When/When.php'; ...@@ -39,32 +39,32 @@ require_once 'packages/When/When.php';
class CRM_AdvancedEvents_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { class CRM_AdvancedEvents_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
const RUNNING = 1; const RUNNING = 1;
public $schedule = array(); public $schedule = [];
public $scheduleId = NULL; public $scheduleId = NULL;
public $scheduleFormValues = array(); public $scheduleFormValues = [];