Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
232624b1 | 4 | | CiviCRM version 4.4 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright (C) 2011 Marty Wright | | |
7 | | Licensed to CiviCRM under the Academic Free License version 3.0. | | |
8 | +--------------------------------------------------------------------+ | |
9 | | This file is a part of CiviCRM. | | |
10 | | | | |
11 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
12 | | under the terms of the GNU Affero General Public License | | |
13 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
14 | | | | |
15 | | CiviCRM is distributed in the hope that it will be useful, but | | |
16 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
17 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
18 | | See the GNU Affero General Public License for more details. | | |
19 | | | | |
20 | | You should have received a copy of the GNU Affero General Public | | |
21 | | License and the CiviCRM Licensing Exception along | | |
22 | | with this program; if not, contact CiviCRM LLC | | |
23 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
24 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
25 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
26 | +--------------------------------------------------------------------+ | |
27 | */ | |
28 | ||
29 | /** | |
30 | * | |
31 | * @package CRM | |
32 | * @copyright CiviCRM LLC (c) 2004-2013 | |
33 | * $Id$ | |
34 | * | |
35 | */ | |
36 | ||
37 | /** | |
38 | * Page for displaying list of Reminders | |
39 | */ | |
40 | class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic { | |
41 | ||
42 | /** | |
43 | * The action links that we need to display for the browse screen | |
44 | * | |
45 | * @var array | |
46 | * @static | |
47 | */ | |
48 | static $_links = NULL; | |
49 | ||
50 | /** | |
51 | * Get BAO Name | |
52 | * | |
53 | * @return string Classname of BAO. | |
54 | */ | |
55 | function getBAOName() { | |
56 | return 'CRM_Core_BAO_ActionSchedule'; | |
57 | } | |
58 | ||
59 | /** | |
60 | * Get action Links | |
61 | * | |
62 | * @return array (reference) of action links | |
63 | */ | |
64 | function &links() { | |
65 | if (!(self::$_links)) { | |
66 | // helper variable for nicer formatting | |
67 | self::$_links = array( | |
68 | CRM_Core_Action::UPDATE => array( | |
69 | 'name' => ts('Edit'), | |
70 | 'url' => 'civicrm/admin/scheduleReminders', | |
71 | 'qs' => 'action=update&id=%%id%%&reset=1', | |
72 | 'title' => ts('Edit Schedule Reminders'), | |
73 | ), | |
74 | CRM_Core_Action::ENABLE => array( | |
75 | 'name' => ts('Enable'), | |
4d17a233 | 76 | 'ref' => 'crm-enable-disable', |
6a488035 TO |
77 | 'title' => ts('Enable Label Format'), |
78 | ), | |
79 | CRM_Core_Action::DISABLE => array( | |
80 | 'name' => ts('Disable'), | |
4d17a233 | 81 | 'ref' => 'crm-enable-disable', |
6a488035 TO |
82 | 'title' => ts('Disable Label Format'), |
83 | ), | |
84 | CRM_Core_Action::DELETE => array( | |
85 | 'name' => ts('Delete'), | |
86 | 'url' => 'civicrm/admin/scheduleReminders', | |
87 | 'qs' => 'action=delete&id=%%id%%', | |
88 | 'title' => ts('Delete Schedule Reminders'), | |
89 | ), | |
90 | ); | |
91 | } | |
92 | ||
93 | return self::$_links; | |
94 | } | |
95 | ||
96 | /** | |
97 | * Get name of edit form | |
98 | * | |
99 | * @return string Classname of edit form. | |
100 | */ | |
101 | function editForm() { | |
102 | return 'CRM_Admin_Form_ScheduleReminders'; | |
103 | } | |
104 | ||
105 | /** | |
106 | * Get edit form name | |
107 | * | |
108 | * @return string name of this page. | |
109 | */ | |
110 | function editName() { | |
111 | return 'ScheduleReminders'; | |
112 | } | |
113 | ||
114 | /** | |
115 | * Get user context. | |
116 | * | |
117 | * @return string user context. | |
118 | */ | |
119 | function userContext($mode = NULL) { | |
120 | return 'civicrm/admin/scheduleReminders'; | |
121 | } | |
122 | ||
123 | /** | |
124 | * Browse all Scheduled Reminders settings. | |
125 | * | |
126 | * @return void | |
127 | * @access public | |
128 | * @static | |
129 | */ | |
130 | function browse($action = NULL) { | |
f1cf499b CW |
131 | if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajax_popups_enabled', NULL, TRUE)) { |
132 | CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); | |
133 | } | |
6a488035 TO |
134 | // Get list of configured reminders |
135 | $reminderList = CRM_Core_BAO_ActionSchedule::getList(); | |
136 | ||
137 | if (is_array($reminderList)) { | |
138 | // Add action links to each of the reminders | |
139 | foreach ($reminderList as & $format) { | |
140 | $action = array_sum(array_keys($this->links())); | |
141 | if ($format['is_active']) { | |
142 | $action -= CRM_Core_Action::ENABLE; | |
143 | } | |
144 | else { | |
145 | $action -= CRM_Core_Action::DISABLE; | |
146 | } | |
87dab4a4 AH |
147 | $format['action'] = CRM_Core_Action::formLink( |
148 | self::links(), | |
149 | $action, | |
150 | array('id' => $format['id']), | |
151 | ts('more'), | |
152 | FALSE, | |
153 | 'actionSchedule.manage.action', | |
154 | 'ActionSchedule', | |
155 | $format['id'] | |
156 | ); | |
6a488035 TO |
157 | } |
158 | } | |
159 | ||
160 | $this->assign('rows', $reminderList); | |
161 | } | |
162 | } | |
163 |