Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * | |
15 | * @package CRM | |
ca5cec67 | 16 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
17 | */ |
18 | ||
19 | /** | |
20 | * This class generates form components for scheduling reminders for Event | |
21 | * | |
22 | */ | |
23 | class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_ManageEvent { | |
24 | ||
25 | /** | |
66f9e52b | 26 | * Set variables up before form is built. |
6a488035 TO |
27 | * |
28 | * @return void | |
6a488035 | 29 | */ |
00be9182 | 30 | public function preProcess() { |
6a488035 | 31 | parent::preProcess(); |
e4b857f8 | 32 | $this->setSelectedChild('reminder'); |
4d3e4dbe | 33 | $setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0); |
6a488035 | 34 | |
be2fb01f | 35 | $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings([ |
46f5566c | 36 | 'id' => ($this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID), |
be2fb01f | 37 | ])); |
987e3a4f | 38 | $reminderList = CRM_Core_BAO_ActionSchedule::getList($mapping, $this->_id); |
39 | // Add action links to each of the reminders | |
40 | foreach ($reminderList as & $format) { | |
41 | $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE; | |
42 | if ($format['is_active']) { | |
43 | $action += CRM_Core_Action::DISABLE; | |
6a488035 | 44 | } |
987e3a4f | 45 | else { |
46 | $action += CRM_Core_Action::ENABLE; | |
47 | } | |
48 | $scheduleReminder = new CRM_Admin_Page_ScheduleReminders(); | |
49 | $links = $scheduleReminder->links(); | |
50 | $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}"; | |
51 | $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}"; | |
52 | $format['action'] = CRM_Core_Action::formLink( | |
53 | $links, | |
54 | $action, | |
55 | ['id' => $format['id']], | |
56 | ts('more'), | |
57 | FALSE, | |
58 | 'actionSchedule.manage.action', | |
59 | 'ActionSchedule', | |
60 | $this->_id | |
61 | ); | |
6a488035 TO |
62 | } |
63 | ||
4d3e4dbe | 64 | $this->assign('rows', $reminderList); |
0479b4c8 TO |
65 | $this->assign('setTab', $setTab); |
66 | $this->assign('component', 'event'); | |
6a488035 | 67 | |
4d3e4dbe | 68 | // Update tab "disabled" css class |
69 | $this->ajaxResponse['tabValid'] = is_array($reminderList) && (count($reminderList) > 0); | |
70 | $this->setPageTitle(ts('Scheduled Reminder')); | |
6a488035 | 71 | } |
6a488035 | 72 | |
1cd3ffa9 EM |
73 | /** |
74 | * @return string | |
75 | */ | |
00be9182 | 76 | public function getTemplateFileName() { |
4d3e4dbe | 77 | return 'CRM/Admin/Page/ScheduleReminders.tpl'; |
6a488035 | 78 | } |
96025800 | 79 | |
ef10e0b5 | 80 | } |