本文整理汇总了PHP中CRM_Utils_Hook::postProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::postProcess方法的具体用法?PHP CRM_Utils_Hook::postProcess怎么用?PHP CRM_Utils_Hook::postProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::postProcess方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcessHook
/**
* The postProcess hook is typically called by the framework.
* However in a few cases, the form exits or redirects early in which
* case it needs to call this function so other modules can do the needful
* Calling this function directly should be avoided if possible. In general a
* better way is to do setUserContext so the framework does the redirect
*/
public function postProcessHook()
{
CRM_Utils_Hook::postProcess(get_class($this), $this);
}
示例2: endPostProcess
function endPostProcess()
{
// make submit buttons keep the current working tab opened.
if ($this->_action & CRM_Core_Action::UPDATE) {
$subPage = CRM_Utils_Request::retrieve('subPage', 'String', $this);
if ($subPage) {
$title = CRM_Event_Form_ManageEvent_TabHeader::getSubPageInfo($this, $subPage);
}
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $title)));
// we need to call the hook manually here since we redirect and never
// go back to CRM/Core/Form.php
// A better way might have been to setUserContext so the framework does the rediret
CRM_Utils_Hook::postProcess(get_class($this), $this);
$className = CRM_Utils_String::getClassName($this->_name);
if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
CRM_Utils_System::redirect($this->_doneUrl);
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), "action=update&reset=1&id={$this->_id}&subPage={$subPage}"));
}
}
}
示例3: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
static function postProcess(&$form)
{
$formValues = $form->controller->exportValues($form->getName());
// process message template
require_once 'CRM/Core/BAO/MessageTemplates.php';
if (CRM_Utils_Array::value('saveTemplate', $formValues) || CRM_Utils_Array::value('updateTemplate', $formValues)) {
$messageTemplate = array('msg_text' => NULL, 'msg_html' => $formValues['html_message'], 'msg_subject' => NULL, 'is_active' => true);
if ($formValues['saveTemplate']) {
$messageTemplate['msg_title'] = $formValues['saveTemplateName'];
CRM_Core_BAO_MessageTemplates::add($messageTemplate);
}
if ($formValues['template'] && $formValues['updateTemplate']) {
$messageTemplate['id'] = $formValues['template'];
unset($messageTemplate['msg_title']);
CRM_Core_BAO_MessageTemplates::add($messageTemplate);
}
}
require_once 'dompdf/dompdf_config.inc.php';
$html = '<html><head><style>body { margin: 56px; }</style></head><body>';
require_once 'api/v2/Contact.php';
require_once 'CRM/Utils/Token.php';
$tokens = array();
CRM_Utils_Hook::tokens($tokens);
$categories = array_keys($tokens);
$html_message = $formValues['html_message'];
//time being hack to strip ' '
//from particular letter line, CRM-6798
self::formatMessage($html_message);
require_once 'CRM/Activity/BAO/Activity.php';
$messageToken = CRM_Activity_BAO_Activity::getTokens($html_message);
$returnProperties = array();
if (isset($messageToken['contact'])) {
foreach ($messageToken['contact'] as $key => $value) {
$returnProperties[$value] = 1;
}
}
require_once 'CRM/Mailing/BAO/Mailing.php';
$mailing = new CRM_Mailing_BAO_Mailing();
if (defined('CIVICRM_MAIL_SMARTY')) {
require_once 'CRM/Core/Smarty/resources/String.php';
civicrm_smarty_register_string_resource();
}
$first = TRUE;
foreach ($form->_contactIds as $item => $contactId) {
$params = array('contact_id' => $contactId);
list($contact) = $mailing->getDetails($params, $returnProperties, false);
if (civicrm_error($contact)) {
$notSent[] = $contactId;
continue;
}
$tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact[$contactId], true, $messageToken);
$tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact[$contactId], $categories, true);
if (defined('CIVICRM_MAIL_SMARTY')) {
$smarty = CRM_Core_Smarty::singleton();
// also add the contact tokens to the template
$smarty->assign_by_ref('contact', $contact);
$tokenHtml = $smarty->fetch("string:{$tokenHtml}");
}
if ($first == TRUE) {
$first = FALSE;
$html .= $tokenHtml;
} else {
$html .= "<div STYLE='page-break-after: always'></div>{$tokenHtml}";
}
}
$html .= '</body></html>';
require_once 'CRM/Activity/BAO/Activity.php';
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'Print PDF Letter', 'name');
$activityParams = array('source_contact_id' => $userID, 'activity_type_id' => $activityTypeID, 'activity_date_time' => date('YmdHis'), 'details' => $html_message);
if ($form->_activityId) {
$activityParams += array('id' => $form->_activityId);
}
if ($form->_cid) {
$activity = CRM_Activity_BAO_Activity::create($activityParams);
} else {
// create Print PDF activity for each selected contact. CRM-6886
$activityIds = array();
foreach ($form->_contactIds as $contactId) {
$activityID = CRM_Activity_BAO_Activity::create($activityParams);
$activityIds[$contactId] = $activityID->id;
}
}
foreach ($form->_contactIds as $contactId) {
$activityTargetParams = array('activity_id' => empty($activity->id) ? $activityIds[$contactId] : $activity->id, 'target_contact_id' => $contactId);
CRM_Activity_BAO_Activity::createActivityTarget($activityTargetParams);
}
require_once 'CRM/Utils/PDF/Utils.php';
CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", 'portrait', 'letter');
// we need to call the hook manually here since we redirect and never
// go back to CRM/Core/Form.php
CRM_Utils_Hook::postProcess(get_class($form), $form);
CRM_Utils_System::civiExit(1);
//.........这里部分代码省略.........
示例4: mainProcess
/**
* This function is just a wrapper, so that we can call all the hook functions
*/
function mainProcess()
{
$this->postProcess();
CRM_Utils_Hook::postProcess(get_class($this), $this);
}
示例5: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
static function postProcess(&$form)
{
$formValues = $form->controller->exportValues($form->getName());
// process message template
require_once 'CRM/Core/BAO/MessageTemplates.php';
if (CRM_Utils_Array::value('saveTemplate', $formValues) || CRM_Utils_Array::value('updateTemplate', $formValues)) {
$messageTemplate = array('msg_text' => NULL, 'msg_html' => $formValues['html_message'], 'msg_subject' => NULL, 'is_active' => true);
if ($formValues['saveTemplate']) {
$messageTemplate['msg_title'] = $formValues['saveTemplateName'];
CRM_Core_BAO_MessageTemplates::add($messageTemplate);
}
if ($formValues['template'] && $formValues['updateTemplate']) {
$messageTemplate['id'] = $formValues['template'];
unset($messageTemplate['msg_title']);
CRM_Core_BAO_MessageTemplates::add($messageTemplate);
}
}
require_once 'dompdf/dompdf_config.inc.php';
$html = '<html><head><style>body { margin: 56px; }</style></head><body>';
require_once 'api/v2/Contact.php';
require_once 'CRM/Utils/Token.php';
$tokens = array();
CRM_Utils_Hook::tokens($tokens);
$categories = array_keys($tokens);
$html_message = $formValues['html_message'];
require_once 'CRM/Activity/BAO/Activity.php';
$messageToken = CRM_Activity_BAO_Activity::getTokens($html_message);
$returnProperties = array();
if (isset($messageToken['contact'])) {
foreach ($messageToken['contact'] as $key => $value) {
$returnProperties[$value] = 1;
}
}
require_once 'CRM/Mailing/BAO/Mailing.php';
$mailing =& new CRM_Mailing_BAO_Mailing();
$first = TRUE;
foreach ($form->_contactIds as $item => $contactId) {
$params = array('contact_id' => $contactId);
list($contact) = $mailing->getDetails($params, $returnProperties, false);
if (civicrm_error($contact)) {
$notSent[] = $contactId;
continue;
}
$tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact[$contactId], true, $messageToken);
$tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact[$contactId], $categories, true);
if ($first == TRUE) {
$first = FALSE;
$html .= $tokenHtml;
} else {
$html .= "<div STYLE='page-break-after: always'></div>{$tokenHtml}";
}
}
$html .= '</body></html>';
require_once 'CRM/Utils/PDF/Utils.php';
CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", 'portrait');
// we need to call the hook manually here since we redirect and never
// go back to CRM/Core/Form.php
CRM_Utils_Hook::postProcess(get_class($form), $form);
exit(1);
}
示例6: endPostProcess
function endPostProcess()
{
// make submit buttons keep the current working tab opened.
if ($this->_action & CRM_Core_Action::UPDATE) {
$className = CRM_Utils_String::getClassName($this->_name);
if ($className == 'EventInfo') {
$subPage = 'eventInfo';
} elseif ($className == 'Event') {
$subPage = 'friend';
} else {
$subPage = strtolower($className);
}
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $subPage == 'friend' ? 'Friend' : $className)));
// we need to call the hook manually here since we redirect and never
// go back to CRM/Core/Form.php
// A better way might have been to setUserContext so the framework does the rediret
CRM_Utils_Hook::postProcess(get_class($this), $this);
if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
if ($this->_isTemplate) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1'));
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/manage', 'reset=1'));
}
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/event/manage/{$subPage}", "action=update&reset=1&id={$this->_id}"));
}
}
}