Commit | Line | Data |
---|---|---|
546a1ecc TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
41498ac5 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
546a1ecc | 5 | | | |
41498ac5 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
546a1ecc TO |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | namespace Civi\ActionSchedule; | |
13 | ||
db01bf2f | 14 | /** |
15 | * Interface MappingInterface | |
16 | * @package Civi\ActionSchedule | |
17 | */ | |
546a1ecc TO |
18 | interface MappingInterface { |
19 | ||
9e1bf145 TO |
20 | /** |
21 | * @return mixed | |
22 | */ | |
23 | public function getId(); | |
24 | ||
25 | /** | |
26 | * @return string | |
27 | */ | |
28 | public function getEntity(); | |
29 | ||
30 | /** | |
31 | * Get a printable label for this mapping type. | |
32 | * | |
33 | * @return string | |
34 | */ | |
35 | public function getLabel(); | |
36 | ||
37 | /** | |
38 | * Get a printable label to use as the header on the 'value' filter. | |
39 | * | |
40 | * @return string | |
41 | */ | |
42 | public function getValueHeader(); | |
43 | ||
44 | /** | |
45 | * Get a printable label to use as the header on the 'status' filter. | |
46 | * | |
47 | * @return string | |
48 | */ | |
49 | public function getStatusHeader(); | |
50 | ||
546a1ecc TO |
51 | /** |
52 | * Get a list of value options. | |
53 | * | |
54 | * @return array | |
55 | * Array(string $value => string $label). | |
56 | * Ex: array(123 => 'Phone Call', 456 => 'Meeting'). | |
57 | */ | |
58 | public function getValueLabels(); | |
59 | ||
60 | /** | |
61 | * Get a list of status options. | |
62 | * | |
63 | * @param string|int $value | |
64 | * The list of status options may be contingent upon the selected filter value. | |
65 | * This is the selected filter value. | |
66 | * @return array | |
67 | * Array(string $value => string $label). | |
68 | * Ex: Array(123 => 'Completed', 456 => 'Scheduled'). | |
69 | */ | |
70 | public function getStatusLabels($value); | |
71 | ||
72 | /** | |
73 | * Get a list of available date fields. | |
74 | * | |
75 | * @return array | |
76 | * Array(string $fieldName => string $fieldLabel). | |
77 | */ | |
78 | public function getDateFields(); | |
79 | ||
80 | /** | |
0effed37 | 81 | * Get a list of recipient types. |
546a1ecc | 82 | * |
0effed37 TO |
83 | * Note: A single schedule may filter on *zero* or *one* recipient types. |
84 | * When an admin chooses a value, it's stored in $schedule->recipient. | |
673c1c81 | 85 | * |
546a1ecc | 86 | * @return array |
0effed37 TO |
87 | * array(string $value => string $label). |
88 | * Ex: array('assignee' => 'Activity Assignee'). | |
546a1ecc | 89 | */ |
0effed37 | 90 | public function getRecipientTypes(); |
546a1ecc TO |
91 | |
92 | /** | |
0effed37 | 93 | * Get a list of recipients which match the given type. |
673c1c81 | 94 | * |
0effed37 TO |
95 | * Note: A single schedule may filter on *multiple* recipients. |
96 | * When an admin chooses value(s), it's stored in $schedule->recipient_listing. | |
546a1ecc | 97 | * |
0effed37 TO |
98 | * @param string $recipientType |
99 | * Ex: 'participant_role'. | |
546a1ecc | 100 | * @return array |
0effed37 TO |
101 | * Array(mixed $name => string $label). |
102 | * Ex: array(1 => 'Attendee', 2 => 'Volunteer'). | |
103 | * @see getRecipientTypes | |
546a1ecc | 104 | */ |
0effed37 | 105 | public function getRecipientListing($recipientType); |
546a1ecc | 106 | |
7f0141d8 TO |
107 | /** |
108 | * Determine whether a schedule based on this mapping is sufficiently | |
109 | * complete. | |
110 | * | |
111 | * @param \CRM_Core_DAO_ActionSchedule $schedule | |
112 | * @return array | |
113 | * Array (string $code => string $message). | |
114 | * List of error messages. | |
115 | */ | |
116 | public function validateSchedule($schedule); | |
117 | ||
546a1ecc TO |
118 | /** |
119 | * Generate a query to locate contacts who match the given | |
120 | * schedule. | |
121 | * | |
122 | * @param \CRM_Core_DAO_ActionSchedule $schedule | |
123 | * @param string $phase | |
124 | * See, e.g., RecipientBuilder::PHASE_RELATION_FIRST. | |
efc40454 TO |
125 | * @param array $defaultParams |
126 | * Default parameters that should be included with query. | |
546a1ecc TO |
127 | * @return \CRM_Utils_SQL_Select |
128 | * @see RecipientBuilder | |
129 | */ | |
efc40454 | 130 | public function createQuery($schedule, $phase, $defaultParams); |
546a1ecc | 131 | |
e08fae02 PH |
132 | /** |
133 | * Determine whether a schedule based on this mapping should | |
134 | * reset the reminder state if the trigger date changes. | |
135 | * | |
136 | * @return bool | |
137 | * | |
138 | * @param \CRM_Core_DAO_ActionSchedule $schedule | |
139 | */ | |
140 | public function resetOnTriggerDateChange($schedule); | |
141 | ||
3741f351 JG |
142 | /** |
143 | * Determine whether a schedule based on this mapping should | |
144 | * send to additional contacts. | |
145 | */ | |
146 | public function sendToAdditional($entityId): bool; | |
147 | ||
546a1ecc | 148 | } |