3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Page for displaying list of Reminders.
21 class CRM_Admin_Page_ScheduleReminders
extends CRM_Core_Page_Basic
{
23 public $useLivePageJS = TRUE;
26 * The action links that we need to display for the browse screen.
30 public static $_links = NULL;
38 public function getBAOName() {
39 return 'CRM_Core_BAO_ActionSchedule';
46 * (reference) of action links
48 public function &links() {
49 if (!(self
::$_links)) {
50 // helper variable for nicer formatting
52 CRM_Core_Action
::UPDATE
=> [
54 'url' => 'civicrm/admin/scheduleReminders',
55 'qs' => 'action=update&id=%%id%%&reset=1',
56 'title' => ts('Edit Schedule Reminders'),
58 CRM_Core_Action
::ENABLE
=> [
59 'name' => ts('Enable'),
60 'ref' => 'crm-enable-disable',
61 'title' => ts('Enable Label Format'),
63 CRM_Core_Action
::DISABLE
=> [
64 'name' => ts('Disable'),
65 'ref' => 'crm-enable-disable',
66 'title' => ts('Disable Label Format'),
68 CRM_Core_Action
::DELETE
=> [
69 'name' => ts('Delete'),
70 'url' => 'civicrm/admin/scheduleReminders',
71 'qs' => 'action=delete&id=%%id%%',
72 'title' => ts('Delete Schedule Reminders'),
81 * Get name of edit form.
84 * Classname of edit form.
86 public function editForm() {
87 return 'CRM_Admin_Form_ScheduleReminders';
96 public function editName() {
97 return 'ScheduleReminders';
108 public function userContext($mode = NULL) {
109 return 'civicrm/admin/scheduleReminders';
113 * Browse all Scheduled Reminders settings.
115 * @param null $action
117 * @throws \CRM_Core_Exception
119 public function browse($action = NULL) {
120 //CRM-16777: Do not permit access to user, for page 'Administer->Communication->Schedule Reminder',
121 //when do not have 'administer CiviCRM' permission.
122 if (!CRM_Core_Permission
::check('administer CiviCRM')) {
123 CRM_Core_Error
::statusBounce(ts('You do not have permission to access this page.'));
126 // Get list of configured reminders
127 $reminderList = CRM_Core_BAO_ActionSchedule
::getList();
129 if (is_array($reminderList)) {
130 // Add action links to each of the reminders
131 foreach ($reminderList as & $format) {
132 $action = array_sum(array_keys($this->links()));
133 if ($format['is_active']) {
134 $action -= CRM_Core_Action
::ENABLE
;
137 $action -= CRM_Core_Action
::DISABLE
;
139 $format['action'] = CRM_Core_Action
::formLink(
142 ['id' => $format['id']],
145 'actionSchedule.manage.action',
152 $this->assign('rows', $reminderList);