*
* @var array
*/
- static $_actionLinks = NULL;
+ public static $_actionLinks = NULL;
/**
* The event links to display for the browse screen.
* @var array
*/
- static $_eventLinks = NULL;
+ public static $_eventLinks = NULL;
- static $_links = NULL;
+ public static $_links = NULL;
- static $_tabLinks = NULL;
+ public static $_tabLinks = NULL;
protected $_pager = NULL;
$copyExtra = ts('Are you sure you want to make a copy of this Event?');
$deleteExtra = ts('Are you sure you want to delete this Event?');
- self::$_actionLinks = array(
- CRM_Core_Action::DISABLE => array(
+ self::$_actionLinks = [
+ CRM_Core_Action::DISABLE => [
'name' => ts('Disable'),
'ref' => 'crm-enable-disable',
'title' => ts('Disable Event'),
- ),
- CRM_Core_Action::ENABLE => array(
+ ],
+ CRM_Core_Action::ENABLE => [
'name' => ts('Enable'),
'ref' => 'crm-enable-disable',
'title' => ts('Enable Event'),
- ),
- CRM_Core_Action::DELETE => array(
+ ],
+ CRM_Core_Action::DELETE => [
'name' => ts('Delete'),
'url' => CRM_Utils_System::currentPath(),
'qs' => 'action=delete&id=%%id%%',
'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"',
'title' => ts('Delete Event'),
- ),
- CRM_Core_Action::COPY => array(
+ ],
+ CRM_Core_Action::COPY => [
'name' => ts('Copy'),
'url' => CRM_Utils_System::currentPath(),
'qs' => 'reset=1&action=copy&id=%%id%%',
'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"',
'title' => ts('Copy Event'),
- ),
- );
+ ],
+ ];
}
return self::$_actionLinks;
}
public static function &tabs($enableCart) {
$cacheKey = $enableCart ? 1 : 0;
if (!(self::$_tabLinks)) {
- self::$_tabLinks = array();
+ self::$_tabLinks = [];
}
if (!isset(self::$_tabLinks[$cacheKey])) {
self::$_tabLinks[$cacheKey]['settings']
- = array(
+ = [
'title' => ts('Info and Settings'),
'url' => 'civicrm/event/manage/settings',
'field' => 'id',
- );
+ ];
self::$_tabLinks[$cacheKey]['location']
- = array(
+ = [
'title' => ts('Location'),
'url' => 'civicrm/event/manage/location',
'field' => 'loc_block_id',
- );
+ ];
self::$_tabLinks[$cacheKey]['fee']
- = array(
+ = [
'title' => ts('Fees'),
'url' => 'civicrm/event/manage/fee',
'field' => 'is_monetary',
- );
+ ];
self::$_tabLinks[$cacheKey]['registration']
- = array(
+ = [
'title' => ts('Online Registration'),
'url' => 'civicrm/event/manage/registration',
'field' => 'is_online_registration',
- );
+ ];
- if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
+ // @fixme I don't understand the event permissions check here - can we just get rid of it?
+ $permissions = CRM_Event_BAO_Event::getAllPermissions();
+ if (CRM_Core_Permission::check('administer CiviCRM') || !empty($permissions[CRM_Core_Permission::EDIT])) {
self::$_tabLinks[$cacheKey]['reminder']
- = array(
+ = [
'title' => ts('Schedule Reminders'),
'url' => 'civicrm/event/manage/reminder',
'field' => 'reminder',
- );
+ ];
}
self::$_tabLinks[$cacheKey]['conference']
- = array(
+ = [
'title' => ts('Conference Slots'),
'url' => 'civicrm/event/manage/conference',
'field' => 'slot_label_id',
- );
+ ];
self::$_tabLinks[$cacheKey]['friend']
- = array(
+ = [
'title' => ts('Tell a Friend'),
'url' => 'civicrm/event/manage/friend',
'field' => 'friend',
- );
+ ];
self::$_tabLinks[$cacheKey]['pcp']
- = array(
+ = [
'title' => ts('Personal Campaign Pages'),
'url' => 'civicrm/event/manage/pcp',
'field' => 'is_pcp_enabled',
- );
+ ];
self::$_tabLinks[$cacheKey]['repeat']
- = array(
+ = [
'title' => ts('Repeat'),
'url' => 'civicrm/event/manage/repeat',
'field' => 'is_repeating_event',
- );
+ ];
}
if (!$enableCart) {
unset(self::$_tabLinks[$cacheKey]['conference']);
}
- CRM_Utils_Hook::tabset('civicrm/event/manage', self::$_tabLinks[$cacheKey], array());
+ CRM_Utils_Hook::tabset('civicrm/event/manage', self::$_tabLinks[$cacheKey], []);
return self::$_tabLinks[$cacheKey];
}
}
if (!$this->_isTemplate && $id) {
- $breadCrumb = array(
- array(
+ $breadCrumb = [
+ [
'title' => ts('Manage Events'),
'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'),
- ),
- );
+ ],
+ ];
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
$this->search();
- $params = array();
+ $params = [];
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean',
$this, FALSE
);
$this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
$whereClause = $this->whereClause($params, FALSE, $this->_force);
- $this->pagerAToZ($whereClause, $params);
- $params = array();
+ if (CRM_Core_Config::singleton()->includeAlphabeticalPager) {
+ $this->pagerAToZ($whereClause, $params);
+ }
+
+ $params = [];
$whereClause = $this->whereClause($params, TRUE, $this->_force);
// because is_template != 1 would be to simple
$whereClause .= ' AND (is_template = 0 OR is_template IS NULL)';
list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
// get all custom groups sorted by weight
- $manageEvent = array();
+ $manageEvent = [];
$query = "
SELECT *
$allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
// get the list of active event pcps
- $eventPCPS = array();
+ $eventPCPS = [];
$pcpDao = new CRM_PCP_DAO_PCPBlock();
$pcpDao->entity_table = 'civicrm_event';
// check if we're in shopping cart mode for events
$enableCart = Civi::settings()->get('enable_cart');
$this->assign('eventCartEnabled', $enableCart);
- $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array(
+ $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings([
'id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID,
- )));
+ ]));
$eventType = CRM_Core_OptionGroup::values('event_type');
while ($dao->fetch()) {
if (in_array($dao->id, $permittedEventsByAction[CRM_Core_Permission::VIEW])) {
- $manageEvent[$dao->id] = array();
+ $manageEvent[$dao->id] = [];
$repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($dao->id, 'civicrm_event');
$manageEvent[$dao->id]['repeat'] = '';
if ($repeat) {
- $manageEvent[$dao->id]['repeat'] = ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
+ $manageEvent[$dao->id]['repeat'] = ts('Repeating (%1 of %2)', [1 => $repeat[0], 2 => $repeat[1]]);
}
CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
$manageEvent[$dao->id]['eventlinks'] = CRM_Core_Action::formLink($eventLinks,
NULL,
- array('id' => $dao->id),
+ ['id' => $dao->id],
ts('Event Links'),
TRUE,
'event.manage.eventlinks',
);
$manageEvent[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(),
$action,
- array('id' => $dao->id),
+ ['id' => $dao->id],
ts('more'),
TRUE,
'event.manage.list',
$dao->id
);
- $params = array(
+ $params = [
'entity_id' => $dao->id,
'entity_table' => 'civicrm_event',
'is_active' => 1,
- );
+ ];
$defaults['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
$manageEvent[$dao->id]['event_type'] = CRM_Utils_Array::value($manageEvent[$dao->id]['event_type_id'], $eventType);
$manageEvent[$dao->id]['is_repeating_event'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_RecurringEntity', $dao->id, 'parent_id', 'entity_id');
// allow hooks to set 'field' value which allows configuration pop-up to show a tab as enabled/disabled
- CRM_Utils_Hook::tabset('civicrm/event/manage/rows', $manageEvent, array('event_id' => $dao->id));
+ CRM_Utils_Hook::tabset('civicrm/event/manage/rows', $manageEvent, ['event_id' => $dao->id]);
}
}
* @return string
*/
public function whereClause(&$params, $sortBy = TRUE, $force) {
- $values = array();
- $clauses = array();
+ $values = [];
+ $clauses = [];
$title = $this->get('title');
$createdId = $this->get('cid');
if ($title) {
$clauses[] = "title LIKE %1";
if (strpos($title, '%') !== FALSE) {
- $params[1] = array(trim($title), 'String', FALSE);
+ $params[1] = [trim($title), 'String', FALSE];
}
else {
- $params[1] = array(trim($title), 'String', TRUE);
+ $params[1] = [trim($title), 'String', TRUE];
}
}
if (is_array($value)) {
$type = implode(',', $value);
}
- $clauses[] = "event_type_id IN ({$type})";
+ $clauses[] = "event_type_id IN (%2)";
+ $params[2] = [$type, 'String'];
}
$eventsByDates = $this->get('eventsByDates');
$from = $this->get('start_date');
if (!CRM_Utils_System::isNull($from)) {
$clauses[] = '( end_date >= %3 OR end_date IS NULL )';
- $params[3] = array($from, 'String');
+ $params[3] = [$from, 'String'];
}
$to = $this->get('end_date');
if (!CRM_Utils_System::isNull($to)) {
$clauses[] = '( start_date <= %4 OR start_date IS NULL )';
- $params[4] = array($to, 'String');
+ $params[4] = [$to, 'String'];
}
}
else {
$campaignIds = $this->get('campaign_id');
if (!CRM_Utils_System::isNull($campaignIds)) {
if (!is_array($campaignIds)) {
- $campaignIds = array($campaignIds);
+ $campaignIds = [$campaignIds];
}
$clauses[] = '( campaign_id IN ( ' . implode(' , ', array_values($campaignIds)) . ' ) )';
}