Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b 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 | /** | |
28 | * @package CRM | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Core/Job.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:c3340527b2d2cb17211eba848371b469) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_Job constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_Job extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_job'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = false; | |
53 | /** | |
54 | * Job Id | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Which Domain is this scheduled job for | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $domain_id; | |
65 | /** | |
66 | * Scheduled job run frequency. | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $run_frequency; | |
71 | /** | |
72 | * When was this cron entry last run | |
73 | * | |
74 | * @var datetime | |
75 | */ | |
76 | public $last_run; | |
77 | /** | |
78 | * When is this cron entry scheduled to run | |
79 | * | |
80 | * @var timestamp | |
81 | */ | |
82 | public $scheduled_run_date; | |
83 | /** | |
84 | * Title of the job | |
85 | * | |
86 | * @var string | |
87 | */ | |
88 | public $name; | |
89 | /** | |
90 | * Description of the job | |
91 | * | |
92 | * @var string | |
93 | */ | |
94 | public $description; | |
95 | /** | |
96 | * Entity of the job api call | |
97 | * | |
98 | * @var string | |
99 | */ | |
100 | public $api_entity; | |
101 | /** | |
102 | * Action of the job api call | |
103 | * | |
104 | * @var string | |
105 | */ | |
106 | public $api_action; | |
107 | /** | |
108 | * List of parameters to the command. | |
109 | * | |
110 | * @var text | |
111 | */ | |
112 | public $parameters; | |
113 | /** | |
114 | * Is this job active? | |
115 | * | |
116 | * @var boolean | |
117 | */ | |
118 | public $is_active; | |
119 | /** | |
f41f0342 | 120 | * Class constructor. |
e501603b TO |
121 | */ |
122 | function __construct() { | |
123 | $this->__table = 'civicrm_job'; | |
124 | parent::__construct(); | |
125 | } | |
126 | /** | |
f41f0342 | 127 | * Returns foreign keys and entity references. |
e501603b TO |
128 | * |
129 | * @return array | |
130 | * [CRM_Core_Reference_Interface] | |
131 | */ | |
132 | static function getReferenceColumns() { | |
346aaaba TO |
133 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
134 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
135 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); | |
136 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 137 | } |
346aaaba | 138 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
139 | } |
140 | /** | |
141 | * Returns all the column names of this table | |
142 | * | |
143 | * @return array | |
144 | */ | |
145 | static function &fields() { | |
346aaaba TO |
146 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
147 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
148 | 'id' => array( |
149 | 'name' => 'id', | |
150 | 'type' => CRM_Utils_Type::T_INT, | |
151 | 'title' => ts('Job ID') , | |
152 | 'description' => 'Job Id', | |
153 | 'required' => true, | |
522a26c9 | 154 | 'table_name' => 'civicrm_job', |
155 | 'entity' => 'Job', | |
156 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 157 | 'localizable' => 0, |
e501603b TO |
158 | ) , |
159 | 'domain_id' => array( | |
160 | 'name' => 'domain_id', | |
161 | 'type' => CRM_Utils_Type::T_INT, | |
162 | 'title' => ts('Job Domain') , | |
163 | 'description' => 'Which Domain is this scheduled job for', | |
164 | 'required' => true, | |
522a26c9 | 165 | 'table_name' => 'civicrm_job', |
166 | 'entity' => 'Job', | |
167 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 168 | 'localizable' => 0, |
e501603b TO |
169 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
170 | 'pseudoconstant' => array( | |
171 | 'table' => 'civicrm_domain', | |
172 | 'keyColumn' => 'id', | |
173 | 'labelColumn' => 'name', | |
174 | ) | |
175 | ) , | |
176 | 'run_frequency' => array( | |
177 | 'name' => 'run_frequency', | |
178 | 'type' => CRM_Utils_Type::T_STRING, | |
179 | 'title' => ts('Job Frequency') , | |
180 | 'description' => 'Scheduled job run frequency.', | |
181 | 'maxlength' => 8, | |
182 | 'size' => CRM_Utils_Type::EIGHT, | |
183 | 'default' => 'Daily', | |
522a26c9 | 184 | 'table_name' => 'civicrm_job', |
185 | 'entity' => 'Job', | |
186 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 187 | 'localizable' => 0, |
e501603b TO |
188 | 'html' => array( |
189 | 'type' => 'Select', | |
190 | ) , | |
191 | 'pseudoconstant' => array( | |
192 | 'callback' => 'CRM_Core_SelectValues::getJobFrequency', | |
193 | ) | |
194 | ) , | |
195 | 'last_run' => array( | |
196 | 'name' => 'last_run', | |
197 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
198 | 'title' => ts('Last Run') , | |
199 | 'description' => 'When was this cron entry last run', | |
200 | 'default' => 'NULL', | |
522a26c9 | 201 | 'table_name' => 'civicrm_job', |
202 | 'entity' => 'Job', | |
203 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 204 | 'localizable' => 0, |
e501603b TO |
205 | ) , |
206 | 'scheduled_run_date' => array( | |
207 | 'name' => 'scheduled_run_date', | |
208 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
209 | 'title' => ts('Scheduled Run Date') , | |
210 | 'description' => 'When is this cron entry scheduled to run', | |
211 | 'required' => false, | |
212 | 'default' => 'NULL', | |
522a26c9 | 213 | 'table_name' => 'civicrm_job', |
214 | 'entity' => 'Job', | |
215 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 216 | 'localizable' => 0, |
e501603b TO |
217 | ) , |
218 | 'name' => array( | |
219 | 'name' => 'name', | |
220 | 'type' => CRM_Utils_Type::T_STRING, | |
221 | 'title' => ts('Job Name') , | |
222 | 'description' => 'Title of the job', | |
223 | 'maxlength' => 255, | |
224 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 225 | 'table_name' => 'civicrm_job', |
226 | 'entity' => 'Job', | |
227 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 228 | 'localizable' => 0, |
e501603b TO |
229 | ) , |
230 | 'description' => array( | |
231 | 'name' => 'description', | |
232 | 'type' => CRM_Utils_Type::T_STRING, | |
233 | 'title' => ts('Job Description') , | |
234 | 'description' => 'Description of the job', | |
235 | 'maxlength' => 255, | |
236 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 237 | 'table_name' => 'civicrm_job', |
238 | 'entity' => 'Job', | |
239 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 240 | 'localizable' => 0, |
e501603b TO |
241 | ) , |
242 | 'api_entity' => array( | |
243 | 'name' => 'api_entity', | |
244 | 'type' => CRM_Utils_Type::T_STRING, | |
245 | 'title' => ts('API Entity') , | |
246 | 'description' => 'Entity of the job api call', | |
247 | 'maxlength' => 255, | |
248 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 249 | 'table_name' => 'civicrm_job', |
250 | 'entity' => 'Job', | |
251 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 252 | 'localizable' => 0, |
e501603b TO |
253 | ) , |
254 | 'api_action' => array( | |
255 | 'name' => 'api_action', | |
256 | 'type' => CRM_Utils_Type::T_STRING, | |
257 | 'title' => ts('API Action') , | |
258 | 'description' => 'Action of the job api call', | |
259 | 'maxlength' => 255, | |
260 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 261 | 'table_name' => 'civicrm_job', |
262 | 'entity' => 'Job', | |
263 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 264 | 'localizable' => 0, |
e501603b TO |
265 | ) , |
266 | 'parameters' => array( | |
267 | 'name' => 'parameters', | |
268 | 'type' => CRM_Utils_Type::T_TEXT, | |
269 | 'title' => ts('API Parameters') , | |
270 | 'description' => 'List of parameters to the command.', | |
271 | 'rows' => 4, | |
272 | 'cols' => 60, | |
522a26c9 | 273 | 'table_name' => 'civicrm_job', |
274 | 'entity' => 'Job', | |
275 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 276 | 'localizable' => 0, |
e501603b TO |
277 | 'html' => array( |
278 | 'type' => 'TextArea', | |
279 | ) , | |
280 | ) , | |
281 | 'is_active' => array( | |
282 | 'name' => 'is_active', | |
283 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
284 | 'title' => ts('Job Is Active?') , | |
285 | 'description' => 'Is this job active?', | |
522a26c9 | 286 | 'table_name' => 'civicrm_job', |
287 | 'entity' => 'Job', | |
288 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 289 | 'localizable' => 0, |
e501603b TO |
290 | ) , |
291 | ); | |
346aaaba | 292 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 293 | } |
346aaaba | 294 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
295 | } |
296 | /** | |
bd8e0b14 | 297 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
298 | * |
299 | * @return array | |
bd8e0b14 | 300 | * Array(string $name => string $uniqueName). |
e501603b TO |
301 | */ |
302 | static function &fieldKeys() { | |
bd8e0b14 TO |
303 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
304 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 305 | } |
bd8e0b14 | 306 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
307 | } |
308 | /** | |
309 | * Returns the names of this table | |
310 | * | |
311 | * @return string | |
312 | */ | |
313 | static function getTableName() { | |
314 | return self::$_tableName; | |
315 | } | |
316 | /** | |
317 | * Returns if this table needs to be logged | |
318 | * | |
319 | * @return boolean | |
320 | */ | |
321 | function getLog() { | |
322 | return self::$_log; | |
323 | } | |
324 | /** | |
325 | * Returns the list of fields that can be imported | |
326 | * | |
327 | * @param bool $prefix | |
328 | * | |
329 | * @return array | |
330 | */ | |
331 | static function &import($prefix = false) { | |
60808919 TO |
332 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, array()); |
333 | return $r; | |
e501603b TO |
334 | } |
335 | /** | |
336 | * Returns the list of fields that can be exported | |
337 | * | |
338 | * @param bool $prefix | |
339 | * | |
340 | * @return array | |
341 | */ | |
342 | static function &export($prefix = false) { | |
60808919 TO |
343 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, array()); |
344 | return $r; | |
e501603b | 345 | } |
e7a6b91a AS |
346 | /** |
347 | * Returns the list of indices | |
348 | */ | |
349 | public static function indices($localize = TRUE) { | |
350 | $indices = array(); | |
351 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
352 | } | |
e501603b | 353 | } |