Merge pull request #13170 from elisseck/dev/core/485
[civicrm-core.git] / CRM / Mailing / Page / Component.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
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 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2019
32 */
33
34 /**
35 * Page to display / edit the header / footer of a mailing
36 *
37 */
38 class CRM_Mailing_Page_Component extends CRM_Core_Page_Basic {
39
40 /**
41 * The action links that we need to display for the browse screen.
42 *
43 * @var array
44 */
45 static $_links = NULL;
46
47 /**
48 * Get BAO Name.
49 *
50 * @return string
51 * Classname of BAO.
52 */
53 public function getBAOName() {
54 return 'CRM_Mailing_BAO_MailingComponent';
55 }
56
57 /**
58 * Get action Links.
59 *
60 * @return array
61 * (reference) of action links
62 */
63 public function &links() {
64 if (!(self::$_links)) {
65 self::$_links = array(
66 CRM_Core_Action::UPDATE => array(
67 'name' => ts('Edit'),
68 'url' => CRM_Utils_System::currentPath(),
69 'qs' => 'action=update&id=%%id%%',
70 'title' => ts('Edit Mailing Component'),
71 ),
72 CRM_Core_Action::DISABLE => array(
73 'name' => ts('Disable'),
74 'ref' => 'crm-enable-disable',
75 'title' => ts('Disable Mailing Component'),
76 ),
77 CRM_Core_Action::ENABLE => array(
78 'name' => ts('Enable'),
79 'ref' => 'crm-enable-disable',
80 'title' => ts('Enable Mailing Component'),
81 ),
82 );
83 }
84 return self::$_links;
85 }
86
87 /**
88 * Get name of edit form.
89 *
90 * @return string
91 * Classname of edit form.
92 */
93 public function editForm() {
94 return 'CRM_Mailing_Form_Component';
95 }
96
97 /**
98 * Get edit form name.
99 *
100 * @return string
101 * name of this page.
102 */
103 public function editName() {
104 return 'Mailing Components';
105 }
106
107 /**
108 * Get user context.
109 *
110 * @param null $mode
111 *
112 * @return string
113 * user context.
114 */
115 public function userContext($mode = NULL) {
116 return CRM_Utils_System::currentPath();
117 }
118
119 /**
120 * @param null $args
121 * @param null $pageArgs
122 * @param null $sort
123 */
124 public function run($args = NULL, $pageArgs = NULL, $sort = NULL) {
125 return parent::run($args, $pageArgs, "component_type, is_default desc, name");
126 }
127
128 }