Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.6 | | |
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. | | |
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 | /** | |
29 | * | |
30 | * @package CRM | |
31 | * @copyright CiviCRM LLC (c) 2004-2015 | |
32 | * $Id$ | |
33 | * | |
34 | */ | |
35 | function civicrm_rules_get_condition() { | |
36 | return array( | |
37 | 'civicrm_rules_condition_mailing_approved' => | |
38 | array( | |
39 | 'label' => t('Approval Status: Approved'), | |
40 | 'arguments' => array( | |
41 | 'approvalstatus' => array( | |
42 | 'type' => 'mailing', | |
43 | 'label' => t('Approved'), | |
44 | ), | |
45 | ), | |
46 | 'base' => 'civicrm_rules_condition_mailing_approved', | |
47 | 'group' => 'CiviCRM Mailing', | |
48 | ), | |
49 | 'civicrm_rules_condition_mailing_rejected' => | |
50 | array( | |
51 | 'label' => t('Approval Status: Rejected'), | |
52 | 'arguments' => array( | |
53 | 'approvalstatus' => array( | |
54 | 'type' => 'mailing', | |
55 | 'label' => t('Rejected'), | |
56 | ), | |
57 | ), | |
58 | 'base' => 'civicrm_rules_condition_mailing_rejected', | |
59 | 'group' => 'CiviCRM Mailing', | |
60 | ), | |
61 | 'civicrm_rules_condition_participant_role' => | |
62 | array( | |
63 | 'label' => t('Participant Role'), | |
64 | 'base' => 'civicrm_rules_condition_participant_role', | |
65 | 'parameter' => civicrm_rules_condition_parameter(t('Participant Role'), 'participant'), | |
66 | 'group' => 'CiviCRM participant', | |
67 | ), | |
68 | 'civicrm_rules_condition_event_type' => | |
69 | array( | |
70 | 'label' => t('Event Type'), | |
71 | 'base' => 'civicrm_rules_condition_event_type', | |
72 | 'parameter' => civicrm_rules_condition_parameter(t('Created Event'), 'event'), | |
73 | 'group' => 'CiviCRM event', | |
74 | ), | |
75 | ); | |
76 | } | |
77 | ||
78 | function civicrm_rules_condition_parameter($label, $type = 'contact') { | |
79 | ||
80 | $default = array($type => array('type' => $type, 'label' => $label)); | |
81 | ||
82 | if ($type == 'participant') { | |
83 | return $default + array( | |
84 | 'civicrm_participant_role' => array('type' => 'list<integer>', | |
85 | 'label' => t('Participant role'), | |
86 | 'options list' => 'civicrm_rules_get_participant_role_options', | |
87 | )); | |
88 | } | |
89 | ||
90 | if ($type == 'event') { | |
91 | return $default + array( | |
92 | 'civicrm_event_type' => array('type' => 'list<integer>', | |
93 | 'label' => t('CiviCRM event type'), | |
94 | 'options list' => 'civicrm_rules_get_event_type_options', | |
95 | )); | |
96 | } | |
97 | ||
98 | return $default; | |
99 | } | |
100 |