static function findNode($parentNode, $id, $asObject = false, $remoteID = false) { if (!isset($parentNode) || $parentNode == NULL) { $parentNode = 2; } $propertiesOverride = array("parent_node_id" => $parentNode = (int) $parentNode); $db = eZDB::instance(); if ($asObject) { if ($remoteID) { $objectIDFilter = "ezcontentobject.remote_id = '" . $db->escapeString($id) . "'"; $propertiesOverride["object_remote_id"] = $id; } else { $objectIDFilter = 'contentobject_id = ' . (int) $id; $propertiesOverride["id"] = $id; } $retNodeArray = eZContentObjectTreeNodeNoLanguage::makeObjectsArray($db->arrayQuery("SELECT " . "ezcontentobject.contentclass_id, ezcontentobject.current_version, " . (!isset($propertiesOverride["id"]) ? "ezcontentobject.id, " : "") . "ezcontentobject.initial_language_id, ezcontentobject.language_mask, ezcontentobject.modified, " . "ezcontentobject.name, ezcontentobject.owner_id, ezcontentobject.published, " . (!isset($propertiesOverride["object_remote_id"]) ? "ezcontentobject.remote_id AS object_remote_id, " : "") . "ezcontentobject.section_id, ezcontentobject.status, " . "ezcontentobject_tree.contentobject_is_published, ezcontentobject_tree.contentobject_version, ezcontentobject_tree.depth, ezcontentobject_tree.is_hidden, " . "ezcontentobject_tree.is_invisible, ezcontentobject_tree.main_node_id, ezcontentobject_tree.modified_subnode, ezcontentobject_tree.node_id, " . "ezcontentobject_tree.path_identification_string, ezcontentobject_tree.path_string, ezcontentobject_tree.priority, ezcontentobject_tree.remote_id, ezcontentobject_tree.sort_field, " . "ezcontentobject_tree.sort_order, ezcontentclass.serialized_name_list as class_serialized_name_list, ezcontentclass.identifier as class_identifier, ezcontentclass.is_container " . "FROM ezcontentobject_tree " . "INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id) " . "INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id AND ezcontentclass.version = 0) " . "WHERE parent_node_id = {$parentNode} AND " . $objectIDFilter), true, $propertiesOverride); if (!empty($retNodeArray)) { return $retNodeArray[0]; } else { return null; } } else { $id = (int) $id; $getNodeQuery = "SELECT node_id\n FROM ezcontentobject_tree\n WHERE\n parent_node_id={$parentNode} AND\n contentobject_id = {$id} "; $nodeArr = $db->arrayQuery($getNodeQuery); if (isset($nodeArr[0])) { return $nodeArr[0]['node_id']; } else { return false; } } }