本文整理汇总了PHP中eZContentClass::definition方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClass::definition方法的具体用法?PHP eZContentClass::definition怎么用?PHP eZContentClass::definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClass
的用法示例。
在下文中一共展示了eZContentClass::definition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchList
static function fetchList($version = eZContentClass::VERSION_STATUS_DEFINED, $asObject = true, $user_id = false, $sorts = null, $fields = null, $classFilter = false, $limit = null)
{
$conds = array();
$custom_fields = null;
$custom_tables = null;
$custom_conds = null;
if (is_numeric($version)) {
$conds["version"] = $version;
}
if ($user_id !== false and is_numeric($user_id)) {
$conds["creator_id"] = $user_id;
}
if ($classFilter) {
$classIDCount = 0;
$classIdentifierCount = 0;
$classIDFilter = array();
$classIdentifierFilter = array();
foreach ($classFilter as $classType) {
if (is_numeric($classType)) {
$classIDFilter[] = $classType;
$classIDCount++;
} else {
$classIdentifierFilter[] = $classType;
$classIdentifierCount++;
}
}
if ($classIDCount > 1) {
$conds['id'] = array($classIDFilter);
} else {
if ($classIDCount == 1) {
$conds['id'] = $classIDFilter[0];
}
}
if ($classIdentifierCount > 1) {
$conds['identifier'] = array($classIdentifierFilter);
} else {
if ($classIdentifierCount == 1) {
$conds['identifier'] = $classIdentifierFilter[0];
}
}
}
if ($sorts && isset($sorts['name'])) {
$nameFiler = eZContentClassName::sqlFilter('ezcontentclass');
$custom_tables = array($nameFiler['from']);
$custom_conds = "AND " . $nameFiler['where'];
$custom_fields = array($nameFiler['nameField']);
$sorts[$nameFiler['orderBy']] = $sorts['name'];
unset($sorts['name']);
}
return eZPersistentObject::fetchObjectList(eZContentClass::definition(), $fields, $conds, $sorts, $limit, $asObject, false, $custom_fields, $custom_tables, $custom_conds);
}
示例2: foreach
$key = $attribute->attribute('id');
if (isset($attributeNames[$key])) {
$attribute->setName($attributeNames[$key], $EditLanguage);
}
}
}
if ($http->hasPostVariable('ContentAttribute_description')) {
$attributeNames = $http->postVariable('ContentAttribute_description');
foreach ($attributes as $attribute) {
$key = $attribute->attribute('id');
if (isset($attributeNames[$key])) {
$attribute->setDescription($attributeNames[$key], $EditLanguage);
}
}
}
eZHTTPPersistence::fetch('ContentClass', eZContentClass::definition(), $class, $http, false);
if ($http->hasPostVariable('ContentClass_name')) {
$class->setName($http->postVariable('ContentClass_name'), $EditLanguage);
}
if ($http->hasPostVariable('ContentClass_description')) {
$class->setDescription($http->postVariable('ContentClass_description'), $EditLanguage);
}
if ($http->hasVariable('ContentClass_is_container_exists')) {
if ($http->hasVariable('ContentClass_is_container_checked')) {
$class->setAttribute("is_container", 1);
} else {
$class->setAttribute("is_container", 0);
}
}
if ($http->hasVariable('ContentClass_always_available_exists')) {
if ($http->hasVariable('ContentClass_always_available')) {
示例3: getBrowseItems
/**
* Returns a struct containing the following values:
* - limit the number of element by page
* - offset the current offset
* - items array, each element contains
* - has_child boolean
* - can_create boolean
* - node eZContentObjectTreeNode
* - has_prev boolean, true if there's a previous page
* - has_next boolean, true if there's a next page
*
* @param eZContentObjectTreeNode $start the node where the browse will start
* @param eZContentClass $class class of the object to be created
* @param int $offset
* @return array
*/
private static function getBrowseItems( eZContentObjectTreeNode $start, eZContentClass $class, $offset = 0 )
{
$result = array(
'limit' => 10,
'offset' => $offset,
'items' => array(),
'has_prev' => ( $offset != 0 ),
'has_next' => false
);
$containerClasses = eZPersistentObject::fetchObjectList(
eZContentClass::definition(), null,
array(
'version' => eZContentClass::VERSION_STATUS_DEFINED,
'is_container' => 1
)
);
$classFilterArray = array();
foreach ( $containerClasses as $c )
{
$classFilterArray[] = $c->attribute( 'identifier' );
}
$children = $start->subTree(
array(
'ClassFilterArray' => $classFilterArray,
'ClassFilterType' => 'include',
'Depth' => 1,
'Limit' => $result['limit'],
'Offset' => $offset
)
);
$count = $start->subTreeCount(
array(
'ClassFilterArray' => $classFilterArray,
'ClassFilterType' => 'include',
'Depth' => 1
)
);
if ( $count > ( $offset + $result['limit'] ) )
{
$result['has_next'] = true;
}
foreach( $children as $node )
{
$elt = array();
$elt['node'] = $node;
$canCreateClassist = $node->canCreateClassList();
foreach( $canCreateClassist as $c )
{
if ( $c['id'] == $class->attribute( 'id' ) )
{
$elt['can_create'] = true;
break;
}
}
if ( !isset( $elt['can_create'] ) )
{
$elt['can_create'] = false;
}
$childrenContainerCount = $node->subTreeCount(
array(
'ClassFilterArray' => $classFilterArray,
'ClassFilterType' => 'include',
'Depth' => 1
)
);
$elt['has_child'] = ( $childrenContainerCount > 0 );
$result['items'][] = $elt;
}
return $result;
}
示例4: redirectToContentBrowseModuleView
/**
* Pass module view default template parameters
*
* @param array $parameters Array of parameters. Optional
* @param object $module Object of eZModule. Required
* @return string String of url to content/browse
*/
function redirectToContentBrowseModuleView($parameters = false, $module)
{
if ($parameters == false) {
// Fetch and use parameters from session directly
$parameters = eZSession::get('bcimagealias_create_parameters', $parameters);
}
/**
* Fetch array of container classes
*/
$classes = eZPersistentObject::fetchObjectList(eZContentClass::definition(), array('identifier'), array('is_container' => 1), null, null, false);
// as object
/**
* Prepare array of allowed class identifiers based on above fetch results
*/
$allowedClasses = array();
foreach ($classes as $class) {
$allowedClasses[] = $class['identifier'];
}
/**
* Return browse for node selection view limited to allowed classes
*/
return eZContentBrowse::browse(array('action_name' => 'BCImageAliasCreateAliasesAddNode', 'from_page' => '/bcimagealias/create', 'class_array' => $allowedClasses, 'persistent_data' => array('ParametersSerialized' => serialize($parameters))), $module);
}