本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::getPublicViewUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::getPublicViewUrl方法的具体用法?PHP CRM_Mailing_BAO_Mailing::getPublicViewUrl怎么用?PHP CRM_Mailing_BAO_Mailing::getPublicViewUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::getPublicViewUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ts
//.........这里部分代码省略.........
// supercedes all permission
if (CRM_Core_Permission::check('access CiviMail')) {
$allAccess = TRUE;
}
if (CRM_Core_Permission::check('approve mailings')) {
$showApprovalLinks = TRUE;
}
if (CRM_Core_Permission::check('create mailings')) {
$showCreateLinks = TRUE;
}
if (CRM_Core_Permission::check('schedule mailings')) {
$showScheduleLinks = TRUE;
}
}
$mailing = new CRM_Mailing_BAO_Mailing();
$params = array();
$whereClause = ' AND ' . $this->whereClause($params);
if (empty($params)) {
$this->_parent->assign('isSearch', 0);
} else {
$this->_parent->assign('isSearch', 1);
}
$rows =& $mailing->getRows($offset, $rowCount, $sort, $whereClause, $params);
// get the search base mailing Ids, CRM-3711.
$searchMailings = $mailing->searchMailingIDs();
// check for delete CRM-4418
$allowToDelete = CRM_Core_Permission::check('delete in CiviMail');
if ($output != CRM_Core_Selector_Controller::EXPORT) {
// create the appropriate $op to use for hook_civicrm_links
$pageTypes = array('view', 'mailing', 'browse');
if ($this->_parent->_unscheduled) {
$pageTypes[] = 'unscheduled';
}
if ($this->_parent->_scheduled) {
$pageTypes[] = 'scheduled';
}
if ($this->_parent->_archived) {
$pageTypes[] = 'archived';
}
$opString = implode('.', $pageTypes);
foreach ($rows as $key => $row) {
$actionMask = NULL;
if ($row['sms_provider_id']) {
$actionLinks[CRM_Core_Action::PREVIEW]['url'] = 'civicrm/sms/send';
}
if (!($row['status'] == 'Not scheduled') && !$row['sms_provider_id']) {
if ($allAccess || $showCreateLinks) {
$actionMask = CRM_Core_Action::VIEW;
}
if (!in_array($row['id'], $searchMailings)) {
if ($allAccess || $showCreateLinks) {
$actionMask |= CRM_Core_Action::UPDATE;
}
}
} else {
if ($allAccess || ($showCreateLinks || $showScheduleLinks)) {
$actionMask = CRM_Core_Action::PREVIEW;
}
}
if (in_array($row['status'], array('Scheduled', 'Running', 'Paused'))) {
if ($allAccess || $showApprovalLinks && $showCreateLinks && $showScheduleLinks) {
$actionMask |= CRM_Core_Action::DISABLE;
}
if ($row['status'] == 'Scheduled' && empty($row['approval_status_id'])) {
if ($workFlow && ($allAccess || $showApprovalLinks)) {
$actionMask |= CRM_Core_Action::ENABLE;
}
}
}
if (in_array($row['status'], array('Complete', 'Canceled')) && !$row['archived']) {
if ($allAccess || $showCreateLinks) {
$actionMask |= CRM_Core_Action::RENEW;
}
}
// check for delete permission.
if ($allowToDelete) {
$actionMask |= CRM_Core_Action::DELETE;
}
if ($actionMask == NULL) {
$actionMask = CRM_Core_Action::ADD;
}
// get status strings as per locale settings CRM-4411.
$rows[$key]['status'] = CRM_Mailing_BAO_MailingJob::status($row['status']);
$validLinks = $actionLinks;
if (($mailingUrl = CRM_Mailing_BAO_Mailing::getPublicViewUrl($row['id'])) != FALSE) {
$validLinks[] = array('name' => ts('Public View'), 'url' => 'civicrm/mailing/view', 'qs' => 'id=%%mid%%&reset=1', 'title' => ts('Public View'), 'fe' => TRUE);
}
$rows[$key]['action'] = CRM_Core_Action::formLink($validLinks, $actionMask, array('mid' => $row['id']), "more", FALSE, $opString, "Mailing", $row['id']);
// unset($rows[$key]['id']);
// if the scheduled date is 0, replace it with an empty string
if ($rows[$key]['scheduled_iso'] == '0000-00-00 00:00:00') {
$rows[$key]['scheduled'] = '';
}
unset($rows[$key]['scheduled_iso']);
}
}
// also initialize the AtoZ pager
$this->pagerAtoZ();
return $rows;
}
示例2: 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();
}