本文整理汇总了PHP中eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings方法的具体用法?PHP eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings怎么用?PHP eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subTree
function subTree($params, $nodeID, $countChildren = false)
{
$nodeListArray = array();
// sorting params
$sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($params['SortBy']);
// node params
$notEqParentString = '';
$pathStringCond = '';
eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings($pathStringCond, $notEqParentString, $nodeID, 1, false);
// class filter
$classCondition = eZContentObjectTreeNode::createClassFilteringSQLString($params['ClassFilterType'], $params['ClassFilterArray']);
if ($classCondition === false) {
return $nodeListArray;
}
// permissions
$limitationParams = false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitationParams);
if ($limitationList === false) {
return $nodeListArray;
}
$permissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
// version
$useVersionName = true;
$versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString($useVersionName);
$versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString($useVersionName);
$versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString($useVersionName);
// invisible nodes.
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(false, $params['FetchHidden']);
$query = '';
if ($countChildren) {
$query = "SELECT count(*) as count\n FROM\n ezcontentobject_tree,\n ezcontentobject,ezcontentclass\n {$versionNameTables}\n {$permissionChecking['from']}\n WHERE {$pathStringCond}\n {$classCondition}\n ezcontentclass.version=0 AND\n {$notEqParentString}\n ezcontentobject_tree.contentobject_id = ezcontentobject.id AND\n ezcontentclass.id = ezcontentobject.contentclass_id\n {$versionNameJoins}\n {$permissionChecking['where']} ";
} else {
$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 {$versionNameTargets}\n FROM\n ezcontentobject_tree,\n ezcontentobject,ezcontentclass\n {$versionNameTables}\n {$sortingInfo['attributeFromSQL']}\n {$permissionChecking['from']}\n WHERE\n {$pathStringCond}\n {$sortingInfo['attributeWhereSQL']}\n ezcontentclass.version=0 AND\n {$notEqParentString}\n ezcontentobject_tree.contentobject_id = ezcontentobject.id AND\n ezcontentclass.id = ezcontentobject.contentclass_id AND\n {$classCondition}\n ezcontentobject_tree.contentobject_is_published = 1\n {$versionNameJoins}\n {$showInvisibleNodesCond}\n {$permissionChecking['where']}\n ORDER BY {$sortingInfo['sortingFields']}";
}
$db = eZDB::instance();
$nodeListArray = $db->arrayQuery($query);
// cleanup temp tables
$db->dropTempTableList($permissionChecking['temp_tables']);
if ($countChildren) {
return $nodeListArray[0]['count'];
} else {
foreach ($nodeListArray as $key => $row) {
$nodeListArray[$key]['path_identification_string'] = eZContentObjectTreeNode::fetch($row['node_id'])->pathWithNames();
}
return $nodeListArray;
}
}
示例2: fetchKeyword
public static function fetchKeyword($alphabet, $classid, $offset, $limit, $owner = false, $sortBy = array(), $parentNodeID = false, $includeDuplicates = true, $strictMatching = false, $depth = 1)
{
$classIDArray = array();
if (is_numeric($classid)) {
$classIDArray = array($classid);
} else {
if (is_array($classid)) {
$classIDArray = $classid;
}
}
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
$limitation = false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
$db_params = array();
$db_params['offset'] = $offset;
$db_params['limit'] = $limit;
$keywordNodeArray = array();
$lastKeyword = '';
$db = eZDB::instance();
//in SELECT clause below we will use a full keyword value
//or just a part of ezkeyword.keyword matched to $alphabet respective to $includeDuplicates parameter.
//In the case $includeDuplicates = ture we need only a part
//of ezkeyword.keyword to be fetched in field to allow DISTINCT to remove rows with the same node id's
$sqlKeyword = 'ezkeyword.keyword';
if (!$includeDuplicates) {
$sqlKeyword = $db->subString('ezkeyword.keyword', 1, strlen($alphabet)) . ' AS keyword ';
}
$alphabet = $db->escapeString($alphabet);
$sortingInfo = array();
$sortingInfo['attributeFromSQL'] = '';
$sqlTarget = $sqlKeyword . ',ezcontentobject_tree.node_id';
if (is_array($sortBy) && count($sortBy) > 0) {
switch ($sortBy[0]) {
case 'keyword':
case 'name':
$sortingString = '';
if ($sortBy[0] == 'name') {
$sortingString = 'ezcontentobject.name';
} elseif ($sortBy[0] == 'keyword') {
if ($includeDuplicates) {
$sortingString = 'ezkeyword.keyword';
} else {
$sortingString = 'keyword';
}
}
$sortOrder = true;
// true is ascending
if (isset($sortBy[1])) {
$sortOrder = $sortBy[1];
}
$sortingOrder = $sortOrder ? ' ASC' : ' DESC';
$sortingInfo['sortingFields'] = $sortingString . $sortingOrder;
break;
default:
$sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($sortBy);
}
// Fixing the attributeTargetSQL
switch ($sortBy[0]) {
case 'keyword':
$sortingInfo['attributeTargetSQL'] = '';
break;
case 'name':
$sortingInfo['attributeTargetSQL'] = ', ezcontentobject.name';
break;
case 'attribute':
case 'class_name':
break;
default:
$sortingInfo['attributeTargetSQL'] .= ', ' . strtok($sortingInfo["sortingFields"], " ");
}
$sqlTarget .= $sortingInfo['attributeTargetSQL'];
} else {
$sortingInfo['sortingFields'] = 'ezkeyword.keyword ASC';
}
//Adding DISTINCT to avoid duplicates,
//check if DISTINCT keyword was added before providing clauses for sorting.
if (!$includeDuplicates && substr($sqlTarget, 0, 9) != 'DISTINCT ') {
$sqlTarget = 'DISTINCT ' . $sqlTarget;
}
$sqlOwnerString = is_numeric($owner) ? "AND ezcontentobject.owner_id = '{$owner}'" : '';
$parentNodeIDString = '';
if (is_numeric($parentNodeID)) {
$notEqParentString = '';
// If the node(s) doesn't exist we return null.
if (!eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings($parentNodeIDString, $notEqParentString, $parentNodeID, $depth)) {
return null;
}
}
$sqlClassIDString = '';
if (is_array($classIDArray) and count($classIDArray)) {
$sqlClassIDString = 'AND ' . $db->generateSQLINStatement($classIDArray, 'ezkeyword.class_id', false, false, 'int') . ' ';
}
// composing sql for matching tag word, it could be strict equiality or LIKE clause
// dependent of $strictMatching parameter.
$sqlMatching = "ezkeyword.keyword LIKE '{$alphabet}%'";
if ($strictMatching) {
$sqlMatching = "ezkeyword.keyword = '{$alphabet}'";
}
$query = "SELECT {$sqlTarget}\n FROM ezkeyword\n INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id)\n INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id)\n INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id)\n INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n {$sortingInfo['attributeFromSQL']}\n {$sqlPermissionChecking['from']}\n WHERE\n {$parentNodeIDString}\n {$sqlMatching}\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}\n {$sqlClassIDString}\n {$sqlOwnerString}\n AND ezcontentclass.version = 0\n AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "\n AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id\n ORDER BY {$sortingInfo['sortingFields']}";
//.........这里部分代码省略.........
示例3: calendar
static function calendar($params = false, $nodeID = 0)
{
if (!is_numeric($nodeID) and !is_array($nodeID)) {
return array();
}
if ($params === false) {
$params = array('Depth' => false, 'Offset' => false, 'Limit' => false, 'AttributeFilter' => false, 'ExtendedAttributeFilter' => false, 'ClassFilterType' => false, 'ClassFilterArray' => false, 'GroupBy' => false);
}
$offset = isset($params['Offset']) && is_numeric($params['Offset']) ? $params['Offset'] : false;
$limit = isset($params['Limit']) && is_numeric($params['Limit']) ? $params['Limit'] : false;
$depth = isset($params['Depth']) && is_numeric($params['Depth']) ? $params['Depth'] : false;
$depthOperator = isset($params['DepthOperator']) ? $params['DepthOperator'] : false;
$groupBy = isset($params['GroupBy']) ? $params['GroupBy'] : false;
$mainNodeOnly = isset($params['MainNodeOnly']) ? $params['MainNodeOnly'] : false;
$ignoreVisibility = isset($params['IgnoreVisibility']) ? $params['IgnoreVisibility'] : false;
if (!isset($params['ClassFilterType'])) {
$params['ClassFilterType'] = false;
}
$classCondition = eZContentObjectTreeNode::createClassFilteringSQLString($params['ClassFilterType'], $params['ClassFilterArray']);
$attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($params['AttributeFilter'], $sortingInfo);
$extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings($params['ExtendedAttributeFilter']);
$mainNodeOnlyCond = eZContentObjectTreeNode::createMainNodeConditionSQLString($mainNodeOnly);
$pathStringCond = '';
$notEqParentString = '';
eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings($pathStringCond, $notEqParentString, $nodeID, $depth, $depthOperator);
$groupBySelectText = '';
$groupBySQL = $extendedAttributeFilter['group_by'];
if (!$groupBySQL) {
eZContentObjectTreeNode::createGroupBySQLStrings($groupBySelectText, $groupBySQL, $groupBy);
} else {
if ($groupBy) {
eZDebug::writeError("Cannot use group_by parameter together with extended attribute filter which sets group_by!", __METHOD__);
}
}
$limitation = isset($params['Limitation']) && is_array($params['Limitation']) ? $params['Limitation'] : false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
// Determine whether we should show invisible nodes.
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(!$ignoreVisibility);
$query = "SELECT DISTINCT\n ezcontentobject.published as published\n {$groupBySelectText}\n FROM\n ezcontentobject_tree\n INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id)\n INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_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\n {$attributeFilter['from']}\n {$extendedAttributeFilter['tables']}\n {$sqlPermissionChecking['from']}\n WHERE\n {$pathStringCond}\n {$extendedAttributeFilter['joins']}\n {$attributeFilter['where']}\n ezcontentclass.version = 0 AND\n {$notEqParentString}\n {$mainNodeOnlyCond}\n {$classCondition}\n " . eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject') . "\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}\n {$groupBySQL}";
$db = eZDB::instance();
$server = count($sqlPermissionChecking['temp_tables']) > 0 ? eZDBInterface::SERVER_SLAVE : false;
if (!$offset && !$limit) {
$nodeListArray = $db->arrayQuery($query, array(), $server);
} else {
$nodeListArray = $db->arrayQuery($query, array('offset' => $offset, 'limit' => $limit), $server);
}
// cleanup temp tables
$db->dropTempTableList($sqlPermissionChecking['temp_tables']);
return $nodeListArray;
}
示例4: calendar
static function calendar( $params = false, $nodeID = 0 )
{
if ( !is_numeric( $nodeID ) and !is_array( $nodeID ) )
{
return array();
}
if ( $params === false )
{
$params = array( 'Depth' => false,
'Offset' => false,
'Limit' => false,
'AttributeFilter' => false,
'ExtendedAttributeFilter' => false,
'ClassFilterType' => false,
'ClassFilterArray' => false,
'GroupBy' => false );
}
$offset = ( isset( $params['Offset'] ) && is_numeric( $params['Offset'] ) ) ? $params['Offset'] : false;
$limit = ( isset( $params['Limit'] ) && is_numeric( $params['Limit'] ) ) ? $params['Limit'] : false;
$depth = ( isset( $params['Depth'] ) && is_numeric( $params['Depth'] ) ) ? $params['Depth'] : false;
$depthOperator = ( isset( $params['DepthOperator'] ) ) ? $params['DepthOperator'] : false;
$groupBy = ( isset( $params['GroupBy'] ) ) ? $params['GroupBy'] : false;
$mainNodeOnly = ( isset( $params['MainNodeOnly'] ) ) ? $params['MainNodeOnly'] : false;
$ignoreVisibility = ( isset( $params['IgnoreVisibility'] ) ) ? $params['IgnoreVisibility'] : false;
if ( !isset( $params['ClassFilterType'] ) )
$params['ClassFilterType'] = false;
$classCondition = eZContentObjectTreeNode::createClassFilteringSQLString( $params['ClassFilterType'], $params['ClassFilterArray'] );
$attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings( $params['AttributeFilter'], $sortingInfo );
$extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings( $params['ExtendedAttributeFilter'] );
$mainNodeOnlyCond = eZContentObjectTreeNode::createMainNodeConditionSQLString( $mainNodeOnly );
$pathStringCond = '';
$notEqParentString = '';
eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings( $pathStringCond, $notEqParentString, $nodeID, $depth, $depthOperator );
$groupBySelectText = '';
$groupBySQL = $extendedAttributeFilter['group_by'];
if ( !$groupBySQL )
{
eZContentObjectTreeNode::createGroupBySQLStrings( $groupBySelectText, $groupBySQL, $groupBy );
}
else if ( $groupBy )
{
eZDebug::writeError( "Cannot use group_by parameter together with extended attribute filter which sets group_by!", __METHOD__ );
}
$useVersionName = true;
$versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString( $useVersionName );
$versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString( $useVersionName, false );
$limitation = ( isset( $params['Limitation'] ) && is_array( $params['Limitation'] ) ) ? $params['Limitation']: false;
$limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList );
// Determine whether we should show invisible nodes.
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( !$ignoreVisibility );
$query = "SELECT DISTINCT
ezcontentobject.published as published
$groupBySelectText
FROM
ezcontentobject_tree,
ezcontentobject,ezcontentclass
$versionNameTables
$attributeFilter[from]
$extendedAttributeFilter[tables]
$sqlPermissionChecking[from]
WHERE
$pathStringCond
$extendedAttributeFilter[joins]
$attributeFilter[where]
ezcontentclass.version=0
AND
$notEqParentString
$mainNodeOnlyCond
ezcontentobject_tree.contentobject_id = ezcontentobject.id AND
ezcontentclass.id = ezcontentobject.contentclass_id AND
$classCondition
$versionNameJoins
$showInvisibleNodesCond
$sqlPermissionChecking[where]
$groupBySQL";
$db = eZDB::instance();
$server = count( $sqlPermissionChecking['temp_tables'] ) > 0 ? eZDBInterface::SERVER_SLAVE : false;
if ( !$offset && !$limit )
{
$nodeListArray = $db->arrayQuery( $query, array(), $server );
}
else
{
$nodeListArray = $db->arrayQuery( $query, array( 'offset' => $offset,
'limit' => $limit ),
$server );
//.........这里部分代码省略.........