本文整理汇总了PHP中eZTemplate::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplate::fetch方法的具体用法?PHP eZTemplate::fetch怎么用?PHP eZTemplate::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplate
的用法示例。
在下文中一共展示了eZTemplate::fetch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateRegistration
/**
* @param \eZTemplate $mailTpl
* @param array $userData
*
* @return array|null|string
*/
function generateRegistration( eZTemplate $mailTpl, array $userData )
{
$databaseMap = eZSetupDatabaseMap();
$databaseInfo = $this->PersistenceList['database_info'];
$databaseInfo['info'] = $databaseMap[$databaseInfo['type']];
$regionalInfo = $this->PersistenceList['regional_info'];
if ( !isset( $regionalInfo['languages'] ) )
$regionalInfo['languages'] = array();
$emailInfo = $this->PersistenceList['email_info'];
$siteType = $this->chosenSiteType();
$url = $siteType['url'];
if ( !preg_match( "#^[a-zA-Z0-9]+://(.*)$#", $url ) )
{
$url = 'http://' . $url;
}
$currentURL = $url;
$adminURL = $url;
if ( $siteType['access_type'] == 'url' )
{
$url .= '/' . $siteType['access_type_value'];
$adminURL .= '/' . $siteType['admin_access_type_value'];
}
else if ( $siteType['access_type'] == 'hostname' )
{
$url = eZHTTPTool::createRedirectURL( 'http://' . $siteType['access_type_value'] );
$adminURL = eZHTTPTool::createRedirectURL( 'http://' . $siteType['admin_access_type_value'] );
}
else if ( $siteType['access_type'] == 'port' )
{
$url = eZHTTPTool::createRedirectURL( $currentURL, array( 'override_port' => $siteType['access_type_value'] ) );
$adminURL = eZHTTPTool::createRedirectURL( $currentURL, array( 'override_port' => $siteType['admin_access_type_value'] ) );
}
$siteType['url'] = $url;
$siteType['admin_url'] = $adminURL;
$testsRun = $this->PersistenceList['tests_run'];
$imageMagickProgram = $this->PersistenceList['imagemagick_program'];
$imageGDExtension = $this->PersistenceList['imagegd_extension'];
$phpVersion = $this->PersistenceList['phpversion'];
$phpVersion['sapi'] = PHP_SAPI;
$webserverInfo = false;
if ( function_exists( 'apache_get_version' ) )
{
$webserverInfo = array( 'version' => apache_get_version() );
}
else if ( !empty( $_SERVER['SERVER_SOFTWARE'] ) )
{
$webserverInfo = array( 'version' => $_SERVER['SERVER_SOFTWARE'] );
}
$systemInfo = new eZSysInfo();
$systemInfo->scan();
$optionalTests = eZSetupOptionalTests();
$runResult = eZSetupRunTests( $optionalTests, 'eZSetup:init:send_registration', $this->PersistenceList );
$testResults = $runResult['results'];
// Generate email body e-mail
$mailTpl->setVariable( 'user_data', $userData );
$mailTpl->setVariable( 'database_info', $databaseInfo );
$mailTpl->setVariable( 'regional_info', $regionalInfo );
$mailTpl->setVariable( 'email_info', $emailInfo );
$mailTpl->setVariable( 'site_type', $siteType );
$mailTpl->setVariable( 'tests_run', $testsRun );
$mailTpl->setVariable( 'imagemagick_program', $imageMagickProgram );
$mailTpl->setVariable( 'imagegd_extension', $imageGDExtension );
$mailTpl->setVariable( 'phpversion', $phpVersion );
$mailTpl->setVariable( 'webserver', $webserverInfo );
$mailTpl->setVariable( 'system', $systemInfo );
$mailTpl->setVariable( 'os', array( 'name' => php_uname() ) );
$mailTpl->setVariable( 'optional_tests', $testResults );
$mailTpl->setVariable( "version", array( "text" => eZPublishSDK::version(),
"major" => eZPublishSDK::majorVersion(),
"minor" => eZPublishSDK::minorVersion(),
"release" => eZPublishSDK::release() ) );
return $mailTpl->fetch( 'design:setup/registration_email.tpl' );
}
示例2: generateNodeViewData
/**
* Generate result data for a node view
*
* @param eZTemplate $tpl
* @param eZContentObjectTreeNode $node
* @param eZContentObject $object
* @param bool|string $languageCode
* @param string $viewMode
* @param int $offset
* @param array $viewParameters
* @param bool|array $collectionAttributes
* @param bool $validation
* @return array Result array for view
*/
static function generateNodeViewData(eZTemplate $tpl, eZContentObjectTreeNode $node, eZContentObject $object, $languageCode, $viewMode, $offset, array $viewParameters = array('offset' => 0, 'year' => false, 'month' => false, 'day' => false), $collectionAttributes = false, $validation = false)
{
$section = eZSection::fetch($object->attribute('section_id'));
if ($section) {
$navigationPartIdentifier = $section->attribute('navigation_part_identifier');
$sectionIdentifier = $section->attribute('identifier');
} else {
$navigationPartIdentifier = null;
$sectionIdentifier = null;
}
$keyArray = array(array('object', $object->attribute('id')), array('node', $node->attribute('node_id')), array('parent_node', $node->attribute('parent_node_id')), array('class', $object->attribute('contentclass_id')), array('class_identifier', $node->attribute('class_identifier')), array('view_offset', $offset), array('viewmode', $viewMode), array('remote_id', $object->attribute('remote_id')), array('node_remote_id', $node->attribute('remote_id')), array('navigation_part_identifier', $navigationPartIdentifier), array('depth', $node->attribute('depth')), array('url_alias', $node->attribute('url_alias')), array('class_group', $object->attribute('match_ingroup_id_list')), array('state', $object->attribute('state_id_array')), array('state_identifier', $object->attribute('state_identifier_array')), array('section', $object->attribute('section_id')), array('section_identifier', $sectionIdentifier));
$parentClassID = false;
$parentClassIdentifier = false;
$parentNodeRemoteID = false;
$parentObjectRemoteID = false;
$parentNode = $node->attribute('parent');
if (is_object($parentNode)) {
$parentNodeRemoteID = $parentNode->attribute('remote_id');
$keyArray[] = array('parent_node_remote_id', $parentNodeRemoteID);
$parentObject = $parentNode->attribute('object');
if (is_object($parentObject)) {
$parentObjectRemoteID = $parentObject->attribute('remote_id');
$keyArray[] = array('parent_object_remote_id', $parentObjectRemoteID);
$parentClass = $parentObject->contentClass();
if (is_object($parentClass)) {
$parentClassID = $parentClass->attribute('id');
$parentClassIdentifier = $parentClass->attribute('identifier');
$keyArray[] = array('parent_class', $parentClassID);
$keyArray[] = array('parent_class_identifier', $parentClassIdentifier);
}
}
}
$res = eZTemplateDesignResource::instance();
$res->setKeys($keyArray);
if ($languageCode) {
$oldLanguageCode = $node->currentLanguage();
$node->setCurrentLanguage($languageCode);
}
$tpl->setVariable('node', $node);
$tpl->setVariable('viewmode', $viewMode);
$tpl->setVariable('language_code', $languageCode);
if (isset($viewParameters['_custom'])) {
foreach ($viewParameters['_custom'] as $customVarName => $customValue) {
$tpl->setVariable($customVarName, $customValue);
}
unset($viewParameters['_custom']);
}
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('collection_attributes', $collectionAttributes);
$tpl->setVariable('validation', $validation);
$tpl->setVariable('persistent_variable', false);
$parents = $node->attribute('path');
$path = array();
$titlePath = array();
foreach ($parents as $parent) {
$path[] = array('text' => $parent->attribute('name'), 'url' => '/content/view/full/' . $parent->attribute('node_id'), 'url_alias' => $parent->attribute('url_alias'), 'node_id' => $parent->attribute('node_id'));
}
$titlePath = $path;
$path[] = array('text' => $object->attribute('name'), 'url' => false, 'url_alias' => false, 'node_id' => $node->attribute('node_id'));
$titlePath[] = array('text' => $object->attribute('name'), 'url' => false, 'url_alias' => false);
$tpl->setVariable('node_path', $path);
$event = ezpEvent::getInstance();
$event->notify('content/pre_rendering', array($node, $tpl, $viewMode));
$Result = array();
$Result['content'] = $tpl->fetch('design:node/view/' . $viewMode . '.tpl');
$Result['view_parameters'] = $viewParameters;
$Result['path'] = $path;
$Result['title_path'] = $titlePath;
$Result['section_id'] = $object->attribute('section_id');
$Result['node_id'] = $node->attribute('node_id');
$Result['navigation_part'] = $navigationPartIdentifier;
$contentInfoArray = array();
$contentInfoArray['object_id'] = $object->attribute('id');
$contentInfoArray['node_id'] = $node->attribute('node_id');
$contentInfoArray['parent_node_id'] = $node->attribute('parent_node_id');
$contentInfoArray['class_id'] = $object->attribute('contentclass_id');
$contentInfoArray['class_identifier'] = $node->attribute('class_identifier');
$contentInfoArray['remote_id'] = $object->attribute('remote_id');
$contentInfoArray['node_remote_id'] = $node->attribute('remote_id');
$contentInfoArray['offset'] = $offset;
$contentInfoArray['viewmode'] = $viewMode;
$contentInfoArray['navigation_part_identifier'] = $navigationPartIdentifier;
$contentInfoArray['node_depth'] = $node->attribute('depth');
$contentInfoArray['url_alias'] = $node->attribute('url_alias');
$contentInfoArray['current_language'] = $object->attribute('current_language');
$contentInfoArray['language_mask'] = $object->attribute('language_mask');
//.........这里部分代码省略.........
示例3: modify
/**
* @param $tpl eZTemplate
* @param $operatorName array
* @param $operatorParameters array
* @param $rootNamespace string
* @param $currentNamespace string
* @param $operatorValue mixed
* @param $namedParameters array
*
* @return mixed
*/
function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$ini = eZINI::instance('ocoperatorscollection.ini');
$appini = eZINI::instance('app.ini');
switch ($operatorName) {
case 'related_attribute_objects':
$object = $operatorValue;
$identifier = $namedParameters['identifier'];
$dataMap = $object instanceof eZContentObject || $object instanceof eZContentObjectTreeNode ? $object->attribute('data_map') : array();
$data = array();
if (isset($dataMap[$identifier])) {
$ids = $dataMap[$identifier] instanceof eZContentObjectAttribute ? explode('-', $dataMap[$identifier]->toString()) : array();
if (!empty($ids)) {
$data = eZContentObject::fetchList(true, array("id" => array($ids)));
}
}
$operatorValue = $data;
break;
case 'smart_override':
$identifier = $namedParameters['identifier'];
$view = $namedParameters['view'];
$node = $operatorValue;
$operatorValue = $this->findSmartTemplate($identifier, $view, $node);
break;
case 'parse_link_href':
$href = $operatorValue;
$hrefParts = explode(':', $href);
$hrefFirst = array_shift($hrefParts);
if (!in_array($hrefFirst, array('http', 'https', 'file', 'mailto', 'ftp'))) {
if (!empty($hrefFirst)) {
$nodeID = eZURLAliasML::fetchNodeIDByPath('/' . $hrefFirst);
if ($nodeID) {
$contentNode = eZContentObjectTreeNode::fetch($nodeID);
if ($contentNode instanceof eZContentObjectTreeNode) {
$keyArray = array(array('node', $contentNode->attribute('node_id')), array('object', $contentNode->attribute('contentobject_id')), array('class_identifier', $contentNode->attribute('class_identifier')), array('class_group', $contentNode->attribute('object')->attribute('content_class')->attribute('match_ingroup_id_list')));
$tpl = new eZTemplate();
$ini = eZINI::instance();
$autoLoadPathList = $ini->variable('TemplateSettings', 'AutoloadPathList');
$extensionAutoloadPath = $ini->variable('TemplateSettings', 'ExtensionAutoloadPath');
$extensionPathList = eZExtension::expandedPathList($extensionAutoloadPath, 'autoloads/');
$autoLoadPathList = array_unique(array_merge($autoLoadPathList, $extensionPathList));
$tpl->setAutoloadPathList($autoLoadPathList);
$tpl->autoload();
$tpl->setVariable('node', $contentNode);
$tpl->setVariable('object', $contentNode->attribute('object'));
$tpl->setVariable('original_href', $href);
$res = new eZTemplateDesignResource();
$res->setKeys($keyArray);
$tpl->registerResource($res);
$result = trim($tpl->fetch('design:link/href.tpl'));
if (!empty($result)) {
$href = $result;
}
}
}
}
}
return $operatorValue = $href;
break;
case 'gmap_static_image':
try {
$cacheFileNames = array();
//@todo
$operatorValue = OCOperatorsCollectionsTools::gmapStaticImage($namedParameters['parameters'], $namedParameters['attribute'], $cacheFileNames);
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), 'gmap_static_image');
}
break;
case 'fa_class_icon':
$faIconIni = eZINI::instance('fa_icons.ini');
$node = $operatorValue;
$data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : $faIconIni->variable('ClassIcons', '_fallback');
if ($node instanceof eZContentObjectTreeNode) {
if ($faIconIni->hasVariable('ClassIcons', $node->attribute('class_identifier'))) {
$data = $faIconIni->variable('ClassIcons', $node->attribute('class_identifier'));
}
}
$operatorValue = $data;
break;
case 'fa_object_icon':
$faIconIni = eZINI::instance('fa_icons.ini');
$object = $operatorValue;
$data = $namedParameters['fallback'] != '' ? $namedParameters['fallback'] : '';
if ($object instanceof eZContentObject) {
if ($faIconIni->hasVariable('ObjectIcons', $object->attribute('id'))) {
$data = $faIconIni->variable('ObjectIcons', $object->attribute('id'));
}
} else {
if ($faIconIni->hasVariable('ObjectIcons', $node)) {
//.........这里部分代码省略.........
示例4: handleTagChooserImport
/**
* @deprecated usare un client ad hoc
*
* @param eZModule $module
* @param eZTemplate $tpl
* @param $repositoryNodeID
* @param $localParentNodeID
*
* @throws Exception
*/
protected function handleTagChooserImport(eZModule $module, eZTemplate $tpl, $repositoryNodeID, $localParentNodeID, &$Result)
{
if (isset($this->attributes['definition']['AskTagTematica']) && $this->attributes['definition']['AskTagTematica'] == true) {
$http = eZHTTPTool::instance();
if (!$http->hasPostVariable('SelectTags')) {
$tpl->setVariable('fromPage', '/repository/import/' . $this->attributes['definition']['Identifier'] . '/' . $repositoryNodeID);
$tpl->setVariable('localParentNodeID', $localParentNodeID);
$Result['content'] = $tpl->fetch('design:repository/eztagschooser.tpl');
$Result['path'] = array(array('url' => false, 'text' => 'Scegli Tag'));
return;
} else {
$tagIDs = array();
$tagKeywords = array();
$tagParents = array();
foreach ($_POST as $key => $value) {
if (substr($key, 0, 8) == 'tematica') {
list($tagID, $tagKeyword, $tagParent) = explode(";", $value);
$tagIDs[] = $tagID;
$tagKeywords[] = $tagKeyword;
$tagParents[] = $tagParent;
}
}
}
$newObject = $this->import($repositoryNodeID, $localParentNodeID);
foreach ($newObject->contentObjectAttributes() as $attribute) {
if ($attribute->contentClassAttributeIdentifier() == 'tematica') {
$eZTags = new eZTags();
$eZTags->createFromStrings(implode('|#', $tagIDs), implode('|#', $tagKeywords), implode('|#', $tagParents));
$eZTags->store($attribute);
break;
}
}
$module->redirectTo($newObject->attribute('main_node')->attribute('url_alias'));
} else {
$newObject = $this->import($repositoryNodeID, $localParentNodeID);
$module->redirectTo($newObject->attribute('main_node')->attribute('url_alias'));
}
}
示例5: getGooglePlusComments
/**
* Generate G+ comments feed for an activity
* @param eZTemplate $tpl
* @param array $namedParameters
* @return string
*/
private function getGooglePlusComments($tpl, $namedParameters)
{
//get config
$nlGooglePlusIni = eZINI::instance('nlgoogleplus.ini');
//initilize G+ Service
$plus = $this->initializeGooglePlusService();
if (!isset($namedParameters['activityid'])) {
eZLog::write('Activity id is required', 'error.log');
return false;
}
//parameters needed
$activityId = $namedParameters['activityid'];
$title = $namedParameters['title'];
//find all related comments
$optParams = array('maxResults' => $nlGooglePlusIni->variable('Feed', 'MaxResults'));
try {
$comments = $plus->comments->listComments($activityId, $optParams);
} catch (Exception $e) {
eZLog::write('Google Plus get comments problem : ' . $e->getMessage(), 'error.log');
}
//use template
$tpl->setVariable('comments', $comments);
$tpl->setVariable('title', $title);
return $tpl->fetch('design:nlgoogleplus/googleplusboxcomments.tpl');
}