本文整理汇总了PHP中Zikula_View::template_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Zikula_View::template_exists方法的具体用法?PHP Zikula_View::template_exists怎么用?PHP Zikula_View::template_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zikula_View
的用法示例。
在下文中一共展示了Zikula_View::template_exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_legalinlinelink
/**
* Smarty function to display a single inline user link of a specific policy for the Legal module.
*
* Example
* {legalinlinelink policytype='termsofuse'}
*
* Tag Parameters:
* policyType The unique string identifier of the policy typw whose inline link is to be returned; required.
* target The target for the generated link, such as "_blank" to open the policy in a new window; optional, default is blank (same effect as "_self").
* assign The name of the template variable to which the output is assiged, if provided; optional, if not specified the output is sent to the template.
*
* Templates used:
* legal_function_legalinlinelink_notfound.tpl
* legal_function_legalinlinelink_legalnotice.tpl
* legal_function_legalinlinelink_termsofuse.tpl
* legal_function_legalinlinelink_privacypolicy.tpl
* legal_function_legalinlinelink_tradeconditions.tpl
* legal_function_legalinlinelink_cancellationrightpolicy.tpl
* legal_function_legalinlinelink_accessibilitystatement.tpl
*
* Template Parameters Exported:
* $target The target for the generated link, such as "_blank" to open the policy in a new window; optional, default is blank (same effect as "_self").
* (assign) If an assign tag parameter is specified, then a template variable a name equal to the value of the assign parameter is exported, containing the rendered output; optional, default is to return the output to the template.
*
* @param array $params All parameters passed to this function from the template.
* @param Zikula_View &$view Reference to the Zikula view object, a subclass of Smarty.
*
* @return string The rendered template output for the specified policy type.
*/
function smarty_function_legalinlinelink($params, Zikula_View &$view)
{
if (!isset($params['policyType'])) {
$template = 'plugins/legal_function_legalinlinelink_notfound.tpl';
} else {
$params['policyType'] = strtolower($params['policyType']);
$template = 'plugins/legal_function_legalinlinelink_' . $params['policyType'] . '.tpl';
if (!$view->template_exists($template)) {
$template = 'plugins/legal_function_legalinlinelink_notfound.tpl';
}
}
$templateVars = array(
'target' => isset($params['target']) ? $params['target'] : ''
);
$view->assign($templateVars);
if (isset($params['assign']) && !empty($params['assign'])) {
$view->assign($params['assign'], $view->fetch($template));
} else {
return $view->fetch($template);
}
}
示例2: getAuthenticationMethodSelector
/**
* @param array $args
*
* @deprecated Use "getAuthenticationMethodSelectorAction" instead.
*
* @return string
*
* @throws \InvalidArgumentException
* @throws FatalErrorException
*/
public function getAuthenticationMethodSelector(array $args)
{
// Parameter extraction and error checking
if (!isset($args) || !is_array($args)) {
throw new \InvalidArgumentException($this->__('An invalid \'$args\' parameter was received.'));
}
if (!isset($args['form_type']) || !is_string($args['form_type'])) {
throw new \InvalidArgumentException($this->__f('An invalid form type (\'%1$s\') was received.', array(isset($args['form_type']) ? $args['form_type'] : 'NULL')));
}
if (!isset($args['form_action']) || !is_string($args['form_action'])) {
throw new \InvalidArgumentException($this->__f('An invalid form action (\'%1$s\') was received.', array(isset($args['form_action']) ? $args['form_action'] : 'NULL')));
}
if (!isset($args['method']) || !is_string($args['method']) || !$this->supportsAuthenticationMethod($args['method'])) {
throw new \InvalidArgumentException($this->__f('Error: An invalid method (\'%1$s\') was received.', array(isset($args['method']) ? $args['method'] : 'NULL')));
}
// End parameter extraction and error checking
if ($this->authenticationMethodIsEnabled($args['method'])) {
/** @var \Zikula\UsersModule\Helper\AuthenticationMethodHelper $authenticationMethod */
$authenticationMethod = $this->getAuthenticationMethod($args['method']);
$icon = $authenticationMethod->getIcon();
$isFontAwesomeIcon = $authenticationMethod->isFontAwesomeIcon();
$templateVars = array('authentication_method' => array('modname' => $this->name, 'method' => $args['method']), 'is_selected' => isset($args['is_selected']) && $args['is_selected'], 'form_type' => $args['form_type'], 'form_action' => $args['form_action'], 'submit_text' => $authenticationMethod->getShortDescription(), 'icon' => $icon, 'isFontAwesomeIcon' => $isFontAwesomeIcon, 'skipLoginFormFieldsPage' => $authenticationMethod->getSkipLoginFormFieldsPage() && $args['form_type'] === 'registration');
$view = new Zikula_View($this->serviceManager, 'ZikulaUsersModule', Zikula_View::CACHE_ENABLED);
$view->assign($templateVars);
$templateName = "Authentication/AuthenticationMethodSelector/{$args['form_type']}/Base.tpl";
if (!$view->template_exists($templateName)) {
$templateName = "Authentication/AuthenticationMethodSelector/Base/Base.tpl";
if (!$view->template_exists($templateName)) {
throw new FatalErrorException($this->__f('A form fields template was not found for the %1$s method using form type \'%2$s\'.', array($args['method'], $args['form_type'])));
}
}
return $this->response($view->fetch($templateName));
} else {
return $this->response('');
}
}
示例3: _renderTemplate
/**
* Render template.
*
* @param Zikula_View $render Renderer.
* @param string $objectType Object type.
* @param string $type Controller.
* @param string $func Function of Controller.
* @param string $theme Theme to use (themes are subfolders in /templates).
* @param string $tpl Sub template name.
* @param string $defaultTheme Default theme (Use if $theme is null).
*
* @return string Rendered Template (HTML)
*/
private function _renderTemplate(Zikula_View $render, $objectType, $type, $func, $theme = null, $tpl = null, $defaultTheme = null)
{
$template = $type . '_' . $func . '_' . $objectType;
if ($tpl != null) {
$template .= '_' . $tpl;
}
$template .= '.tpl';
if (!empty($theme) && $render->template_exists(DataUtil::formatForOS($theme) . '/' . $template)) {
$template = DataUtil::formatForOS($theme) . '/' . $template;
} else {
if (!empty($defaultTheme) && $render->template_exists(DataUtil::formatForOS($defaultTheme) . '/' . $template)) {
$template = DataUtil::formatForOS($defaultTheme) . '/' . $template;
}
}
return $render->fetch($template);
}