本文整理汇总了PHP中CRM_Utils_Hook::pageRun方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::pageRun方法的具体用法?PHP CRM_Utils_Hook::pageRun怎么用?PHP CRM_Utils_Hook::pageRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::pageRun方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$args = $_REQUEST;
if (!empty($args['file']) && strpos($args['file'], '..') === FALSE) {
$file = $args['file'] . '.hlp';
$additionalTPLFile = $args['file'] . '.extra.hlp';
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('id', $args['id']);
CRM_Utils_Array::remove($args, 'file', 'class_name', 'type', 'q', 'id');
foreach ($args as &$arg) {
$arg = strip_tags($arg);
}
$smarty->assign('params', $args);
$extraoutput = '';
if ($smarty->template_exists($additionalTPLFile)) {
//@todo hook has been put here as a conservative approach
// but probably should always run. It doesn't run otherwise because of the exit
CRM_Utils_Hook::pageRun($this);
$extraoutput .= trim($smarty->fetch($additionalTPLFile));
}
exit($smarty->fetch($file) . $extraoutput);
}
}
示例2: run
//.........这里部分代码省略.........
$errors = CRM_Profile_Form::validateContactActivityProfile($this->_activityId, $this->_id, $this->_gid);
if (!empty($errors)) {
CRM_Core_Error::fatal(array_pop($errors));
}
}
//reformat fields array
foreach ($fields as $name => $field) {
// also eliminate all formatting fields
if (CRM_Utils_Array::value('field_type', $field) == 'Formatting') {
unset($fields[$name]);
}
// make sure that there is enough permission to expose this field
if (!$admin && $field['visibility'] == 'User and User Admin Only') {
unset($fields[$name]);
}
}
if ($this->_isContactActivityProfile) {
$contactFields = $activityFields = array();
foreach ($fields as $fieldName => $field) {
if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
$activityFields[$fieldName] = $field;
} else {
$contactFields[$fieldName] = $field;
}
}
CRM_Core_BAO_UFGroup::getValues($this->_id, $contactFields, $values);
if ($this->_activityId) {
CRM_Core_BAO_UFGroup::getValues(NULL, $activityFields, $values, TRUE, array(array('activity_id', '=', $this->_activityId, 0, 0)));
}
} else {
$customWhereClause = NULL;
if ($this->_multiRecord & CRM_Core_Action::VIEW && $this->_recordId) {
if ($this->_allFields) {
$copyFields = $fields;
CRM_Core_BAO_UFGroup::shiftMultiRecordFields($copyFields, $multiRecordFields);
$fieldKey = key($multiRecordFields);
} else {
$fieldKey = key($fields);
}
if ($fieldID = CRM_Core_BAO_CustomField::getKeyID($fieldKey)) {
$tableColumnGroup = CRM_Core_BAO_CustomField::getTableColumnGroup($fieldID);
$columnName = "{$tableColumnGroup[0]}.id";
$customWhereClause = $columnName . ' = ' . $this->_recordId;
}
}
CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values, TRUE, NULL, FALSE, $customWhereClause);
}
// $profileFields array can be used for customized display of field labels and values in Profile/View.tpl
$profileFields = array();
$labels = array();
foreach ($fields as $name => $field) {
//CRM-14338
// Create a unique, non-empty index for each field.
$index = $field['title'];
if ($index === '') {
$index = ' ';
}
while (array_key_exists($index, $labels)) {
$index .= ' ';
}
$labels[$index] = preg_replace('/\\s+|\\W+/', '_', $name);
}
foreach ($values as $title => $value) {
$profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
}
$template->assign_by_ref('row', $values);
$template->assign_by_ref('profileFields', $profileFields);
}
$name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
$this->assign('ufGroupName', $name);
CRM_Utils_Hook::viewProfile($name);
if (strtolower($name) == 'summary_overlay') {
$template->assign('overlayProfile', TRUE);
}
if ($this->_multiRecord & CRM_Core_Action::VIEW && $this->_recordId && !$this->_allFields) {
$fieldDetail = reset($fields);
$fieldId = CRM_Core_BAO_CustomField::getKeyID($fieldDetail['name']);
$customGroupDetails = CRM_Core_BAO_CustomGroup::getGroupTitles(array($fieldId));
$multiRecTitle = $customGroupDetails[$fieldId]['groupTitle'];
} else {
$title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
}
//CRM-4131.
$displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_id, 'display_name');
if ($displayName) {
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
if ($session->get('userID') && CRM_Core_Permission::check('access CiviCRM') && CRM_Contact_BAO_Contact_Permission::allow($session->get('userID'), CRM_Core_Permission::VIEW) && !$config->userFrameworkFrontend) {
$contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', "action=view&reset=1&cid={$this->_id}", TRUE);
$this->assign('displayName', $displayName);
$displayName = "<a href=\"{$contactViewUrl}\">{$displayName}</a>";
}
$title .= ' - ' . $displayName;
}
$title = isset($multiRecTitle) ? ts('View %1 Record', array(1 => $multiRecTitle)) : $title;
CRM_Utils_System::setTitle($title);
// invoke the pagRun hook, CRM-3906
CRM_Utils_Hook::pageRun($this);
return trim($template->fetch($this->getHookedTemplateFileName()));
}
示例3: 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);
self::$_template->assign('tplFile', $this->getTemplateFileName());
// invoke the pagRun hook, CRM-3906
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::pageRun($this);
if ($this->_print) {
if ($this->_print == CRM_Core_Smarty::PRINT_SNIPPET || $this->_print == CRM_Core_Smarty::PRINT_PDF) {
$content = self::$_template->fetch('CRM/common/snippet.tpl');
} else {
$content = self::$_template->fetch('CRM/common/print.tpl');
}
if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
require_once 'CRM/Utils/PDF/Utils.php';
CRM_Utils_PDF_Utils::domlib($content, "{$this->_name}.pdf");
} else {
echo $content;
}
exit;
}
$config =& CRM_Core_Config::singleton();
$content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
echo CRM_Utils_System::theme('page', $content, true, $this->_print);
return;
}
示例4: 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);
}
示例5: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
*
* @return void
* @access public
*
*/
function run()
{
$template =& CRM_Core_Smarty::singleton();
if ($this->_id && $this->_gid) {
// first check that id is part of the limit group id, CRM-4822
$limitListingsGroupsID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'limit_listings_group_id');
$config =& CRM_Core_Config::singleton();
if ($limitListingsGroupsID) {
require_once 'CRM/Contact/BAO/GroupContact.php';
if (!CRM_Contact_BAO_GroupContact::isContactInGroup($this->_id, $limitListingsGroupsID)) {
CRM_Core_Error::statusBounce(ts('You do not have permission to view this contact record. Contact the site administrator if you need assistance.'), $config->userFrameworkBaseURL);
}
}
require_once 'CRM/Core/BAO/UFGroup.php';
$values = array();
$fields = CRM_Core_BAO_UFGroup::getFields($this->_gid, false, CRM_Core_Action::VIEW, null, null, false, $this->_restrict, $this->_skipPermission, null, CRM_Core_Permission::VIEW);
// make sure we dont expose all fields based on permission
$admin = false;
$session =& CRM_Core_Session::singleton();
if (!$config->userFrameworkFrontend && (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts')) || $this->_id == $session->get('userID')) {
$admin = true;
}
if (!$admin) {
foreach ($fields as $name => $field) {
// make sure that there is enough permission to expose this field
if ($field['visibility'] == 'User and User Admin Only') {
unset($fields[$name]);
}
}
}
CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values);
// $profileFields_$gid array can be used for customized display of field labels and values in Profile/View.tpl
$profileFields = array();
$labels = array();
foreach ($fields as $name => $field) {
$labels[$field['title']] = preg_replace('/\\s+|\\W+/', '_', $name);
}
foreach ($values as $title => $value) {
$profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
}
$template->assign_by_ref('row', $values);
$template->assign_by_ref('profileFields_' . $this->_gid, $profileFields);
}
// invoke the pagRun hook, CRM-3906
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::pageRun($this);
return trim($template->fetch($this->getTemplateFileName()));
}
示例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->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;
}
示例7: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
*
* @return void
* @access public
*
*/
function run()
{
$template = CRM_Core_Smarty::singleton();
if ($this->_id && $this->_gid) {
// first check that id is part of the limit group id, CRM-4822
$limitListingsGroupsID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'limit_listings_group_id');
$config = CRM_Core_Config::singleton();
if ($limitListingsGroupsID) {
require_once 'CRM/Contact/BAO/GroupContact.php';
if (!CRM_Contact_BAO_GroupContact::isContactInGroup($this->_id, $limitListingsGroupsID)) {
CRM_Utils_System::setTitle(ts('Profile View - Permission Denied'));
return CRM_Core_Session::setStatus(ts('You do not have permission to view this contact record. Contact the site administrator if you need assistance.'));
}
}
require_once 'CRM/Core/BAO/UFGroup.php';
$values = array();
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileIds, false, CRM_Core_Action::VIEW, null, null, false, $this->_restrict, $this->_skipPermission, null, CRM_Core_Permission::VIEW);
require_once 'CRM/Contact/BAO/Contact/Permission.php';
// make sure we dont expose all fields based on permission
$admin = false;
$session = CRM_Core_Session::singleton();
if (!$config->userFrameworkFrontend && (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts') || CRM_Contact_BAO_Contact_Permission::allow($this->_id, CRM_Core_Permission::VIEW)) || $this->_id == $session->get('userID')) {
$admin = true;
}
if (!$admin) {
foreach ($fields as $name => $field) {
// make sure that there is enough permission to expose this field
if ($field['visibility'] == 'User and User Admin Only') {
unset($fields[$name]);
}
}
}
CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values);
// $profileFields array can be used for customized display of field labels and values in Profile/View.tpl
$profileFields = array();
$labels = array();
foreach ($fields as $name => $field) {
$labels[$field['title']] = preg_replace('/\\s+|\\W+/', '_', $name);
}
foreach ($values as $title => $value) {
$profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
}
$template->assign_by_ref('row', $values);
$template->assign_by_ref('profileFields', $profileFields);
}
$name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
if (strtolower($name) == 'summary_overlay') {
$template->assign('overlayProfile', true);
}
$title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
//CRM-4131.
$displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_id, 'display_name');
if ($displayName) {
require_once 'CRM/Core/Permission.php';
require_once 'CRM/Contact/BAO/Contact/Permission.php';
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
if ($session->get('userID') && CRM_Core_Permission::check('access CiviCRM') && CRM_Contact_BAO_Contact_Permission::allow($session->get('userID'), CRM_Core_Permission::VIEW) && !$config->userFrameworkFrontend) {
$contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', "action=view&reset=1&cid={$this->_id}", true);
$this->assign('displayName', $displayName);
$displayName = "<a href=\"{$contactViewUrl}\">{$displayName}</a>";
}
$title .= ' - ' . $displayName;
}
CRM_Utils_System::setTitle($title);
// invoke the pagRun hook, CRM-3906
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::pageRun($this);
return trim($template->fetch($this->getTemplateFileName()));
}
示例8: run
//.........这里部分代码省略.........
{
$template = CRM_Core_Smarty::singleton();
if ($this->_id && $this->_gid) {
// first check that id is part of the limit group id, CRM-4822
$limitListingsGroupsID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'limit_listings_group_id');
$config = CRM_Core_Config::singleton();
if ($limitListingsGroupsID) {
if (!CRM_Contact_BAO_GroupContact::isContactInGroup($this->_id, $limitListingsGroupsID)) {
CRM_Utils_System::setTitle(ts('Profile View - Permission Denied'));
return CRM_Core_Session::setStatus(ts('You do not have permission to view this contact record. Contact the site administrator if you need assistance.'));
}
}
$values = array();
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileIds, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, $this->_restrict, $this->_skipPermission, NULL, CRM_Core_Permission::VIEW);
if ($this->_isContactActivityProfile && $this->_gid) {
$errors = CRM_Profile_Form::validateContactActivityProfile($this->_activityId, $this->_id, $this->_gid);
if (!empty($errors)) {
CRM_Core_Error::fatal(array_pop($errors));
}
}
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$this->_isPermissionedChecksum = FALSE;
if ($this->_id != $userID) {
// do not allow edit for anon users in joomla frontend, CRM-4668, unless u have checksum CRM-5228
if ($config->userFrameworkFrontend) {
$this->_isPermissionedChecksum = CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum($this->_id, $this, FALSE);
} else {
$this->_isPermissionedChecksum = CRM_Contact_BAO_Contact_Permission::validateChecksumContact($this->_id, $this, FALSE);
}
}
// make sure we dont expose all fields based on permission
$admin = FALSE;
if (!$config->userFrameworkFrontend && (CRM_Core_Permission::check('administer users') || CRM_Core_Permission::check('view all contacts') || CRM_Contact_BAO_Contact_Permission::allow($this->_id, CRM_Core_Permission::VIEW)) || $this->_id == $userID || $this->_isPermissionedChecksum) {
$admin = TRUE;
}
if (!$admin) {
foreach ($fields as $name => $field) {
// make sure that there is enough permission to expose this field
if ($field['visibility'] == 'User and User Admin Only') {
unset($fields[$name]);
}
}
}
// also eliminate all formatting fields
foreach ($fields as $name => $field) {
if (CRM_Utils_Array::value('field_type', $field) == 'Formatting') {
unset($fields[$name]);
}
}
if ($this->_isContactActivityProfile) {
$contactFields = $activityFields = array();
foreach ($fields as $fieldName => $field) {
if (CRM_Utils_Array::value('field_type', $field) == 'Activity') {
$activityFields[$fieldName] = $field;
} else {
$contactFields[$fieldName] = $field;
}
}
CRM_Core_BAO_UFGroup::getValues($this->_id, $contactFields, $values);
if ($this->_activityId) {
CRM_Core_BAO_UFGroup::getValues(NULL, $activityFields, $values, TRUE, array(array('activity_id', '=', $this->_activityId, 0, 0)));
}
} else {
CRM_Core_BAO_UFGroup::getValues($this->_id, $fields, $values);
}
// $profileFields array can be used for customized display of field labels and values in Profile/View.tpl
$profileFields = array();
$labels = array();
foreach ($fields as $name => $field) {
$labels[$field['title']] = preg_replace('/\\s+|\\W+/', '_', $name);
}
foreach ($values as $title => $value) {
$profileFields[$labels[$title]] = array('label' => $title, 'value' => $value);
}
$template->assign_by_ref('row', $values);
$template->assign_by_ref('profileFields', $profileFields);
}
$name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
if (strtolower($name) == 'summary_overlay') {
$template->assign('overlayProfile', TRUE);
}
$title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
//CRM-4131.
$displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_id, 'display_name');
if ($displayName) {
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
if ($session->get('userID') && CRM_Core_Permission::check('access CiviCRM') && CRM_Contact_BAO_Contact_Permission::allow($session->get('userID'), CRM_Core_Permission::VIEW) && !$config->userFrameworkFrontend) {
$contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', "action=view&reset=1&cid={$this->_id}", TRUE);
$this->assign('displayName', $displayName);
$displayName = "<a href=\"{$contactViewUrl}\">{$displayName}</a>";
}
$title .= ' - ' . $displayName;
}
CRM_Utils_System::setTitle($title);
// invoke the pagRun hook, CRM-3906
CRM_Utils_Hook::pageRun($this);
return trim($template->fetch($this->getTemplateFileName()));
}
示例9: 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;
}