<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | 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_Form_ManageEvent_TabHeader {
/**
- * @param CRM_Core_Form $form
+ * @param CRM_Event_Form_ManageEvent $form
*
* @return array
*/
- static function build(&$form) {
+ public static function build(&$form) {
$tabs = $form->get('tabHeader');
if (!$tabs || empty($_GET['reset'])) {
$tabs = self::process($form);
$form->assign_by_ref('tabHeader', $tabs);
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
- ->addSetting(array('tabSettings' => array(
- 'active' => self::getCurrentTab($tabs),
- )));
+ ->addSetting(array(
+ 'tabSettings' => array(
+ 'active' => self::getCurrentTab($tabs),
+ ),
+ ));
CRM_Event_Form_ManageEvent::addProfileEditScripts();
return $tabs;
}
/**
- * @param CRM_Core_Form $form
+ * @param CRM_Event_Form_ManageEvent $form
*
* @return array
* @throws Exception
*/
- static function process(&$form) {
+ public static function process(&$form) {
if ($form->getVar('_id') <= 0) {
return NULL;
}
$tabs['location'] = array('title' => ts('Event Location')) + $default;
$tabs['fee'] = array('title' => ts('Fees')) + $default;
$tabs['registration'] = array('title' => ts('Online Registration')) + $default;
- if (CRM_Core_Permission::check('administer CiviCRM')) {
+ if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
$tabs['reminder'] = array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default;
}
$tabs['conference'] = array('title' => ts('Conference Slots')) + $default;
$tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default;
$tabs['repeat'] = array('title' => ts('Repeat')) + $default;
+ // Repeat tab must refresh page when switching repeat mode so js & vars will get set-up
+ if (!$form->_isRepeatingEvent) {
+ unset($tabs['repeat']['class']);
+ }
// check if we're in shopping cart mode for events
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME,
CRM_Utils_Hook::tabset('civicrm/event/manage', $tabs,
array('event_id' => $eventID));
- $fullName = $form->getVar('_name');
+ $fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
- $new = '';
- $action = 'update';
+ $new = '';
// hack for special cases.
switch ($className) {
$tabs[$key]['qfKey'] = NULL;
}
+ $action = 'update';
if ($key == 'reminder') {
$action = 'browse';
}
}
/**
- * @param $form
+ * @param CRM_Event_Form_ManageEvent $form
*/
- static function reset(&$form) {
+ public static function reset(&$form) {
$tabs = self::process($form);
$form->set('tabHeader', $tabs);
}
*
* @return int|string
*/
- static function getCurrentTab($tabs) {
+ public static function getCurrentTab($tabs) {
static $current = FALSE;
if ($current) {
$current = $current ? $current : 'settings';
return $current;
}
+
}