本文整理汇总了PHP中eZContentObjectTreeNode::makeObjectsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::makeObjectsArray方法的具体用法?PHP eZContentObjectTreeNode::makeObjectsArray怎么用?PHP eZContentObjectTreeNode::makeObjectsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::makeObjectsArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findNode
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 = eZContentObjectTreeNode::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;
}
}
}
示例2: search
//.........这里部分代码省略.........
if ($i == 0) {
$table = $db->generateUniqueTempTableName('ezsearch_tmp_%', 0);
$this->saveCreatedTempTableName(0, $table);
$db->createTempTable("CREATE TEMPORARY TABLE {$table} ( contentobject_id int primary key not null, published int )");
$db->query("INSERT INTO {$table} SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published\n FROM ezcontentobject\n INNER JOIN ezsearch_object_word_link ON (ezsearch_object_word_link.contentobject_id = ezcontentobject.id)\n {$subTreeTable}\n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n {$sqlPermissionChecking['from']}\n WHERE\n {$searchDateQuery}\n {$sectionQuery}\n {$classQuery}\n {$classAttributeQuery}\n {$searchPartText}\n {$subTreeSQL}\n ezcontentclass.version = '0' AND\n ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}", eZDBInterface::SERVER_SLAVE);
} else {
$table = $db->generateUniqueTempTableName('ezsearch_tmp_%', $i);
$this->saveCreatedTempTableName($i, $table);
$tmpTable0 = $this->getSavedTempTableName(0);
$db->createTempTable("CREATE TEMPORARY TABLE {$table} ( contentobject_id int primary key not null, published int )");
$db->query("INSERT INTO {$table} SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published\n FROM\n ezcontentobject\n INNER JOIN ezsearch_object_word_link ON (ezsearch_object_word_link.contentobject_id = ezcontentobject.id)\n {$subTreeTable}\n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n INNER JOIN {$tmpTable0} ON ({$tmpTable0}.contentobject_id = ezsearch_object_word_link.contentobject_id)\n {$sqlPermissionChecking['from']}\n WHERE\n {$searchDateQuery}\n {$sectionQuery}\n {$classQuery}\n {$classAttributeQuery}\n {$searchPartText}\n {$subTreeSQL}\n ezcontentclass.version = '0' AND\n ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}", eZDBInterface::SERVER_SLAVE);
}
$i++;
} else {
$stopWordArray[] = array('word' => $searchPart['text']);
}
}
if (count($searchPartsArray) === 0 && $this->TempTablesCount == 0) {
$table = $db->generateUniqueTempTableName('ezsearch_tmp_%', 0);
$this->saveCreatedTempTableName(0, $table);
$db->createTempTable("CREATE TEMPORARY TABLE {$table} ( contentobject_id int primary key not null, published int )");
$db->query("INSERT INTO {$table} SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published\n FROM ezcontentobject\n INNER JOIN ezsearch_object_word_link ON (ezsearch_object_word_link.contentobject_id = ezcontentobject.id)\n {$subTreeTable}\n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n {$sqlPermissionChecking['from']}\n WHERE\n {$searchDateQuery}\n {$sectionQuery}\n {$classQuery}\n {$classAttributeQuery}\n {$subTreeSQL}\n ezcontentclass.version = '0' AND\n ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}", eZDBInterface::SERVER_SLAVE);
$this->TempTablesCount = 1;
$i = $this->TempTablesCount;
}
$nonExistingWordCount = count(array_unique($searchWordArray)) - count($wordIDHash) - $wildCardCount;
$excludeWordCount = $searchWordCount - count($stopWordArray);
if (count($stopWordArray) + $nonExistingWordCount == $searchWordCount && $this->TempTablesCount == 0) {
// No words to search for, return empty result
// cleanup temp tables
$db->dropTempTableList($sqlPermissionChecking['temp_tables']);
$db->dropTempTableList($this->getSavedTempTablesList());
return array("SearchResult" => array(), "SearchCount" => 0, "StopWordArray" => $stopWordArray);
}
$tmpTablesFrom = "";
$tmpTablesWhere = "";
/// tmp tables
$tmpTableCount = $i;
for ($i = 0; $i < $tmpTableCount; $i++) {
$tmpTablesFrom .= $this->getSavedTempTableName($i);
if ($i < $tmpTableCount - 1) {
$tmpTablesFrom .= ", ";
}
}
$tmpTablesSeparator = '';
if ($tmpTableCount > 0) {
$tmpTablesSeparator = ', ';
}
$tmpTable0 = $this->getSavedTempTableName(0);
for ($i = 1; $i < $tmpTableCount; $i++) {
$tmpTableI = $this->getSavedTempTableName($i);
$tmpTablesWhere .= " {$tmpTable0}.contentobject_id={$tmpTableI}.contentobject_id ";
if ($i < $tmpTableCount - 1) {
$tmpTablesWhere .= " AND ";
}
}
$tmpTablesWhereExtra = '';
if ($tmpTableCount > 0) {
$tmpTablesWhereExtra = "ezcontentobject.id={$tmpTable0}.contentobject_id AND";
}
$and = "";
if ($tmpTableCount > 1) {
$and = " AND ";
}
// Generate ORDER BY SQL
$orderBySQLArray = $this->buildSortSQL($sortArray);
$orderByFieldsSQL = $orderBySQLArray['sortingFields'];
$sortWhereSQL = $orderBySQLArray['whereSQL'];
$sortFromSQL = $orderBySQLArray['fromSQL'];
$sortSelectSQL = $orderBySQLArray['selectSQL'];
// Fetch data from table
$searchQuery = '';
$searchQuery = "SELECT DISTINCT ezcontentobject.*, ezcontentclass.serialized_name_list as class_serialized_name_list,\n ezcontentobject_tree.*, ezcontentobject_name.name as name,\n ezcontentobject_name.real_translation {$sortSelectSQL}\n FROM\n {$tmpTablesFrom} {$tmpTablesSeparator}\n ezcontentobject\n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id )\n INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n INNER JOIN ezcontentobject_name ON (\n ezcontentobject_name.contentobject_id = ezcontentobject_tree.contentobject_id AND\n ezcontentobject_name.content_version = ezcontentobject_tree.contentobject_version\n )\n {$sortFromSQL}\n WHERE\n {$tmpTablesWhere} {$and}\n {$tmpTablesWhereExtra}\n ezcontentclass.version = '0' AND\n ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id AND\n " . eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject') . "\n {$showInvisibleNodesCond}\n {$sortWhereSQL}\n ORDER BY {$orderByFieldsSQL}";
// Count query
$languageCond = eZContentLanguage::languagesSQLFilter('ezcontentobject');
if ($tmpTableCount == 0) {
$searchCountQuery = "SELECT count( DISTINCT ezcontentobject.id ) AS count\n FROM\n ezcontentobject,\n ezcontentobject_tree\n WHERE\n ezcontentobject.id = ezcontentobject_tree.contentobject_id and\n ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id\n AND {$languageCond}\n {$showInvisibleNodesCond}";
} else {
$searchCountQuery = "SELECT count( DISTINCT ezcontentobject.id ) AS count\n FROM {$tmpTablesFrom} {$tmpTablesSeparator}\n ezcontentobject\n WHERE {$tmpTablesWhere} {$and}\n {$tmpTablesWhereExtra}\n {$languageCond}";
}
$objectRes = array();
$searchCount = 0;
if ($nonExistingWordCount <= 0) {
// execute search query
$objectResArray = $db->arrayQuery($searchQuery, array("limit" => $searchLimit, "offset" => $searchOffset), eZDBInterface::SERVER_SLAVE);
// execute search count query
$objectCountRes = $db->arrayQuery($searchCountQuery, array(), eZDBInterface::SERVER_SLAVE);
$objectRes = eZContentObjectTreeNode::makeObjectsArray($objectResArray);
$searchCount = $objectCountRes[0]['count'];
} else {
$objectRes = array();
}
// Drop tmp tables
$db->dropTempTableList($sqlPermissionChecking['temp_tables']);
$db->dropTempTableList($this->getSavedTempTablesList());
return array("SearchResult" => $objectRes, "SearchCount" => $searchCount, "StopWordArray" => $stopWordArray);
} else {
return array("SearchResult" => array(), "SearchCount" => 0, "StopWordArray" => array());
}
}
示例3: findNode
static function findNode($parentNode, $id, $asObject = false, $remoteID = false)
{
if (!isset($parentNode) || $parentNode == NULL) {
$parentNode = 2;
}
$parentNode = (int) $parentNode;
$db = eZDB::instance();
if ($asObject) {
if ($remoteID) {
$objectIDFilter = 'ezcontentobject.remote_id = ' . (string) $id;
} else {
$objectIDFilter = 'contentobject_id = ' . (int) $id;
}
$query = "SELECT ezcontentobject.*,\n ezcontentobject_tree.*,\n ezcontentclass.serialized_name_list as class_serialized_name_list,\n ezcontentclass.identifier as class_identifier,\n ezcontentclass.is_container as is_container\n FROM ezcontentobject_tree,\n ezcontentobject,\n ezcontentclass\n WHERE parent_node_id = {$parentNode} AND\n {$objectIDFilter} AND\n ezcontentobject_tree.contentobject_id=ezcontentobject.id AND\n ezcontentclass.version=0 AND\n ezcontentclass.id = ezcontentobject.contentclass_id ";
$nodeListArray = $db->arrayQuery($query);
$retNodeArray = eZContentObjectTreeNode::makeObjectsArray($nodeListArray);
if (count($retNodeArray) > 0) {
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;
}
}
}
示例4: assignedNodes
/**
* Returns the node assignments for the current object.
*
* @param boolean $asObject
* @param boolean $checkVisibility if true, the visibility and the setting
* site.ini/[SiteAccessSettings]/ShowHiddenNodes are taken into account.
* @return eZContentObjectTreeNode[]|array[]
*/
function assignedNodes( $asObject = true, $checkVisibility = false )
{
$contentobjectID = $this->attribute( 'id' );
if ( $contentobjectID == null )
{
return array();
}
$visibilitySQL = '';
if (
$checkVisibility === true
&& eZINI::instance()->variable( 'SiteAccessSettings', 'ShowHiddenNodes' ) !== 'true'
)
{
$visibilitySQL = "AND ezcontentobject_tree.is_invisible = 0 ";
}
$nodesListArray = eZDB::instance()->arrayQuery(
"SELECT " .
"ezcontentobject.contentclass_id, ezcontentobject.current_version, ezcontentobject.initial_language_id, ezcontentobject.language_mask, " .
"ezcontentobject.modified, ezcontentobject.name, ezcontentobject.owner_id, ezcontentobject.published, 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.parent_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 as is_container " .
"FROM ezcontentobject_tree " .
"INNER JOIN ezcontentobject ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) " .
"INNER JOIN ezcontentclass ON (ezcontentclass.version = 0 AND ezcontentclass.id = ezcontentobject.contentclass_id) " .
"WHERE contentobject_id = $contentobjectID " .
$visibilitySQL .
"ORDER BY path_string"
);
if ( $asObject == true )
{
return eZContentObjectTreeNode::makeObjectsArray( $nodesListArray, true, array( "id" => $contentobjectID ) );
}
else
return $nodesListArray;
}
示例5: assignedNodes
function assignedNodes( $asObject = true )
{
$contentobjectID = $this->attribute( 'id' );
if ( $contentobjectID == null )
{
$retValue = array();
return $retValue;
}
$query = "SELECT ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.serialized_name_list as class_serialized_name_list,
ezcontentclass.identifier as class_identifier,
ezcontentclass.is_container as is_container
FROM ezcontentobject_tree,
ezcontentobject,
ezcontentclass
WHERE contentobject_id=$contentobjectID AND
ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
ezcontentclass.version=0 AND
ezcontentclass.id = ezcontentobject.contentclass_id
ORDER BY path_string";
$db = eZDB::instance();
$nodesListArray = $db->arrayQuery( $query );
if ( $asObject == true )
{
$nodes = eZContentObjectTreeNode::makeObjectsArray( $nodesListArray );
return $nodes;
}
else
return $nodesListArray;
}
示例6: assignedNodes
/**
* Returns the nodes for the current object.
*
* @param boolean $asObject
* @param boolean $checkVisibility if true, the visibility and the setting
* site.ini/[SiteAccessSettings]/ShowHiddenNodes are taken into account.
* @return eZContentObjectTreeNode[]|array[]
*/
function assignedNodes( $asObject = true, $checkVisibility = false )
{
$contentobjectID = $this->attribute( 'id' );
if ( $contentobjectID == null )
{
$retValue = array();
return $retValue;
}
$visibilitySQL = '';
if (
$checkVisibility === true
&& eZINI::instance()->variable( 'SiteAccessSettings', 'ShowHiddenNodes' ) !== 'true'
)
{
$visibilitySQL = "AND ezcontentobject_tree.is_invisible = 0 ";
}
$query = "SELECT ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.serialized_name_list as class_serialized_name_list,
ezcontentclass.identifier as class_identifier,
ezcontentclass.is_container as is_container
FROM ezcontentobject_tree,
ezcontentobject,
ezcontentclass
WHERE contentobject_id=$contentobjectID AND
ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
ezcontentclass.version=0 AND
ezcontentclass.id = ezcontentobject.contentclass_id
$visibilitySQL
ORDER BY path_string";
$db = eZDB::instance();
$nodesListArray = $db->arrayQuery( $query );
if ( $asObject == true )
{
$nodes = eZContentObjectTreeNode::makeObjectsArray( $nodesListArray );
return $nodes;
}
else
return $nodesListArray;
}
示例7: modify
//.........这里部分代码省略.........
$tpl = eZTemplate::factory();
foreach ($namedParameters['variables'] as $key => $value) {
$tpl->setVariable($key, $value);
}
$operatorValue = $tpl->fetch('design:' . $namedParameters['template']);
break;
case 'find_global_layout':
$result = false;
$node = $operatorValue;
if (is_numeric($node)) {
$node = eZContentObjectTreeNode::fetch($node);
}
if (!$node) {
return $operatorValue = $result;
}
$pathArray = $node->attribute('path_array');
$nodesParams = array();
foreach ($pathArray as $pathNodeID) {
if ($pathNodeID < eZINI::instance('content.ini')->variable('NodeSettings', 'RootNode') || $pathNodeID == $node->attribute('node_id')) {
continue;
} else {
$nodesParams[] = array('ParentNodeID' => $pathNodeID, 'ResultID' => 'ezcontentobject_tree.node_id', 'ClassFilterType' => 'include', 'ClassFilterArray' => $ini->variable('GlobalLayout', 'Classes'), 'Depth' => 1, 'DepthOperator' => 'eq', 'AsObject' => false);
}
}
//eZDebug::writeWarning( var_export($nodesParams,1), __METHOD__);
$findNodes = eZContentObjectTreeNode::subTreeMultiPaths($nodesParams, array('SortBy' => array('node_id', false)));
$sortByParentNodeID = array();
if (!empty($findNodes)) {
foreach ($findNodes as $findNode) {
$sortByParentNodeID[$findNode['parent_node_id']] = $findNode;
}
krsort($sortByParentNodeID);
$result = array_shift($sortByParentNodeID);
$result = eZContentObjectTreeNode::makeObjectsArray(array($result));
if (!empty($result)) {
$result = $result[0];
}
}
return $operatorValue = $result;
case 'redirect':
$url = $namedParameters['url'];
header('Location: ' . $url);
break;
case 'sort_nodes':
$sortNodes = array();
if (!empty($operatorValue) && is_array($operatorValue)) {
$nodes = $operatorValue;
foreach ($nodes as $node) {
if (!$node instanceof eZContentObjectTreeNode) {
continue;
}
$object = $node->object();
switch ($namedParameters['by']) {
case 'published':
default:
$sortby = $object->attribute('published');
break;
}
$sortNodes[$sortby] = $node;
}
ksort($sortNodes);
if ($namedParameters['order'] == 'desc') {
$sortNodes = array_reverse($sortNodes);
}
}
return $operatorValue = $sortNodes;