Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * This implements the profile page for all contacts. It uses a selector | |
38 | * object to do the actual dispay. The fields displayd are controlled by | |
39 | * the admin | |
40 | */ | |
41 | class CRM_Mailing_Page_Event extends CRM_Core_Page { | |
42 | ||
43 | /** | |
fe482240 | 44 | * All the fields that are listings related. |
6a488035 TO |
45 | * |
46 | * @var array | |
6a488035 TO |
47 | */ |
48 | protected $_fields; | |
49 | ||
50 | /** | |
100fef9d | 51 | * Run this page (figure out the action needed and perform it). |
6a488035 TO |
52 | * |
53 | * @return void | |
54 | */ | |
00be9182 | 55 | public function run() { |
6a488035 TO |
56 | $selector = &new CRM_Mailing_Selector_Event( |
57 | CRM_Utils_Request::retrieve('event', 'String', $this), | |
58 | CRM_Utils_Request::retrieve('distinct', 'Boolean', $this), | |
59 | CRM_Utils_Request::retrieve('mid', 'Positive', $this), | |
60 | CRM_Utils_Request::retrieve('jid', 'Positive', $this), | |
61 | CRM_Utils_Request::retrieve('uid', 'Positive', $this) | |
62 | ); | |
63 | ||
64 | $mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this); | |
65 | ||
01c22255 KJ |
66 | //assign backurl |
67 | $context = CRM_Utils_Request::retrieve('context', 'String', $this); | |
68 | ||
5a99d240 KJ |
69 | if ($context == 'activitySelector') { |
70 | $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this); | |
71 | $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity"); | |
72 | $backUrlTitle = ts('Back to Activities'); | |
73 | } | |
74 | elseif ($context == 'mailing') { | |
01c22255 KJ |
75 | $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this); |
76 | $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing"); | |
77 | $backUrlTitle = ts('Back to Mailing'); | |
78 | } | |
05381a97 TO |
79 | elseif ($context == 'angPage') { |
80 | $angPage = CRM_Utils_Request::retrieve('angPage', 'String', $this); | |
81 | if (!preg_match(':^[a-zA-Z0-9\-_/]+$:', $angPage)) { | |
82 | CRM_Core_Error::fatal('Malformed return URL'); | |
83 | } | |
84 | $backUrl = CRM_Utils_System::url('civicrm/a/#/' . $angPage); | |
85 | $backUrlTitle = ts('Back to Report'); | |
86 | } | |
01c22255 | 87 | else { |
9afae995 | 88 | $backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}"); |
01c22255 KJ |
89 | $backUrlTitle = ts('Back to Report'); |
90 | } | |
91 | ||
92 | $this->assign('backUrl', $backUrl); | |
93 | $this->assign('backUrlTitle', $backUrlTitle); | |
94 | ||
6a488035 TO |
95 | CRM_Utils_System::setTitle($selector->getTitle()); |
96 | $this->assign('title', $selector->getTitle()); | |
97 | $this->assign('mailing_id', $mailing_id); | |
98 | ||
99 | $sortID = NULL; | |
100 | if ($this->get(CRM_Utils_Sort::SORT_ID)) { | |
101 | $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), | |
102 | $this->get(CRM_Utils_Sort::SORT_DIRECTION) | |
103 | ); | |
104 | } | |
105 | ||
106 | $controller = new CRM_Core_Selector_Controller( | |
107 | $selector, | |
108 | $this->get(CRM_Utils_Pager::PAGE_ID), | |
109 | $sortID, | |
110 | CRM_Core_Action::VIEW, | |
111 | $this, | |
112 | CRM_Core_Selector_Controller::TEMPLATE | |
113 | ); | |
114 | ||
115 | $controller->setEmbedded(TRUE); | |
116 | $controller->run(); | |
117 | ||
118 | return parent::run(); | |
119 | } | |
96025800 | 120 | |
6a488035 | 121 | } |