*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Event_BAO_Event extends CRM_Event_DAO_Event {
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
- * @return CRM_Event_BAO_ManageEvent
+ * @return CRM_Event_DAO_Event
*/
public static function retrieve(&$params, &$defaults) {
$event = new CRM_Event_DAO_Event();
* @param array $params
* Reference array contains the values submitted by the form.
*
- *
- * @return object
+ * @return CRM_Event_DAO_Event
*/
public static function add(&$params) {
CRM_Utils_System::flushCache();
}
/**
- * Delete the location block associated with an event,
- * if not being used by any other event.
+ * Delete the location block associated with an event.
+ *
+ * Function checks that it is not being used by any other event.
*
- * @param $locBlockId
+ * @param int $locBlockId
* Location block id to be deleted.
* @param int $eventId
* Event with which loc block is associated.
- *
*/
public static function deleteEventLocBlock($locBlockId, $eventId = NULL) {
$query = "SELECT count(ce.id) FROM civicrm_event ce WHERE ce.loc_block_id = $locBlockId";
}
/**
- * Get current/future Events
+ * Get current/future Events.
*
* @param int $all
* 0 returns current and future events.
/**
* Get events Summary.
*
- *
* @return array
* Array of event summary values
*/
$optionGroupId = $optionGroupDAO->id;
}
// Get the event summary display preferences
- $show_max_events = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME,
- 'show_events'
- );
- // default to 10 if no option is set
- if (is_null($show_max_events)) {
- $show_max_events = 10;
- }
+ $show_max_events = Civi::settings()->get('show_events');
// show all events if show_events is set to a negative value
if ($show_max_events >= 0) {
$event_summary_limit = "LIMIT 0, $show_max_events";
* @param bool $role consider counted( is filter role) participant.
* Consider counted( is filter role) participant.
*
- *
* @return array
* array with count of participants for each event based on status/role
*/
if ($role) {
$roleClause = 'IN';
}
- $roles = implode(',', array_keys($roleTypes));
- if (empty($roles)) {
- $roles = 0;
+
+ if (!empty($roleTypes)) {
+ $escapedRoles = array();
+ foreach (array_keys($roleTypes) as $roleType) {
+ $escapedRoles[] = CRM_Utils_Type::escape($roleType, 'String');
+ }
+
+ $clause[] = "participant.role_id {$roleClause} ( '" . implode("', '", $escapedRoles) . "' ) ";
}
- $clause[] = "participant.role_id {$roleClause} ( $roles )";
}
$sqlClause = '';
$permissions = CRM_Core_Permission::event(CRM_Core_Permission::VIEW);
// check if we're in shopping cart mode for events
- $enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME,
- 'enable_cart'
- );
+ $enable_cart = Civi::settings()->get('enable_cart');
if ($enable_cart) {
}
while ($dao->fetch()) {
}
/**
- * make a copy of a Event, including
- * all the fields in the event Wizard
+ * Make a copy of a Event.
+ *
+ * Include all the fields in the event Wizard.
*
* @param int $id
* The event id to copy.
}
/**
- * This is sometimes called in a loop (during event search)
- * hence we cache the values to prevent repeated calls to the db
+ * This is sometimes called in a loop (during event search).
+ *
+ * We cache the values to prevent repeated calls to the db.
+ *
+ * @param int $id
+ *
+ * @return bool
*/
public static function isMonetary($id) {
static $isMonetary = array();
}
/**
- * This is sometimes called in a loop (during event search)
- * hence we cache the values to prevent repeated calls to the db
+ * This is sometimes called in a loop (during event search).
+ *
+ * We cache the values to prevent repeated calls to the db.
+ *
+ * @param int $id
+ *
+ * @return bool
*/
public static function usesPriceSet($id) {
static $usesPriceSet = array();
}
/**
- * Process that send e-mails
+ * Send e-mails.
*
* @param int $contactID
- * @param $values
+ * @param array $values
* @param int $participantId
* @param bool $isTest
* @param bool $returnMessageText
- *
- * @return void
*/
public static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) {
// append invoice pdf to email
$template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('totalTaxAmount');
- $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+ $prefixValue = Civi::settings()->get('contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if (isset($invoicing) && isset($prefixValue['is_email_pdf']) && !empty($values['contributionId'])) {
$sendTemplateParams['isEmailPdf'] = TRUE;
}
/**
- * Add the custom fields OR array of participant's
- * profile info
+ * Add the custom fields OR array of participant's profile info.
*
* @param int $id
* @param string $name
* @param int $cid
- * @param $template
+ * @param string $template
* @param int $participantId
- * @param $isTest
+ * @param bool $isTest
* @param bool $isCustomProfile
* @param array $participantParams
*
- * @return void
+ * @return array|null
*/
public static function buildCustomDisplay(
$id,
* Formatted array of key value.
*
* @param array $profileFields
- *
- * @return void
*/
public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$profileFields = array()) {
if ($gid) {
//take the custom field options
$returnProperties = array($name => 1);
$query = new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
- $options = &$query->_options;
if (!$skip) {
- $displayValue = CRM_Core_BAO_CustomField::getDisplayValue($customVal, $cfID, $options);
+ $displayValue = CRM_Core_BAO_CustomField::displayValue($customVal, $cfID);
}
//Hack since we dont have function to check empty.
//FIXME in 2.3 using crmIsEmptyArray()
}
/**
- * Build the array for Additional participant's information array of priamry and additional Ids
+ * Build the array for Additional participant's information array of primary and additional Ids.
*
* @param int $participantId
* Id of Primary participant.