<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
class CRM_Event_Page_ManageEvent extends CRM_Core_Page {
/**
- * The action links that we need to display for the browse screen
+ * The action links that we need to display for the browse screen.
*
* @var array
*/
protected $_isTemplate = FALSE;
/**
- * Get action Links
+ * Get action Links.
*
* @return array
* (reference) of action links
}
/**
- * Get tab Links for events
+ * Get tab Links for events.
*
* @param $enableCart
*
'field' => 'is_online_registration',
);
- if (CRM_Core_Permission::check('administer CiviCRM')) {
+ if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
self::$_tabLinks[$cacheKey]['reminder']
= array(
'title' => ts('Schedule Reminders'),
}
/**
- * Browse all events
+ * Browse all events.
*
* @return void
*/
public function browse() {
- $this->assign('includeWysiwygEditor', TRUE);
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
'String',
$this
'enable_cart'
);
$this->assign('eventCartEnabled', $enableCart);
- $mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'civicrm_event', 'id', 'entity_value');
+ $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array(
+ 'id' => CRM_Core_ActionScheduleTmp::EVENT_NAME_MAPPING_ID,
+ )));
$eventType = CRM_Core_OptionGroup::values('event_type');
while ($dao->fetch()) {
if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
$manageEvent[$dao->id] = array();
- $isRecurringEvent = CRM_Core_BAO_RecurringEntity::getParentFor($dao->id, 'civicrm_event');
+ $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($dao->id, 'civicrm_event');
$manageEvent[$dao->id]['repeat'] = '';
- if ($isRecurringEvent) {
- if ($dao->id == $isRecurringEvent) {
- $manageEvent[$dao->id]['repeat'] = 'Recurring Event - (Parent)';
- }
- else {
- $manageEvent[$dao->id]['repeat'] = 'Recurring Event - (Child)';
- }
+ if ($repeat) {
+ $manageEvent[$dao->id]['repeat'] = ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
}
CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
//show campaigns on selector.
$manageEvent[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
- $manageEvent[$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mappingID);
+ $manageEvent[$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mapping->id);
$manageEvent[$dao->id]['is_pcp_enabled'] = CRM_Utils_Array::value($dao->id, $eventPCPS);
$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');
}
$value = $this->get('event_type_id');
- $val = array();
if ($value) {
if (is_array($value)) {
- foreach ($value as $k => $v) {
- if ($v) {
- $val[$k] = $k;
- }
- }
- $type = implode(',', $val);
+ $type = implode(',', $value);
}
$clauses[] = "event_type_id IN ({$type})";
}