本文整理匯總了PHP中eZURL::definition方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZURL::definition方法的具體用法?PHP eZURL::definition怎麽用?PHP eZURL::definition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZURL
的用法示例。
在下文中一共展示了eZURL::definition方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handleList
static function handleList( $parameters = array(), $asCount = false )
{
$parameters = array_merge( array( 'as_object' => true,
'is_valid' => null,
'offset' => false,
'limit' => false,
'only_published' => false ),
$parameters );
$asObject = $parameters['as_object'];
$isValid = $parameters['is_valid'];
$offset = $parameters['offset'];
$limit = $parameters['limit'];
$onlyPublished = $parameters['only_published'];
$limitArray = null;
if ( !$asCount and $offset !== false and $limit !== false )
$limitArray = array( 'offset' => $offset,
'length' => $limit );
$conditions = array();
if( $isValid === false ) $isValid = 0;
if ( $isValid !== null )
{
$conditions['is_valid'] = $isValid;
}
if ( count( $conditions ) == 0 )
$conditions = null;
if ( $onlyPublished ) // Only fetch published urls
{
$conditionQuery = "";
if ( $isValid !== null )
{
$isValid = (int) $isValid;
$conditionQuery = " AND ezurl.is_valid=$isValid ";
}
$db = eZDB::instance();
$cObjAttrVersionColumn = eZPersistentObject::getShortAttributeName( $db, eZURLObjectLink::definition(), 'contentobject_attribute_version' );
if ( $asCount )
{
$urls = $db->arrayQuery( "SELECT count( DISTINCT ezurl.id ) AS count
FROM
ezurl,
ezurl_object_link,
ezcontentobject_attribute,
ezcontentobject_version
WHERE
ezurl.id = ezurl_object_link.url_id
AND ezurl_object_link.contentobject_attribute_id = ezcontentobject_attribute.id
AND ezurl_object_link.$cObjAttrVersionColumn = ezcontentobject_attribute.version
AND ezcontentobject_attribute.contentobject_id = ezcontentobject_version.contentobject_id
AND ezcontentobject_attribute.version = ezcontentobject_version.version
AND ezcontentobject_version.status = " . eZContentObjectVersion::STATUS_PUBLISHED . "
$conditionQuery" );
return $urls[0]['count'];
}
else
{
$query = "SELECT DISTINCT ezurl.*
FROM
ezurl,
ezurl_object_link,
ezcontentobject_attribute,
ezcontentobject_version
WHERE
ezurl.id = ezurl_object_link.url_id
AND ezurl_object_link.contentobject_attribute_id = ezcontentobject_attribute.id
AND ezurl_object_link.$cObjAttrVersionColumn = ezcontentobject_attribute.version
AND ezcontentobject_attribute.contentobject_id = ezcontentobject_version.contentobject_id
AND ezcontentobject_attribute.version = ezcontentobject_version.version
AND ezcontentobject_version.status = " . eZContentObjectVersion::STATUS_PUBLISHED . "
$conditionQuery";
if ( !$offset && !$limit )
{
$urlArray = $db->arrayQuery( $query );
}
else
{
$urlArray = $db->arrayQuery( $query, array( 'offset' => $offset,
'limit' => $limit ) );
}
if ( $asObject )
{
$urls = array();
foreach ( $urlArray as $url )
{
$urls[] = new eZURL( $url );
}
return $urls;
}
else
$urls = $urlArray;
return $urls;
}
}
else
{
if ( $asCount )
{
$urls = eZPersistentObject::fetchObjectList( eZURL::definition(),
//.........這裏部分代碼省略.........