c43b685ed3a4fa538a7c654fcf9ec32ea368ce31
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
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['crmMailingAB'] = array(
62 'js' => array('js/angular-crmMailingAB.js'),
63 'css' => array('css/angular-crmMailingAB.css'),
66 $civiMails = civicrm_api3('Mailing', 'get', array());
67 $campNames = civicrm_api3('Campaign', 'get', array());
68 $mailStatus = civicrm_api3('MailingJob', 'get', array());
69 $groupNames = civicrm_api3('Group', 'get', array());
70 $headerfooterList = civicrm_api3('MailingComponent', 'get', array());
71 $emailAdd = civicrm_api3('Email', 'get', array(
76 $mesTemplate = civicrm_api3('MessageTemplate', 'get', array(
78 'return' => array("msg_html", "id", "msg_title"),
79 'id' => array('>' => 58),
82 CRM_Core_Resources
::singleton()->addSetting(array(
83 'crmMailing' => array(
84 'civiMails' => array_values($civiMails['values']),
85 'campNames' => array_values($campNames['values']),
86 'mailStatus' => array_values($mailStatus['values']),
87 'groupNames' => array_values($groupNames['values']),
88 'headerfooterList' => array_values($headerfooterList['values']),
89 'mesTemplate' => array_values($mesTemplate['values']),
90 'emailAdd' => array_values($emailAdd['values']),
101 static function workflowEnabled() {
102 $config = CRM_Core_Config
::singleton();
104 // early exit, since not true for most
105 if (!$config->userSystem
->is_drupal ||
106 !function_exists('module_exists')
111 if (!module_exists('rules')) {
115 $enableWorkflow = CRM_Core_BAO_Setting
::getItem(CRM_Core_BAO_Setting
::MAILING_PREFERENCES_NAME
,
121 return ($enableWorkflow &&
122 $config->userSystem
->is_drupal
126 // docs inherited from interface
128 * @param bool $getAllUnconditionally
132 public function getPermissions($getAllUnconditionally = FALSE) {
133 $permissions = array(
135 'access CiviMail subscribe/unsubscribe pages',
136 'delete in CiviMail',
137 'view public CiviMail content',
140 if (self
::workflowEnabled() ||
$getAllUnconditionally) {
141 $permissions[] = 'create mailings';
142 $permissions[] = 'schedule mailings';
143 $permissions[] = 'approve mailings';
150 // docs inherited from interface
154 public function getUserDashboardElement() {
155 // no dashboard element for this component
162 public function getUserDashboardObject() {
163 // no dashboard element for this component
167 // docs inherited from interface
171 public function registerTab() {
173 'title' => ts('Mailings'),
180 // docs inherited from interface
184 public function registerAdvancedSearchPane() {
185 return array('title' => ts('Mailings'),
190 // docs inherited from interface
194 public function getActivityTypes() {
198 // add shortcut to Create New
202 public function creatNewShortcut(&$shortCuts) {}