Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
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 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
bf8648e1 | 19 | * This implements the profile page for all contacts. |
20 | * | |
21 | * It uses a selector object to do the actual display. The fields displayed are controlled by | |
6a488035 TO |
22 | * the admin |
23 | */ | |
24 | class CRM_Mailing_Page_Event extends CRM_Core_Page { | |
25 | ||
26 | /** | |
fe482240 | 27 | * All the fields that are listings related. |
6a488035 TO |
28 | * |
29 | * @var array | |
6a488035 TO |
30 | */ |
31 | protected $_fields; | |
32 | ||
33 | /** | |
100fef9d | 34 | * Run this page (figure out the action needed and perform it). |
6a488035 | 35 | */ |
00be9182 | 36 | public function run() { |
bf8648e1 | 37 | $selector = new CRM_Mailing_Selector_Event( |
6a488035 TO |
38 | CRM_Utils_Request::retrieve('event', 'String', $this), |
39 | CRM_Utils_Request::retrieve('distinct', 'Boolean', $this), | |
40 | CRM_Utils_Request::retrieve('mid', 'Positive', $this), | |
41 | CRM_Utils_Request::retrieve('jid', 'Positive', $this), | |
42 | CRM_Utils_Request::retrieve('uid', 'Positive', $this) | |
43 | ); | |
44 | ||
45 | $mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this); | |
46 | ||
5bcf3e57 DJ |
47 | // check that the user has permission to access mailing id |
48 | CRM_Mailing_BAO_Mailing::checkPermission($mailing_id); | |
49 | ||
edc80cda | 50 | $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); |
01c22255 | 51 | |
5a99d240 KJ |
52 | if ($context == 'activitySelector') { |
53 | $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this); | |
54 | $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity"); | |
55 | $backUrlTitle = ts('Back to Activities'); | |
56 | } | |
57 | elseif ($context == 'mailing') { | |
01c22255 KJ |
58 | $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this); |
59 | $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing"); | |
60 | $backUrlTitle = ts('Back to Mailing'); | |
61 | } | |
05381a97 TO |
62 | elseif ($context == 'angPage') { |
63 | $angPage = CRM_Utils_Request::retrieve('angPage', 'String', $this); | |
64 | if (!preg_match(':^[a-zA-Z0-9\-_/]+$:', $angPage)) { | |
2a7b8221 | 65 | throw new CRM_Core_Exception('Malformed return URL'); |
05381a97 TO |
66 | } |
67 | $backUrl = CRM_Utils_System::url('civicrm/a/#/' . $angPage); | |
68 | $backUrlTitle = ts('Back to Report'); | |
69 | } | |
01c22255 | 70 | else { |
9afae995 | 71 | $backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}"); |
01c22255 KJ |
72 | $backUrlTitle = ts('Back to Report'); |
73 | } | |
74 | ||
75 | $this->assign('backUrl', $backUrl); | |
76 | $this->assign('backUrlTitle', $backUrlTitle); | |
77 | ||
6a488035 TO |
78 | CRM_Utils_System::setTitle($selector->getTitle()); |
79 | $this->assign('title', $selector->getTitle()); | |
80 | $this->assign('mailing_id', $mailing_id); | |
81 | ||
82 | $sortID = NULL; | |
83 | if ($this->get(CRM_Utils_Sort::SORT_ID)) { | |
84 | $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), | |
85 | $this->get(CRM_Utils_Sort::SORT_DIRECTION) | |
86 | ); | |
87 | } | |
88 | ||
89 | $controller = new CRM_Core_Selector_Controller( | |
90 | $selector, | |
91 | $this->get(CRM_Utils_Pager::PAGE_ID), | |
92 | $sortID, | |
93 | CRM_Core_Action::VIEW, | |
94 | $this, | |
95 | CRM_Core_Selector_Controller::TEMPLATE | |
96 | ); | |
97 | ||
98 | $controller->setEmbedded(TRUE); | |
99 | $controller->run(); | |
100 | ||
101 | return parent::run(); | |
102 | } | |
96025800 | 103 | |
6a488035 | 104 | } |