Modifications to CRM-16777
[civicrm-core.git] / CRM / Admin / Form / ScheduleReminders.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
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-2015
33 * $Id$
34 *
35 */
36
37 /**
38 * This class generates form components for Scheduling Reminders
39 *
40 */
41 class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
42
43 /**
44 * Scheduled Reminder ID.
45 */
46 protected $_id = NULL;
47
48 public $_freqUnits;
49
50 /**
51 * Build the form object.
52 *
53 * @return void
54 */
55 public function buildQuickForm() {
56 parent::buildQuickForm();
57 $this->_mappingID = $mappingID = NULL;
58 $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
59 $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
60
61 //CRM-16777: Don't provide access to administer schedule reminder page, with user that does not have 'administer CiviCRM' permission
62 if (empty($this->_context) && !CRM_Core_Permission::check('administer CiviCRM')) {
63 CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
64 }
65
66 if ($this->_action & (CRM_Core_Action::DELETE)) {
67 $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title');
68 if ($this->_context == 'event') {
69 $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
70 }
71 $this->assign('reminderName', $reminderName);
72 return;
73 }
74 elseif ($this->_action & (CRM_Core_Action::UPDATE)) {
75 $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
76 if ($this->_context == 'event') {
77 $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
78 }
79 }
80 elseif (!empty($this->_context)) {
81 if ($this->_context == 'event') {
82 $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
83 $field = 'civicrm_event';
84 $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_compId, 'is_template');
85 if ($isTemplate) {
86 $field = 'event_template';
87 }
88 $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value');
89 if (!$this->_mappingID) {
90 CRM_Core_Error::fatal('Could not find mapping for event scheduled reminders.');
91 }
92 }
93 }
94
95 if (!empty($_POST) && !empty($_POST['entity']) && empty($this->_context)) {
96 $mappingID = $_POST['entity'][0];
97 }
98 elseif ($this->_mappingID) {
99 $mappingID = $this->_mappingID;
100 }
101
102 $this->add(
103 'text',
104 'title',
105 ts('Title'),
106 array('size' => 45, 'maxlength' => 128),
107 TRUE
108 );
109
110 $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection($mappingID);
111 extract($selectionOptions);
112 $this->assign('entityMapping', json_encode($entityMapping));
113 $this->assign('recipientMapping', json_encode($recipientMapping));
114
115 if (empty($this->_context)) {
116 if (empty($sel1)) {
117 CRM_Core_Error::fatal('Could not find mapping for scheduled reminders.');
118 }
119
120 $sel = &$this->add(
121 'hierselect',
122 'entity',
123 ts('Entity'),
124 array(
125 'name' => 'entity[0]',
126 'style' => 'vertical-align: top;',
127 )
128 );
129 $sel->setOptions(array($sel1, $sel2, $sel3));
130
131 if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
132 // make second selector a multi-select -
133 $sel->_elements[1]->setMultiple(TRUE);
134 $sel->_elements[1]->setSize(5);
135 }
136
137 if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
138 // make third selector a multi-select -
139 $sel->_elements[2]->setMultiple(TRUE);
140 $sel->_elements[2]->setSize(5);
141 }
142 }
143 else {
144 $options = $sel3[$this->_mappingID][0];
145 $attributes = array('multiple' => 'multiple', 'class' => 'crm-select2 huge', 'placeholder' => $options[0]);
146 unset($options[0]);
147 $this->add('select', 'entity', ts('Recipient(s)'), $options, TRUE, $attributes);
148 $this->assign('context', $this->_context);
149 }
150
151 //get the frequency units.
152 $this->_freqUnits = CRM_Core_SelectValues::getRecurringFrequencyUnits();
153
154 //pass the mapping ID in UPDATE mode
155 $mappings = CRM_Core_BAO_ActionSchedule::getMapping($mappingID);
156
157 $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
158
159 //reminder_interval
160 $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
161 $isActive = ts('Send email');
162 $recordActivity = ts('Record activity for automated email');
163 if ($providersCount) {
164 $this->assign('sms', $providersCount);
165 $isActive = ts('Send email or SMS');
166 $recordActivity = ts('Record activity for automated email or SMS');
167 $options = CRM_Core_OptionGroup::values('msg_mode');
168 $this->add('select', 'mode', ts('Send as'), $options);
169
170 $providers = CRM_SMS_BAO_Provider::getProviders(NULL, NULL, TRUE, 'is_default desc');
171
172 $providerSelect = array();
173 foreach ($providers as $provider) {
174 $providerSelect[$provider['id']] = $provider['title'];
175 }
176 $this->add('select', 'sms_provider_id', ts('SMS Provider'), $providerSelect, TRUE);
177 }
178
179 foreach ($this->_freqUnits as $val => $label) {
180 $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
181 }
182
183 $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing'));
184
185 //reminder_frequency
186 $this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE);
187
188 $condition = array(
189 'before' => ts('before'),
190 'after' => ts('after'),
191 );
192 //reminder_action
193 $this->add('select', 'start_action_condition', ts('Action Condition'), $condition);
194
195 $this->add('select', 'start_action_date', ts('Date Field'), $sel4, TRUE);
196
197 $this->addElement('checkbox', 'record_activity', $recordActivity);
198
199 $this->addElement('checkbox', 'is_repeat', ts('Repeat'),
200 NULL, array('onchange' => "return showHideByValue('is_repeat',true,'repeatFields','table-row','radio',false);")
201 );
202
203 $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay);
204 $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions);
205 $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay);
206 $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions);
207 $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
208 $this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE);
209
210 $this->add('text', 'from_name', ts('From Name'));
211 $this->add('text', 'from_email', ts('From Email'));
212
213 $recipient = 'activity_contacts';
214 $recipientListingOptions = array();
215
216 if ($mappingID) {
217 $recipient = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping',
218 $mappingID,
219 'entity_recipient'
220 );
221 }
222
223 $limitOptions = array('' => '-neither-', 1 => ts('Limit to'), 0 => ts('Also include'));
224
225 $recipientLabels = array('activity' => ts('Recipients'), 'other' => ts('Limit or Add Recipients'));
226 $this->assign('recipientLabels', $recipientLabels);
227
228 $this->add('select', 'limit_to', ts('Limit Options'), $limitOptions, FALSE, array('onChange' => "showHideByValue('limit_to','','recipient', 'select','select',true);"));
229
230 $this->add('select', 'recipient', $recipientLabels['other'], $sel5[$recipient],
231 FALSE, array('onchange' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);")
232 );
233
234 if (!empty($this->_submitValues['recipient_listing'])) {
235 if (!empty($this->_context)) {
236 $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_mappingID, $this->_submitValues['recipient']);
237 }
238 else {
239 $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']);
240 }
241 }
242 elseif (!empty($this->_values['recipient_listing'])) {
243 $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_values['mapping_id'], $this->_values['recipient']);
244 }
245
246 $this->add('select', 'recipient_listing', ts('Recipient Roles'), $recipientListingOptions, FALSE,
247 array('multiple' => TRUE, 'class' => 'crm-select2 huge', 'placeholder' => TRUE));
248
249 $this->addEntityRef('recipient_manual_id', ts('Manual Recipients'), array('multiple' => TRUE, 'create' => TRUE));
250
251 $this->add('select', 'group_id', ts('Group'),
252 CRM_Core_PseudoConstant::nestedGroup('Mailing'), FALSE, array('class' => 'crm-select2 huge')
253 );
254
255 CRM_Mailing_BAO_Mailing::commonCompose($this);
256
257 $this->add('text', 'subject', ts('Subject'),
258 CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActionSchedule', 'subject')
259 );
260
261 $this->add('checkbox', 'is_active', $isActive);
262
263 $this->addFormRule(array('CRM_Admin_Form_ScheduleReminders', 'formRule'), $this);
264
265 $this->setPageTitle(ts('Scheduled Reminder'));
266 }
267
268 /**
269 * Global form rule.
270 *
271 * @param array $fields
272 * The input form values.
273 *
274 * @return bool|array
275 * true if no errors, else array of errors
276 */
277 public static function formRule($fields, $files, $self) {
278 $errors = array();
279 if ((array_key_exists(1, $fields['entity']) && $fields['entity'][1][0] === 0) ||
280 (array_key_exists(2, $fields['entity']) && $fields['entity'][2][0] == 0)
281 ) {
282 $errors['entity'] = ts('Please select appropriate value');
283 }
284
285 if (array_key_exists(1, $fields['entity']) && !is_numeric($fields['entity'][1][0])) {
286 if (count($fields['entity'][1]) > 1) {
287 $errors['entity'] = ts('You may only select one contact field per reminder');
288 }
289 elseif (!(array_key_exists(2, $fields['entity']) && $fields['entity'][2][0] > 0)) {
290 $errors['entity'] = ts('Please select whether the reminder is sent each year.');
291 }
292 }
293
294 if (!empty($fields['is_active']) &&
295 CRM_Utils_Array::value('mode', $fields) == 'SMS' &&
296 CRM_Utils_System::isNull($fields['subject'])
297 ) {
298 $errors['subject'] = ts('Subject is a required field.');
299 }
300
301 if (empty($self->_context) && CRM_Utils_System::isNull(CRM_Utils_Array::value(1, $fields['entity']))) {
302 $errors['entity'] = ts('Please select entity value');
303 }
304
305 if (!CRM_Utils_System::isNull($fields['absolute_date'])) {
306 if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($fields['absolute_date'], NULL)) < CRM_Utils_Date::format(date('Ymd'))) {
307 $errors['absolute_date'] = ts('Absolute date cannot be earlier than the current time.');
308 }
309 }
310
311 $recipientKind = array(
312 'participant_role' => array(
313 'name' => 'participant role',
314 'target_id' => 'recipient_listing',
315 ),
316 'manual' => array(
317 'name' => 'recipient',
318 'target_id' => 'recipient_manual_id',
319 ),
320 );
321 if ($fields['limit_to'] != '' && array_key_exists($fields['recipient'], $recipientKind) && empty($fields[$recipientKind[$fields['recipient']]['target_id']])) {
322 $errors[$recipientKind[$fields['recipient']]['target_id']] = ts('If "Also include" or "Limit to" are selected, you must specify at least one %1', array(1 => $recipientKind[$fields['recipient']]['name']));
323 }
324
325 if (!empty($errors)) {
326 return $errors;
327 }
328
329 return empty($errors) ? TRUE : $errors;
330 }
331
332 /**
333 * @return int
334 */
335 public function setDefaultValues() {
336 if ($this->_action & CRM_Core_Action::ADD) {
337 $defaults['is_active'] = 1;
338 $defaults['mode'] = 'Email';
339 $defaults['record_activity'] = 1;
340 }
341 else {
342 $defaults = $this->_values;
343 $entityValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('entity_value', $defaults));
344 $entityStatus = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('entity_status', $defaults));
345 if (empty($this->_context)) {
346 $defaults['entity'][0] = CRM_Utils_Array::value('mapping_id', $defaults);
347 $defaults['entity'][1] = $entityValue;
348 $defaults['entity'][2] = $entityStatus;
349 }
350 else {
351 $defaults['entity'] = $entityStatus;
352 }
353 if ($absoluteDate = CRM_Utils_Array::value('absolute_date', $defaults)) {
354 list($date, $time) = CRM_Utils_Date::setDateDefaults($absoluteDate);
355 $defaults['absolute_date'] = $date;
356 }
357
358 if ($recipientListing = CRM_Utils_Array::value('recipient_listing', $defaults)) {
359 $defaults['recipient_listing'] = explode(CRM_Core_DAO::VALUE_SEPARATOR,
360 $recipientListing
361 );
362 }
363 $defaults['text_message'] = CRM_Utils_Array::value('body_text', $defaults);
364 $defaults['html_message'] = CRM_Utils_Array::value('body_html', $defaults);
365 $defaults['sms_text_message'] = CRM_Utils_Array::value('sms_body_text', $defaults);
366 $defaults['template'] = CRM_Utils_Array::value('msg_template_id', $defaults);
367 $defaults['SMStemplate'] = CRM_Utils_Array::value('sms_template_id', $defaults);
368 if (!empty($defaults['group_id'])) {
369 $defaults['recipient'] = 'group';
370 }
371 elseif (!empty($defaults['recipient_manual'])) {
372 $defaults['recipient'] = 'manual';
373 $defaults['recipient_manual_id'] = $defaults['recipient_manual'];
374 }
375 }
376
377 return $defaults;
378 }
379
380 /**
381 * Process the form submission.
382 *
383 *
384 * @return void
385 */
386 public function postProcess() {
387 if ($this->_action & CRM_Core_Action::DELETE) {
388 // delete reminder
389 CRM_Core_BAO_ActionSchedule::del($this->_id);
390 CRM_Core_Session::setStatus(ts('Selected Reminder has been deleted.'), ts('Record Deleted'), 'success');
391 if ($this->_context == 'event' && $this->_compId) {
392 $url = CRM_Utils_System::url('civicrm/event/manage/reminder',
393 "reset=1&action=browse&id={$this->_compId}&component={$this->_context}&setTab=1"
394 );
395 $session = CRM_Core_Session::singleton();
396 $session->pushUserContext($url);
397 }
398 return;
399 }
400 $values = $this->controller->exportValues($this->getName());
401
402 $keys = array(
403 'title',
404 'subject',
405 'absolute_date',
406 'group_id',
407 'record_activity',
408 'limit_to',
409 'mode',
410 'sms_provider_id',
411 'from_name',
412 'from_email',
413 );
414 foreach ($keys as $key) {
415 $params[$key] = CRM_Utils_Array::value($key, $values);
416 }
417
418 $params['is_repeat'] = CRM_Utils_Array::value('is_repeat', $values, 0);
419
420 $moreKeys = array(
421 'start_action_offset',
422 'start_action_unit',
423 'start_action_condition',
424 'start_action_date',
425 'repetition_frequency_unit',
426 'repetition_frequency_interval',
427 'end_frequency_unit',
428 'end_frequency_interval',
429 'end_action',
430 'end_date',
431 );
432
433 if ($absoluteDate = CRM_Utils_Array::value('absolute_date', $params)) {
434 $params['absolute_date'] = CRM_Utils_Date::processDate($absoluteDate);
435 $params['is_repeat'] = 0;
436 foreach ($moreKeys as $mkey) {
437 $params[$mkey] = 'null';
438 }
439 }
440 else {
441 $params['absolute_date'] = 'null';
442 foreach ($moreKeys as $mkey) {
443 $params[$mkey] = CRM_Utils_Array::value($mkey, $values);
444 }
445 }
446
447 $params['body_text'] = CRM_Utils_Array::value('text_message', $values);
448 $params['sms_body_text'] = CRM_Utils_Array::value('sms_text_message', $values);
449 $params['body_html'] = CRM_Utils_Array::value('html_message', $values);
450
451 if (CRM_Utils_Array::value('recipient', $values) == 'manual') {
452 $params['recipient_manual'] = CRM_Utils_Array::value('recipient_manual_id', $values);
453 $params['group_id'] = $params['recipient'] = $params['recipient_listing'] = 'null';
454 }
455 elseif (CRM_Utils_Array::value('recipient', $values) == 'group') {
456 $params['group_id'] = $values['group_id'];
457 $params['recipient_manual'] = $params['recipient'] = $params['recipient_listing'] = 'null';
458 }
459 elseif (!CRM_Utils_System::isNull($values['recipient_listing']) && !CRM_Utils_System::isNull($values['limit_to'])) {
460 $params['recipient'] = CRM_Utils_Array::value('recipient', $values);
461 $params['recipient_listing'] = implode(CRM_Core_DAO::VALUE_SEPARATOR,
462 CRM_Utils_Array::value('recipient_listing', $values)
463 );
464 $params['group_id'] = $params['recipient_manual'] = 'null';
465 }
466 else {
467 $params['recipient'] = CRM_Utils_Array::value('recipient', $values);
468 $params['group_id'] = $params['recipient_manual'] = $params['recipient_listing'] = 'null';
469 }
470
471 if (!empty($this->_mappingID) && !empty($this->_compId)) {
472 $params['mapping_id'] = $this->_mappingID;
473 $params['entity_value'] = $this->_compId;
474 $params['entity_status'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $values['entity']);
475 }
476 else {
477 $params['mapping_id'] = $values['entity'][0];
478 $entity_value = $values['entity'][1];
479 $entity_status = $values['entity'][2];
480 if ($params['mapping_id'] == 1) {
481 $params['limit_to'] = 1;
482 }
483
484 foreach (array('entity_value', 'entity_status') as $key) {
485 $params[$key] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $$key);
486 }
487 }
488
489 $params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0);
490
491 if (CRM_Utils_Array::value('is_repeat', $values) == 0) {
492 $params['repetition_frequency_unit'] = 'null';
493 $params['repetition_frequency_interval'] = 'null';
494 $params['end_frequency_unit'] = 'null';
495 $params['end_frequency_interval'] = 'null';
496 $params['end_action'] = 'null';
497 $params['end_date'] = 'null';
498 }
499
500 if ($this->_action & CRM_Core_Action::UPDATE) {
501 $params['id'] = $this->_id;
502 }
503 elseif ($this->_action & CRM_Core_Action::ADD) {
504 // we do this only once, so name never changes
505 $params['name'] = CRM_Utils_String::munge($params['title'], '_', 64);
506 }
507
508 $modePrefixes = array('Mail' => NULL, 'SMS' => 'SMS');
509
510 if ($params['mode'] == 'Email' || empty($params['sms_provider_id'])) {
511 unset($modePrefixes['SMS']);
512 }
513 elseif ($params['mode'] == 'SMS') {
514 unset($modePrefixes['Mail']);
515 }
516
517 //TODO: handle postprocessing of SMS and/or Email info based on $modePrefixes
518
519 $composeFields = array(
520 'template',
521 'saveTemplate',
522 'updateTemplate',
523 'saveTemplateName',
524 );
525 $msgTemplate = NULL;
526 //mail template is composed
527
528 foreach ($modePrefixes as $prefix) {
529 $composeParams = array();
530 foreach ($composeFields as $key) {
531 $key = $prefix . $key;
532 if (!empty($values[$key])) {
533 $composeParams[$key] = $values[$key];
534 }
535 }
536
537 if (!empty($composeParams[$prefix . 'updateTemplate'])) {
538 $templateParams = array('is_active' => TRUE);
539 if ($prefix == 'SMS') {
540 $templateParams += array(
541 'msg_text' => $params['sms_body_text'],
542 'is_sms' => TRUE,
543 );
544 }
545 else {
546 $templateParams += array(
547 'msg_text' => $params['body_text'],
548 'msg_html' => $params['body_html'],
549 'msg_subject' => $params['subject'],
550 );
551 }
552 $templateParams['id'] = $values[$prefix . 'template'];
553
554 $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
555 }
556
557 if (!empty($composeParams[$prefix . 'saveTemplate'])) {
558 $templateParams = array('is_active' => TRUE);
559 if ($prefix == 'SMS') {
560 $templateParams += array(
561 'msg_text' => $params['sms_body_text'],
562 'is_sms' => TRUE,
563 );
564 }
565 else {
566 $templateParams += array(
567 'msg_text' => $params['body_text'],
568 'msg_html' => $params['body_html'],
569 'msg_subject' => $params['subject'],
570 );
571 }
572 $templateParams['msg_title'] = $composeParams[$prefix . 'saveTemplateName'];
573
574 $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
575 }
576
577 if ($prefix == 'SMS') {
578 if (isset($msgTemplate->id)) {
579 $params['sms_template_id'] = $msgTemplate->id;
580 }
581 else {
582 $params['sms_template_id'] = CRM_Utils_Array::value('SMStemplate', $values);
583 }
584 }
585 else {
586 if (isset($msgTemplate->id)) {
587 $params['msg_template_id'] = $msgTemplate->id;
588 }
589 else {
590 $params['msg_template_id'] = CRM_Utils_Array::value('template', $values);
591 }
592 }
593 }
594
595 $bao = CRM_Core_BAO_ActionSchedule::add($params);
596 // we need to set this on the form so that hooks can identify the created entity
597 $this->set('id', $bao->id);
598 $bao->free();
599
600 $status = ts("Your new Reminder titled %1 has been saved.",
601 array(1 => "<strong>{$values['title']}</strong>")
602 );
603
604 if ($this->_action) {
605 if ($this->_action & CRM_Core_Action::UPDATE) {
606 $status = ts("Your Reminder titled %1 has been updated.",
607 array(1 => "<strong>{$values['title']}</strong>")
608 );
609 }
610
611 if ($this->_context == 'event' && $this->_compId) {
612 $url = CRM_Utils_System::url('civicrm/event/manage/reminder', "reset=1&action=browse&id={$this->_compId}&component={$this->_context}&setTab=1");
613 $session = CRM_Core_Session::singleton();
614 $session->pushUserContext($url);
615 }
616 }
617 CRM_Core_Session::setStatus($status, ts('Saved'), 'success');
618 }
619
620 }