本文整理汇总了PHP中CRM_Core_BAO_MessageTemplate::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_MessageTemplate::del方法的具体用法?PHP CRM_Core_BAO_MessageTemplate::del怎么用?PHP CRM_Core_BAO_MessageTemplate::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_MessageTemplate
的用法示例。
在下文中一共展示了CRM_Core_BAO_MessageTemplate::del方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Process the form submission.
*
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_MessageTemplate::del($this->_id);
} elseif ($this->_action & CRM_Core_Action::VIEW) {
// currently, the above action is used solely for previewing default workflow templates
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'));
} else {
$params = array();
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
}
if ($this->_workflow_id) {
$params['workflow_id'] = $this->_workflow_id;
$params['is_active'] = TRUE;
}
$messageTemplate = CRM_Core_BAO_MessageTemplate::add($params);
CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', array(1 => $messageTemplate->msg_title)), ts('Saved'), 'success');
if ($this->_workflow_id) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'));
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=user&reset=1'));
}
}
}
示例2: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_MessageTemplate::del($this->_id);
} elseif ($this->_action & CRM_Core_Action::VIEW) {
// currently, the above action is used solely for previewing default workflow templates
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'));
} else {
$params = array();
// store the submitted values in an array
$params = $this->controller->exportValues($this->_name);
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
}
if (!empty($params['file_type'])) {
unset($params['msg_html']);
unset($params['msg_text']);
CRM_Utils_File::formatFile($params, 'file_id');
} elseif (!empty($this->_id)) {
$entityFileDAO = new CRM_Core_DAO_EntityFile();
$entityFileDAO->entity_id = $this->_id;
$entityFileDAO->entity_table = 'civicrm_msg_template';
if ($entityFileDAO->find(TRUE)) {
$fileDAO = new CRM_Core_DAO_File();
$fileDAO->id = $entityFileDAO->file_id;
$fileDAO->find(TRUE);
$entityFileDAO->delete();
$fileDAO->delete();
}
}
if ($this->_workflow_id) {
$params['workflow_id'] = $this->_workflow_id;
$params['is_active'] = TRUE;
}
$messageTemplate = CRM_Core_BAO_MessageTemplate::add($params);
CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', array(1 => $messageTemplate->msg_title)), ts('Saved'), 'success');
if ($this->_workflow_id) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'));
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=user&reset=1'));
}
}
}