public function getData() { $ezTagsObject = new eZTagsObject(); $returnArray = array(); $childrenArray = array(); // recupero la lista dei remoteID dei tags che il server gestisce $tagsGestiti = explode(',', $this->runtimeSettingsINI->variable('serverSyncTags', 'serverSyncTagsList')); $numtagreturned = count($tagsGestiti); // Ciclo per recuperare gli array degli oggetti ritornati for ($i = 0; $i < $numtagreturned; $i++) { $parentFields = array(); #$eZTagParentObj = eZTagsObject::fetchByRemoteID('e4fd6bcf76ab7ce0e04684bdb867a76d'); #$eZTagParentObj = eZTagsObject::fetchByRemoteID(trim($tagsGestiti[$i])); $eZTagParentObj_array = eZTagsObject::fetchByKeyword(trim($tagsGestiti[$i]), true); $eZTagParentObj = $eZTagParentObj_array[0]; /* $eZTagParentObj->RemoteID; $eZTagParentObj->getAttribute('RemoteID'); $eZTagParentObj->attributes('remote_id'); */ # recupero e trasformo in array l'oggetto parentID $parentFields = itobjectsutils::getObjectAsArray($eZTagParentObj); # recupero tutti i children tags $childrenArray = eZTagsObject::fetchByParentID($eZTagParentObj->ID); # aggiungo al mio array generale il blocco dei children tags $parentFields['subTags'] = $childrenArray; $returnArray[$eZTagParentObj->RemoteID] = $parentFields; } return $returnArray; }
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT'); header('Cache-Control: max-age=' . MAX_AGE); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) . ' GMT'); header('Pragma: '); eZExecution::cleanExit(); } $tagID = (int) $Params['TagID']; $siteINI = eZINI::instance(); $eztagsINI = eZINI::instance('eztags.ini'); $tag = eZTagsObject::fetch($tagID); if (!($tag instanceof eZTagsObject || $TagID == 0)) { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); } else { $children = eZTagsObject::fetchByParentID($tagID); $response = array(); $response['error_code'] = 0; $response['id'] = $tagID; $response['parent_id'] = $tag instanceof eZTagsObject ? (int) $tag->attribute('parent_id') : -1; $response['children_count'] = count($children); $response['children'] = array(); foreach ($children as $child) { $childResponse = array(); $childResponse['id'] = (int) $child->attribute('id'); $childResponse['parent_id'] = (int) $child->attribute('parent_id'); $childResponse['has_children'] = eZTagsObject::childrenCountByParentID($child->attribute('id')) ? 1 : 0; $childResponse['synonyms_count'] = eZTagsObject::synonymsCount($child->attribute('id')); $childResponse['subtree_limitations_count'] = $child->getSubTreeLimitationsCount(); $childResponse['keyword'] = $child->attribute('keyword'); $childResponse['url'] = 'tags/id/' . $child->attribute('id');
<?php echo 'ciao'; $numberOfChildren = 0; $childrenArray = array(); $ezTagsObject = new eZTagsObject(); $numberOfChildren = eZTagsObject::childrenCountByParentID(20); $childrenArray = eZTagsObject::fetchByParentID(20); echo '----------Il numero dei figli del nodo Aromenti:<br>'; echo $numberOfChildren . '<br>'; echo '----------I figli del nodo Aromenti:<br>'; print_r($childrenArray); echo '<br>----------Fine array----------------------';