本文整理汇总了PHP中CRM_Mailing_BAO_Mailing类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing类的具体用法?PHP CRM_Mailing_BAO_Mailing怎么用?PHP CRM_Mailing_BAO_Mailing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Mailing_BAO_Mailing类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: mailing_select
/**
* @return array
*/
public function mailing_select()
{
$data = array();
$mailing = new CRM_Mailing_BAO_Mailing();
$query = "SELECT name FROM civicrm_mailing WHERE sms_provider_id IS NULL";
$mailing->query($query);
while ($mailing->fetch()) {
$data[mysql_real_escape_string($mailing->name)] = $mailing->name;
}
return $data;
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:14,代码来源:Summary.php
示例2: mailing_select
function mailing_select()
{
require_once 'CRM/Mailing/BAO/Mailing.php';
$data = array();
$mailing = new CRM_Mailing_BAO_Mailing();
$query = "SELECT name FROM civicrm_mailing ";
$mailing->query($query);
while ($mailing->fetch()) {
$data[$mailing->name] = $mailing->name;
}
return $data;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:12,代码来源:Summary.php
示例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();
}
开发者ID:hguru,项目名称:224Civi,代码行数:32,代码来源:Report.php
示例4: 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' => '[email protected]', 'toName' => 'Front Office VnV', 'toEmail' => '[email protected]', 'subject' => $subject, 'text' => $subject, 'html' => $content, 'replyTo' => '[email protected]');
CRM_Utils_Mail::send($params);
}
开发者ID:jvos,项目名称:nl.vnv.rapportagenamailings_old,代码行数:36,代码来源:RapportageNaMailings.php
示例5: getContactMailings
/**
* Function to retrieve contact mailings
*/
public static function getContactMailings()
{
$contactID = CRM_Utils_Type::escape($_GET['contact_id'], 'Integer');
$sortMapper = array(0 => 'subject', 1 => 'creator_name', 2 => '', 3 => 'start_date', 4 => '', 5 => 'links');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
$params['contact_id'] = $contactID;
$params['context'] = $context;
// get the contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array('subject', 'mailing_creator', 'recipients', 'start_date', 'openstats', 'links');
header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($mailings, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:28,代码来源:AJAX.php
示例6: send
/**
* Store Mails into Spool table.
*
* @param string|array $recipient
* Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
* @param array $headers
* The array of headers to send with the mail.
*
* @param string $body
* The full text of the message body, including any mime parts, etc.
*
* @param int $job_id
*
* @return bool|CRM_Core_Error
* true if successful
*/
public function send($recipient, $headers, $body, $job_id = NULL)
{
$headerStr = array();
foreach ($headers as $name => $value) {
$headerStr[] = "{$name}: {$value}";
}
$headerStr = implode("\n", $headerStr);
if (is_null($job_id)) {
// This is not a bulk mailing. Create a dummy job for it.
$session = CRM_Core_Session::singleton();
$params = array();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
$params['scheduled_id'] = $params['created_id'];
$params['scheduled_date'] = $params['created_date'];
$params['is_completed'] = 1;
$params['is_archived'] = 1;
$params['body_html'] = htmlspecialchars($headerStr) . "\n\n" . $body;
$params['subject'] = $headers['Subject'];
$params['name'] = $headers['Subject'];
$ids = array();
$mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
if (empty($mailing) || is_a($mailing, 'CRM_Core_Error')) {
return PEAR::raiseError('Unable to create spooled mailing.');
}
$job = new CRM_Mailing_BAO_MailingJob();
$job->is_test = 0;
// if set to 1 it doesn't show in the UI
$job->status = 'Complete';
$job->scheduled_date = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s'));
$job->start_date = $job->scheduled_date;
$job->end_date = $job->scheduled_date;
$job->mailing_id = $mailing->id;
$job->save();
$job_id = $job->id;
// need this for parent_id below
$job = new CRM_Mailing_BAO_MailingJob();
$job->is_test = 0;
$job->status = 'Complete';
$job->scheduled_date = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s'));
$job->start_date = $job->scheduled_date;
$job->end_date = $job->scheduled_date;
$job->mailing_id = $mailing->id;
$job->parent_id = $job_id;
$job->job_type = 'child';
$job->save();
$job_id = $job->id;
// this is the one we want for the spool
if (is_array($recipient)) {
$recipient = implode(';', $recipient);
}
}
$session = CRM_Core_Session::singleton();
$params = array('job_id' => $job_id, 'recipient_email' => $recipient, 'headers' => $headerStr, 'body' => $body, 'added_at' => date("YmdHis"), 'removed_at' => NULL);
$spoolMail = new CRM_Mailing_DAO_Spool();
$spoolMail->copyValues($params);
$spoolMail->save();
return TRUE;
}
开发者ID:kidaa30,项目名称:yes,代码行数:79,代码来源:Spool.php
示例7: getContactMailings
/**
* Retrieve contact mailings.
*/
public static function getContactMailings()
{
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params += CRM_Core_Page_AJAX::validateParams(array('contact_id' => 'Integer'));
// get the contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
CRM_Utils_JSON::output($mailings);
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:AJAX.php
示例8: buildQuickForm
/**
* Build the form
*
* @access public
* @return void
*/
static function buildQuickForm(&$form)
{
$form->assign('totalSelectedContacts', count($form->_contactIds));
require_once "CRM/Mailing/BAO/Mailing.php";
CRM_Mailing_BAO_Mailing::commonLetterCompose($form);
$form->addDefaultButtons(ts('Make PDF Letters'));
$form->addFormRule(array('CRM_Contact_Form_Task_PDFLetterCommon', 'formRule'), $form);
}
开发者ID:bhirsch,项目名称:civicrm,代码行数:14,代码来源:PDFLetterCommon.php
示例9: run
function run()
{
$this->_mailing_id = CRM_Utils_Request::retrieve('mid', $this);
require_once 'CRM/Mailing/BAO/Mailing.php';
$report =& CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
$this->assign('report', $report);
CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
parent::run();
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:9,代码来源:Report.php
示例10: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
require_once 'CRM/Mailing/BAO/Mailing.php';
$session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', CRM_Core_DAO::$_nullObject, false, 'text');
$type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject, false, 'text');
$options = array();
$session->getVars($options, "CRM_Mailing_Controller_Send_{$qfKey}");
//get the options if control come from search context, CRM-3711
if (empty($options)) {
$session->getVars($options, "CRM_Contact_Controller_Search_{$qfKey}");
}
// FIXME: the below and CRM_Mailing_Form_Test::testMail()
// should be refactored
$fromEmail = null;
$mailing = new CRM_Mailing_BAO_Mailing();
if (!empty($options)) {
$mailing->id = $options['mailing_id'];
$fromEmail = CRM_Utils_Array::value('from_email', $options);
}
$mailing->find(true);
CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
if (defined('CIVICRM_MAIL_SMARTY')) {
require_once 'CRM/Core/Smarty/resources/String.php';
civicrm_smarty_register_string_resource();
}
// get and format attachments
require_once 'CRM/Core/BAO/File.php';
$attachments =& CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $mailing->id);
//get details of contact with token value including Custom Field Token Values.CRM-3734
$returnProperties = $mailing->getReturnProperties();
$params = array('contact_id' => $session->get('userID'));
$details = $mailing->getDetails($params, $returnProperties);
$mime =& $mailing->compose(null, null, null, $session->get('userID'), $fromEmail, $fromEmail, true, $details[0][$session->get('userID')], $attachments);
if ($type == 'html') {
header('Content-Type: text/html; charset=utf-8');
print $mime->getHTMLBody();
} else {
header('Content-Type: text/plain; charset=utf-8');
print $mime->getTXTBody();
}
CRM_Utils_System::civiExit();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:48,代码来源:Preview.php
示例11: postProcess
/**
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Mailing_BAO_Mailing::del($this->_mailingId);
} elseif ($this->_action & CRM_Core_Action::DISABLE) {
CRM_Mailing_BAO_MailingJob::cancel($this->_mailingId);
} elseif ($this->_action & CRM_Core_Action::RENEW) {
//set is_archived to 1
CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId, 'is_archived', TRUE);
}
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:15,代码来源:Browse.php
示例12: __construct
/**
* Class constructor.
*/
public function __construct()
{
$this->_columns = array();
$this->_columns['civicrm_contact'] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('id' => array('title' => ts('Contact ID'), 'required' => TRUE), 'sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Contact Name')), 'source' => array('title' => ts('Contact Source'), 'type' => CRM_Utils_Type::T_STRING), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'order_bys' => array('sort_name' => array('title' => ts('Contact Name'), 'default' => TRUE, 'default_order' => 'ASC')), 'grouping' => 'contact-fields');
$this->_columns['civicrm_mailing'] = array('dao' => 'CRM_Mailing_DAO_Mailing', 'fields' => array('mailing_name' => array('name' => 'name', 'title' => ts('Mailing'), 'default' => TRUE), 'mailing_name_alias' => array('name' => 'name', 'required' => TRUE, 'no_display' => TRUE)), 'filters' => array('mailing_id' => array('name' => 'id', 'title' => ts('Mailing'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'type' => CRM_Utils_Type::T_INT, 'options' => CRM_Mailing_BAO_Mailing::getMailingsList(), 'operator' => 'like')), 'order_bys' => array('mailing_name' => array('name' => 'name', 'title' => ts('Mailing'))), 'grouping' => 'mailing-fields');
$this->_columns['civicrm_email'] = array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'order_bys' => array('email' => array('title' => ts('Email'), 'default_order' => 'ASC')), 'grouping' => 'contact-fields');
$this->_columns['civicrm_phone'] = array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields');
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
parent::__construct();
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:14,代码来源:Opened.php
示例13: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
//get the activity values
$activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
//check for required permissions, CRM-6264
if ($activityId && !CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::VIEW)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$session = CRM_Core_Session::singleton();
if (!in_array($context, array('home', 'dashlet', 'dashletFullscreen'))) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
} else {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session->pushUserContext($url);
$defaults = array();
$params = array('id' => $activityId);
CRM_Activity_BAO_Activity::retrieve($params, $defaults);
//set activity type name and description to template
list($activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($defaults['activity_type_id']);
$this->assign('activityTypeName', $activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
if (CRM_Utils_Array::value('mailingId', $defaults)) {
$this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults);
$mailingReport = CRM_Mailing_BAO_Mailing::report($this->_mailing_id, TRUE);
CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this);
$this->assign('mailingReport', $mailingReport);
$full_open_report = CRM_Mailing_Event_BAO_Opened::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, $cid);
$this->assign('openreport', $full_open_report);
$click_thru_report = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
$this->assign('clickreport', $click_thru_report);
}
foreach ($defaults as $key => $value) {
if (substr($key, -3) != '_id') {
$values[$key] = $value;
}
}
//get the campaign
if ($campaignId = CRM_Utils_Array::value('campaign_id', $defaults)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$values['campaign'] = $campaigns[$campaignId];
}
if ($engagementLevel = CRM_Utils_Array::value('engagement_level', $defaults)) {
$engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
$values['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel);
}
$values['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityId);
$this->assign('values', $values);
}
开发者ID:hguru,项目名称:224Civi,代码行数:57,代码来源:ActivityView.php
示例14: run
/**
* A PHP cron script to run the outstanding and scheduled CiviMail jobs
* initiated by Owen Barton from a mailing sent by Lobo to crm-mail
*
* The structure of the file is set to mimiic soap.php which is a stand-alone
* script and hence does not have any UF issues. You should be able to run
* this script using a web url or from the command line
*/
function run()
{
session_start();
if (!function_exists('drush_get_context')) {
require_once '../civicrm.config.php';
}
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
// this does not return on failure
CRM_Utils_System::authenticateScript(TRUE);
// we now use DB locks on a per job basis
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::processQueue();
}
开发者ID:hguru,项目名称:224Civi,代码行数:22,代码来源:civimail.cronjob.php
示例15: run
/**
* Run this page (figure out the action needed and perform it).
*
* @return void
*/
public function run()
{
$session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'text');
$type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'text');
$options = array();
$session->getVars($options, "CRM_Mailing_Controller_Send_{$qfKey}");
//get the options if control come from search context, CRM-3711
if (empty($options)) {
$session->getVars($options, "CRM_Contact_Controller_Search_{$qfKey}");
}
// FIXME: the below and CRM_Mailing_Form_Test::testMail()
// should be refactored
$fromEmail = NULL;
$mailing = new CRM_Mailing_BAO_Mailing();
if (!empty($options)) {
$mailing->id = $options['mailing_id'];
$fromEmail = CRM_Utils_Array::value('from_email', $options);
}
$mailing->find(TRUE);
CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
// get and format attachments
$attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $mailing->id);
//get details of contact with token value including Custom Field Token Values.CRM-3734
$returnProperties = $mailing->getReturnProperties();
$params = array('contact_id' => $session->get('userID'));
$details = CRM_Utils_Token::getTokenDetails($params, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens(), get_class($this));
$mime =& $mailing->compose(NULL, NULL, NULL, $session->get('userID'), $fromEmail, $fromEmail, TRUE, $details[0][$session->get('userID')], $attachments);
if ($type == 'html') {
CRM_Utils_System::setHttpHeader('Content-Type', 'text/html; charset=utf-8');
print $mime->getHTMLBody();
} else {
CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain; charset=utf-8');
print $mime->getTXTBody();
}
CRM_Utils_System::civiExit();
}
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:42,代码来源:Preview.php
示例16: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
//get the activity values
$activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
//check for required permissions, CRM-6264
if ($activityId && !CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::VIEW)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$session = CRM_Core_Session::singleton();
if ($context != 'home') {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
} else {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session->pushUserContext($url);
$params = array('id' => $activityId);
CRM_Activity_BAO_Activity::retrieve($params, $defaults);
//set activity type name and description to template
require_once 'CRM/Core/BAO/OptionValue.php';
list($activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($defaults['activity_type_id']);
$this->assign('activityTypeName', $activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
if (CRM_Utils_Array::value('mailingId', $defaults)) {
$this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults);
require_once 'CRM/Mailing/BAO/Mailing.php';
$mailingReport =& CRM_Mailing_BAO_Mailing::report($this->_mailing_id, true);
CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this);
$this->assign('mailingReport', $mailingReport);
}
foreach ($defaults as $key => $value) {
if (substr($key, -3) != '_id') {
$values[$key] = $value;
}
}
require_once 'CRM/Core/BAO/File.php';
$values['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityId);
$this->assign('values', $values);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:46,代码来源:ActivityView.php
示例17: mte_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function mte_civicrm_install()
{
$mailingParams = array('subject' => '***All Transactional Emails***', 'name' => ts('Transaction Emails'), 'url_tracking' => TRUE, 'forward_replies' => FALSE, 'auto_responder' => FALSE, 'open_tracking' => TRUE, 'is_completed' => FALSE);
//create entry in civicrm_mailing
$mailing = CRM_Mailing_BAO_Mailing::add($mailingParams, CRM_Core_DAO::$_nullArray);
//add entry in civicrm_mailing_job
//MTE-17
$config = CRM_Core_Config::singleton();
if (property_exists($config, 'civiVersion')) {
$civiVersion = $config->civiVersion;
} else {
$civiVersion = CRM_Core_BAO_Domain::version();
}
$jobCLassName = 'CRM_Mailing_DAO_MailingJob';
if (version_compare('4.4alpha1', $civiVersion) > 0) {
$jobCLassName = 'CRM_Mailing_DAO_Job';
}
$changeENUM = FALSE;
if (version_compare('4.5alpha1', $civiVersion) > 0) {
$changeENUM = TRUE;
}
CRM_Core_Smarty::singleton()->assign('changeENUM', $changeENUM);
_mte_civix_civicrm_install();
$saveJob = new $jobCLassName();
$saveJob->start_date = $saveJob->end_date = date('YmdHis');
$saveJob->status = 'Complete';
$saveJob->job_type = "Special: All transactional emails being sent through Mandrill";
$saveJob->mailing_id = $mailing->id;
$saveJob->save();
// create mailing bounce type
$mailingBounceType = array('1' => array('name' => 'Mandrill Hard', 'description' => 'Mandrill hard bounce', 'hold_threshold' => 1), '2' => array('name' => 'Mandrill Soft', 'description' => 'Mandrill soft bounce', 'hold_threshold' => 3), '3' => array('name' => 'Mandrill Spam', 'description' => 'User marked a transactional email sent via Mandrill as spam', 'hold_threshold' => 1), '4' => array('name' => 'Mandrill Reject', 'description' => 'Mandrill rejected delivery to this email address', 'hold_threshold' => 1));
foreach ($mailingBounceType as $value) {
$bounceType = new CRM_Mailing_DAO_BounceType();
$bounceType->copyValues($value);
if (!$bounceType->find(true)) {
$bounceType->save();
}
}
return TRUE;
}
开发者ID:vakeesan26,项目名称:biz.jmaconsulting.mte,代码行数:43,代码来源:mte.php
示例18: getContactMailings
/**
* Retrieve contact mailings.
*/
public static function getContactMailings()
{
$contactID = CRM_Utils_Type::escape($_GET['contact_id'], 'Integer');
$sortMapper = array();
foreach ($_GET['columns'] as $key => $value) {
$sortMapper[$key] = $value['data'];
}
$offset = isset($_GET['start']) ? CRM_Utils_Type::escape($_GET['start'], 'Integer') : 0;
$rowCount = isset($_GET['length']) ? CRM_Utils_Type::escape($_GET['length'], 'Integer') : 25;
$sort = isset($_GET['order'][0]['column']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_GET['order'][0]['column'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_GET['order'][0]['dir']) ? CRM_Utils_Type::escape($_GET['order'][0]['dir'], 'String') : 'asc';
$params = $_GET;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
$params['contact_id'] = $contactID;
$params['context'] = $context;
// get the contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
CRM_Utils_JSON::output($mailings);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:26,代码来源:AJAX.php
示例19: buildQuickForm
//.........这里部分代码省略.........
if (count($ids) > 1) {
$extendTargetContacts++;
continue;
}
$validActivities++;
$form->_contactIds = empty($form->_contactIds) ? $ids : array_unique(array_merge($form->_contactIds, $ids));
}
if (!$validActivities) {
$errorMess = "";
if ($extendTargetContacts) {
$errorMess = ts('One selected activity consists of more than one target contact.', array('count' => $extendTargetContacts, 'plural' => '%count selected activities consist of more than one target contact.'));
}
if ($invalidActivity) {
$errorMess = $errorMess ? ' ' : '';
$errorMess .= ts('The selected activity is invalid.', array('count' => $invalidActivity, 'plural' => '%count selected activities are invalid.'));
}
CRM_Core_Error::statusBounce(ts("%1: SMS Reply will not be sent.", array(1 => $errorMess)));
}
}
if (is_array($form->_contactIds) && !empty($form->_contactIds) && $toSetDefault) {
$returnProperties = array('sort_name' => 1, 'phone' => 1, 'do_not_sms' => 1, 'is_deceased' => 1, 'display_name' => 1);
list($form->_contactDetails) = CRM_Utils_Token::getTokenDetails($form->_contactIds, $returnProperties, FALSE, FALSE);
// make a copy of all contact details
$form->_allContactDetails = $form->_contactDetails;
foreach ($form->_contactIds as $key => $contactId) {
$value = $form->_contactDetails[$contactId];
//to check if the phone type is "Mobile"
$phoneTypes = CRM_Core_OptionGroup::values('phone_type', TRUE, FALSE, FALSE, NULL, 'name');
if (CRM_Utils_System::getClassName($form) == 'CRM_Activity_Form_Task_SMS') {
//to check for "if the contact id belongs to a specified activity type"
$actDetails = CRM_Activity_BAO_Activity::getContactActivity($contactId);
if (self::RECIEVED_SMS_ACTIVITY_SUBJECT != CRM_Utils_Array::retrieveValueRecursive($actDetails, 'subject')) {
$suppressedSms++;
unset($form->_contactDetails[$contactId]);
continue;
}
}
if (isset($value['phone_type_id']) && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) || $value['do_not_sms'] || empty($value['phone']) || !empty($value['is_deceased'])) {
//if phone is not primary check if non-primary phone is "Mobile"
if (!empty($value['phone']) && $value['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes) && empty($value['is_deceased'])) {
$filter = array('do_not_sms' => 0);
$contactPhones = CRM_Core_BAO_Phone::allPhones($contactId, FALSE, 'Mobile', $filter);
if (count($contactPhones) > 0) {
$mobilePhone = CRM_Utils_Array::retrieveValueRecursive($contactPhones, 'phone');
$form->_contactDetails[$contactId]['phone_id'] = CRM_Utils_Array::retrieveValueRecursive($contactPhones, 'id');
$form->_contactDetails[$contactId]['phone'] = $mobilePhone;
$form->_contactDetails[$contactId]['phone_type_id'] = CRM_Utils_Array::value('Mobile', $phoneTypes);
} else {
$suppressedSms++;
unset($form->_contactDetails[$contactId]);
continue;
}
} else {
$suppressedSms++;
unset($form->_contactDetails[$contactId]);
continue;
}
}
if (isset($mobilePhone)) {
$phone = $mobilePhone;
} elseif (empty($form->_toContactPhone)) {
$phone = $value['phone'];
} else {
$phone = CRM_Utils_Array::value($key, $form->_toContactPhone);
}
if ($phone) {
$toArray[] = array('text' => '"' . $value['sort_name'] . '" (' . $phone . ')', 'id' => "{$contactId}::{$phone}");
}
}
if (empty($toArray)) {
CRM_Core_Error::statusBounce(ts('Selected contact(s) do not have a valid Phone, or communication preferences specify DO NOT SMS, or they are deceased'));
}
}
//activity related variables
if (isset($invalidActivity)) {
$form->assign('invalidActivity', $invalidActivity);
}
if (isset($extendTargetContacts)) {
$form->assign('extendTargetContacts', $extendTargetContacts);
}
$form->assign('toContact', json_encode($toArray));
$form->assign('suppressedSms', $suppressedSms);
$form->assign('totalSelectedContacts', count($form->_contactIds));
$form->add('select', 'sms_provider_id', ts('From'), $providerSelect, TRUE);
CRM_Mailing_BAO_Mailing::commonCompose($form);
if ($form->_single) {
// also fix the user context stack
if ($form->_context) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
$url = CRM_Utils_System::url('civicrm/contact/view', "&show=1&action=browse&cid={$form->_contactIds[0]}&selectedChild=activity");
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
$form->addDefaultButtons(ts('Send SMS'), 'upload', 'cancel');
} else {
$form->addDefaultButtons(ts('Send SMS'), 'upload');
}
$form->addFormRule(array('CRM_Contact_Form_Task_SMSCommon', 'formRule'), $form);
}
开发者ID:kidaa30,项目名称:yes,代码行数:101,代码来源:SMSCommon.php
示例20: confirm
/**
* Confirm a pending subscription
*
* @param int $contact_id The id of the contact
* @param int $subscribe_id The id of the subscription event
* @param string $hash The hash
*
* @return boolean True on success
* @access public
* @static
*/
public static function confirm($contact_id, $subscribe_id, $hash)
{
$se =& CRM_Mailing_Event_BAO_Subscribe::verify($contact_id, $subscribe_id, $hash);
if (!$se) {
return FALSE;
}
// before we proceed lets just check if this contact is already 'Added'
// if so, we should ignore this request and hence avoid sending multiple
// emails - CRM-11157
$details = CRM_Contact_BAO_GroupContact::getMembershipDetail($contact_id, $se->group_id);
if ($details && $details->status == 'Added') {
// This contact is already subscribed
// lets return the group title
return CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $se->group_id, 'title');
}
$transaction = new CRM_Core_Transaction();
$ce = new CRM_Mailing_Event_BAO_Confirm();
$ce->event_subscribe_id = $se->id;
$ce->time_stamp = date('YmdHis');
$ce->save();
CRM_Contact_BAO_GroupContact::addContactsToGroup(array($contact_id), $se->group_id, 'Email', 'Added', $ce->id);
$transaction->commit();
$config = CRM_Core_Config::singleton();
$domain = CRM_Core_BAO_Domain::getDomain();
list($domainEmailName, $_) = CRM_Core_BAO_Domain::getNameAndEmail();
list($display_name, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($se->contact_id);
$group = new CRM_Contact_DAO_Group();
$group->id = $se->group_id;
$group->find(TRUE);
$component = new CRM_Mailing_BAO_Component();
$component->is_default = 1;
$component->is_active = 1;
$component->component_type = 'Welcome';
$component->find(TRUE);
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$html = $component->body_html;
if ($component->body_text) {
$text = $component->body_text;
} else {
$text = CRM_Utils_String::htmlToText($component->body_html);
}
$bao = new CRM_Mailing_BAO_Mailing();
$bao->body_text = $text;
$bao->body_html = $html;
$tokens = $bao->getTokens();
$html = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html']);
$html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->title, TRUE);
$text = CRM_Utils_Token::replaceDomainTokens($text, $domain, FALSE, $tokens['text']);
$text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->title, FALSE);
$mailParams = array('groupName' => 'Mailing Event ' . $component->component_type, 'subject' => $component->subject, 'from' => "\"{$domainEmailName}\" <do-not-reply@{$emailDomain}>", 'toEmail' => $email, 'toName' => $display_name, 'replyTo' => "do-not-reply@{$emailDomain}", 'returnPath' => "do-not-reply@{$emailDomain}", 'html' => $html, 'text' => $text);
// send - ignore errors because the desired status change has already been successful
$unused_result = CRM_Utils_Mail::send($mailParams);
return $group->title;
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:65,代码来源:Confirm.php |
请发表评论