Merge pull request #6866 from eileenmcnaughton/CRM-17318
[civicrm-core.git] / Civi / ActionSchedule / MappingInterface.php
CommitLineData
546a1ecc
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
3435af9a 4 | CiviCRM version 4.7 |
546a1ecc
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28namespace Civi\ActionSchedule;
29
30interface MappingInterface {
31
9e1bf145
TO
32 /**
33 * @return mixed
34 */
35 public function getId();
36
37 /**
38 * @return string
39 */
40 public function getEntity();
41
42 /**
43 * Get a printable label for this mapping type.
44 *
45 * @return string
46 */
47 public function getLabel();
48
49 /**
50 * Get a printable label to use as the header on the 'value' filter.
51 *
52 * @return string
53 */
54 public function getValueHeader();
55
56 /**
57 * Get a printable label to use as the header on the 'status' filter.
58 *
59 * @return string
60 */
61 public function getStatusHeader();
62
546a1ecc
TO
63 /**
64 * Get a list of value options.
65 *
66 * @return array
67 * Array(string $value => string $label).
68 * Ex: array(123 => 'Phone Call', 456 => 'Meeting').
69 */
70 public function getValueLabels();
71
72 /**
73 * Get a list of status options.
74 *
75 * @param string|int $value
76 * The list of status options may be contingent upon the selected filter value.
77 * This is the selected filter value.
78 * @return array
79 * Array(string $value => string $label).
80 * Ex: Array(123 => 'Completed', 456 => 'Scheduled').
81 */
82 public function getStatusLabels($value);
83
84 /**
85 * Get a list of available date fields.
86 *
87 * @return array
88 * Array(string $fieldName => string $fieldLabel).
89 */
90 public function getDateFields();
91
92 /**
0effed37 93 * Get a list of recipient types.
546a1ecc 94 *
0effed37
TO
95 * Note: A single schedule may filter on *zero* or *one* recipient types.
96 * When an admin chooses a value, it's stored in $schedule->recipient.
673c1c81 97 *
546a1ecc 98 * @return array
0effed37
TO
99 * array(string $value => string $label).
100 * Ex: array('assignee' => 'Activity Assignee').
546a1ecc 101 */
0effed37 102 public function getRecipientTypes();
546a1ecc
TO
103
104 /**
0effed37 105 * Get a list of recipients which match the given type.
673c1c81 106 *
0effed37
TO
107 * Note: A single schedule may filter on *multiple* recipients.
108 * When an admin chooses value(s), it's stored in $schedule->recipient_listing.
546a1ecc 109 *
0effed37
TO
110 * @param string $recipientType
111 * Ex: 'participant_role'.
546a1ecc 112 * @return array
0effed37
TO
113 * Array(mixed $name => string $label).
114 * Ex: array(1 => 'Attendee', 2 => 'Volunteer').
115 * @see getRecipientTypes
546a1ecc 116 */
0effed37 117 public function getRecipientListing($recipientType);
546a1ecc 118
7f0141d8
TO
119 /**
120 * Determine whether a schedule based on this mapping is sufficiently
121 * complete.
122 *
123 * @param \CRM_Core_DAO_ActionSchedule $schedule
124 * @return array
125 * Array (string $code => string $message).
126 * List of error messages.
127 */
128 public function validateSchedule($schedule);
129
546a1ecc
TO
130 /**
131 * Generate a query to locate contacts who match the given
132 * schedule.
133 *
134 * @param \CRM_Core_DAO_ActionSchedule $schedule
135 * @param string $phase
136 * See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
efc40454
TO
137 * @param array $defaultParams
138 * Default parameters that should be included with query.
546a1ecc
TO
139 * @return \CRM_Utils_SQL_Select
140 * @see RecipientBuilder
141 */
efc40454 142 public function createQuery($schedule, $phase, $defaultParams);
546a1ecc
TO
143
144}