/** * Returns string with rendered content * * @return string */ public function render() { $tpl = eZTemplate::factory(); $ini = eZINI::instance('rest.ini'); $nodeViewData = eZNodeviewfunctions::generateNodeViewData($tpl, $this->content->main_node, $this->content->main_node->attribute('object'), $this->content->activeLanguage, 'rest', 0); $tpl->setVariable('module_result', $nodeViewData); $routingInfos = $this->controller->getRouter()->getRoutingInformation(); $templateName = $ini->variable($routingInfos->controllerClass . '_' . $routingInfos->action . '_OutputSettings', 'Template'); return $tpl->fetch('design:' . $templateName); }
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } if (isset($Params['LanguageCode'])) { $languageCode = $Params['LanguageCode']; } else { $locale = eZLocale::instance(); $languageCode = $locale->localeCode(); } $node = eZContentObjectTreeNode::fetch($nodeID, $languageCode); if (!$node) { return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } $tpl = eZTemplate::factory(); $ini = eZINI::instance(); $contentObject = $node->attribute('object'); $nodeResult = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $languageCode, 'full', 0); // Generate a unique cache key for use in cache-blocks in pagelayout.tpl. // This should be looked as a temporary fix as ideally all cache-blocks // should be disabled by this view. $cacheKey = "timeline-" + time(); $nodeResult["title_path"] = array(array("text" => "Timeline Preview"), array("text" => $node->attribute('name'))); $httpCharset = eZTextCodec::httpCharset(); $locale = eZLocale::instance(); $languageCode = $locale->httpLocaleCode(); $nodeResult['content_info']['persistent_variable']['extra_template_list'] = array('timeline.tpl'); $nodeResult['content_info']['persistent_variable']['pagestyle_css_classes'] = array('yui-skin-sam', 'yui-skin-ezflow'); $site = array('title' => $ini->variable('SiteSettings', 'SiteName'), 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'uri' => eZURI::instance(eZSys::requestURI()), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $httpCharset, 'Content-language' => $languageCode)); $currentUser = eZUser::currentUser(); $tpl->setVariable("current_user", $currentUser); $tpl->setVariable('ui_context', ""); $uri = eZURI::instance(eZSys::requestURI());
static function contentViewGenerate( $file, $args ) { extract( $args ); $node = eZContentObjectTreeNode::fetch( $NodeID ); if ( !is_object( $node ) ) { if ( !eZDB::instance()->isConnected()) { return array( 'content' => $Module->handleError( eZError::KERNEL_NO_DB_CONNECTION, 'kernel' ), 'store' => false ); } else { return array( 'content' => $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ), 'store' => false ); } } $object = $node->attribute( 'object' ); if ( !is_object( $object ) ) { return array( 'content' => $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ), 'store' => false ); } if ( !$object instanceof eZContentObject ) { return array( 'content' => $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ), 'store' => false ); } if ( $node === null ) { return array( 'content' => $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ), 'store' => false ); } if ( $object === null ) { return array( 'content' => $Module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' ), 'store' => false ); } if ( $node->attribute( 'is_invisible' ) && !eZContentObjectTreeNode::showInvisibleNodes() ) { return array( 'content' => $Module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' ), 'store' => false ); } if ( !$node->canRead() ) { return array( 'content' => $Module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel', array( 'AccessList' => $node->checkAccess( 'read', false, false, true ) ) ), 'store' => false ); } $Result = eZNodeviewfunctions::generateNodeViewData( $tpl, $node, $object, $LanguageCode, $ViewMode, $Offset, $viewParameters, $collectionAttributes, $validation ); // 'store' depends on noCache: if $noCache is set, this means that retrieve // returned it, and the noCache fake cache file is already stored // and should not be stored again $retval = array( 'content' => $Result, 'scope' => 'viewcache', 'store' => !( isset( $noCache ) and $noCache ) ); if ( $file !== false && $retval['store'] ) $retval['binarydata'] = serialize( $Result ); return $retval; }
eZSiteAccess::load($access); eZDebug::checkDebugByUser(); // Change content object default language $GLOBALS['eZContentObjectDefaultLanguage'] = $LanguageCode; eZTranslatorManager::resetTranslations(); ezpI18n::reset(); eZContentObject::clearCache(); eZContentLanguage::expireCache(); $Module->setTitle('View ' . $class->attribute('name') . ' - ' . $contentObject->attribute('name')); $ini = eZINI::instance(); $res = eZTemplateDesignResource::instance(); $res->setDesignSetting($ini->variable('DesignSettings', 'SiteDesign'), 'site'); $res->setOverrideAccess($siteAccess); $tpl = eZTemplate::factory(); if ($http->hasSessionVariable('LastAccessesVersionURI')) { $tpl->setVariable('redirect_uri', $http->sessionVariable('LastAccessesVersionURI')); } $designKeys = array(array('object', $contentObject->attribute('id')), array('node', $virtualNodeID), array('remote_id', $contentObject->attribute('remote_id')), array('class', $class->attribute('id')), array('class_identifier', $class->attribute('identifier')), array('viewmode', 'full')); // View mode if ($assignment) { $designKeys[] = array('parent_node', $assignment->attribute('parent_node')); if ($parentNodeObject instanceof eZContentObjectTreeNode) { $designKeys[] = array('depth', $parentNodeObject->attribute('depth') + 1); } } $res->setKeys($designKeys); unset($contentObject); $contentObject = $node->attribute('object'); $Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $LanguageCode, 'full', 0, $viewParameters); $Result['requested_uri_string'] = $requestedURIString; $Result['ui_context'] = 'view';
function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters) { switch ($action) { case "send_preview": $module = $parameters['module']; var_dump($module->obj); //viewData() ); var_dump($obj); /* $classAttribute = $contentObjectAttribute->contentClassAttribute(); var_dump($http); var_dump($action); var_dump($contentObjectAttribute); var_dump //$classAttribute = $contentObjectAttribute->contentClassAttribute(); //$module = $classAttribute->currentModule(); $module = $parameters['module']; //var_dump($module); //var_dump($parameters); $ObjectVersion = 26; $ObjectID = 99; $contentObject = ezContentObjectVersion::fetchVersion( $ObjectVersion ,$ObjectID); $tpl =& templateInit(); $tpl->setVariable('object', $contentObject); //$tpl->setVariable('newsletter', $newsletter); $tpl->fetch( 'design:eznewsletter/newsletter_preview.tpl' ); */ /* $cacheFileArray = array( 'cache_dir' => false, 'cache_path' => false ); $NodeID = 101; //$Module = $Params['Module']; $tpl = templateInit(); $LanguageCode = $Params['Language']; $ViewMode = "full"; $Offset = $Params['Offset']; //$ini = eZINI::instance(); $Year = $Params['Year']; $Month = $Params['Month']; $Day = $Params['Day']; $viewParameters = array( 'offset' => $Offset, 'year' => $Year, 'month' => $Month, 'day' => $Day, 'namefilter' => false ); $viewParameters = array_merge( $viewParameters, $UserParameters ); $collectionAttributes = false; if ( isset( $Params['CollectionAttributes'] ) ) $collectionAttributes = $Params['CollectionAttributes']; $validation = array( 'processed' => false, 'attributes' => array() ); if ( isset( $Params['AttributeValidation'] ) ) $validation = $Params['AttributeValidation']; $localVars = array( "cacheFileArray", "NodeID", "Module", "tpl", "LanguageCode", "ViewMode", "Offset", "ini", "cacheFileArray", "viewParameters", "collectionAttributes", "validation" ); $args = compact( $localVars ); // the false parameter will disable generation of the 'binarydata' entry $data = eZNodeviewfunctions::contentViewGenerate( false, $args ); */ $tpl = templateInit(); $EditVersion = 26; $pathIdentificationString = ""; $ObjectID = 99; $parentNodeID = 2; $virtualNodeID = null; $pathString = ""; $depth = 2; $objectName = "OMG"; $node = new eZContentObjectTreeNode(); $node->setAttribute('contentobject_version', $EditVersion); $node->setAttribute('path_identification_string', $pathIdentificationString); $node->setAttribute('contentobject_id', $ObjectID); $node->setAttribute('parent_node_id', $parentNodeID); $node->setAttribute('main_node_id', $virtualNodeID); $node->setAttribute('path_string', $pathString); $node->setAttribute('depth', $depth); $node->setAttribute('node_id', $virtualNodeID); //$node->setAttribute( 'sort_field', $class->attribute( 'sort_field' ) ); //$node->setAttribute( 'sort_order', $class->attribute( 'sort_order' ) ); $node->setName($objectName); $node->setContentObject($contentObject); $contentObject = null; $LanguageCode = null; $viewParameters = array(); $contentObject = eZContentObject::fetch($ObjectID); $Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $LanguageCode, 'full', 0); var_dump($Result); //var_dump( $module->run("versionview") ); $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'The email address is not valid.')); } }
static function contentViewGenerate($file, $args) { extract($args); $node = eZContentObjectTreeNode::fetch($NodeID); if (!is_object($node)) { return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false); } $object = $node->attribute('object'); if (!is_object($object)) { return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false); } if (!$object instanceof eZContentObject) { return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false); } if ($node === null) { return array('content' => $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'), 'store' => false); } if ($object === null) { return array('content' => $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel'), 'store' => false); } // HACK! Ignore showInvisibleNodes policy for the 'detail' view mode in ez_sbase. We do policy // checking in the template. if ($ViewMode != 'detail') { if ($node->attribute('is_invisible') && !eZContentObjectTreeNode::showInvisibleNodes()) { return array('content' => $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel'), 'store' => false); } } if (!$object->canRead()) { return array('content' => $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array('AccessList' => $object->accessList('read'))), 'store' => false); } $Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $object, $LanguageCode, $ViewMode, $Offset, $viewParameters, $collectionAttributes, $validation); // 'store' depends on noCache: if $noCache is set, this means that retrieve // returned it, and the noCache fake cache file is already stored // and should not be stored again $retval = array('content' => $Result, 'scope' => 'viewcache', 'store' => !(isset($noCache) and $noCache)); if ($file !== false && $retval['store']) { $retval['binarydata'] = serialize($Result); } return $retval; }