Merge pull request #12067 from michaelmcandrew/CRM-21576-sms-permission-extra
[civicrm-core.git] / Civi / ActionSchedule / MappingInterface.php
CommitLineData
546a1ecc
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
546a1ecc 5 +--------------------------------------------------------------------+
8c9251b3 6 | Copyright CiviCRM LLC (c) 2004-2018 |
546a1ecc
TO
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
db01bf2f 30/**
31 * Interface MappingInterface
32 * @package Civi\ActionSchedule
33 */
546a1ecc
TO
34interface MappingInterface {
35
9e1bf145
TO
36 /**
37 * @return mixed
38 */
39 public function getId();
40
41 /**
42 * @return string
43 */
44 public function getEntity();
45
46 /**
47 * Get a printable label for this mapping type.
48 *
49 * @return string
50 */
51 public function getLabel();
52
53 /**
54 * Get a printable label to use as the header on the 'value' filter.
55 *
56 * @return string
57 */
58 public function getValueHeader();
59
60 /**
61 * Get a printable label to use as the header on the 'status' filter.
62 *
63 * @return string
64 */
65 public function getStatusHeader();
66
546a1ecc
TO
67 /**
68 * Get a list of value options.
69 *
70 * @return array
71 * Array(string $value => string $label).
72 * Ex: array(123 => 'Phone Call', 456 => 'Meeting').
73 */
74 public function getValueLabels();
75
76 /**
77 * Get a list of status options.
78 *
79 * @param string|int $value
80 * The list of status options may be contingent upon the selected filter value.
81 * This is the selected filter value.
82 * @return array
83 * Array(string $value => string $label).
84 * Ex: Array(123 => 'Completed', 456 => 'Scheduled').
85 */
86 public function getStatusLabels($value);
87
88 /**
89 * Get a list of available date fields.
90 *
91 * @return array
92 * Array(string $fieldName => string $fieldLabel).
93 */
94 public function getDateFields();
95
96 /**
0effed37 97 * Get a list of recipient types.
546a1ecc 98 *
0effed37
TO
99 * Note: A single schedule may filter on *zero* or *one* recipient types.
100 * When an admin chooses a value, it's stored in $schedule->recipient.
673c1c81 101 *
546a1ecc 102 * @return array
0effed37
TO
103 * array(string $value => string $label).
104 * Ex: array('assignee' => 'Activity Assignee').
546a1ecc 105 */
0effed37 106 public function getRecipientTypes();
546a1ecc
TO
107
108 /**
0effed37 109 * Get a list of recipients which match the given type.
673c1c81 110 *
0effed37
TO
111 * Note: A single schedule may filter on *multiple* recipients.
112 * When an admin chooses value(s), it's stored in $schedule->recipient_listing.
546a1ecc 113 *
0effed37
TO
114 * @param string $recipientType
115 * Ex: 'participant_role'.
546a1ecc 116 * @return array
0effed37
TO
117 * Array(mixed $name => string $label).
118 * Ex: array(1 => 'Attendee', 2 => 'Volunteer').
119 * @see getRecipientTypes
546a1ecc 120 */
0effed37 121 public function getRecipientListing($recipientType);
546a1ecc 122
7f0141d8
TO
123 /**
124 * Determine whether a schedule based on this mapping is sufficiently
125 * complete.
126 *
127 * @param \CRM_Core_DAO_ActionSchedule $schedule
128 * @return array
129 * Array (string $code => string $message).
130 * List of error messages.
131 */
132 public function validateSchedule($schedule);
133
546a1ecc
TO
134 /**
135 * Generate a query to locate contacts who match the given
136 * schedule.
137 *
138 * @param \CRM_Core_DAO_ActionSchedule $schedule
139 * @param string $phase
140 * See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
efc40454
TO
141 * @param array $defaultParams
142 * Default parameters that should be included with query.
546a1ecc
TO
143 * @return \CRM_Utils_SQL_Select
144 * @see RecipientBuilder
145 */
efc40454 146 public function createQuery($schedule, $phase, $defaultParams);
546a1ecc
TO
147
148}