Merge pull request #22487 from mattwire/repeattransactiontemplatecontribution
[civicrm-core.git] / CRM / Core / BAO / UserJob.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class contains user jobs functionality.
20 */
21 class CRM_Core_BAO_UserJob extends CRM_Core_DAO_UserJob {
22
23 /**
24 * Restrict access to the relevant user.
25 *
26 * Note that it is likely we might want to permit other users such as
27 * sysadmins to access other people's user_jobs in future but it has been
28 * kept tightly restricted for initial simplicity (ie do we want to
29 * use an existing permission? a new permission ? do they require
30 * 'view all contacts' etc.
31 *
32 * @inheritDoc
33 */
34 public function addSelectWhereClause(): array {
35 $clauses['created_id'] = '= ' . (int) CRM_Core_Session::getLoggedInContactID();
36 return $clauses;
37 }
38
39 /**
40 * Get the statuses for Import Jobs.
41 *
42 * @return array
43 */
44 public static function getStatuses(): array {
45 return [
46 [
47 'id' => 1,
48 'name' => 'completed',
49 'label' => ts('Completed'),
50 ],
51 [
52 'id' => 2,
53 'name' => 'draft',
54 'label' => ts('Draft'),
55 ],
56 [
57 'id' => 3,
58 'name' => 'scheduled',
59 'label' => ts('Scheduled'),
60 ],
61 [
62 'id' => 4,
63 'name' => 'in_progress',
64 'label' => ts('In Progress'),
65 ],
66 ];
67 }
68
69 /**
70 * Get the types Import Jobs.
71 *
72 * This is largely a placeholder at this stage. It will likely wind
73 * up as an option value so extensions can add different types.
74 *
75 * However, for now it just holds the one type being worked on.
76 *
77 * @return array
78 */
79 public static function getTypes(): array {
80 return [
81 [
82 'id' => 1,
83 'name' => 'contact_import',
84 'label' => ts('Contact Import'),
85 ],
86 ];
87 }
88
89 }