/** * Getter * Returns given attribute for current content node if it exists (ie. path_string). * Will throw an exception otherwise. * All "classic" attributes can be used (See {@link eZContentObjectTreeNode::definition()}). * @param $name * @throws ezcBasePropertyNotFoundException * @return mixed */ public function __get($name) { $this->getNode(); $ret = null; switch ($name) { default: if ($this->node->hasAttribute($name)) { $ret = $this->node->attribute($name); } else { throw new ezcBasePropertyNotFoundException($name); } } return $ret; }
function attribute($attr, $noFunction = false) { $retVal = null; switch ($attr) { case 'object': if ($this->attribute('is_local_installation')) { $retVal = eZContentObjectTreeNode::attribute($attr, $noFunction); } else { if (empty($this->ResultObject)) { $this->ResultObject = new eZFindResultObject(array('published' => $this->attribute('published'))); } $retVal = $this->ResultObject; } break; case 'language_code': $retVal = $this->CurrentLanguage; break; default: if (in_array($attr, $this->LocalAttributeNameList)) { $retVal = isset($this->LocalAttributeValueList[$attr]) ? $this->LocalAttributeValueList[$attr] : null; // Timestamps are stored as strings for remote objects, so it must be converted. if ($attr == 'published') { $retVal = strtotime($retVal); } } else { if ($this->attribute('is_local_installation')) { $retVal = eZContentObjectTreeNode::attribute($attr, $noFunction); } } break; } return $retVal; }
public static function getTimeTableFromNode(eZContentObjectTreeNode $node) { $dataMap = $node->attribute('data_map'); if (isset($dataMap['timetable']) && $dataMap['timetable'] instanceof eZContentObjectAttribute && $dataMap['timetable']->attribute('has_content')) { $timeTableContent = $dataMap['timetable']->attribute('content')->attribute('matrix'); $timeTable = array(); foreach ($timeTableContent['columns']['sequential'] as $column) { foreach ($column['rows'] as $row) { $parts = explode('-', $row); if (count($parts) == 2) { $fromParts = explode(':', $parts[0]); if (count($fromParts) != 2) { $fromParts = explode('.', $parts[0]); } $toParts = explode(':', $parts[1]); if (count($toParts) != 2) { $toParts = explode('.', $parts[1]); } if (count($fromParts) == 2 && count($toParts) == 2) { if (!isset($timeTable[$column['identifier']])) { $timeTable[$column['identifier']] = array(); } $timeTable[$column['identifier']][] = array('from_time' => array('hour' => trim($fromParts[0]), 'minute' => trim($fromParts[1])), 'to_time' => array('hour' => trim($toParts[0]), 'minute' => trim($toParts[1]))); } } } } return $timeTable; } return array(); }
static function fetchByNode(eZContentObjectTreeNode $node) { $attributes = $node->attribute('data_map'); foreach ($attributes as $attribute) { if ($attribute->DataTypeString == 'xrowmetadata' and $attribute->hasContent()) { return $attribute->content(); } } return false; }
/** * @return array */ public function getSocialInfos() { if( !($this->node instanceof eZContentObjectTreeNode) || $this->node->attribute('class_identifier') != 'article' ) return array(); /* @type eZContentObjectAttribute[] $dataMap */ $dataMap = $this->node->dataMap(); $headline = $dataMap["headline"]->content(); $urlParams = array(); $description = ""; $imageUrl = ""; $urlGet = ""; if ( ClusterTool::isTwoLangCluster() ) { $urlParams['ll'] = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'exact_target' ); } if($dataMap["promo_description"]->hasContent()) { $description = strip_tags($dataMap["promo_description"]->content()); } if ( count($urlParams) > 0 ) { $urlGet = '?' . http_build_query($urlParams); } if ( NodeOperatorHelper::hasImageArticle($this->node, ImageArticleTool::SLIDE_APPLICATION_CASE ) ) { $imageUrl = SolrSafeOperatorHelper::getImageArticleUrl( ImageArticleTool::SLIDE_APPLICATION_CASE, $this->node->attribute('contentobject_id'), $this->node->currentLanguage(), 'dt_full' ); $imageUrl .= $urlGet; } return array( "title" => $headline, "description" => $description, "url" => $this->applicationName()."/".$this->node->remoteID().$urlGet, "imageUrl" => $imageUrl ); }
/** * * @param eZContentObjectTreeNode $childNode * @return integer */ public static function getPublisherNodeIdFromArticleNode ( $childNode ) { if ( !( $childNode instanceof eZContentObjectTreeNode ) ) return false; $mainNode = $childNode; if ( !$mainNode->isMain() ) $mainNode = eZContentObjectTreeNode::fetch( $childNode->attribute('main_node_id'), $childNode->currentLanguage() ); $pathString = $mainNode->attribute('path_string'); $match = array(); if ( !preg_match('#^/1/2/\d+/(\d+)/.*$#', $pathString, $match) ) return null; return (int)$match[1]; }
function addImage(eZContentObjectTreeNode $node) { $images = false; $ini = eZINI::instance('xrowsitemap.ini'); $dm = $node->attribute('data_map'); foreach ($dm as $attribute) { switch ($attribute->DataTypeString) { case 'ezimage': if ($attribute->hasContent()) { if ($images === false) { $images = array(); } $imagedata = $attribute->content(); $image = new xrowSitemapItemImage(); if ($ini->hasVariable('SitemapSettings', 'ImageAlias')) { $aliasdata = $imagedata->attribute($ini->variable('SitemapSettings', 'ImageAlias')); $image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url']; } else { $aliasdata = $imagedata->attribute('original'); $image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url']; } if ($imagedata->attribute('alternative_text')) { $image->caption = $imagedata->attribute('alternative_text'); } $image->title = $node->attribute('name'); $images[] = $image; } break; } } return $images; }
/** * Create Access element. * * @param DOMDocument Owner DOMDocument * @param eZContentObjectTreeNode eZContentObjectTreeNode object. * * @return DOMElement AccessRights DOMDocument, example: * <AccessRights canRead="1" canCreate="1" canEdit="0" /> */ protected function createAccessDOMElement(DOMDocument $domDocument, eZContentObjectTreeNode $node) { $accessElement = $domDocument->createElement('AccessRights'); $accessElement->setAttribute('canRead', $node->attribute('can_read') ? '1' : '0'); $accessElement->setAttribute('canEdit', $node->attribute('can_edit') ? '1' : '0'); $accessElement->setAttribute('canCreate', $node->attribute('can_create') ? '1' : '0'); return $accessElement; }
/** * Deletes a node and all of its locations * * @param eZContentObjectTreeNode $node Node to delete **/ protected function deleteNode( $node ) { $object = $node->attribute( 'object' ); $object->purge(); }
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';
/** * @param string $applicationName Compatibility with other getNodeUrl operators * @param eZContentObjectTreeNode $node * @param boolean $languageCode * @return string */ public static function getMerckManualNodeUrl($applicationName, $node, $languageCode = false) { if( $languageCode ) $node->setCurrentLanguage($languageCode); /* @type $dataMap eZContentObjectAttribute[] */ $chapterNode = ( $node->attribute( 'depth' ) > 4 ) ? $node->fetchParent() : $node; $topicNode = ( $node->attribute( 'depth' ) > 4 ) ? $node : null; $linkType = is_null( $topicNode ) ? 'chapter' : 'topic'; $dataMap = $chapterNode->dataMap(); if ( !$dataMap || !isset($dataMap['serialized_taxonomies']) || !$dataMap['serialized_taxonomies']->hasContent() ) return ""; $serial = $dataMap['serialized_taxonomies']->content(); $sectionRemote = null; if( isset($serial['section']) && is_array($serial['section']) ) $sectionRemote = $serial['section'][0]; $fetchResult = MerckManualFunctionCollection::fetchUnifiedUrl($sectionRemote, $chapterNode, $topicNode, $linkType); return $fetchResult['result']; }
/** * @param eZContentObjectTreeNode $node * @param integer $mediaCase * @return boolean */ public static function hasImageArticle($node, $mediaCase) { // Way to know if an image exists for the article via solr if ($node == null) { return false; } $params = array( 'MediaCase' => $mediaCase, 'ArticleObjectId' => $node->attribute('contentobject_id'), 'ArticleLanguage' => $node->currentLanguage(), 'Alias' => false, ); try { $imageHandler = new ImageArticleTool($params); } catch ( Exception $e ) { return false; } return $imageHandler->hasImage(); }
/** * Creates a new eZContentObjectTrashNode based on an eZContentObjectTreeNode * * @param eZContentObjectTreeNode $node * @return eZContentObjectTrashNode */ static function createFromNode($node) { $row = array('node_id' => $node->attribute('node_id'), 'parent_node_id' => $node->attribute('parent_node_id'), 'main_node_id' => $node->attribute('main_node_id'), 'contentobject_id' => $node->attribute('contentobject_id'), 'contentobject_version' => $node->attribute('contentobject_version'), 'contentobject_is_published' => $node->attribute('contentobject_is_published'), 'depth' => $node->attribute('depth'), 'sort_field' => $node->attribute('sort_field'), 'sort_order' => $node->attribute('sort_order'), 'priority' => $node->attribute('priority'), 'modified_subnode' => $node->attribute('modified_subnode'), 'path_string' => $node->attribute('path_string'), 'path_identification_string' => $node->attribute('path_identification_string'), 'remote_id' => $node->attribute('remote_id'), 'is_hidden' => $node->attribute('is_hidden'), 'is_invisible' => $node->attribute('is_invisible')); $trashNode = new eZContentObjectTrashNode($row); return $trashNode; }
/** * Creates object with nodeAssignment from given parent Node, class ID and language code. * * @param eZContentObjectTreeNode $parentNode * @param int $contentClassID * @param string $languageCode * @param string|bool $remoteID * * @return eZContentObject|null */ static function createWithNodeAssignment( $parentNode, $contentClassID, $languageCode, $remoteID = false ) { $class = eZContentClass::fetch( $contentClassID ); $parentObject = $parentNode->attribute( 'object' ); // Check if the user has access to create a folder here if ( $class instanceof eZContentClass and $parentObject->checkAccess( 'create', $contentClassID, false, false, $languageCode ) == '1' ) { // Set section of the newly created object to the section's value of it's parent object $sectionID = $parentObject->attribute( 'section_id' ); $db = eZDB::instance(); $db->begin(); $contentObject = $class->instantiateIn( $languageCode, false, $sectionID, false, eZContentObjectVersion::STATUS_INTERNAL_DRAFT ); $nodeAssignment = $contentObject->createNodeAssignment( $parentNode->attribute( 'node_id' ), true, $remoteID, $class->attribute( 'sort_field' ), $class->attribute( 'sort_order' ) ); $db->commit(); return $contentObject; } return null; }
/** * @param eZContentObjectTreeNode|eZContentObject $object * @param string $identifier * * @return bool|eZContentObjectAttribute */ public function hasContentObjectAttribute($object, $identifier) { if ($object instanceof eZContentObjectTreeNode || $object instanceof eZContentObject) { /** @var eZContentObjectTreeNode|eZContentObject $object */ /** @var eZContentObjectAttribute[] $dataMap */ $dataMap = $object->attribute('data_map'); if (isset($dataMap[$identifier])) { if ($dataMap[$identifier] instanceof eZContentObjectAttribute) { //eZDebug::writeError( $object->attribute( 'class_identifier' ) . ' ' . $dataMap[$identifier]->attribute( 'data_type_string' ) . ' ' . $identifier, __METHOD__ ); if ($identifier == 'image' && $dataMap[$identifier]->attribute('data_type_string') == 'ezobjectrelationlist' && $dataMap[$identifier]->attribute('has_content')) { $content = explode('-', $dataMap[$identifier]->toString()); $firstImage = array_shift($content); $imageObject = eZContentObject::fetch($firstImage); return $this->hasContentObjectAttribute($imageObject, 'image'); } if ($identifier == 'image' && $dataMap[$identifier]->attribute('data_type_string') == 'ezobjectrelation' && $dataMap[$identifier]->attribute('has_content')) { $imageObject = $dataMap[$identifier]->content(); return $this->hasContentObjectAttribute($imageObject, 'image'); } switch ($dataMap[$identifier]->attribute('data_type_string')) { case 'ezcomcomments': return $dataMap[$identifier]; break; case 'ezboolean': if ($dataMap[$identifier]->attribute('data_int') == 1) { return $dataMap[$identifier]; } break; default: if ($dataMap[$identifier]->attribute('has_content')) { return $dataMap[$identifier]; } } } } } return false; }
function transformNode(eZContentObjectTreeNode $node) { $values = array(); if ($node instanceof eZContentObjectTreeNode) { /** @var eZContentObject $object */ $object = $node->attribute('object'); /** @var eZContentObjectAttribute[] $attributes */ $attributes = $object->attribute('contentobject_attributes'); foreach ($attributes as $attribute) { $attributeIdentifier = $attribute->attribute('contentclass_attribute_identifier'); $datatypeString = $attribute->attribute('data_type_string'); if (isset($this->options['ExcludeAttributeIdentifiers']) && in_array($attributeIdentifier, $this->options['ExcludeAttributeIdentifiers'])) { continue; } if (isset($this->options['ExcludeDatatype']) && in_array($datatypeString, $this->options['ExcludeDatatype'])) { continue; } $attributeName = $attribute->attribute('contentclass_attribute_name'); if (!isset($this->CSVheaders[$attributeIdentifier])) { $this->CSVheaders[$attributeIdentifier] = $attributeName; } switch ($datatypeString) { case 'ezobjectrelation': $attributeStringContent = $attribute->content()->attribute('name'); break; case 'ezobjectrelationlist': $attributeContent = $attribute->content(); $relations = $attributeContent['relation_list']; $relatedNames = array(); foreach ($relations as $relation) { $related = eZContentObject::fetch($relation['contentobject_id']); if ($related) { $relatedNames[] = $related->attribute('name'); eZContentObject::clearCache($related->attribute('id')); } } $attributeStringContent = implode(',', $relatedNames); break; case 'ezxmltext': $text = str_replace('"', "'", $attribute->content()->attribute('output')->outputText()); $text = strip_tags($text); $text = str_replace(';', ',', $text); $text = str_replace(array("\n", "\r"), "", $text); $attributeStringContent = $text; break; case 'ezbinaryfile': $attributeStringContent = ''; if ($attribute->hasContent()) { $file = $attribute->content(); $filePath = "content/download/{$attribute->attribute('contentobject_id')}/{$attribute->attribute('id')}/{$attribute->content()->attribute('original_filename')}"; $attributeStringContent = eZSys::hostname() . '/' . $filePath; } break; case 'ezdatetime': case 'ezdate': $attributeStringContent = ''; if ($attribute->hasContent()) { $attributeStringContent = strftime('%d/%m/%Y', $attribute->toString()); } break; case 'ezuser': $attributeStringContent = ''; if ($attribute->hasContent()) { $login = $attribute->content()->attribute('login'); $email = $attribute->content()->attribute('email'); $attributeStringContent = $login != $email ? $login . '|' . $email : $email; } break; default: $attributeStringContent = ''; if ($attribute->hasContent()) { $attributeStringContent = $attribute->toString(); } break; } $values[] = $attributeStringContent; } eZContentObject::clearCache($object->attribute('id')); } return $values; }
/** * @param eZContentObjectTreeNode $node * @param string $taxonomyIdentifier * * @return array */ protected function walkTaxonomyItem($node, $taxonomyIdentifier) { /** @var eZContentObject $object */ $object = $node->attribute('object'); $item = array('name' => $node->attribute('name'), 'main_node_id' => intval($object->attribute('main_node_id')), 'main_parent_node_id' => intval($object->attribute('main_parent_node_id')), 'id' => intval($node->attribute('contentobject_id')), 'class_identifier' => $node->attribute('class_identifier'), 'solr_filter' => array(), 'children' => array()); $solrIdFields = array(); $baseFields = $this->getTaxonomySolrBaseFields($taxonomyIdentifier); if ($baseFields[$node->attribute('class_identifier')]) { foreach ($baseFields[$node->attribute('class_identifier')] as $baseField) { $solrIdFields[] = "submeta_{$baseField}___id____si"; } } /** @var eZContentObjectTreeNode[] $children */ $children = eZContentObjectTreeNode::subTreeByNodeID($this->getTaxonomyFetchParameters($taxonomyIdentifier), $node->attribute('node_id')); $parentFields = array(); foreach ($children as $child) { $item['children'][] = $this->walkTaxonomyItem($child, $taxonomyIdentifier); foreach ($baseFields[$child->attribute('class_identifier')] as $baseField) { $parentFields[] = "submeta_{$baseField}___path____si"; } } $parentFields = array_unique($parentFields); if (count($parentFields)) { if (count($solrIdFields) > 0) { foreach ($solrIdFields as $solrIdField) { $solrFilter = array('or', $solrIdField . ':' . $item['id']); foreach ($parentFields as $parentField) { $solrFilter[] = $parentField . ':' . $item['main_node_id']; } $item['solr_filter'][] = $solrFilter; } } else { $solrFilter = array('or'); foreach ($item['children'] as $child) { $solrFilter = array_merge($solrFilter, $child['solr_filter']); } $item['solr_filter'] = $solrFilter; } } else { foreach ($solrIdFields as $solrIdField) { if ($solrIdField) { $item['solr_filter'][] = $solrIdField . ':' . $item['id']; } } } return $item; }
/** * create HTML eZ Publish object * @param eZContentObjectTreeNode $parentNode * @param SimpleXMLElement $_item */ function createHTMLObject($parentNode, $_item) { try { //get actual user $user = eZUser::currentUser(); //object parameters $params = array(); $params ['class_identifier'] = 'html'; $params['creator_id'] = $user->attribute('contentobject_id'); $params['parent_node_id'] = $parentNode->attribute('node_id'); $params['section_id'] = $parentNode->object()->attribute('section_id'); //set template attributes include_once('kernel/common/template.php'); $htmlTpl = eZTemplate::factory(); $htmlTpl->setVariable('title', $_item->title); $htmlTpl->setVariable('link', '/congressos-e-eventos?deeplink=' . urlencode($_item->link)); $htmlTpl->setVariable('description', $_item->description); $htmlTpl->setVariable('category', $_item->category); $text = $htmlTpl->fetch('design:html/cronview.tpl'); //attributes to insert $attributesData = array(); $attributesData['title'] = $_item->title; $attributesData['text'] = $text; $params['attributes'] = $attributesData; //object creation eZContentFunctions::createAndPublishObject($params); } catch (Exception $e) { $cli = eZCLI::instance(); $cli->output($e->getMessage()); } }
function transformNode(eZContentObjectTreeNode $node) { if ($node instanceof eZContentObjectTreeNode) { $object = $node->attribute('object'); self::$recursion = 0; $this->transformObject($object, $node); } }
function transformNode(eZContentObjectTreeNode $node) { set_time_limit(0); $row = array(); $object = $node->attribute('object'); if (!$object instanceof eZContentObject) { return null; } $data_map = $object->dataMap(); //0 //CIG //cig nillable="false" $cig = self::$ERRORS_IN_FIELD; if ($data_map['cig']) { $cig = $data_map['cig']->content(); //deve essere di 10 caratteri if (strlen($cig) != 10) { $cig = self::$ERRORS_IN_FIELD; } } $row[] = $cig; //--------------------------------------------------------------------------- //1 //FLAG_CONTRATTO_SENZA_CIG if ($cig) { $row[] = 'N'; } else { $row[] = 'S'; } //--------------------------------------------------------------------------- //2 //ANNO_PUBBLICAZIONE //nillable="false $anno_pubblicazione = self::$ERRORS_IN_FIELD; if ($this->anno_pubblicazione) { $anno_pubblicazione = $this->anno_pubblicazione; if (strlen($anno_pubblicazione) != 4) { $anno_pubblicazione = self::$ERRORS_IN_FIELD; } } $row[] = $anno_pubblicazione; //--------------------------------------------------------------------------- //3 //OGGETTO //oggetto nillable="false" $oggetto = ''; if ($data_map['oggetto']) { $oggetto = $data_map['oggetto']->content(); //xsd:maxLength value="500" if (strlen($oggetto) > 500) { $oggetto = self::$ERRORS_IN_FIELD; } } $row[] = $oggetto; //--------------------------------------------------------------------------- //4 //SCELTA_CONTRAENTE //sceltaContraente nillable="false" //select a scelta obbligata di valori indicati nella documentazione $scelta_contraente = self::$ERRORS_IN_FIELD; if ($data_map['scelta_contraente']) { if ($data_map['scelta_contraente']->title()) { $scelta_contraente = $data_map['scelta_contraente']->title(); //tengo solo numeri come previsto da documentazione $scelta_contraente = substr($scelta_contraente, 0, 2); } } $row[] = $scelta_contraente; //--------------------------------------------------------------------------- //5 //IMPORTO_GARA $importo_gara = self::$ERRORS_IN_FIELD; if ($data_map['importo_gara']) { if ($data_map['importo_gara']->content()) { $importo_gara = $data_map['importo_gara']->content(); if ($importo_gara instanceof eZPrice) { if (!$this->checkImporti($importo_gara->Price)) { $importo_gara = self::$ERRORS_IN_FIELD; } else { $importo_gara = $importo_gara->Price; } } else { $importo_gara = self::$ERRORS_IN_FIELD; } } } $row[] = $importo_gara; //--------------------------------------------------------------------------- //6 //IMPORTO_AGGIUDICAZIONE $importo_aggiudicazione = ''; if ($data_map['importo_aggiudicazione']) { $importo_aggiudicazione = $data_map['importo_aggiudicazione']->content(); if ($importo_aggiudicazione instanceof eZPrice) { if (!$this->checkImporti($importo_aggiudicazione->Price)) { $importo_aggiudicazione = self::$ERRORS_IN_FIELD; } else { $importo_aggiudicazione = $importo_aggiudicazione->Price; } } else { $importo_aggiudicazione = self::$ERRORS_IN_FIELD; } } $row[] = $importo_aggiudicazione; //--------------------------------------------------------------------------- //7 //DATA_INIZIO $data_inizio = ''; if ($data_map['data_inizio']) { $data_inizio = date('d/m/Y', $data_map['data_inizio']->DataInt); } $row[] = $data_inizio; //--------------------------------------------------------------------------- //8 //DATA_ULTIMAZIONE $data_ultimazione = ''; if ($data_map['data_ultimazione']) { $data_ultimazione = date('d/m/Y', $data_map['data_ultimazione']->DataInt); } $row[] = $data_ultimazione; //--------------------------------------------------------------------------- //9 //IMPORTO_SOMME_LIQUIDATE $importo_somme_liquidate = ''; if ($data_map['importo_somme_liquidate']) { $importo_somme_liquidate = $data_map['importo_somme_liquidate']->content(); if ($importo_somme_liquidate instanceof eZPrice) { if (!$this->checkImporti($importo_somme_liquidate->Price)) { $importo_somme_liquidate = self::$ERRORS_IN_FIELD; } else { $importo_somme_liquidate = $importo_somme_liquidate->Price; } } else { $importo_somme_liquidate = self::$ERRORS_IN_FIELD; } } $row[] = $importo_somme_liquidate; //--------------------------------------------------------------------------- //10 //FLAG_COMPLETAMENTO $flag_completamento = ''; if ($data_map['flag_completamento']) { $flag_completamento = $data_map['flag_completamento']->content(); } if ($flag_completamento == 1) { $row[] = 'S'; } else { $row[] = 'N'; } //valorizzo i campi CF_AZIENDA;ID_GRUPPO;TIPO_PARTECIPAZIONE;ATTRIBUTO_INVITATA;ATRIBUTO_PARTECIPANTE;ATTRIBUTO_AGGIUDICATARIA //ripetendo le righe qualora ci siano più figure dello stesso tipo $anagrafiche = array(); //$this->id_gruppo++; $invitati_matrix = $data_map['invitati']->content(); $partecipanti_matrix = $data_map['partecipanti']->content(); $aggiudicatario_matrix = $data_map['aggiudicatari']->content(); $invitati_matrix_sequential = $invitati_matrix->Matrix['rows']['sequential']; $invitati_partecipanti_matrix = $partecipanti_matrix->Matrix['rows']['sequential']; $invitati_aggiudicatario_matrix = $aggiudicatario_matrix->Matrix['rows']['sequential']; //--------------------------------------------------------------------------- //invitati foreach ($invitati_matrix_sequential as $invitato) { $this->getDataFromMatrix($anagrafiche, $invitato, self::$INVIATO); } //--------------------------------------------------------------------------- //partecipanti foreach ($invitati_partecipanti_matrix as $partecipante) { $this->getDataFromMatrix($anagrafiche, $partecipante, self::$PARTECIPANTE); } //--------------------------------------------------------------------------- //aggiudicatari foreach ($invitati_aggiudicatario_matrix as $aggiudicatario) { $this->getDataFromMatrix($anagrafiche, $aggiudicatario, self::$AGGIUDICATARIO); } //DUPLICAZIONE RIGHE //creo tante righe quanto sono le anagrafiche foreach ($anagrafiche as $key => $anagrafica) { ksort($anagrafica); $values[] = array_merge($row, $anagrafica); } //gestione eventuali errori $this->manageErrors($values, $object); $object->resetDataMap(); eZContentObject::clearCache($object->attribute('id')); unset($data_map); return $values; }
/** * Checks if a node is an orphan * * An orphan node is a node without any reverse relations. (e.g no other * objects related to the node). * * @param eZContentObjectTreeNode $node * @return bool **/ protected function isNodeOrphan( $node ) { return ( eZContentObjectTreeNode::reverseRelatedCount( array( $node->attribute('node_id') ) ) <= 0 ); }
/** * Clears the view cache for a subtree * * @param eZContentObjectTreeNode $node * @param bool $clearForRootNode * @return bool */ static function clearViewCacheForSubtree(eZContentObjectTreeNode $node, $clearForRootNode = true) { // Max nodes to fetch at a time static $limit = 200; if ($clearForRootNode) { $objectID = $node->attribute('contentobject_id'); eZContentCacheManager::clearContentCacheIfNeeded($objectID); } $offset = 0; $params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array()); // Empty array means no permission checking $subtreeCount = $node->subTreeCount($params); while ($offset < $subtreeCount) { $params['Offset'] = $offset; $params['Limit'] = $limit; $subtreeChunk = $node->subTree($params); $nNodesInChunk = count($subtreeChunk); $offset += $nNodesInChunk; if ($nNodesInChunk == 0) { break; } $objectIDList = array(); foreach ($subtreeChunk as $curNode) { $objectIDList[] = $curNode['id']; } unset($subtreeChunk); eZContentCacheManager::clearContentCacheIfNeeded(array_unique($objectIDList)); } return true; }
/** * @param eZContentObjectTreeNode $parentNode * @param $isParentInvisible */ public static function spreadGlobalLimitationChange( $parentNode, $isParentInvisible ) { $db = eZDB::instance(); $childQuery = "SELECT contentobject_id FROM ezcontentobject_tree where depth='%s' and path_string='%s%%'"; $children = $db->arrayQuery(sprintf( $childQuery, $parentNode->attribute('depth') + 1, $parentNode->attribute('path_string') )); foreach( $children as $child ) { $childObjectId = $child['contentobject_id']; $child = eZContentObject::fetch($childObjectId); if ( $child instanceof eZContentObject ) self::updateGlobalLimitation($childObjectId, $isParentInvisible); unset($child); eZContentObject::clearCache(array($childObjectId)); } }
/** * 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'); $contentInfoArray['main_node_id'] = $node->attribute('main_node_id'); $contentInfoArray['main_node_url_alias'] = false; // Add url alias for main node if it is not current node and user has access to it if (!$node->isMain()) { $mainNode = $object->mainNode(); if ($mainNode->canRead()) { $contentInfoArray['main_node_url_alias'] = $mainNode->attribute('url_alias'); } } $contentInfoArray['persistent_variable'] = false; if ($tpl->variable('persistent_variable') !== false) { $contentInfoArray['persistent_variable'] = $tpl->variable('persistent_variable'); $keyArray[] = array('persistent_variable', $contentInfoArray['persistent_variable']); $res->setKeys($keyArray); } $contentInfoArray['class_group'] = $object->attribute('match_ingroup_id_list'); $contentInfoArray['state'] = $object->attribute('state_id_array'); $contentInfoArray['state_identifier'] = $object->attribute('state_identifier_array'); $contentInfoArray['parent_class_id'] = $parentClassID; $contentInfoArray['parent_class_identifier'] = $parentClassIdentifier; $contentInfoArray['parent_node_remote_id'] = $parentNodeRemoteID; $contentInfoArray['parent_object_remote_id'] = $parentObjectRemoteID; $Result['content_info'] = $contentInfoArray; // Store which templates were used to make this cache. $Result['template_list'] = $tpl->templateFetchList(); // Check if time to live is set in template if ($tpl->hasVariable('cache_ttl')) { $cacheTTL = $tpl->variable('cache_ttl'); } if (!isset($cacheTTL)) { $cacheTTL = -1; } $Result['cache_ttl'] = $cacheTTL; // if cache_ttl is set to 0 from the template, we need to add a no-cache advice // to the node's data. That way, the retrieve callback on the next calls // will be able to determine earlier that no cache generation should be started // for this node if ($cacheTTL == 0) { $Result['no_cache'] = true; } if ($languageCode) { $node->setCurrentLanguage($oldLanguageCode); } return $Result; }
/** * @param eZSolrDoc[] $docList * @param eZContentObjectTreeNode $node * @param $publisherFolderRelations */ protected function processSpecificMerckManual(&$docList, $node, $dataMap, $publisherFolderRelations) { /* @var eZContentObjectAttribute[] $datamapDefault */ $datamapDefault = $dataMap; $taxonomiesAttribute = $datamapDefault['serialized_taxonomies']; $merckManualClusters = array(); foreach ( $publisherFolderRelations['clusters'] as $cluster => $applications ) foreach ( $applications as $application ) if( $application == MerckManualShowcase::mainApplicationIdentifier() ) $merckManualClusters[] = $cluster; if( $taxonomiesAttribute instanceof eZContentObjectAttribute && $taxonomiesAttribute->hasContent() ) { $taxonomies = $taxonomiesAttribute->content(); if( isset( $taxonomies['section']) ) { $sections = $taxonomies['section']; foreach( $docList as $languageCode => $doc ) { $datamap = $node->object()->fetchDataMap(false, $languageCode); if( !$datamap ) $datamap = $datamapDefault; $customSectionChaptersParts = array( $sections[0], $node->attribute( 'node_id' ), $datamap['headline']->content() ); foreach( $merckManualClusters as $cluster ) { $doc->addField('attr_custom_section_chapter_' . $cluster . '_s', implode('##', $customSectionChaptersParts)); } } $this->addValueToDoc( $docList, 'subattr_section___source_id____s', $sections, true, true ); } } elseif ( !($taxonomiesAttribute instanceof eZContentObjectAttribute) ) { eZLog::write( "Indexation : Article with nodeId {$node->NodeID} doesn't have serialized_taxonomies attribute", 'error.log' ); } }