composer.json - Move ezc components from packages to composer.json
[civicrm-core.git] / CRM / Event / ActionMapping.php
index 5a0fe9f42d9780d4ffc16c50d614855ddb205402..fc4d9d8dadc6a90cff5d80bd5ca5fba30a1b60b8 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -88,6 +88,43 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
     )));
   }
 
+  /**
+   * Get a list of recipient types.
+   *
+   * Note: A single schedule may filter on *zero* or *one* recipient types.
+   * When an admin chooses a value, it's stored in $schedule->recipient.
+   *
+   * @return array
+   *   array(string $value => string $label).
+   *   Ex: array('assignee' => 'Activity Assignee').
+   */
+  public function getRecipientTypes() {
+    return \CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name');
+  }
+
+  /**
+   * Get a list of recipients which match the given type.
+   *
+   * Note: A single schedule may filter on *multiple* recipients.
+   * When an admin chooses value(s), it's stored in $schedule->recipient_listing.
+   *
+   * @param string $recipientType
+   *   Ex: 'participant_role'.
+   * @return array
+   *   Array(mixed $name => string $label).
+   *   Ex: array(1 => 'Attendee', 2 => 'Volunteer').
+   * @see getRecipientTypes
+   */
+  public function getRecipientListing($recipientType) {
+    switch ($recipientType) {
+      case 'participant_role':
+        return \CRM_Event_PseudoConstant::participantRole();
+
+      default:
+        return array();
+    }
+  }
+
   /**
    * Generate a query to locate recipients who match the given
    * schedule.
@@ -96,6 +133,8 @@ class CRM_Event_ActionMapping extends \Civi\ActionSchedule\Mapping {
    *   The schedule as configured by the administrator.
    * @param string $phase
    *   See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
+   * @param array $defaultParams
+   *
    * @return \CRM_Utils_SQL_Select
    * @see RecipientBuilder
    */