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