Merge pull request #8944 from totten/master-givi
[civicrm-core.git] / CRM / Core / DAO / Job.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/Job.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:5c0e5cb30a7aaee5be8f3a2e6d23b84b)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_Job extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_job';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Job Id
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Which Domain is this scheduled job for
59 *
60 * @var int unsigned
61 */
62 public $domain_id;
63 /**
64 * Scheduled job run frequency.
65 *
66 * @var string
67 */
68 public $run_frequency;
69 /**
70 * When was this cron entry last run
71 *
72 * @var datetime
73 */
74 public $last_run;
75 /**
76 * When is this cron entry scheduled to run
77 *
78 * @var timestamp
79 */
80 public $scheduled_run_date;
81 /**
82 * Title of the job
83 *
84 * @var string
85 */
86 public $name;
87 /**
88 * Description of the job
89 *
90 * @var string
91 */
92 public $description;
93 /**
94 * Entity of the job api call
95 *
96 * @var string
97 */
98 public $api_entity;
99 /**
100 * Action of the job api call
101 *
102 * @var string
103 */
104 public $api_action;
105 /**
106 * List of parameters to the command.
107 *
108 * @var text
109 */
110 public $parameters;
111 /**
112 * Is this job active?
113 *
114 * @var boolean
115 */
116 public $is_active;
117 /**
118 * class constructor
119 *
120 * @return civicrm_job
121 */
122 function __construct() {
123 $this->__table = 'civicrm_job';
124 parent::__construct();
125 }
126 /**
127 * Returns foreign keys and entity references
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,
154 ) ,
155 'domain_id' => array(
156 'name' => 'domain_id',
157 'type' => CRM_Utils_Type::T_INT,
158 'title' => ts('Job Domain') ,
159 'description' => 'Which Domain is this scheduled job for',
160 'required' => true,
161 'FKClassName' => 'CRM_Core_DAO_Domain',
162 'pseudoconstant' => array(
163 'table' => 'civicrm_domain',
164 'keyColumn' => 'id',
165 'labelColumn' => 'name',
166 )
167 ) ,
168 'run_frequency' => array(
169 'name' => 'run_frequency',
170 'type' => CRM_Utils_Type::T_STRING,
171 'title' => ts('Job Frequency') ,
172 'description' => 'Scheduled job run frequency.',
173 'maxlength' => 8,
174 'size' => CRM_Utils_Type::EIGHT,
175 'default' => 'Daily',
176 'html' => array(
177 'type' => 'Select',
178 ) ,
179 'pseudoconstant' => array(
180 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
181 )
182 ) ,
183 'last_run' => array(
184 'name' => 'last_run',
185 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
186 'title' => ts('Last Run') ,
187 'description' => 'When was this cron entry last run',
188 'default' => 'NULL',
189 ) ,
190 'scheduled_run_date' => array(
191 'name' => 'scheduled_run_date',
192 'type' => CRM_Utils_Type::T_TIMESTAMP,
193 'title' => ts('Scheduled Run Date') ,
194 'description' => 'When is this cron entry scheduled to run',
195 'required' => false,
196 'default' => 'NULL',
197 ) ,
198 'name' => array(
199 'name' => 'name',
200 'type' => CRM_Utils_Type::T_STRING,
201 'title' => ts('Job Name') ,
202 'description' => 'Title of the job',
203 'maxlength' => 255,
204 'size' => CRM_Utils_Type::HUGE,
205 ) ,
206 'description' => array(
207 'name' => 'description',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Job Description') ,
210 'description' => 'Description of the job',
211 'maxlength' => 255,
212 'size' => CRM_Utils_Type::HUGE,
213 ) ,
214 'api_entity' => array(
215 'name' => 'api_entity',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('API Entity') ,
218 'description' => 'Entity of the job api call',
219 'maxlength' => 255,
220 'size' => CRM_Utils_Type::HUGE,
221 ) ,
222 'api_action' => array(
223 'name' => 'api_action',
224 'type' => CRM_Utils_Type::T_STRING,
225 'title' => ts('API Action') ,
226 'description' => 'Action of the job api call',
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
229 ) ,
230 'parameters' => array(
231 'name' => 'parameters',
232 'type' => CRM_Utils_Type::T_TEXT,
233 'title' => ts('API Parameters') ,
234 'description' => 'List of parameters to the command.',
235 'rows' => 4,
236 'cols' => 60,
237 'html' => array(
238 'type' => 'TextArea',
239 ) ,
240 ) ,
241 'is_active' => array(
242 'name' => 'is_active',
243 'type' => CRM_Utils_Type::T_BOOLEAN,
244 'title' => ts('Job Is Active?') ,
245 'description' => 'Is this job active?',
246 ) ,
247 );
346aaaba 248 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 249 }
346aaaba 250 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
251 }
252 /**
bd8e0b14 253 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
254 *
255 * @return array
bd8e0b14 256 * Array(string $name => string $uniqueName).
e501603b
TO
257 */
258 static function &fieldKeys() {
bd8e0b14
TO
259 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
260 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 261 }
bd8e0b14 262 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
263 }
264 /**
265 * Returns the names of this table
266 *
267 * @return string
268 */
269 static function getTableName() {
270 return self::$_tableName;
271 }
272 /**
273 * Returns if this table needs to be logged
274 *
275 * @return boolean
276 */
277 function getLog() {
278 return self::$_log;
279 }
280 /**
281 * Returns the list of fields that can be imported
282 *
283 * @param bool $prefix
284 *
285 * @return array
286 */
287 static function &import($prefix = false) {
60808919
TO
288 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, array());
289 return $r;
e501603b
TO
290 }
291 /**
292 * Returns the list of fields that can be exported
293 *
294 * @param bool $prefix
295 *
296 * @return array
297 */
298 static function &export($prefix = false) {
60808919
TO
299 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, array());
300 return $r;
e501603b
TO
301 }
302}