本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::del方法的具体用法?PHP CRM_Mailing_BAO_Mailing::del怎么用?PHP CRM_Mailing_BAO_Mailing::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::del方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run($newArgs)
{
$this->preProcess();
if (isset($_GET['runJobs']) || CRM_Utils_Array::value('2', $newArgs) == 'queue') {
require_once 'CRM/Mailing/BAO/Job.php';
$config =& CRM_Core_Config::singleton();
CRM_Mailing_BAO_Job::runJobs_pre($config->mailerJobSize);
CRM_Mailing_BAO_Job::runJobs();
CRM_Mailing_BAO_Job::runJobs_post();
}
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
if ($this->_sortByCharacter == 1 || !empty($_POST)) {
$this->_sortByCharacter = '';
$this->set('sortByCharacter', '');
}
if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') {
$this->_unscheduled = true;
}
$this->set('unscheduled', $this->_unscheduled);
if (CRM_Utils_Array::value(3, $newArgs) == 'archived') {
$this->_archived = true;
}
$this->set('archived', $this->_archived);
if (CRM_Utils_Array::value(3, $newArgs) == 'scheduled') {
$this->_scheduled = true;
}
$this->set('scheduled', $this->_scheduled);
$this->_createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false, 0);
if ($this->_createdId) {
$this->set('createdId', $this->_createdId);
}
$session = CRM_Core_Session::singleton();
$context = $session->readUserContext();
if ($this->_action & CRM_Core_Action::DISABLE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) {
require_once 'CRM/Mailing/BAO/Job.php';
CRM_Mailing_BAO_Job::cancel($this->_mailingId);
CRM_Utils_System::redirect($context);
} else {
$controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Cancel Mailing'), $this->_action);
$controller->setEmbedded(true);
$controller->run();
}
} else {
if ($this->_action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) {
// check for action permissions.
if (!CRM_Core_Permission::checkActionPermission('CiviMail', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::del($this->_mailingId);
CRM_Utils_System::redirect($context);
} else {
$controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Delete Mailing'), $this->_action);
$controller->setEmbedded(true);
$controller->run();
}
} else {
if ($this->_action & CRM_Core_Action::RENEW) {
//archive this mailing, CRM-3752.
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) {
//set is_archived to 1
CRM_Core_DAO::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId, 'is_archived', true);
CRM_Utils_System::redirect($context);
} else {
$controller = new CRM_Core_Controller_Simple('CRM_Mailing_Form_Browse', ts('Archive Mailing'), $this->_action);
$controller->setEmbedded(true);
$controller->run();
}
}
}
}
$selector = new CRM_Mailing_Selector_Browse();
$selector->setParent($this);
$controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $this->get(CRM_Utils_Sort::SORT_ID) . $this->get(CRM_Utils_Sort::SORT_DIRECTION), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE);
$controller->setEmbedded(true);
$controller->run();
//hack to display results as per search
$rows = $controller->getRows($controller);
$this->assign('rows', $rows);
$urlParams = 'reset=1';
$urlString = 'civicrm/mailing/browse';
if (CRM_Utils_Array::value(3, $newArgs) == 'unscheduled') {
$urlString .= '/unscheduled';
$urlParams .= '&scheduled=false';
$this->assign('unscheduled', true);
CRM_Utils_System::setTitle(ts('Draft and Unscheduled Mailings'));
} else {
if (CRM_Utils_Array::value(3, $newArgs) == 'archived') {
$urlString .= '/archived';
$this->assign('archived', true);
CRM_Utils_System::setTitle(ts('Archived Mailings'));
} else {
if (CRM_Utils_Array::value(3, $newArgs) == 'scheduled') {
//.........这里部分代码省略.........
示例3: del
/**
* Delete MailingAB and all its associated records.
*
* @param int $id
* Id of the mail to delete.
*/
public static function del($id)
{
if (empty($id)) {
CRM_Core_Error::fatal();
}
CRM_Core_Transaction::create()->run(function () use($id) {
CRM_Utils_Hook::pre('delete', 'MailingAB', $id, CRM_Core_DAO::$_nullArray);
$dao = new CRM_Mailing_DAO_MailingAB();
$dao->id = $id;
if ($dao->find(TRUE)) {
$mailing_ids = array($dao->mailing_id_a, $dao->mailing_id_b, $dao->mailing_id_c);
$dao->delete();
foreach ($mailing_ids as $mailing_id) {
if ($mailing_id) {
CRM_Mailing_BAO_Mailing::del($mailing_id);
}
}
}
CRM_Core_Session::setStatus(ts('Selected mailing has been deleted.'), ts('Deleted'), 'success');
CRM_Utils_Hook::post('delete', 'MailingAB', $id, $dao);
});
}