本文整理汇总了PHP中eZContentClass::classIdentifierByID方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClass::classIdentifierByID方法的具体用法?PHP eZContentClass::classIdentifierByID怎么用?PHP eZContentClass::classIdentifierByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClass
的用法示例。
在下文中一共展示了eZContentClass::classIdentifierByID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClassConstraintListAsArray
function getClassConstraintListAsArray($class_identifier = false, $contentclass_id = false, $debug = false)
{
//todo debug
if (!$contentclass_id && !$class_identifier) {
return;
}
if ($contentclass_id && $class_identifier) {
return;
}
$ezobjectrelationlist = eZContentClassAttribute::fetchFilteredList(array('data_type_string' => 'ezobjectrelationlist'));
$return = array();
if ($contentclass_id) {
foreach ($ezobjectrelationlist as $attribute) {
if ($attribute->attribute('contentclass_id') == $contentclass_id) {
$attributeContent = $attribute->content();
if (!empty($attributeContent['class_constraint_list'])) {
$return = array_merge($return, $attributeContent['class_constraint_list']);
}
}
}
if (!empty($return)) {
return $return;
} else {
return false;
}
}
if ($class_identifier) {
foreach ($ezobjectrelationlist as $attribute) {
$attributeContent = $attribute->content();
if (!empty($attributeContent['class_constraint_list'])) {
if (in_array($class_identifier, $attributeContent['class_constraint_list'])) {
$class = eZContentClass::fetch($attribute->attribute('contentclass_id'));
$classIdentifier = eZContentClass::classIdentifierByID($attribute->attribute('contentclass_id'));
$return[$classIdentifier][] = array('class_id' => $attribute->attribute('contentclass_id'), 'class_name' => $class->attribute('name'), 'attribute_identifier' => $attribute->attribute('identifier'), 'attribute_name' => $attribute->attribute('name'), 'class_constraint_list' => $attributeContent['class_constraint_list'], 'search_filter' => $classIdentifier . '/' . $attribute->attribute('identifier') . '/main_node_id');
}
}
}
//eZDebug::writeNotice( $return, __METHOD__ );
if (!empty($return)) {
return $return;
} else {
return false;
}
}
return false;
}
示例2: versionHistoryLimit
/**
* Computes the version history limit for a content class
*
* @param mixed $class
* Content class ID, content class identifier or content class object
* @return int
* @since 4.2
*/
public static function versionHistoryLimit($class)
{
// default version limit
$contentINI = eZINI::instance('content.ini');
$versionLimit = $contentINI->variable('VersionManagement', 'DefaultVersionHistoryLimit');
// version limit can't be < 2
if ($versionLimit < 2) {
eZDebug::writeWarning("Global version history limit must be equal to or higher than 2", __METHOD__);
$versionLimit = 2;
}
// we need to take $class down to a class ID
if (is_numeric($class)) {
if (!eZContentClass::classIdentifierByID($class)) {
eZDebug::writeWarning("class integer parameter doesn't match any content class ID", __METHOD__);
return $versionLimit;
}
$classID = (int) $class;
} elseif (is_string($class)) {
$classID = eZContentClass::classIDByIdentifier($class);
if (!$classID) {
eZDebug::writeWarning("class string parameter doesn't match any content class identifier", __METHOD__);
return $versionLimit;
}
} elseif (is_object($class)) {
if (!$class instanceof eZContentClass) {
eZDebug::writeWarning("class object parameter is not an eZContentClass", __METHOD__);
return $versionLimit;
} else {
$classID = $class->attribute('id');
}
}
$classLimitSetting = $contentINI->variable('VersionManagement', 'VersionHistoryClass');
$classArray = array_keys($classLimitSetting);
$limitsArray = array_values($classLimitSetting);
$classArray = eZContentClass::classIDByIdentifier($classArray);
foreach ($classArray as $index => $id) {
if ($id == $classID) {
$limit = $limitsArray[$index];
// version limit can't be < 2
if ($limit < 2) {
$classIdentifier = eZContentClass::classIdentifierByID($classID);
eZDebug::writeWarning("Version history limit for class {$classIdentifier} must be equal to or higher than 2", __METHOD__);
$limit = 2;
}
$versionLimit = $limit;
}
}
return $versionLimit;
}
示例3:
// MA 02110-1301, USA.
$http = eZHTTPTool::instance();
$listIni = eZINI::instance('lists.ini');
$Module = $Params["Module"];
$hasPost = false;
$ajax = false;
$classIdentifier = '';
if (isset($Params['classIdentifier'])) {
$classIdentifier = $Params['classIdentifier'];
}
if ($http->hasPostVariable('classIdentifier')) {
$classIdentifier = $http->postVariable('classIdentifier');
$hasPost = true;
}
if (is_numeric($classIdentifier)) {
$classIdentifier = eZContentClass::classIdentifierByID($classIdentifier);
}
$sortMethod = $listIni->variable('ListSettings', 'DefaultSortMethod');
if (isset($Params['sortMethod'])) {
$sortMethod = $Params['sortMethod'];
}
if ($http->hasPostVariable('sortMethod')) {
$sortMethod = $http->postVariable('sortMethod');
$hasPost = true;
}
$sortOrder = $listIni->variable('ListSettings', 'DefaultSortOrder');
if (isset($Params['sortOrder'])) {
$sortOrder = $Params['sortOrder'];
}
if ($http->hasPostVariable('sortOrder')) {
$sortOrder = $http->postVariable('sortOrder');
示例4: contentClassIdentifier
/**
* Returns the content class identifer for the current content object
*
* The object will cache the class name information so multiple calls will be fast.
*
* @return string|bool|null
*/
function contentClassIdentifier()
{
if ( !is_numeric( $this->ClassID ) )
{
$retValue = null;
return $retValue;
}
if ( $this->ClassIdentifier !== false )
return $this->ClassIdentifier;
$this->ClassIdentifier = eZContentClass::classIdentifierByID( $this->ClassID );
return $this->ClassIdentifier;
}
示例5: check
/**
* Checks for integrity all object attributes of a given datatype. Or for a single attribute of one class.
* The rules applied for each datatype depend on ini settings.
* The datatype to check is set via loadDatatypeChecks()
*
* @param string $type datatype name or classidentifier/attributeidentifier
* @param bool $also_unpublished
* @return array
* @throws Exception
*/
public function check($type, $also_unpublished = false)
{
$classIdentifierFilter = null;
$attributeIdentifierFilter = null;
if ($this->isAttributeDefinition($type)) {
list($classIdentifierFilter, $attributeIdentifierFilter) = $this->parseAttributeDefinition($type);
$type = $this->datatypeByAttributeDefinition($type);
}
if (!isset($this->checkerClasses[$type])) {
$this->loadDatatypeChecksforType($type);
}
$warnings = array();
// Loop over all class attributes using the datatype:
$classAttributes = eZContentClassAttribute::fetchList(true, array('version' => eZContentClass::VERSION_STATUS_DEFINED, 'data_type' => $type));
$db = eZDB::instance();
foreach ($classAttributes as $classAttribute) {
$classIdentifier = eZContentClass::classIdentifierByID($classAttribute->attribute('contentclass_id'));
$attributeIdentifier = $classAttribute->attribute('identifier');
if ($classIdentifierFilter !== null && $classIdentifier !== $classIdentifierFilter || $attributeIdentifierFilter !== null && $attributeIdentifier !== $attributeIdentifierFilter) {
continue;
}
$this->output("Checking attribute '{$attributeIdentifier}' in class '{$classIdentifier}'...");
// the checkers get initialized once per class attribute
$checkers = array();
foreach ($this->checkerClasses[$type] as $key => $checkerClass) {
$checkers[$key] = call_user_func_array(array($checkerClass, 'instance'), array($classAttribute));
}
$offset = 0;
$total = 0;
do {
$tables = 'ezcontentobject_attribute';
$where = 'contentclassattribute_id = ' . $classAttribute->attribute('id');
if (!$also_unpublished) {
$tables .= ', ezcontentobject';
$where .= ' AND ezcontentobject.id = ezcontentobject_attribute.contentobject_id' . ' AND ezcontentobject.current_version = ezcontentobject_attribute.version' . ' AND ezcontentobject.status = 1';
}
$query = "SELECT ezcontentobject_attribute.* " . "FROM {$tables} " . "WHERE {$where}";
$rows = $db->arrayQuery($query, array('offset' => $offset, 'limit' => $this->limit));
if ($rows === false) {
throw new Exception("DB Error, something is deeply wrong here");
}
foreach ($rows as $row) {
foreach ($checkers as $checker) {
$problems = $checker->checkObjectAttribute($row);
if (count($problems)) {
$warnings = array_merge($warnings, $problems);
}
}
}
$offset += $this->limit;
$total += count($rows);
} while (count($rows) > 0);
$this->output("Checked {$total} object attributes");
}
return $warnings;
}
示例6: switch
if ($attribute->attribute('data_type_string') === 'ezpage') {
$page = $attribute->content();
$ini = eZINI::instance('zone.ini');
$zoneName = $ini->variable($page->attribute('zone_layout'), 'ZoneName');
break;
}
}
}
if ($http->hasPostVariable('node_id')) {
$nodeToAdd = eZContentObjectTreeNode::fetch($http->postVariable('node_id'));
$objectToAdd = null;
if ($nodeToAdd instanceof eZContentObjectTreeNode) {
$objectToAdd = $nodeToAdd->object();
}
if ($objectToAdd instanceof eZContentObject) {
$classIdentifier = eZContentClass::classIdentifierByID($objectToAdd->attribute('contentclass_id'));
}
}
switch ($http->postVariable('content')) {
case 'frontpage':
if ($page instanceof eZPage) {
foreach ($page->attribute('zones') as $index => $zone) {
$identifier = $zone->attribute('zone_identifier');
$res[] = array('index' => $index, 'id' => $zone->attribute('id'), 'name' => $zoneName[$identifier], 'zone_identifier' => $identifier);
}
}
break;
case 'zone':
$blockINI = eZINI::instance('block.ini');
if ($http->hasPostVariable('zone')) {
$zoneID = $http->postVariable('zone');