Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
7e9e8871 | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
fa938177 | 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
6a488035 TO |
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 and the CiviCRM Licensing Exception. | | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * | |
31 | * @package CRM | |
fa938177 | 32 | * @copyright CiviCRM LLC (c) 2004-2016 |
6a488035 TO |
33 | * $Id$ |
34 | * | |
35 | */ | |
36 | ||
37 | /** | |
38 | * This class generates form components for scheduling reminders for Event | |
39 | * | |
40 | */ | |
41 | class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_ManageEvent { | |
42 | ||
43 | /** | |
66f9e52b | 44 | * Set variables up before form is built. |
6a488035 TO |
45 | * |
46 | * @return void | |
6a488035 | 47 | */ |
00be9182 | 48 | public function preProcess() { |
6a488035 | 49 | parent::preProcess(); |
4d3e4dbe | 50 | $setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0); |
6a488035 | 51 | |
77e16391 | 52 | $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array( |
46f5566c | 53 | 'id' => ($this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID), |
77e16391 TO |
54 | ))); |
55 | $reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $mapping, $this->_id); | |
4d3e4dbe | 56 | if ($reminderList && is_array($reminderList)) { |
57 | // Add action links to each of the reminders | |
58 | foreach ($reminderList as & $format) { | |
59 | $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE; | |
60 | if ($format['is_active']) { | |
61 | $action += CRM_Core_Action::DISABLE; | |
62 | } | |
63 | else { | |
64 | $action += CRM_Core_Action::ENABLE; | |
65 | } | |
317fceb4 | 66 | $scheduleReminder = new CRM_Admin_Page_ScheduleReminders(); |
4d3e4dbe | 67 | $links = $scheduleReminder->links(); |
68 | $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}"; | |
69 | $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}"; | |
70 | $format['action'] = CRM_Core_Action::formLink( | |
71 | $links, | |
72 | $action, | |
73 | array('id' => $format['id']), | |
74 | ts('more'), | |
75 | FALSE, | |
76 | 'actionSchedule.manage.action', | |
77 | 'ActionSchedule', | |
78 | $this->_id | |
79 | ); | |
6a488035 TO |
80 | } |
81 | } | |
82 | ||
4d3e4dbe | 83 | $this->assign('rows', $reminderList); |
0479b4c8 TO |
84 | $this->assign('setTab', $setTab); |
85 | $this->assign('component', 'event'); | |
6a488035 | 86 | |
4d3e4dbe | 87 | // Update tab "disabled" css class |
88 | $this->ajaxResponse['tabValid'] = is_array($reminderList) && (count($reminderList) > 0); | |
89 | $this->setPageTitle(ts('Scheduled Reminder')); | |
6a488035 | 90 | } |
6a488035 | 91 | |
1cd3ffa9 EM |
92 | /** |
93 | * @return string | |
94 | */ | |
00be9182 | 95 | public function getTemplateFileName() { |
4d3e4dbe | 96 | return 'CRM/Admin/Page/ScheduleReminders.tpl'; |
6a488035 | 97 | } |
96025800 | 98 | |
ef10e0b5 | 99 | } |