/**
     * Main function, starting the rendering of the list.
     *
     * @return void
     */
    public function main()
    {
        $language = $this->getLanguageService();
        $newRecordIcon = '';
        // Link for creating new records:
        if (!$this->modTSconfig['properties']['noCreateRecordsLink']) {
            $controls = array('category' => array('dataClass' => 'CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryData', 'parent' => 'parent_category'), 'product' => array('dataClass' => 'CommerceTeam\\Commerce\\Tree\\Leaf\\ProductData', 'parent' => 'categories'));
            $newRecordLink = $this->scriptNewWizard . '?id=' . (int) $this->id;
            foreach ($controls as $controlData) {
                /**
                 * Tree data.
                 *
                 * @var \CommerceTeam\Commerce\Tree\Leaf\Data $treeData
                 */
                $treeData = GeneralUtility::makeInstance($controlData['dataClass']);
                $treeData->init();
                if ($treeData->getTable()) {
                    $newRecordLink .= '&edit[' . $treeData->getTable() . '][-' . $this->categoryUid . ']=new';
                    $newRecordLink .= '&defVals[' . $treeData->getTable() . '][' . $controlData['parent'] . ']=' . $this->categoryUid;
                }
            }
            $newRecordIcon = '
                <!--
                    Link for creating a new record:
                -->
                <a href="' . htmlspecialchars($newRecordLink . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . IconUtility::getSpriteIcon('actions-document-new', array('title' => $language->getLL('editPage', 1))) . '</a>';
        }
        // Access check...
        // The page will show only if there is a valid page
        // and if this page may be viewed by the user
        if ($this->categoryUid) {
            $this->pageinfo = \CommerceTeam\Commerce\Utility\BackendUtility::readCategoryAccess($this->categoryUid, $this->perms_clause);
        } else {
            $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->getBackendUser()->getPagePermsClause(1));
        }
        $access = is_array($this->pageinfo);
        // Apply predefined values for hidden checkboxes
        // Set predefined value for DisplayBigControlPanel:
        if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') {
            $this->MOD_SETTINGS['bigControlPanel'] = true;
        } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') {
            $this->MOD_SETTINGS['bigControlPanel'] = false;
        }
        // Set predefined value for Clipboard:
        if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') {
            $this->MOD_SETTINGS['clipBoard'] = true;
        } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') {
            $this->MOD_SETTINGS['clipBoard'] = false;
        }
        // Set predefined value for LocalizationView:
        if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') {
            $this->MOD_SETTINGS['localization'] = true;
        } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') {
            $this->MOD_SETTINGS['localization'] = false;
        }
        // Initialize the dblist object:
        /**
         * Category record list.
         *
         * @var \CommerceTeam\Commerce\ViewHelpers\CategoryRecordList $dbList
         */
        $dbList = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\ViewHelpers\\CategoryRecordList');
        $dbList->backPath = $this->getBackPath();
        $dbList->script = BackendUtility::getModuleUrl('commerce_category', array(), '');
        /**
         * Backend utility.
         *
         * @var \CommerceTeam\Commerce\Utility\BackendUserUtility $utility
         */
        $utility = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Utility\\BackendUserUtility');
        $dbList->calcPerms = $utility->calcPerms((array) BackendUtility::getRecord('tx_commerce_categories', $this->categoryUid));
        $dbList->thumbs = $this->getBackendUser()->uc['thumbnailsByDefault'];
        $dbList->returnUrl = $this->returnUrl;
        $dbList->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0;
        $dbList->localizationView = $this->MOD_SETTINGS['localization'];
        $dbList->showClipboard = 1;
        $dbList->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
        $dbList->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
        $dbList->hideTables = $this->modTSconfig['properties']['hideTables'];
        $dbList->hideTranslations = $this->modTSconfig['properties']['hideTranslations'];
        $dbList->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
        $dbList->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0;
        $dbList->allowedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], true);
        $dbList->deniedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], true);
        $dbList->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
        $dbList->pageRow = $this->pageinfo;
        ++$dbList->counter;
        $dbList->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
        $dbList->modTSconfig = $this->modTSconfig;
        $clickTitleMode = trim($this->modTSconfig['properties']['clickTitleMode']);
        $dbList->clickTitleMode = $clickTitleMode === '' ? 'edit' : $clickTitleMode;
        $dbList->newRecordIcon = $newRecordIcon;
        $dbList->parentUid = $this->categoryUid;
        $dbList->tableList = 'tx_commerce_categories,tx_commerce_products';
        // Clipboard is initialized:
        // Start clipboard
        /**
         * Clipboard.
         *
         * @var \TYPO3\CMS\Backend\Clipboard\Clipboard $clipObj
         */
        $clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
        $dbList->clipObj = $clipObj;
        // Initialize - reads the clipboard content from the user session
        $dbList->clipObj->initializeClipboard();
        // Clipboard actions are handled:
        // CB is the clipboard command array
        $clipboard = GeneralUtility::_GET('CB');
        if ($this->cmd == 'setCB') {
            // CBH is all the fields selected for the clipboard, CBC is the checkbox fields
            // which were checked. By merging we get a full array of checked/unchecked
            // elements This is set to the 'el' array of the CB after being parsed so only
            // the table in question is registered.
            $clipboard['el'] = $dbList->clipObj->cleanUpCBC(array_merge((array) GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), $this->cmd_table);
        }
        if (!$this->MOD_SETTINGS['clipBoard']) {
            // If the clipboard is NOT shown, set the pad to 'normal'.
            $clipboard['setP'] = 'normal';
        }
        // Execute commands.
        $dbList->clipObj->setCmd($clipboard);
        // Clean up pad
        $dbList->clipObj->cleanCurrent();
        // Save the clipboard content
        $dbList->clipObj->endClipboard();
        // This flag will prevent the clipboard panel in being shown.
        // It is set, the clickmenu-layer is active AND the extended
        // view is not enabled.
        $dbList->dontShowClipControlPanels = !$this->MOD_SETTINGS['bigControlPanel'] && $dbList->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
        if ($access || $this->id === 0 && $this->search_levels > 0 && strlen($this->search_field) > 0) {
            // Deleting records...:
            // Has not to do with the clipboard but is simply the delete action. The
            // clipboard object is used to clean up the submitted entries to only the
            // selected table.
            if ($this->cmd == 'delete') {
                $items = $dbList->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), $this->cmd_table, 1);
                if (!empty($items)) {
                    $cmd = array();
                    foreach ($items as $iK => $_) {
                        $iKparts = explode('|', $iK);
                        $cmd[$iKparts[0]][$iKparts[1]]['delete'] = 1;
                    }
                    /**
                     * Data handler.
                     *
                     * @var \TYPO3\CMS\Core\DataHandling\DataHandler $tce
                     */
                    $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                    $tce->stripslashes_values = 0;
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    if (isset($cmd['pages'])) {
                        BackendUtility::setUpdateSignal('updateFolderTree');
                    }
                    $tce->printLogErrorMessages(GeneralUtility::getIndpEnv('REQUEST_URI'));
                }
            }
            // Initialize the listing object, dblist, for rendering the list:
            $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
            $dbList->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
            $dbList->setDispFields();
            $dbList->perms_clause = $this->perms_clause;
            // Render versioning selector:
            if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) {
                $dbList->HTMLcode .= $this->doc->getVersionSelector($this->id);
            }
            $dbList->parentUid = $this->categoryUid;
            // Render the list of tables:
            $dbList->generateList();
            $listUrl = $dbList->listURL();
            // Add JavaScript functions to the page:
            $this->doc->JScode = $this->doc->wrapScriptTags('
                function jumpExt(URL, anchor) {
                    var anc = anchor ? anchor : "";
                    window.location.href = URL + (T3_THIS_LOCATION ? "&returnUrl=" + T3_THIS_LOCATION : "") + anc;
                    return false;
                }
                function jumpSelf(URL) {
                    window.location.href = URL + (T3_RETURN_URL ? "&returnUrl=" + T3_RETURN_URL : "");
                    return false;
                }

                function setHighlight(id) {
                    top.fsMod.recentIds["web"] = id;
                    top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

                    if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
                        top.content.nav_frame.refresh_nav();
                    }
                }
                ' . $this->doc->redirectUrls($listUrl) . '
                ' . $dbList->CBfunctions() . '
                function editRecords(table,idList,addParams,CBflag) {
                    window.location.href="' . $this->getBackPath() . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
                }
                function editList(table, idList) {
                    var list = "";

                    // Checking how many is checked, how many is not
                    var pointer = 0;
                    var pos = idList.indexOf(",");
                    while (pos != -1) {
                        if (cbValue(table + "|" + idList.substr(pointer, pos-pointer))) {
                            list += idList.substr(pointer, pos-pointer) + ",";
                        }
                        pointer = pos + 1;
                        pos = idList.indexOf(",", pointer);
                    }
                    if (cbValue(table + "|" + idList.substr(pointer))) {
                        list += idList.substr(pointer) + ",";
                    }

                    return list ? list : idList;
                }

                if (top.fsMod) {
                    top.fsMod.recentIds["web"] = ' . $this->id . ';
                    top.fsMod.recentIds["commerce"] = ' . $this->categoryUid . ';
                }
            ');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
        }
        // access
        // Begin to compile the whole page, starting out with page header:
        $this->body = $this->doc->header($this->pageinfo['title']);
        $this->body .= '<form action="' . htmlspecialchars($dbList->listURL()) . '" method="post" name="dblistForm">';
        $this->body .= $dbList->HTMLcode;
        $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
        // If a listing was produced, create the page footer with search form etc:
        if ($dbList->HTMLcode) {
            // Making field select box (when extended view for a single table is enabled):
            if ($dbList->table) {
                $this->body .= $dbList->fieldSelectBox($dbList->table);
            }
            // Adding checkbox options for extended listing and clipboard display:
            $this->body .= '

                    <!--
                        Listing options for extended view, clipboard and localization view
                    -->
                    <div id="typo3-listOptions">
                        <form action="" method="post">';
            $functionParameter = array('id' => $this->id);
            if ($this->categoryUid) {
                $functionParameter['control[tx_commerce_categories][uid]'] = $this->categoryUid;
            }
            // Add "display bigControlPanel" checkbox:
            if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') {
                $this->body .= BackendUtility::getFuncCheck($functionParameter, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"');
                $this->body .= '<label for="checkLargeControl">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $language->getLL('largeControl', true)) . '</label><br />';
            }
            // Add "clipboard" checkbox:
            if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable' && $dbList->showClipboard) {
                $this->body .= BackendUtility::getFuncCheck($functionParameter, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"');
                $this->body .= '<label for="checkShowClipBoard">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $language->getLL('showClipBoard', true)) . '</label><br />';
            }
            // Add "localization view" checkbox:
            if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') {
                $this->body .= BackendUtility::getFuncCheck($functionParameter, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"');
                $this->body .= '<label for="checkLocalization">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $language->getLL('localization', true)) . '</label><br />';
            }
            $this->body .= '
                        </form>
                    </div>';
        }
        // Printing clipboard if enabled
        if ($this->MOD_SETTINGS['clipBoard'] && $dbList->showClipboard && ($dbList->HTMLcode || $dbList->clipObj->hasElements())) {
            $this->body .= '<div class="db_list-dashboard">' . $dbList->clipObj->printClipboard() . '</div>';
        }
        // Search box:
        if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dbList->HTMLcode || $dbList->searchString !== '')) {
            $sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $language->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', true));
            $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dbList->getSearchBox(), false, true, false, true) . '</div>';
        }
        // Additional footer content
        $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook'];
        if (is_array($footerContentHook)) {
            foreach ($footerContentHook as $hook) {
                $params = array();
                $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
            }
        }
        $docHeaderButtons = $dbList->getButtons($this->pageinfo);
        if (!$this->categoryUid) {
            $docHeaderButtons['edit'] = '';
        }
        $categoryInfo = $this->categoryUid ? $this->getCategoryInfo($this->pageinfo) : $this->getPageInfo($this->pageinfo);
        $categoryPath = $this->categoryUid ? $this->getCategoryPath($this->pageinfo) : $this->getPagePath($this->pageinfo);
        $markers = array('CSH' => $docHeaderButtons['csh'], 'CATPATH' => $categoryPath, 'CATINFO' => $categoryInfo, 'CONTENT' => $this->body, 'EXTRACONTAINERCLASS' => $this->table ? 'singletable' : '');
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render('DB list', $this->content);
    }
 /**
  * Main function, creating the content for the access editing forms/listings.
  *
  * @return void
  */
 public function main()
 {
     $backendUser = $this->getBackendUser();
     $language = $this->getLanguageService();
     // Access check...
     // The page will show only if there is a valid page and if this page
     // may be viewed by the user
     if ($this->categoryUid) {
         $this->pageinfo = \CommerceTeam\Commerce\Utility\BackendUtility::readCategoryAccess($this->categoryUid, $this->perms_clause);
     } else {
         $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     }
     $access = is_array($this->pageinfo);
     // Checking access:
     if ($this->categoryUid && $access || $backendUser->isAdmin() && !$this->categoryUid) {
         if ($backendUser->isAdmin() && !$this->categoryUid) {
             $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
         }
         // This decides if the editform (tceAction) can and will be drawn:
         $this->editingAllowed = $this->pageinfo['perms_userid'] == $backendUser->user['uid'] || $backendUser->isAdmin();
         $this->edit = $this->edit && $this->editingAllowed;
         // If $this->edit then these functions are called in the end of the page...
         if ($this->edit) {
             $uid = $this->categoryUid;
             $this->doc->postCode .= $this->doc->wrapScriptTags('
                 setCheck("check[perms_user]", "data[tx_commerce_categories][' . $uid . '][perms_user]");
                 setCheck("check[perms_group]", "data[tx_commerce_categories][' . $uid . '][perms_group]");
                 setCheck("check[perms_everybody]", "data[tx_commerce_categories][' . $uid . '][perms_everybody]");
             ');
         }
         // Draw the HTML page header.
         $this->content .= $this->doc->header($language->getLL('permissions') . ($this->edit ? ': ' . $language->getLL('Edit') : ''));
         $vContent = $this->doc->getVersionSelector($this->categoryUid, 1);
         if ($vContent) {
             $this->content .= $this->doc->section('', $vContent);
         }
         // Main function, branching out:
         if (!$this->edit) {
             $this->notEdit();
         } else {
             $this->doEdit();
         }
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']);
         $markers['CONTENT'] = $this->content;
         // Build the <body> for the module
         $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     } else {
         // If no access or if ID == zero
         $this->content .= $this->doc->header($language->getLL('permissions'));
     }
     // Renders the module page
     $this->content = $this->doc->render($language->getLL('permissions'), $this->content);
 }
Пример #3
0
    /**
     * Shows the copy wizard.
     *
     * @param int    $uidClip   Uid of the clipped item
     * @param int    $uidTarget Uid of target
     * @param string $command   Command
     */
    protected function showCopyWizard($uidClip, $uidTarget, $command)
    {
        $language = $this->getLanguageService();
        $str = '';
        $this->pageinfo = BackendUtility::readCategoryAccess($uidTarget, BackendUtility::getCategoryPermsClause(1));
        $str .= $this->doc->header($language->getLL('Copy'));
        $str .= $this->doc->spacer(5);
        // flag if neither sorting nor localizations
        // are existing and we can immediately copy
        $noActionReq = false;
        // First prepare user defined hooks
        $hooks = \CommerceTeam\Commerce\Factory\HookFactory::getHooks('Utility/DataHandlerUtility', 'showCopyWizard');
        switch ($command) {
            case 'overwrite':
                // pass through
            // pass through
            case 'pasteProduct':
                // chose local to copy from product
                /**
                 * Product.
                 *
                 * @var \CommerceTeam\Commerce\Domain\Model\Product $product
                 */
                $product = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Product', $uidClip);
                $product->loadData();
                $prods = $product->getL18nProducts();
                if (!empty($prods)) {
                    $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1>
                        <h2>' . $language->getLL('copy.product') . ': ' . $product->getTitle() . '</h2>
                        <ul>';
                    // walk the l18n and get the selector box
                    $l = count($prods);
                    for ($i = 0; $i < $l; ++$i) {
                        $tmpProd = $prods[$i];
                        $flag = $tmpProd['flag'] != '' ? '<img src="' . $this->getBackPath() . 'gfx/flags/' . $tmpProd['flag'] . '" alt="Flag" />' : '';
                        $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpProd['uid'] . '" value="' . $tmpProd['sys_language'] . '" /><label for="loc_' . $tmpProd['uid'] . '">' . $flag . $tmpProd['title'] . '</label></li>';
                    }
                    $str .= '</ul>';
                }
                $records = array();
                // chose sorting position
                if ($command != 'overwrite') {
                    // Initialize tree object:
                    /**
                     * Product data.
                     *
                     * @var \CommerceTeam\Commerce\Tree\Leaf\ProductData $productData
                     */
                    $productData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ProductData');
                    $productData->init();
                    $records = $productData->getRecordsDbList($uidTarget);
                }
                $l = count($records['pid'][$uidTarget]);
                // Hook: beforeFormClose
                $userIgnoreClose = false;
                foreach ($hooks as $hookObj) {
                    if (method_exists($hookObj, 'beforeFormClose')) {
                        // set $user_ignoreClose to true if you want to
                        // force the script to print out the execute button
                        $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose);
                    }
                }
                if (0 >= $l && (!empty($prods) || $userIgnoreClose)) {
                    // no child object - sorting position is irrelevant - just print a submit button
                    // and notify users that there are not products in the category yet
                    $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />';
                } elseif (0 < $l) {
                    // at least 1 item - offer choice
                    $icon = '<img' . IconUtility::skinImg($this->getBackPath(), 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />';
                    $prodIcon = '<img' . IconUtility::skinImg($this->getBackPath(), IconUtility::getIcon('tx_commerce_products', array('uid' => $uidTarget)), 'width="18" height="16"') . 'align="top" class="c-recIcon"/>';
                    $str .= '<h1>' . $language->getLL('copy.position') . '</h1>';
                    $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"';
                    $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />';
                    for ($i = 0; $i < $l; ++$i) {
                        $record = $records['pid'][$uidTarget][$i];
                        $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"';
                        $str .= '<span class="nobr">' . $prodIcon . $record['title'] . '</span><br />';
                        $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />';
                    }
                } else {
                    $noActionReq = true;
                }
                break;
            case 'pasteCategory':
                // chose locale to copy from category
                /**
                 * Category.
                 *
                 * @var \CommerceTeam\Commerce\Domain\Model\Category $category
                 */
                $category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $uidClip);
                $category->loadData();
                $cats = $category->getL18nCategories();
                if (!empty($cats)) {
                    $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1>
						<h2>' . $language->getLL('copy.category') . ': ' . $category->getTitle() . '</h2>
						<ul>';
                    // walk the l18n and get the selector box
                    $l = count($cats);
                    for ($i = 0; $i < $l; ++$i) {
                        $tmpCat = $cats[$i];
                        $flag = $tmpCat['flag'] != '' ? '<img src="' . $this->getBackPath() . 'gfx/flags/' . $tmpCat['flag'] . '" alt="Flag" />' : '';
                        $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpCat['uid'] . '" value="' . $tmpCat['sys_language'] . '" /><label for="loc_' . $tmpCat['uid'] . '">' . $flag . $tmpCat['title'] . '</label></li>';
                    }
                    $str .= '</ul>';
                }
                // chose sorting position
                // Initialize tree object:
                /**
                 * Category data.
                 *
                 * @var \CommerceTeam\Commerce\Tree\Leaf\CategoryData $categoryData
                 */
                $categoryData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryData');
                $categoryData->init();
                $records = $categoryData->getRecordsDbList($uidTarget);
                $l = count($records['pid'][$uidTarget]);
                // Hook: beforeFormClose
                $userIgnoreClose = false;
                foreach ($hooks as $hookObj) {
                    if (method_exists($hookObj, 'beforeFormClose')) {
                        $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose);
                    }
                }
                if ($l == 0 && (!empty($cats) || $userIgnoreClose)) {
                    // no child object - sorting position is irrelevant - just print a submit button
                    $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />';
                } elseif (0 < $l) {
                    // at least 1 item - offer choice
                    $icon = '<img' . IconUtility::skinImg($this->getBackPath(), 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />';
                    $catIcon = '<img' . IconUtility::skinImg($this->getBackPath(), IconUtility::getIcon('tx_commerce_categories', array('uid' => $uidTarget)), 'width="18" height="16"') . 'align="top" class="c-recIcon"/>';
                    $str .= '<h1>' . $language->getLL('copy.position') . '</h1>';
                    $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"';
                    $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />';
                    for ($i = 0; $i < $l; ++$i) {
                        $record = $records['pid'][$uidTarget][$i];
                        $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"';
                        $str .= '<span class="nobr">' . $catIcon . $record['title'] . '</span><br />
							<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />';
                    }
                } else {
                    $noActionReq = true;
                }
                break;
            default:
                die('unknown command');
        }
        // skip transforming and execute the command
        // if there are no locales and no positions
        if ($noActionReq) {
            $this->commitCommand($uidClip, $uidTarget, $command);
            return;
        }
        // Hook: beforeTransform
        foreach ($hooks as $hookObj) {
            if (method_exists($hookObj, 'beforeTransform')) {
                $str .= $hookObj->beforeTransform($uidClip, $uidTarget, $command);
            }
        }
        $this->content .= $str;
        $markers = array('CSH' => '', 'CONTENT' => $this->content, 'CATINFO' => '', 'CATPATH' => '');
        $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']));
        $this->content = $this->doc->startPage($language->getLL('Copy'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, array(), $markers);
        $this->content .= $this->doc->endPage();
    }