* @return array
*/
public static function buildQillForFieldValue($daoName, $fieldName, $fieldValue, $op, $pseduoExtraParam = array()) {
- $pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array());
$qillOperators = CRM_Core_SelectValues::getSearchBuilderOperators();
+
if ($fieldName == 'activity_type_id') {
$pseduoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
}
+ elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') {
+ $pseduoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE);
+ }
+ else {
+ $pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array());
+ }
//For those $fieldName which don't have any associated pseudoconstant defined
if (empty($pseduoOptions)) {
* 0 returns current and future events.
* 1 if events all are required
* 2 returns events since 3 months ago
- * @param bool|int $id int id of a specific event to return
+ * @param int|array $id single int event id or array of multiple event ids to return
* @param bool $isActive
* true if you need only active events.
* @param bool $checkPermission
* true if you need to check permission else false.
+ * @param bool $titleOnly
+ * true if you need only title not appended with start date
*
* @return array
*/
public static function getEvents(
$all = 0,
- $id = FALSE,
+ $id = NULL,
$isActive = TRUE,
- $checkPermission = TRUE
+ $checkPermission = TRUE,
+ $titleOnly = FALSE
) {
$query = "
SELECT `id`, `title`, `start_date`
FROM `civicrm_event`
WHERE ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )";
- if ($id) {
- $query .= " AND `id` = {$id}";
+ if (!empty($id)) {
+ if (is_array($id)) {
+ $query .= " AND `id` IN (" . implode(',', $id) . ")";
+ }
+ else {
+ $query .= " AND `id` = {$id}";
+ }
}
elseif ($all == 0) {
// find only events ending in the future
) &&
$dao->title
) {
- $events[$dao->id] = $dao->title . ' - ' . CRM_Utils_Date::customFormat($dao->start_date);
+ $events[$dao->id] = $dao->title;
+ if (!$titleOnly) {
+ $events[$dao->id] .= ' - ' . CRM_Utils_Date::customFormat($dao->start_date);
+ }
}
}