962e832229f385f7395dc95c63875301d83aedc9
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 +--------------------------------------------------------------------+
29 * This class introduces component to the system and provides all the
30 * information about it. It needs to extend CRM_Core_Component_Info
34 * @copyright CiviCRM LLC (c) 2004-2014
38 class CRM_Mailing_Info
extends CRM_Core_Component_Info
{
40 // docs inherited from interface
41 protected $keyword = 'mailing';
44 // docs inherited from interface
48 public function getInfo() {
51 'translatedName' => ts('CiviMail'),
52 'title' => 'CiviCRM Mailing Engine',
54 'showActivitiesInCore' => 1,
58 public function getAngularModules() {
60 $result['crmMailing'] = array(
62 'js' => array('js/angular-crmMailing.js', 'js/angular-crmMailing/services.js', 'js/angular-crmMailing/directives.js'),
63 'css' => array('css/angular-crmMailing.css'),
65 $result['crmMailingAB'] = array(
67 'js' => array('js/angular-crmMailingAB.js', 'js/angular-crmMailingAB/services.js', 'js/angular-crmMailingAB/directives.js'),
68 'css' => array('css/angular-crmMailingAB.css'),
70 $result['crmD3'] = array(
72 'js' => array('js/angular-crmD3.js', 'js/d3.min.js'),
75 $config = CRM_Core_Config
::singleton();
76 $session = CRM_Core_Session
::singleton();
77 $contactID = $session->get('userID');
78 $civiMails = civicrm_api3('Mailing', 'get', array());
79 $campNames = civicrm_api3('Campaign', 'get', array());
80 $mailingabNames = civicrm_api3('MailingAB','get',array());
81 $mailStatus = civicrm_api3('MailingJob', 'get', array());
82 $groupNames = civicrm_api3('Group', 'get', array());
83 $headerfooterList = civicrm_api3('MailingComponent', 'get', array());
85 // FIXME: The following two items differ between GSOC CiviMail and ABTest branches
88 $emailAdd = civicrm_api3('Email', 'get', array());
89 $mesTemplate = civicrm_api3('MessageTemplate', 'get', array(
91 'return' => array("msg_html", "id", "msg_title","msg_subject"),
92 'id' => array('>' => 58),
96 $emailAdd = civicrm_api3('Email', 'get', array(
99 'contact_id' => $contactID,
101 $mesTemplate = civicrm_api3('MessageTemplate', 'get', array( 'sequential' => 1,
102 'return' => array("msg_html", "id", "msg_title", "msg_subject", "msg_text"),
103 'workflow_id' => array('IS NULL' => ""),
106 $mailGrp = civicrm_api3('MailingGroup','get', array());
107 $mailTokens = civicrm_api3('Mailing', 'get_token', array( 'usage' => 'Mailing'));
108 $fromAddress = civicrm_api3('OptionGroup', 'get', array(
110 'name' => "from_email_address",
111 'api.OptionValue.get' => array(),
113 CRM_Core_Resources
::singleton()->addSetting(array(
114 'crmMailing' => array(
115 'mailingabNames'=>array_values($mailingabNames['values']),
116 'civiMails' => array_values($civiMails['values']),
117 'campNames' => array_values($campNames['values']),
118 'mailStatus' => array_values($mailStatus['values']),
119 'groupNames' => array_values($groupNames['values']),
120 'headerfooterList' => array_values($headerfooterList['values']),
121 'mesTemplate' => array_values($mesTemplate['values']),
122 'emailAdd' => array_values($emailAdd['values']),
123 'mailGrp' => array_values($mailGrp['values']),
124 'mailTokens' => array_values($mailTokens),
125 'contactid' => $contactID,
126 'enableReplyTo' => isset($config->replyTo
) ?
$config->replyTo
: 0,
127 'fromAddress' => array_values($fromAddress['values'][0]['api.OptionValue.get']['values']),
128 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array('id' => 'user_contact_id', 'return' => 'email')),
129 'visibility' => array(
130 array('value' => 'Public Pages', 'label' => ts('Public Pages')),
131 array('value' => 'User and User Admin Only', 'label' => ts('User and User Admin Only')),
142 public static function workflowEnabled() {
143 $config = CRM_Core_Config
::singleton();
145 // early exit, since not true for most
146 if (!$config->userSystem
->is_drupal ||
147 !function_exists('module_exists')
152 if (!module_exists('rules')) {
156 $enableWorkflow = CRM_Core_BAO_Setting
::getItem(CRM_Core_BAO_Setting
::MAILING_PREFERENCES_NAME
,
162 return ($enableWorkflow &&
163 $config->userSystem
->is_drupal
167 // docs inherited from interface
169 * @param bool $getAllUnconditionally
173 public function getPermissions($getAllUnconditionally = FALSE) {
174 $permissions = array(
176 'access CiviMail subscribe/unsubscribe pages',
177 'delete in CiviMail',
178 'view public CiviMail content',
181 if (self
::workflowEnabled() ||
$getAllUnconditionally) {
182 $permissions[] = 'create mailings';
183 $permissions[] = 'schedule mailings';
184 $permissions[] = 'approve mailings';
191 // docs inherited from interface
195 public function getUserDashboardElement() {
196 // no dashboard element for this component
203 public function getUserDashboardObject() {
204 // no dashboard element for this component
208 // docs inherited from interface
212 public function registerTab() {
214 'title' => ts('Mailings'),
221 // docs inherited from interface
225 public function registerAdvancedSearchPane() {
226 return array('title' => ts('Mailings'),
231 // docs inherited from interface
235 public function getActivityTypes() {
239 // add shortcut to Create New
243 public function creatNewShortcut(&$shortCuts) {}