当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Utils_Hook::alterContent方法代码示例

本文整理汇总了PHP中CRM_Utils_Hook::alterContent方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::alterContent方法的具体用法?PHP CRM_Utils_Hook::alterContent怎么用?PHP CRM_Utils_Hook::alterContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Utils_Hook的用法示例。


在下文中一共展示了CRM_Utils_Hook::alterContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderForm

 /**
  * Render the page using a custom templating system.
  *
  * @param CRM_Core_Form $page
  *   The CRM_Core_Form page.
  */
 public function renderForm(&$page)
 {
     $this->_setRenderTemplates($page);
     $template = CRM_Core_Smarty::singleton();
     $form = $page->toSmarty();
     // Deprecated - use snippet=6 instead of json=1
     $json = CRM_Utils_Request::retrieve('json', 'Boolean', CRM_Core_DAO::$_nullObject);
     if ($json) {
         CRM_Utils_JSON::output($form);
     }
     $template->assign('form', $form);
     $template->assign('isForm', 1);
     $controller =& $page->controller;
     // Stop here if we are in embedded mode. Exception: displaying form errors via ajax
     if ($controller->getEmbedded() && !(!empty($form['errors']) && $controller->_QFResponseType == 'json')) {
         return;
     }
     $template->assign('action', $page->getAction());
     $pageTemplateFile = $page->getHookedTemplateFileName();
     $template->assign('tplFile', $pageTemplateFile);
     $content = $template->fetch($controller->getTemplateFile());
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $page->overrideExtraTemplateFileName());
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'form', $pageTemplateFile, $page);
     $print = $controller->getPrint();
     if ($print) {
         $html =& $content;
     } else {
         $html = CRM_Utils_System::theme($content, $print);
     }
     if ($controller->_QFResponseType == 'json') {
         $response = array('content' => $html);
         if (!empty($page->ajaxResponse)) {
             $response += $page->ajaxResponse;
         }
         if (!empty($form['errors'])) {
             $response['status'] = 'form_error';
             $response['errors'] = $form['errors'];
         }
         CRM_Core_Page_AJAX::returnJsonResponse($response);
     }
     if ($print) {
         if ($print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$page->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } else {
             echo $html;
         }
         CRM_Utils_System::civiExit();
     }
     print $html;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:60,代码来源:Display.php

示例2: run

 /**
  * This function takes care of all the things common to all
  * pages. This typically involves assigning the appropriate smarty
  * variable :)
  *
  * @return void|string
  *   The content generated by running this page
  */
 public function run()
 {
     if ($this->_embedded) {
         return NULL;
     }
     self::$_template->assign('mode', $this->_mode);
     $pageTemplateFile = $this->getHookedTemplateFileName();
     self::$_template->assign('tplFile', $pageTemplateFile);
     // invoke the pagRun hook, CRM-3906
     CRM_Utils_Hook::pageRun($this);
     if ($this->_print) {
         if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON))) {
             $content = self::$_template->fetch('CRM/common/snippet.tpl');
         } else {
             $content = self::$_template->fetch('CRM/common/print.tpl');
         }
         CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $this->overrideExtraTemplateFileName());
         //its time to call the hook.
         CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
         if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } elseif ($this->_print == CRM_Core_Smarty::PRINT_JSON) {
             $this->ajaxResponse['content'] = $content;
             CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse);
         } else {
             echo $content;
         }
         CRM_Utils_System::civiExit();
     }
     $config = CRM_Core_Config::singleton();
     // Intermittent alert to admins
     CRM_Utils_Check::singleton()->showPeriodicAlerts();
     if ($this->useLivePageJS && CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE)) {
         CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
     }
     $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
     // Render page header
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content);
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
     echo CRM_Utils_System::theme($content, $this->_print);
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:53,代码来源:Page.php

示例3: renderForm

 /**
  * render the page using a custom templating
  * system
  *
  * @param object  $page the CRM_Core_Form page
  * @param boolean $ret  should we echo or return output
  *
  * @return void
  * @access public
  */
 function renderForm(&$page)
 {
     $this->_setRenderTemplates($page);
     $template = CRM_Core_Smarty::singleton();
     $form = $page->toSmarty();
     $json = CRM_Utils_Request::retrieve('json', 'Boolean', CRM_Core_DAO::$_nullObject);
     if ($json) {
         CRM_Utils_JSON::output($form);
     }
     $template->assign('form', $form);
     $template->assign('isForm', 1);
     $controller =& $page->controller;
     if ($controller->getEmbedded()) {
         return;
     }
     $template->assign('action', $page->getAction());
     $pageTemplateFile = $page->getHookedTemplateFileName();
     $template->assign('tplFile', $pageTemplateFile);
     $content = $template->fetch($controller->getTemplateFile());
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $page->overrideExtraTemplateFileName());
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'form', $pageTemplateFile, $page);
     $print = $controller->getPrint();
     if ($print) {
         $html =& $content;
     } else {
         $html = CRM_Utils_System::theme($content, $print);
     }
     if ($controller->_QFResponseType == 'json') {
         $response = array('content' => $html);
         // CRM-11831 @see http://www.malsup.com/jquery/form/#file-upload
         $xhr = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
         if (!$xhr) {
             echo '<textarea>';
         }
         echo json_encode($response);
         if (!$xhr) {
             echo '</textarea>';
         }
         CRM_Utils_System::civiExit();
     }
     if ($print) {
         if ($print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$page->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } else {
             echo $html;
         }
         CRM_Utils_System::civiExit();
     }
     print $html;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:64,代码来源:Display.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' => 'frontoffice@vnv.nl', 'toName' => 'Front Office VnV', 'toEmail' => 'frontoffice@vnv.nl', 'subject' => $subject, 'text' => $subject, 'html' => $content, 'replyTo' => 'frontoffice@vnv.nl');
    CRM_Utils_Mail::send($params);
}
开发者ID:jvos,项目名称:nl.vnv.rapportagenamailings_old,代码行数:36,代码来源:RapportageNaMailings.php

示例5: run

 /**
  * This function takes care of all the things common to all
  * pages. This typically involves assigning the appropriate
  * smarty variable :)
  *
  * @return string The content generated by running this page
  */
 function run()
 {
     if ($this->_embedded) {
         return;
     }
     self::$_template->assign('mode', $this->_mode);
     $pageTemplateFile = $this->getHookedTemplateFileName();
     self::$_template->assign('tplFile', $pageTemplateFile);
     // invoke the pagRun hook, CRM-3906
     CRM_Utils_Hook::pageRun($this);
     if ($this->_print) {
         if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON))) {
             $content = self::$_template->fetch('CRM/common/snippet.tpl');
         } else {
             $content = self::$_template->fetch('CRM/common/print.tpl');
         }
         CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $this->overrideExtraTemplateFileName());
         //its time to call the hook.
         CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
         if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } elseif ($this->_print == CRM_Core_Smarty::PRINT_JSON) {
             $this->ajaxResponse['content'] = $content;
             CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse);
         } else {
             echo $content;
         }
         CRM_Utils_System::civiExit();
     }
     $config = CRM_Core_Config::singleton();
     // TODO: Is there a better way to ensure these actions don't happen during AJAX requests?
     if (empty($_GET['snippet'])) {
         // Version check and intermittent alert to admins
         CRM_Utils_VersionCheck::singleton()->versionAlert();
         CRM_Utils_Check_Security::singleton()->showPeriodicAlerts();
         // Debug msg once per hour
         if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) {
             $msg = ts('Warning: Debug is enabled in <a href="%1">system settings</a>. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1')));
             CRM_Core_Session::setStatus($msg, ts('Debug Mode'));
         }
     }
     $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
     // Render page header
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content);
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
     echo CRM_Utils_System::theme($content, $this->_print);
     return;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:59,代码来源:Page.php

示例6: run

 /**
  * This function takes care of all the things common to all
  * pages. This typically involves assigning the appropriate
  * smarty variable :)
  *
  * @return string The content generated by running this page
  */
 function run()
 {
     if ($this->_embedded) {
         return;
     }
     self::$_template->assign('mode', $this->_mode);
     $pageTemplateFile = $this->getTemplateFileName();
     self::$_template->assign('tplFile', $pageTemplateFile);
     // invoke the pagRun hook, CRM-3906
     CRM_Utils_Hook::pageRun($this);
     if ($this->_print) {
         if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM))) {
             $content = self::$_template->fetch('CRM/common/snippet.tpl');
         } else {
             $content = self::$_template->fetch('CRM/common/print.tpl');
         }
         CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $this->overrideExtraTemplateFileName());
         //its time to call the hook.
         CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
         if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } else {
             echo $content;
         }
         CRM_Utils_System::civiExit();
     }
     $config = CRM_Core_Config::singleton();
     $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
     if ($region = CRM_Core_Region::instance('html-header', FALSE)) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content);
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
     echo CRM_Utils_System::theme('page', $content, TRUE, $this->_print);
     return;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:44,代码来源:Page.php


注:本文中的CRM_Utils_Hook::alterContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。