Exemple #1
0
<?php

/**
 * List all existing operations (optionally, in a given module)
 * @author G. Giunta
 * @copyright (C) G. Giunta 2010-2016
 * @license Licensed under GNU General Public License v2.0. See file license.txt
 *
 */
// generic info for all views: module name, extension name, ...
$operationList = array();
$modules = eZModuleLister::getModuleList();
if ($Params['modulename'] != '' && !array_key_exists($Params['modulename'], $modules)) {
    /// @todo
} else {
    foreach ($modules as $modulename => $path) {
        if ($Params['modulename'] == '' || $Params['modulename'] == $modulename) {
            $module = eZModule::exists($modulename);
            if ($module instanceof eZModule) {
                $moduleOperationInfo = new eZModuleOperationInfo($modulename);
                /// @todo prevent warning to be generated here
                $moduleOperationInfo->loadDefinition();
                if ($moduleOperationInfo->isValid()) {
                    $extension = '';
                    if (preg_match('#extension/([^/]+)/modules/#', $path, $matches)) {
                        $extension = $matches[1];
                    }
                    foreach ($moduleOperationInfo->OperationList as $op) {
                        $operationList[$op['name'] . '_' . $modulename] = $op;
                        $operationList[$op['name'] . '_' . $modulename]['module'] = $modulename;
                        $operationList[$op['name'] . '_' . $modulename]['extension'] = $extension;
Exemple #2
0
<?php

/**
 * List all existing tpl ops (optionally, in a given extension)
 *
 * @author G. Giunta
 * @copyright (C) G. Giunta 2014-2016
 * @license Licensed under GNU General Public License v2.0. See file license.txt
 *
 */
// generic info for all views: module name, extension name, ...
$operatorList = array();
$extensions = eZModuleLister::getModuleList();
// ...
if ($Params['extensionname'] != '' && !array_key_exists($Params['extensionname'], $extensions)) {
    /// @todo
} else {
    $classes = sysInfoTools::autoloadClasses();
    $tpl = sysInfoTools::eZTemplateFactory();
    foreach ($tpl->Operators as $opName => $operatorDef) {
        if (!isset($operatorDef['class'])) {
            // cheating
            $operatorDef['script'] = 'kernel/common/eztemplateautoload.php';
            $operatorDef['class'] = '';
        } else {
            // load real path from class name
            $operatorDef['script'] = $classes[$operatorDef['class']];
        }
        if ($Params['extensionname'] == '' || strpos($operatorDef['script'], 'extension/' . $Params['extensionname'] . '/') === 0) {
            $extension = '';
            if (preg_match('#^extension/([^/]+)/#', $operatorDef['script'], $matches)) {