<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* The defaults involved in this page
- *
*/
public $_defaults = array();
/**
- * pre-registered additional participant id.
- *
+ * Pre-registered additional participant id.
*/
public $additionalParticipantId = NULL;
/**
- * Function to set variables up before form is built
+ * Set variables up before form is built
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
$participantNo = substr($this->_name, 12);
}
/**
- * This function sets the default values for the form. For edit/view mode
+ * Set default values for the form. For edit/view mode
* the default values are retrieved from the database
*
- * @access public
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $unsetSubmittedOptions = array();
$discountId = NULL;
//fix for CRM-3088, default value for discount set.
if (!empty($this->_values['discount'])) {
$discountId = CRM_Core_BAO_Discount::findSet($this->_eventId, 'civicrm_event');
if ($discountId && !empty($this->_values['event']['default_discount_fee_id'])) {
- $discountKey = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values['event']['default_discount_fee_id']
- , 'weight', 'id'
+ $discountKey = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values['event']['default_discount_fee_id'], 'weight', 'id'
);
$defaults['amount'] = key(array_slice($this->_values['discount'][$discountId], $discountKey - 1, $discountKey, TRUE));
}
//CRM-4320, setdefault additional participant values.
if ($this->_allowConfirmation && $this->_additionalParticipantId) {
//hack to get set default from eventFees.php
- $this->_discountId = $discountId;
- $this->_pId = $this->_additionalParticipantId;
- $this->_contactId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_additionalParticipantId, 'contact_id');
+ $this->_discountId = $discountId;
+ $this->_pId = $this->_additionalParticipantId;
+ $this->_contactId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_additionalParticipantId, 'contact_id');
$participantDefaults = CRM_Event_Form_EventFees::setDefaultValues($this);
$participantDefaults = array_merge($this->_defaults, $participantDefaults);
// use primary email address if billing email address is empty
}
/**
- * Function to build the form
+ * Build the form object
*
* @return void
- * @access public
*/
public function buildQuickForm() {
$config = CRM_Core_Config::singleton();
$first_name = $last_name = NULL;
$pre = $post = array();
foreach (array(
- 'pre', 'post') as $keys) {
+ 'pre',
+ 'post',
+ ) as $keys) {
if (isset($this->_values['additional_custom_' . $keys . '_id'])) {
$this->buildCustom($this->_values['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys), TRUE);
$$keys = CRM_Core_BAO_UFGroup::getFields($this->_values['additional_custom_' . $keys . '_id']);
}
foreach (array(
- 'first_name', 'last_name') as $name) {
+ 'first_name',
+ 'last_name',
+ ) as $name) {
if (array_key_exists($name, $$keys) &&
CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, $$keys))
) {
$this->_allowWaitlist = FALSE;
$this->set('allowWaitlist', $this->_allowWaitlist);
if ($this->_requireApproval) {
- $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(1 => ++$processedCnt, 2 => $spaces));
+ $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(
+ 1 => ++$processedCnt,
+ 2 => $spaces,
+ ));
}
else {
- $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(1 => ++$processedCnt, 2 => $spaces));
+ $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(
+ 1 => ++$processedCnt,
+ 2 => $spaces,
+ ));
}
}
else {
- $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(1 => ++$processedCnt, 2 => $spaces));
+ $statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(
+ 1 => ++$processedCnt,
+ 2 => $spaces,
+ ));
$allowToProceed = FALSE;
}
CRM_Core_Session::setStatus($statusMessage, ts('Registration Error'), 'error');
$this->assign('statusMessage', $statusMessage);
$buttons = array(
- array('type' => 'back',
- 'name' => ts('<< Go Back'),
+ array(
+ 'type' => 'back',
+ 'name' => ts('Go Back'),
'spacing' => '  ',
),
);
//CRM-4320
if ($allowToProceed) {
$buttons = array_merge($buttons, array(
- array('type' => 'next',
- 'name' => ts('Continue >>'),
+ array(
+ 'type' => 'next',
+ 'name' => ts('Continue'),
'spacing' => ' ',
'isDefault' => TRUE,
'js' => $js,
);
if ($includeSkipButton) {
$buttons = array_merge($buttons, array(
- array('type' => 'next',
- 'name' => ts('Skip Participant >>|'),
+ array(
+ 'type' => 'next',
+ 'name' => ts('Skip Participant'),
'subName' => 'skip',
+ 'icon' => 'seek-next',
),
)
);
}
/**
- * global form rule
+ * Global form rule
*
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
+ * @param array $fields
+ * The input form values.
+ * @param array $files
+ * The uploaded files if any.
* @param $self
*
- * @internal param array $options additional user data
*
- * @return true if no errors, else array of errors
- * @access public
- * @static
+ * @return bool|array
+ * true if no errors, else array of errors
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
//get the button name.
$button = substr($self->controller->getButtonName(), -4);
$existingEmails = array();
$additionalParticipantEmails = array();
if (is_array($value)) {
- foreach ($value as $key => $val) {
- if (substr($key, 0, 6) == 'email-' && $val) {
- $existingEmails[] = $val;
+ foreach ($value as $key => $val) {
+ if (substr($key, 0, 6) == 'email-' && $val) {
+ $existingEmails[] = $val;
+ }
}
}
- }
foreach ($fields as $key => $val) {
if (substr($key, 0, 6) == 'email-' && $val) {
$additionalParticipantEmails[] = $val;
else {
// check with first_name and last_name for additional participants
if (!empty($value['first_name']) && ($value['first_name'] == CRM_Utils_Array::value('first_name', $fields)) &&
- (CRM_Utils_Array::value('last_name',$value) == CRM_Utils_Array::value('last_name', $fields))
+ (CRM_Utils_Array::value('last_name', $value) == CRM_Utils_Array::value('last_name', $fields))
) {
$errors['first_name'] = ts('The first name and last name must be unique for each participant.');
break;
if (!$self->_allowConfirmation && empty($self->_values['event']['has_waitlist']) &&
$totalParticipants > $self->_availableRegistrations
) {
- $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(1 => $totalParticipants, 2 => $self->_availableRegistrations));
+ $errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(
+ 1 => $totalParticipants,
+ 2 => $self->_availableRegistrations,
+ ));
}
}
}
}
}
-
if ($button != 'skip' &&
$self->_values['event']['is_monetary'] &&
!isset($errors['_qf_default']) &&
*
* @return bool
*/
- function validatePaymentValues($self, $fields) {
+ public function validatePaymentValues($self, $fields) {
if (!empty($self->_params[0]['bypass_payment']) ||
$self->_allowWaitlist ||
}
/**
- * Function to process the form
+ * Process the form submission
*
- * @access public
*
* @return void
*/
}
/**
- * check whether call current participant is last one
+ * Check whether call current participant is last one
*
* @param bool $isButtonJs
*
- * @return boolean ture on success.
- * @access public
+ * @return bool
+ * ture on success.
*/
- function isLastParticipant($isButtonJs = FALSE) {
+ public function isLastParticipant($isButtonJs = FALSE) {
$participant = $isButtonJs ? $this->_params[0]['additional_participants'] : $this->_params[0]['additional_participants'] + 1;
if (count($this->_params) == $participant) {
return TRUE;
/**
* Reset values for all options those are full.
*
- **/
- function resetElementValue($optionFullIds = array(
- )) {
+ */
+ public function resetElementValue($optionFullIds = array()) {
if (!is_array($optionFullIds) ||
empty($optionFullIds) ||
!$this->isSubmitted()
}
/**
- * @param $elementName
+ * @param string $elementName
* @param array $optionIds
*/
- function resetSubmittedValue($elementName, $optionIds = array(
- )) {
+ public function resetSubmittedValue($elementName, $optionIds = array()) {
if (empty($elementName) ||
!$this->elementExists($elementName) ||
!$this->getSubmitValue($elementName)
return;
}
foreach (array(
- 'constantValues', 'submitValues', 'defaultValues') as $val) {
+ 'constantValues',
+ 'submitValues',
+ 'defaultValues',
+ ) as $val) {
$values = &$this->{"_$val"};
if (!is_array($values) || empty($values)) {
continue;
}
}
}
-