<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
*
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$showLocation = FALSE;
// when custom data is included in this page
- if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
+ if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Event');
$this->set('subType', CRM_Utils_Array::value('event_type_id', $_POST));
$this->set('entityId', $this->_id);
*
* @access public
*
- * @return None
+ * @return void
*/
function setDefaultValues() {
if ($this->_cdType) {
$defaults = parent::setDefaultValues();
// in update mode, we need to set custom data subtype to tpl
- if (CRM_Utils_Array::value('event_type_id', $defaults)) {
+ if (!empty($defaults['event_type_id'])) {
$this->assign('customDataSubType', $defaults['event_type_id']);
}
$this->_showHide = new CRM_Core_ShowHideBlocks();
// Show waitlist features or event_full_text if max participants set
- if (CRM_Utils_Array::value('max_participants', $defaults)) {
+ if (!empty($defaults['max_participants'])) {
$this->_showHide->addShow('id-waitlist');
- if (CRM_Utils_Array::value('has_waitlist', $defaults)) {
+ if (!empty($defaults['has_waitlist'])) {
$this->_showHide->addShow('id-waitlist-text');
$this->_showHide->addHide('id-event_full');
}
$defaults['waitlist_text'] = CRM_Utils_Array::value('waitlist_text', $defaults, ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.'));
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(CRM_Utils_Array::value('start_date', $defaults), 'activityDateTime');
- if (CRM_Utils_Array::value('end_date', $defaults)) {
+ if (!empty($defaults['end_date'])) {
list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date'], 'activityDateTime');
}
return $defaults;
/**
* Function to build the form
*
- * @return None
+ * @return void
* @access public
*/
public function buildQuickForm() {
CRM_Core_Session::setStatus(ts('If you find that you are creating multiple events with similar settings, you may want to use the <a href="%1">Event Templates</a> feature to streamline your workflow.', array(1 => $url)), ts('Tip'), 'info');
}
if (!CRM_Utils_System::isNull($eventTemplates)) {
- $this->add('select', 'template_id', ts('From Template'), array(
- '' => ts('- select -')) + $eventTemplates,
- FALSE, array('onchange' => "reloadWindow(this.value);")
- );
+ $this->add('select', 'template_id', ts('From Template'), array('' => ts('- select -')) + $eventTemplates, FALSE, array('class' => 'crm-select2 huge'));
}
}
// add event title, make required if this is not a template
$this->add('text', 'title', ts('Event Title'), $attributes['event_title'], !$this->_isTemplate);
- $event = CRM_Core_OptionGroup::values('event_type');
-
- $this->add('select',
- 'event_type_id',
- ts('Event Type'),
- array(
- '' => ts('- select -')) + $event,
- TRUE,
- array('onChange' => "CRM.buildCustomData( 'Event', this.value );")
+ $this->addSelect('event_type_id',
+ array('onChange' => "CRM.buildCustomData( 'Event', this.value );"),
+ TRUE
);
//CRM-7362 --add campaigns.
}
CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
- $participantRole = CRM_Core_OptionGroup::values('participant_role');
- $this->add('select',
- 'default_role_id',
- ts('Participant Role'),
- $participantRole,
- TRUE
- );
+ $this->addSelect('default_role_id', array(), TRUE);
- $participantListing = CRM_Core_OptionGroup::values('participant_listing');
- $this->add('select',
- 'participant_listing_id',
- ts('Participant Listing'),
- array(
- '' => ts('Disabled')) + $participantListing,
- FALSE
- );
+ $this->addSelect('participant_listing_id', array('placeholder' => ts('Disabled')));
$this->add('textarea', 'summary', ts('Event Summary'), $attributes['summary']);
$this->addWysiwyg('description', ts('Complete Description'), $attributes['event_description']);
*
* @access public
*
- * @return None
+ * @return void
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);
);
//merge params with defaults from templates
- if (CRM_Utils_Array::value('template_id', $params)) {
+ if (!empty($params['template_id'])) {
$params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params);
}
$event = CRM_Event_BAO_Event::create($params);
// now that we have the event’s id, do some more template-based stuff
- if (CRM_Utils_Array::value('template_id', $params)) {
+ if (!empty($params['template_id'])) {
CRM_Event_BAO_Event::copy($params['template_id'], $event, TRUE);
}