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


PHP CRM_Core_Smarty::fetch方法代码示例

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


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

示例1: smarty_function_help

/**
 * Adds inline help
 *
 * @param array $params
 *   The function params.
 * @param CRM_Core_Smarty $smarty
 *   Reference to the smarty object.
 *
 * @return string
 *   the help html to be inserted
 */
function smarty_function_help($params, &$smarty)
{
    if (!isset($params['id']) || !isset($smarty->_tpl_vars['config'])) {
        return NULL;
    }
    if (empty($params['file']) && isset($smarty->_tpl_vars['tplFile'])) {
        $params['file'] = $smarty->_tpl_vars['tplFile'];
    } elseif (empty($params['file'])) {
        return NULL;
    }
    $params['file'] = str_replace(array('.tpl', '.hlp'), '', $params['file']);
    if (empty($params['title'])) {
        $vars = $smarty->get_template_vars();
        $smarty->assign('id', $params['id'] . '-title');
        $name = trim($smarty->fetch($params['file'] . '.hlp'));
        $additionalTPLFile = $params['file'] . '.extra.hlp';
        if ($smarty->template_exists($additionalTPLFile)) {
            $name .= trim($smarty->fetch($additionalTPLFile));
        }
        // Ensure we didn't change any existing vars CRM-11900
        foreach ($vars as $key => $value) {
            if ($smarty->get_template_vars($key) !== $value) {
                $smarty->assign($key, $value);
            }
        }
    } else {
        $name = trim(strip_tags($params['title']));
    }
    $class = "helpicon";
    if (!empty($params['class'])) {
        $class .= " {$params['class']}";
    }
    // Escape for html
    $title = htmlspecialchars(ts('%1 Help', array(1 => $name)));
    // Escape for html and js
    $name = htmlspecialchars(json_encode($name), ENT_QUOTES);
    // Format params to survive being passed through json & the url
    unset($params['text'], $params['title']);
    foreach ($params as &$param) {
        $param = is_bool($param) || is_numeric($param) ? (int) $param : (string) $param;
    }
    return '<a class="' . $class . '" title="' . $title . '" href="#" onclick=\'CRM.help(' . $name . ', ' . json_encode($params) . '); return false;\'>&nbsp;</a>';
}
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:54,代码来源:function.help.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();
     // Version check and intermittent alert to admins
     CRM_Utils_VersionCheck::singleton()->versionAlert();
     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');
         $this->assign('includeWysiwygEditor', TRUE);
     }
     $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:kidaa30,项目名称:yes,代码行数:55,代码来源:Page.php

示例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;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:36,代码来源:Page.php

示例4: moveFromSessionToTemplate

 /**
  * Move the variables from the session to the template
  *
  * @return void
  * @access public
  */
 function moveFromSessionToTemplate()
 {
     self::$_template->assign_by_ref("{$this->_prefix}pager", $this->_pager);
     $rows = $this->_store->get("{$this->_prefix}rows");
     if ($rows) {
         if ($this->_dynamicAction) {
             $this->_object->addActions($rows);
         }
         self::$_template->assign("{$this->_prefix}aToZ", $this->_store->get("{$this->_prefix}AToZBar"));
     }
     self::$_template->assign_by_ref("{$this->_prefix}sort", $this->_sort);
     self::$_template->assign("{$this->_prefix}columnHeaders", $this->_store->get("{$this->_prefix}columnHeaders"));
     self::$_template->assign("{$this->_prefix}rows", $rows);
     self::$_template->assign("{$this->_prefix}rowsEmpty", $this->_store->get("{$this->_prefix}rowsEmpty"));
     self::$_template->assign("{$this->_prefix}qill", $this->_store->get("{$this->_prefix}qill"));
     self::$_template->assign("{$this->_prefix}summary", $this->_store->get("{$this->_prefix}summary"));
     if ($this->_embedded) {
         return;
     }
     self::$_template->assign('tplFile', $this->_object->getTemplateFileName());
     if ($this->_print) {
         $content = self::$_template->fetch('CRM/common/print.tpl');
     } else {
         $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);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:34,代码来源:Controller.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_Core_Smarty::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。