public function storeParameters($data)
 {
     if (OCClassExtraParametersManager::currentUserCanEditHandlers($this->getIdentifier())) {
         $classData = isset($data['class']) ? $data['class'] : array();
         $attributesData = isset($data['class_attribute']) ? $data['class_attribute'] : array();
         OCClassExtraParameters::removeByHandlerAndClassIdentifier($this->getIdentifier(), $this->class->Identifier);
         foreach ($classData as $classIdentifier => $values) {
             foreach ($values as $key => $value) {
                 $row = array('class_identifier' => $classIdentifier, 'attribute_identifier' => '*', 'handler' => $this->getIdentifier(), 'key' => $key, 'value' => $value);
                 $parameter = new OCClassExtraParameters($row);
                 $parameter->store();
             }
         }
         foreach ($attributesData as $classIdentifier => $attributesValues) {
             foreach ($attributesValues as $attributeIdentifier => $values) {
                 foreach ($values as $key => $value) {
                     $row = array('class_identifier' => $classIdentifier, 'attribute_identifier' => $attributeIdentifier, 'handler' => $this->getIdentifier(), 'key' => $key, 'value' => $value);
                     $parameter = new OCClassExtraParameters($row);
                     $parameter->store();
                 }
             }
         }
         $this->loadParameters(true);
     }
 }
 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'class_extra_parameters':
             $classIdentifier = $namedParameters['class_identifier'];
             $handler = $namedParameters['handler'];
             $class = eZContentClass::fetchByIdentifier($classIdentifier);
             if ($class instanceof eZContentClass) {
                 $extraParametersManager = OCClassExtraParametersManager::instance($class);
                 if (is_string($handler)) {
                     $operatorValue = $extraParametersManager->getHandler($handler);
                 } else {
                     $operatorValue = $extraParametersManager->getHandlers();
                 }
             }
             break;
     }
 }
Ejemplo n.º 3
0
            $categorys = $contentINI->variable('ClassAttributeSettings', 'CategoryList');
            $defaultCategory = $contentINI->variable('ClassAttributeSettings', 'DefaultCategory');
            foreach ($class->dataMap() as $classAttribute) {
                $attributeCategory = $classAttribute->attribute('category');
                $attributeIdentifier = $classAttribute->attribute('identifier');
                if (!isset($categorys[$attributeCategory]) || !$attributeCategory) {
                    $attributeCategory = $defaultCategory;
                }
                if (!isset($groupedDataMap[$attributeCategory])) {
                    $groupedDataMap[$attributeCategory] = array();
                }
                $groupedDataMap[$attributeCategory][$attributeIdentifier] = $classAttribute;
            }
            return $groupedDataMap;
        }
        $tpl->setVariable('attributes_grouped', createGroupedDataMap($class));
        $extraParametersManager = OCClassExtraParametersManager::instance($class);
        $handlers = OCClassExtraParametersManager::currentUserCanEditHandlers() ? $extraParametersManager->getHandlers() : array();
        $tpl->setVariable('extra_handlers', $handlers);
    }
}
$Result = array();
$Result['content'] = $tpl->fetch('design:classtools/classes.tpl');
$Result['node_id'] = 0;
$contentInfoArray = array('url_alias' => 'classtools/classes', 'class_identifier' => null);
$contentInfoArray['persistent_variable'] = array('show_path' => true);
$Result['content_info'] = $contentInfoArray;
$Result['path'] = array(array('text' => 'Informazioni e utilità per le classi', 'url' => 'classtools/classes', 'node_id' => null));
if ($class instanceof eZContentClass) {
    $Result['path'][] = array('text' => $class->attribute('name'), 'url' => false, 'node_id' => null);
}
Ejemplo n.º 4
0
if ($http->hasPostVariable('handler') && $http->hasPostVariable('class')) {
    $module->redirectTo('classtools/extra/' . $http->postVariable('class') . '/' . $http->postVariable('handler'));
}
if ($classIdentifier) {
    $class = eZContentClass::fetchByIdentifier($classIdentifier);
    if ($class instanceof eZContentClass) {
        $extraParametersManager = OCClassExtraParametersManager::instance($class);
        $handlers = OCClassExtraParametersManager::currentUserCanEditHandlers() ? $extraParametersManager->getHandlers() : array();
        $tpl->setVariable('extra_handlers', $handlers);
        if (!$handlerIdentifier) {
            $firstHandler = array_shift($handlers);
            $handlerIdentifier = $firstHandler->getIdentifier();
            $handlers = array_unshift($handlers, $firstHandler);
        }
        $handler = $extraParametersManager->getHandler($handlerIdentifier);
        if ($handlerIdentifier && OCClassExtraParametersManager::currentUserCanEditHandlers() && $handler instanceof OCClassExtraParametersHandlerInterface) {
            $tpl->setVariable('class', $class);
            if ($http->hasVariable('StoreExtraParameters')) {
                if ($http->hasVariable('extra_handler_' . $handlerIdentifier)) {
                    $data = $http->variable('extra_handler_' . $handlerIdentifier);
                    $handler->storeParameters($data);
                }
                $module->redirectTo('classtools/extra/' . $classIdentifier . '/' . $handlerIdentifier);
            }
            $tpl->setVariable('handler', $handler);
            $Result = array();
            $Result['content'] = $tpl->fetch('design:classtools/extra.tpl');
            $Result['node_id'] = 0;
            $contentInfoArray = array('url_alias' => 'classtools/classes', 'class_identifier' => null);
            $contentInfoArray['persistent_variable'] = array('show_path' => true);
            $Result['content_info'] = $contentInfoArray;