3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2017
35 * Page for displaying list of Mail account settings.
37 class CRM_Admin_Page_MailSettings
extends CRM_Core_Page_Basic
{
39 public $useLivePageJS = TRUE;
42 * The action links that we need to display for the browse screen.
46 static $_links = NULL;
54 public function getBAOName() {
55 return 'CRM_Core_BAO_MailSettings';
62 * (reference) of action links
64 public function &links() {
65 if (!(self
::$_links)) {
66 // helper variable for nicer formatting
67 self
::$_links = array(
68 CRM_Core_Action
::UPDATE
=> array(
70 'url' => 'civicrm/admin/mailSettings',
71 'qs' => 'action=update&id=%%id%%&reset=1',
72 'title' => ts('Edit Mail Settings'),
74 CRM_Core_Action
::DELETE
=> array(
75 'name' => ts('Delete'),
76 'url' => 'civicrm/admin/mailSettings',
77 'qs' => 'action=delete&id=%%id%%',
78 'title' => ts('Delete Mail Settings'),
87 * Browse all mail settings.
89 public function browse() {
90 //get all mail settings.
91 $allMailSettings = array();
92 $mailSetting = new CRM_Core_DAO_MailSettings();
94 $allProtocols = CRM_Core_PseudoConstant
::get('CRM_Core_DAO_MailSettings', 'protocol');
96 //multi-domain support for mail settings. CRM-5244
97 $mailSetting->domain_id
= CRM_Core_Config
::domainID();
99 //find all mail settings.
100 $mailSetting->find();
101 while ($mailSetting->fetch()) {
102 //replace protocol value with name
103 $mailSetting->protocol
= CRM_Utils_Array
::value($mailSetting->protocol
, $allProtocols);
104 CRM_Core_DAO
::storeValues($mailSetting, $allMailSettings[$mailSetting->id
]);
106 //form all action links
107 $action = array_sum(array_keys($this->links()));
109 // disallow the DELETE action for the default set of settings
110 if ($mailSetting->is_default
) {
111 $action &= ~CRM_Core_Action
::DELETE
;
115 $allMailSettings[$mailSetting->id
]['action'] = CRM_Core_Action
::formLink(self
::links(), $action,
116 array('id' => $mailSetting->id
),
119 'mailSetting.manage.action',
125 $this->assign('rows', $allMailSettings);
129 * Get name of edit form.
132 * Classname of edit form.
134 public function editForm() {
135 return 'CRM_Admin_Form_MailSettings';
139 * Get edit form name.
144 public function editName() {
145 return 'Mail Settings';
156 public function userContext($mode = NULL) {
157 return 'civicrm/admin/mailSettings';