Exemple #1
0
if (isset($Params["ClassID"])) {
    $ClassID = $Params["ClassID"];
}
$ClassVersion = null;
if (!is_numeric($ClassID)) {
    return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
$class = eZContentClass::fetch($ClassID, true, eZContentClass::VERSION_STATUS_DEFINED);
if (!$class) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if (!$LanguageCode) {
    $LanguageCode = $class->attribute('top_priority_language_locale');
}
if ($http->hasPostVariable('AddGroupButton') && $http->hasPostVariable('ContentClass_group')) {
    eZClassFunctions::addGroup($ClassID, $ClassVersion, $http->postVariable('ContentClass_group'));
}
if ($http->hasPostVariable('RemoveGroupButton') && $http->hasPostVariable('group_id_checked')) {
    if (!eZClassFunctions::removeGroup($ClassID, $ClassVersion, $http->postVariable('group_id_checked'))) {
        $validation['groups'][] = array('text' => ezpI18n::tr('kernel/class', 'You have to have at least one group that the class belongs to!'));
        $validation['processed'] = true;
    }
}
$attributes = $class->fetchAttributes();
$datatypes = eZDataType::registeredDataTypes();
$mainGroupID = false;
$mainGroupName = false;
$groupList = $class->fetchGroupList();
if (count($groupList) > 0) {
    $mainGroupID = $groupList[0]->attribute('group_id');
    $mainGroupName = $groupList[0]->attribute('group_name');