/**
  * Main function of the module. Write the content to $this->content.
  *
  * @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
     $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $access = is_array($this->pageinfo);
     // Checking access:
     if ($this->id && $access || $backendUser->isAdmin()) {
         // Render content:
         $this->moduleContent();
     } else {
         // If no access or if ID == zero
         $this->content .= $this->doc->header($language->getLL('statistic'));
     }
     $docHeaderButtons = $this->getHeaderButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content);
     $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']));
     // put it all together
     $this->content = $this->doc->startPage($language->getLL('statistic'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 /**
  * Main method.
  *
  * @return void
  */
 public function main()
 {
     $listUrl = GeneralUtility::getIndpEnv('REQUEST_URI');
     // Access check!
     // The page will show only if there is a valid page and if user may access it
     if ($this->id && (is_array($this->pageRow) ? 1 : 0)) {
         // JavaScript
         $this->doc->JScode = $this->doc->wrapScriptTags('
             script_ended = 0;
             function jumpToUrl(URL) {
                 document.location = URL;
             }
             function deleteRecord(table, id, url, warning) {
                 if (
                     confirm(eval(warning))
                 ) {
                     window.location.href = "' . $this->getBackPath() . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url);
                 }
                 return false;
             }
             ' . $this->doc->redirectUrls($listUrl) . '
         ');
         $this->doc->postCode = $this->doc->wrapScriptTags('
             script_ended = 1;
             if (top.fsMod) {
                 top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
             }
         ');
         $this->doc->inDocStylesArray['mod_systemdata'] = '';
         // Render content:
         $this->moduleContent();
     } else {
         $this->content = 'Access denied or commerce pages not created yet!';
     }
     $docHeaderButtons = $this->getHeaderButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content);
     $markers['FUNC_MENU'] = $this->doc->funcMenu('', BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']));
     // put it all together
     $this->content = $this->doc->startPage($this->getLanguageService()->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageRow, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Ejemplo n.º 3
0
    /**
     * Main function of the module. Write the content to $this->content
     * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
     * @return    [type]        ...
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        // Access check!
        // The page will show only if there is a valid page and if this page may be viewed by the user
        $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            $full_script_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/';
            $this->relative_site_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop');
            // first get the http-path to typo3:
            $this->httpTypo3Path = substr(substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'))), 0, -1);
            if (strlen($this->httpTypo3Path) == 1) {
                $this->httpTypo3Path = '/';
            } else {
                $this->httpTypo3Path .= '/';
            }
            // Get the vhost full path (example: /var/www/html/domain.com/public_html/my_cms/)
            $this->DOCUMENT_ROOT = PATH_site;
            // Get the vhost full path to multishop (example: /var/www/html/domain.com/public_html/my_cms/typo3conf/ext/multishop/)
            $this->DOCUMENT_ROOT_MS = PATH_site . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop');
            // Get the site full URL (example: http://domain.com/my_cms/)
            $this->FULL_HTTP_URL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
            // Get the multishop full URL (example: http://domain.com/my_cms/typo3/ext/multishop or http://domain.com/my_cms/typo3conf/ext/multishop)
            $this->FULL_HTTP_URL_MS = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop');
            // Get the host URL (example: http://domain.com)
            // dont use hostURL cause its not supporting subdirectory hosting
            $this->hostURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST');
            // Draw the header.
            $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
            //$this->doc->setModuleTemplate(ExtensionManagementUtility::extPath($this->extKey) . 'mod1/mod_template.html');
            $this->doc->backPath = $GLOBALS['BACK_PATH'];
            //$this->doc= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('bigDoc');
            //$this->doc->backPath=$BACK_PATH;
            // JavaScript
            $this->doc->JScode = '
							<style type="text/css"> 
							/*<![CDATA[*/
							<!-- 
							/*inDocStyles*/
							 
							 
							/*###POSTCSSMARKER###*/
							-->
							/*]]>*/
							.shadow_bottom {
							overflow:hidden;
							width:100%;
							background:url(' . $this->FULL_HTTP_URL_MS . 'mod1/images/shadow_bottom.png) left bottom no-repeat;
							padding:0 0 35px;
							}
							fieldset {
							display:block;
							border:1px solid #999;
							background:#fff;
							margin:10px 0 0;
							padding:10px 10px 10px;
							}
							fieldset legend {
							background:#585858;
							color:#fff;
							font-family:Verdana,Arial,Helvetica,sans-serif;
							font-size:11px;
							padding:2px 4px;
							}
							fieldset legend a
							{
								color:#fff;
							}
							fieldset legend a:hover
							{
								color:#fff;
								text-decoration:underline;
							}							 
							ul {
							list-style:none;
							margin:0;
							padding:0;
							}
							a.buttons, a.buttons_db {
							-moz-border-radius:1px 1px 1px 1px;
							BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button.png);
							background-color:#F6F6F6;
							background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #D5D5D5 90%);
							background-position:center bottom;
							background-repeat:repeat-x;
							border:1px solid #7C7C7C;
							color:#434343;
							display:block;
							padding:2px 4px;
							text-align:center;
							font-family:Verdana,Arial,Helvetica,sans-serif;
							font-size:11px;
							line-height:16px;
							}
							a.buttons:hover, a.buttons_db:hover {
							BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button-hover.png);
							background-color:#C8C8C8;
							background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #BDBCBC 90%);
							background-position:center bottom;
							background-repeat:repeat-x;
							border:1px solid #737F91;
							color:#1E1E1E;
							}
							a.buttons {
							width:142px;
							}
							a.buttons_db {
							width:126px;
							}
							fieldset.mod1MultishopFieldset ul { overflow:hidden; width:100%; }
							fieldset.mod1MultishopFieldset ul li { float:left; margin:0 10px 0 0; }							
							</style> 						
							<!--[if IE]>
							<style>
							fieldset {
							position: relative;
							padding-top:15px;
							margin:20px 0 0;
							}
							legend {
							position: absolute;
							top: -10px;
							left: 10px;
							}
							</style>
							<![endif]-->
							<script language="javascript" type="text/javascript">
								script_ended = 0;
								function jumpToUrl(URL)	{
									document.location = URL;
								}
								function CONFIRM(label)
								{
												if (confirm(label))
												{
													return true;
												}
												else
												{
													return false;
												}
								}												
							</script>
						';
            $this->doc->postCode = '
							<script language="javascript" type="text/javascript">
								script_ended = 1;
								if (top.fsMod) top.fsMod.recentIds["web"] = 0;
							</script>
						';
            $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50);
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])));
            $this->content .= $this->doc->divider(5);
            // Render content:
            $this->moduleContent();
            // ShortCut
            if ($BE_USER->mayMakeShortcut()) {
                $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']));
            }
            $this->content .= $this->doc->spacer(10);
        } else {
            // If no access or if ID == zero
            $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('mediumDoc');
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
Ejemplo n.º 4
0
    /**
     * Shows the copy wizard
     *
     * @param int $uidClip Uid of the clipped item
     * @param int $uidTarget Uid of target
     * @param string $command Command
     *
     * @return void
     */
    protected function showCopyWizard($uidClip, $uidTarget, $command)
    {
        $language = $this->getLanguageService();
        $str = '';
        $this->pageinfo = Tx_Commerce_Utility_BackendUtility::readCategoryAccess($uidTarget, Tx_Commerce_Utility_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 objects (if any)
        // for hooks which extend this function:
        $hookObjectsArr = array();
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/mod_cce/class.tx_commerce_cce_db.php']['copyWizardClass'])) {
            \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('
				hook
				$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/mod_cce/class.tx_commerce_cce_db.php\'][\'copyWizardClass\']
				is deprecated since commerce 1.0.0, it will be removed in commerce 1.4.0, please use instead
				$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/Classes/Utility/DataHandlerUtility.php\'][\'copyWizard\']
			');
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/mod_cce/class.tx_commerce_cce_db.php']['copyWizardClass'] as $classRef) {
                $hookObjectsArr[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
            }
        }
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Utility/DataHandlerUtility.php']['copyWizard'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Utility/DataHandlerUtility.php']['copyWizard'] as $classRef) {
                $hookObjectsArr[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
            }
        }
        switch ($command) {
            case 'overwrite':
                // pass through
            // pass through
            case 'pasteProduct':
                // chose local to copy from product
                /**
                 * Product
                 *
                 * @var Tx_Commerce_Domain_Model_Product $product
                 */
                $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $uidClip);
                $product->loadData();
                $prods = $product->getL18nProducts();
                if (count($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->doc->backPath . '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 Tx_Commerce_Tree_Leaf_ProductData $treedb
                     */
                    $treedb = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ProductData');
                    $treedb->init();
                    $records = $treedb->getRecordsDbList($uidTarget);
                }
                $l = count($records['pid'][$uidTarget]);
                // Hook: beforeFormClose
                $userIgnoreClose = FALSE;
                foreach ($hookObjectsArr 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 && (0 != count($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' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />';
                    $prodIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getIconImage('tx_commerce_products', array('uid' => $uidTarget), $this->doc->backPath, '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 Tx_Commerce_Domain_Model_Category $category
                 */
                $category = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Category', $uidClip);
                $category->loadData();
                $cats = $category->getL18nCategories();
                if (0 != count($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->doc->backPath . '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 Tx_Commerce_Tree_Leaf_CategoryData $treedb
                 */
                $treedb = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_CategoryData');
                $treedb->init();
                $records = $treedb->getRecordsDbList($uidTarget);
                $l = count($records['pid'][$uidTarget]);
                // Hook: beforeFormClose
                $userIgnoreClose = FALSE;
                foreach ($hookObjectsArr as $hookObj) {
                    if (method_exists($hookObj, 'beforeFormClose')) {
                        $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose);
                    }
                }
                if (0 == $l && (0 != count($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' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />';
                    $catIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getIconImage('tx_commerce_categories', array('uid' => $uidTarget), $this->doc->backPath, '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 ($hookObjectsArr 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();
    }
Ejemplo n.º 5
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();
    }