本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::mailingACL方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::mailingACL方法的具体用法?PHP CRM_Mailing_BAO_Mailing::mailingACL怎么用?PHP CRM_Mailing_BAO_Mailing::mailingACL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::mailingACL方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Get all the completed mailing.
*
*
* @param null $mode
*
* @return array
* array reference of all mailing templates if any
*/
public static function &completed($mode = NULL)
{
if (!self::$completed) {
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
$mailingACL .= $mode == 'sms' ? " AND sms_provider_id IS NOT NULL " : "";
CRM_Core_PseudoConstant::populate(self::$completed, 'CRM_Mailing_DAO_Mailing', FALSE, 'name', 'is_completed', $mailingACL);
}
return self::$completed;
}
示例2: runJobs_pre
/**
* before we run jobs, we need to split the jobs
* @param int $offset
* @param null $mode
*/
public static function runJobs_pre($offset = 200, $mode = NULL)
{
$job = new CRM_Mailing_BAO_MailingJob();
$jobTable = CRM_Mailing_DAO_MailingJob::getTableName();
$mailingTable = CRM_Mailing_DAO_Mailing::getTableName();
$currentTime = date('YmdHis');
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
$workflowClause = CRM_Mailing_BAO_MailingJob::workflowClause();
$domainID = CRM_Core_Config::domainID();
$modeClause = 'AND m.sms_provider_id IS NULL';
if ($mode == 'sms') {
$modeClause = 'AND m.sms_provider_id IS NOT NULL';
}
// Select all the mailing jobs that are created from
// when the mailing is submitted or scheduled.
$query = "\n SELECT j.*\n FROM {$jobTable} j,\n {$mailingTable} m\n WHERE m.id = j.mailing_id AND m.domain_id = {$domainID}\n {$workflowClause}\n {$modeClause}\n AND j.is_test = 0\n AND ( ( j.start_date IS null\n AND j.scheduled_date <= {$currentTime}\n AND j.status = 'Scheduled'\n AND j.end_date IS null ) )\n AND ((j.job_type is NULL) OR (j.job_type <> 'child'))\n ORDER BY j.scheduled_date,\n j.start_date";
$job->query($query);
// For each of the "Parent Jobs" we find, we split them into
// X Number of child jobs
while ($job->fetch()) {
// still use job level lock for each child job
$lockName = "civimail.job.{$job->id}";
$lock = new CRM_Core_Lock($lockName);
if (!$lock->isAcquired()) {
continue;
}
// Re-fetch the job status in case things
// changed between the first query and now
// to avoid race conditions
$job->status = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_MailingJob', $job->id, 'status', 'id', TRUE);
if ($job->status != 'Scheduled') {
$lock->release();
continue;
}
$job->split_job($offset);
// update the status of the parent job
$transaction = new CRM_Core_Transaction();
$saveJob = new CRM_Mailing_DAO_MailingJob();
$saveJob->id = $job->id;
$saveJob->start_date = date('YmdHis');
$saveJob->status = 'Running';
$saveJob->save();
$transaction->commit();
// Release the job lock
$lock->release();
}
}
示例3: getTotalCount
/**
* Returns total number of rows for the query.
*
* @param
*
* @return int
* Total number of rows
*/
public function getTotalCount($action)
{
$job = CRM_Mailing_BAO_MailingJob::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
//get the where clause.
$params = array();
$whereClause = "{$mailingACL} AND " . $this->whereClause($params);
// CRM-11919 added addition ON clauses to mailing_job to match getRows
$query = "\n SELECT COUNT( DISTINCT {$mailing}.id ) as count\n FROM {$mailing}\nLEFT JOIN {$job} ON ( {$mailing}.id = {$job}.mailing_id AND civicrm_mailing_job.is_test = 0 AND civicrm_mailing_job.parent_id IS NULL )\nLEFT JOIN civicrm_contact createdContact ON ( {$mailing}.created_id = createdContact.id )\nLEFT JOIN civicrm_contact scheduledContact ON ( {$mailing}.scheduled_id = scheduledContact.id )\n WHERE {$whereClause}";
return CRM_Core_DAO::singleValueQuery($query, $params);
}
示例4:
/**
* Get all the completed mailing
*
* @access public
* @return array - array reference of all mailing templates if any
* @static
*/
public static function &completed()
{
if (!self::$completed) {
require_once 'CRM/Mailing/BAO/Mailing.php';
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
CRM_Core_PseudoConstant::populate(self::$completed, 'CRM_Mailing_DAO_Mailing', false, 'name', 'is_completed', $mailingACL);
}
return self::$completed;
}
示例5: getTotalCount
/**
* Returns total number of rows for the query.
*
* @param
* @return int Total number of rows
* @access public
*/
function getTotalCount($action)
{
require_once 'CRM/Mailing/BAO/Job.php';
require_once 'CRM/Mailing/BAO/Mailing.php';
$job = CRM_Mailing_BAO_Job::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
//get the where clause.
$params = array();
$whereClause = "{$mailingACL} AND " . $this->whereClause($params);
$query = "\n SELECT COUNT( DISTINCT {$mailing}.id ) as count\n FROM {$mailing}\nLEFT JOIN {$job} ON ( {$mailing}.id = {$job}.mailing_id) \nLEFT JOIN civicrm_contact createdContact ON ( {$mailing}.created_id = createdContact.id )\nLEFT JOIN civicrm_contact scheduledContact ON ( {$mailing}.scheduled_id = scheduledContact.id ) \n WHERE {$whereClause}";
return CRM_Core_DAO::singleValueQuery($query, $params);
}
示例6: runJobs_pre
public static function runJobs_pre($offset = 200)
{
$job = new CRM_Mailing_BAO_Job();
$config = CRM_Core_Config::singleton();
$jobTable = CRM_Mailing_DAO_Job::getTableName();
$mailingTable = CRM_Mailing_DAO_Mailing::getTableName();
$currentTime = date('YmdHis');
$mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m');
// add an additional check and only process
// jobs that are approved
$workflowClause = null;
require_once 'CRM/Mailing/Info.php';
if (CRM_Mailing_Info::workflowEnabled()) {
require_once 'CRM/Core/OptionGroup.php';
$approveOptionID = CRM_Core_OptionGroup::getValue('mail_approval_status', 'Approved', 'name');
if ($approveOptionID) {
$workflowClause = " AND m.approval_status_id = {$approveOptionID} ";
}
}
// Select all the mailing jobs that are created from
// when the mailing is submitted or scheduled.
$query = "\n\t\tSELECT j.*\n\t\t FROM {$jobTable} j,\n\t\t\t\t {$mailingTable} m\n\t\t WHERE m.id = j.mailing_id\n {$workflowClause}\n\t\t AND j.is_test = 0\n\t\t AND ( ( j.start_date IS null\n\t\t AND j.scheduled_date <= {$currentTime}\n\t\t AND j.status = 'Scheduled'\n\t\t AND j.end_date IS null ) )\n\t\t AND ((j.job_type is NULL) OR (j.job_type <> 'child'))\n\t\tORDER BY j.scheduled_date,\n\t\t\t\t j.start_date";
$job->query($query);
require_once 'CRM/Core/Lock.php';
// For reach of the "Parent Jobs" we find, we split them into
// X Number of child jobs
while ($job->fetch()) {
// still use job level lock for each child job
$lockName = "civimail.job.{$job->id}";
$lock = new CRM_Core_Lock($lockName);
if (!$lock->isAcquired()) {
continue;
}
// refetch the job status in case things
// changed between the first query and now
// avoid race conditions
$job->status = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Job', $job->id, 'status');
if ($job->status != 'Scheduled') {
$lock->release();
continue;
}
$job->split_job($offset);
// update the status of the parent job
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
$saveJob = new CRM_Mailing_DAO_Job();
$saveJob->id = $job->id;
$saveJob->start_date = date('YmdHis');
$saveJob->status = 'Running';
$saveJob->save();
$transaction->commit();
// Release the job lock
$lock->release();
}
}