本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::checkPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::checkPermission方法的具体用法?PHP CRM_Mailing_BAO_Mailing::checkPermission怎么用?PHP CRM_Mailing_BAO_Mailing::checkPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::checkPermission方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*/
public function preProcess()
{
$this->_unscheduled = $this->_archived = $archiveLinks = FALSE;
$this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
$this->_sms = CRM_Utils_Request::retrieve('sms', 'Positive', $this);
$this->assign('sms', $this->_sms);
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
$this->assign('action', $this->_action);
$showLinks = TRUE;
if (CRM_Mailing_Info::workflowEnabled()) {
if (CRM_Core_Permission::check('create mailings')) {
$archiveLinks = TRUE;
}
if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings')) {
$showLinks = FALSE;
}
}
$this->assign('showLinks', $showLinks);
if (CRM_Core_Permission::check('access CiviMail')) {
$archiveLinks = TRUE;
}
if ($archiveLinks == TRUE) {
$this->assign('archiveLinks', $archiveLinks);
}
}
示例2: civicrm_api3_job_rapportagenamailings_mail
/**
* Send a email to ?? with the mailing report of one mailing
*
* @param type $mailing_id
*/
function civicrm_api3_job_rapportagenamailings_mail($mailing_id)
{
global $base_root;
// create a new Cor Page
$page = new CRM_Core_Page();
$page->_mailing_id = $mailing_id;
// create a new template
$template = CRM_Core_Smarty::singleton();
// from CRM/Mailing/Page/Report.php
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($mailing_id);
$report = CRM_Mailing_BAO_Mailing::report($mailing_id);
//get contents of mailing
CRM_Mailing_BAO_Mailing::getMailingContent($report, $page);
$subject = ts('Mailing Gereed: %1', array(1 => $report['mailing']['name']));
$template->assign('report', $report);
// inlcude $base_root
$template->assign('base_root', $base_root);
$template->assign('subject', $subject);
// from CRM/Core/page.php
// only print
$template->assign('tplFile', 'CRM/Rapportagenamailings/Page/RapportMailing.tpl');
$content = $template->fetch('CRM/common/print.tpl');
CRM_Utils_System::appendTPLFile('CRM/Rapportagenamailings/Page/RapportMailing.tpl', $content, $page->overrideExtraTemplateFileName());
//its time to call the hook.
CRM_Utils_Hook::alterContent($content, 'page', 'CRM/Rapportagenamailings/Page/RapportMailing.tpl', $page);
//echo $content;
// send mail
$params = array('from' => 'frontoffice@vnv.nl', 'toName' => 'Front Office VnV', 'toEmail' => 'frontoffice@vnv.nl', 'subject' => $subject, 'text' => $subject, 'html' => $content, 'replyTo' => 'frontoffice@vnv.nl');
CRM_Utils_Mail::send($params);
}
示例3: run
function run()
{
$this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailing_id);
$report = CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
//get contents of mailing
CRM_Mailing_BAO_Mailing::getMailingContent($report, $this);
//assign backurl
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($context == 'activitySelector') {
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
$backUrlTitle = ts('Back to Activities');
} elseif ($context == 'activity') {
$atype = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/activity/view', "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity");
$backUrlTitle = ts('Back to Activity');
} elseif ($context == 'mailing') {
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
$backUrlTitle = ts('Back to Mailing');
} else {
$backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
$backUrlTitle = ts('Back to CiviMail');
}
$this->assign('backUrl', $backUrl);
$this->assign('backUrlTitle', $backUrlTitle);
$this->assign('report', $report);
CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
return CRM_Core_Page::run();
}
示例4: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
*
* @return None
*/
function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($mailingID);
$defaults = array();
if ($mailingID) {
$mailing = new CRM_Mailing_DAO_Mailing();
$mailing->id = $mailingID;
$mailing->addSelect('name', 'campaign_id');
$mailing->find(TRUE);
$defaults['name'] = $mailing->name;
if (!$continue) {
$defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
} else {
// CRM-7590, reuse same mailing ID if we are continuing
$this->set('mailing_id', $mailingID);
}
$defaults['campaign_id'] = $mailing->campaign_id;
$defaults['dedupe_email'] = $mailing->dedupe_email;
$dao = new CRM_Mailing_DAO_Group();
$mailingGroups = array();
$dao->mailing_id = $mailingID;
$dao->find();
while ($dao->fetch()) {
$mailingGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
$defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
$defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
$defaults['excludeMailings'] = $mailingGroups['civicrm_mailing']['Exclude'];
}
//when the context is search hide the mailing recipients.
$showHide = new CRM_Core_ShowHideBlocks();
$showGroupSelector = TRUE;
if ($this->_searchBasedMailing) {
$showGroupSelector = FALSE;
$formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
$formValues = $this->controller->exportValues($this->_name);
foreach ($formElements as $element) {
if (!empty($formValues[$element])) {
$showGroupSelector = TRUE;
break;
}
}
}
if ($showGroupSelector) {
$showHide->addShow("id-additional");
$showHide->addHide("id-additional-show");
} else {
$showHide->addShow("id-additional-show");
$showHide->addHide("id-additional");
}
$showHide->addToTemplate();
return $defaults;
}
示例5: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, false, null);
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, false, null);
// check that the user has permission to access mailing id
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::checkPermission($mailingID);
$defaults = array();
if ($mailingID && $continue) {
$defaults["name"] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingID, 'name', 'id');
$this->set('mailing_id', $mailingID);
} elseif ($mailingID && !$continue) {
$defaults["name"] = ts('Copy of %1', array(1 => CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingID, 'name', 'id')));
}
if ($mailingID) {
require_once "CRM/Mailing/DAO/Group.php";
$dao =& new CRM_Mailing_DAO_Group();
$mailingGroups = array();
$dao->mailing_id = $mailingID;
$dao->find();
while ($dao->fetch()) {
$mailingGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
$defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
$defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
$defaults['excludeMailings'] = $mailingGroups['civicrm_mailing']['Exclude'];
}
//when the context is search hide the mailing recipients.
require_once 'CRM/Core/ShowHideBlocks.php';
$showHide =& new CRM_Core_ShowHideBlocks();
$context = $this->get('context');
$showGroupSelector = true;
if ($context == 'search') {
$showGroupSelector = false;
$formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
$formValues = $this->controller->exportValues($this->_name);
foreach ($formElements as $element) {
if (!empty($formValues[$element])) {
$showGroupSelector = true;
break;
}
}
}
if ($showGroupSelector) {
$showHide->addShow("id-additional");
$showHide->addHide("id-additional-show");
} else {
$showHide->addShow("id-additional-show");
$showHide->addHide("id-additional");
}
$showHide->addToTemplate();
return $defaults;
}
示例6: run
function run()
{
$this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
// check that the user has permission to access mailing id
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailing_id);
require_once 'CRM/Mailing/BAO/Mailing.php';
$report =& CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
// #6835 Email Mutithreading
//if ( count($report['jobs']) > 1 ) {
// CRM_Core_Error::statusBounce(ts('Selected Mailing has more than one live job.'));
//}
//get contents of mailing
CRM_Mailing_BAO_Mailing::getMailingContent($report, $this);
//assign backurl
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($context == 'activitySelector') {
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
$backUrlTitle = ts('Back to Activities');
} else {
if ($context == 'activity') {
$atype = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/activity/view', "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity");
$backUrlTitle = ts('Back to Activity');
} else {
$backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
$backUrlTitle = ts('Back to CiviMail');
}
}
$this->assign('backUrl', $backUrl);
$this->assign('backUrlTitle', $backUrlTitle);
$this->assign('report', $report);
CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
parent::run();
}
示例7: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
$this->_unscheduled = $this->_archived = $archiveLinks = false;
$this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
// check that the user has permission to access mailing id
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
$this->assign('action', $this->_action);
$showLinks = true;
require_once 'CRM/Mailing/Info.php';
if (CRM_Mailing_Info::workflowEnabled()) {
if (CRM_Core_Permission::check('create mailings')) {
$archiveLinks = true;
}
if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings')) {
$showLinks = false;
}
}
$this->assign('showLinks', $showLinks);
if (CRM_Core_Permission::check('access CiviMail')) {
$archiveLinks = true;
}
if ($archiveLinks == true) {
$this->assign('archiveLinks', $archiveLinks);
}
}
示例8: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
*
* @return None
*/
function setDefaultValues()
{
// to continue the unscheduled or draft mailing
$continue = $this->_continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$defaults = array();
if ($this->_mailingID) {
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingID);
$mailing = new CRM_Mailing_DAO_Mailing();
$mailing->id = $this->_mailingID;
$mailing->addSelect('name', 'campaign_id');
$mailing->find(TRUE);
$defaults['name'] = $mailing->name;
if (!$continue) {
$defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
} else {
// CRM-7590, reuse same mailing ID if we are continuing
$this->set('mailing_id', $this->_mailingID);
}
$defaults['campaign_id'] = $mailing->campaign_id;
$defaults['dedupe_email'] = $mailing->dedupe_email;
$dao = new CRM_Mailing_DAO_MailingGroup();
$mailingGroups = array('civicrm_group' => array(), 'civicrm_mailing' => array());
$dao->mailing_id = $this->_mailingID;
$dao->find();
while ($dao->fetch()) {
// account for multi-lingual
// CRM-11431
$entityTable = 'civicrm_group';
if (substr($dao->entity_table, 0, 15) == 'civicrm_mailing') {
$entityTable = 'civicrm_mailing';
}
$mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['include'];
$defaults['excludeGroups'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_group']);
if (!empty($mailingGroups['civicrm_mailing'])) {
$defaults['includeMailings'] = CRM_Utils_Array::value('include', $mailingGroups['civicrm_mailing']);
$defaults['excludeMailings'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_mailing']);
}
} else {
$defaults['url_tracking'] = TRUE;
$defaults['open_tracking'] = TRUE;
}
//set default message body
$reuseMailing = FALSE;
if ($mailingID) {
$reuseMailing = TRUE;
} else {
$mailingID = $this->_mailingID;
}
$count = $this->get('count');
$this->assign('count', $count);
$this->set('skipTextFile', FALSE);
$this->set('skipHtmlFile', FALSE);
$htmlMessage = NULL;
if ($mailingID) {
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $mailingID;
$dao->find(TRUE);
$dao->storeValues($dao, $defaults);
//we don't want to retrieve template details once it is
//set in session
$templateId = $this->get('template');
$this->assign('templateSelected', $templateId ? $templateId : 0);
if (isset($defaults['msg_template_id']) && !$templateId) {
$defaults['template'] = $defaults['msg_template_id'];
$messageTemplate = new CRM_Core_DAO_MessageTemplate();
$messageTemplate->id = $defaults['msg_template_id'];
$messageTemplate->selectAdd();
$messageTemplate->selectAdd('msg_text, msg_html');
$messageTemplate->find(TRUE);
$defaults['text_message'] = $messageTemplate->msg_text;
$htmlMessage = $messageTemplate->msg_html;
}
if (isset($defaults['body_text'])) {
$defaults['text_message'] = $defaults['body_text'];
$this->set('textFile', $defaults['body_text']);
$this->set('skipTextFile', TRUE);
}
if (isset($defaults['body_html'])) {
$htmlMessage = $defaults['body_html'];
$this->set('htmlFile', $defaults['body_html']);
$this->set('skipHtmlFile', TRUE);
}
//set default from email address.
if (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) {
$defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address'));
} else {
//get the default from email address.
$defaultAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
//.........这里部分代码省略.........
示例9: setDefaultValues
/**
* Set default values for the form.
* the default values are retrieved from the database
*
*
* @return void
*/
public function setDefaultValues()
{
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
$defaults = array();
$defaults['dedupe_email'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'dedupe_email_default', NULL, FALSE);
if ($this->_mailingID) {
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingID);
$mailing = new CRM_Mailing_DAO_Mailing();
$mailing->id = $this->_mailingID;
$mailing->addSelect('name', 'campaign_id');
$mailing->find(TRUE);
$defaults['name'] = $mailing->name;
if (!$continue) {
$defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
} else {
// CRM-7590, reuse same mailing ID if we are continuing
$this->set('mailing_id', $this->_mailingID);
}
$defaults['campaign_id'] = $mailing->campaign_id;
$defaults['dedupe_email'] = $mailing->dedupe_email;
$defaults['location_type_id'] = $mailing->location_type_id;
$defaults['email_selection_method'] = $mailing->email_selection_method;
$dao = new CRM_Mailing_DAO_MailingGroup();
$mailingGroups = array('civicrm_group' => array(), 'civicrm_mailing' => array());
$dao->mailing_id = $this->_mailingID;
$dao->find();
while ($dao->fetch()) {
// account for multi-lingual
// CRM-11431
$entityTable = 'civicrm_group';
if (substr($dao->entity_table, 0, 15) == 'civicrm_mailing') {
$entityTable = 'civicrm_mailing';
}
$mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_group']);
$defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
if (!empty($mailingGroups['civicrm_mailing'])) {
$defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
$defaults['excludeMailings'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_mailing']);
}
}
//when the context is search hide the mailing recipients.
$showHide = new CRM_Core_ShowHideBlocks();
$showGroupSelector = TRUE;
if ($this->_searchBasedMailing) {
$showGroupSelector = FALSE;
$formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
$formValues = $this->controller->exportValues($this->_name);
foreach ($formElements as $element) {
if (!empty($formValues[$element])) {
$showGroupSelector = TRUE;
break;
}
}
}
if ($showGroupSelector) {
$showHide->addShow("id-additional");
$showHide->addHide("id-additional-show");
} else {
$showHide->addShow("id-additional-show");
$showHide->addHide("id-additional");
}
$showHide->addToTemplate();
return $defaults;
}
示例10: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
$this->_unscheduled = $this->_archived = false;
$this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
// check that the user has permission to access mailing id
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
$this->assign('action', $this->_action);
}
示例11: run
/**
* @return string
*/
public function run()
{
$this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
//CRM-15979 - check if abtest exist for mailing then redirect accordingly
$abtest = CRM_Mailing_BAO_MailingAB::getABTest($this->_mailing_id);
if (!empty($abtest) && !empty($abtest->id)) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id));
}
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailing_id);
$report = CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
// get contents of mailing
CRM_Mailing_BAO_Mailing::getMailingContent($report, $this);
// assign backurl
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($context == 'activitySelector') {
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
$backUrlTitle = ts('Back to Activities');
} elseif ($context == 'activity') {
$atype = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/activity/view', "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity");
$backUrlTitle = ts('Back to Activity');
} elseif ($context == 'mailing') {
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
$backUrlTitle = ts('Back to Mailing');
} else {
$backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
$backUrlTitle = ts('Back to CiviMail');
}
$this->assign('backUrl', $backUrl);
$this->assign('backUrlTitle', $backUrlTitle);
$this->assign('report', $report);
CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
$this->assign('public_url', CRM_Mailing_BAO_Mailing::getPublicViewUrl($this->_mailing_id));
return CRM_Core_Page::run();
}