private function getTreeCode() { if (count($this->arrMigrateLangIds) === 1) { return true; } $jsSimilarPages = array(); $this->similarPages = $this->findSimilarPages(); foreach ($this->similarPages as $nodeId => $arrPageIds) { $jsSimilarPages[$nodeId] = array_values($arrPageIds); foreach ($this->arrMigrateLangIds as $migrateLangId) { if (!isset($arrPageIds[$migrateLangId])) { $this->similarPages[$nodeId][$migrateLangId] = 0; } } ksort($this->similarPages[$nodeId]); } $objCx = \ContrexxJavascript::getInstance(); $objCx->setVariable('similarPages', json_encode($jsSimilarPages), 'update/contentMigration'); $objTemplate = new \HTML_Template_Sigma(UPDATE_TPL); $objTemplate->setErrorHandling(PEAR_ERROR_DIE); $objTemplate->loadTemplateFile('page_grouping.html'); $groupedBorderWidth = count($this->arrMigrateLangIds) * 325 - 48; $objTemplate->setGlobalVariable(array('USERNAME' => $_SESSION['contrexx_update']['username'], 'PASSWORD' => $_SESSION['contrexx_update']['password'], 'CMS_VERSION' => $_SESSION['contrexx_update']['version'], 'MIGRATE_LANG_IDS' => $this->migrateLangIds, 'LANGUAGE_WRAPPER_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 330 . 'px;', 'GROUPED_SCROLL_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 325 . 'px;', 'GROUPED_BORDER_WIDTH' => 'width: ' . $groupedBorderWidth . 'px;')); $cl = \Env::get('ClassLoader'); $cl->loadFile(ASCMS_CORE_PATH . '/Tree.class.php'); $cl->loadFile(UPDATE_CORE . '/UpdateTree.class.php'); $pageRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $nodeRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node'); foreach ($this->arrMigrateLangIds as $lang) { $objContentTree = new \UpdateContentTree($lang); foreach ($objContentTree->getTree() as $arrPage) { $pageId = $arrPage['catid']; $nodeId = $arrPage['node_id']; $langId = $arrPage['lang']; $level = $arrPage['level']; $title = $arrPage['catname']; $sort = $nodeRepo->find($nodeId)->getLft(); $grouped = $this->isGrouppedPage($this->similarPages, $pageId) ? 'grouped' : ''; $objTemplate->setVariable(array('TITLE' => $title, 'ID' => $pageId, 'NODE' => $nodeId, 'LANG' => strtoupper(\FWLanguage::getLanguageCodeById($langId)), 'LEVEL' => $level + 1, 'SORT' => $sort, 'GROUPED' => $grouped, 'MARGIN' => 'margin-left: ' . $level * 15 . 'px;')); $objTemplate->parse('page'); } $langFull = \FWLanguage::getLanguageParameter($lang, 'name'); $langShort = strtoupper(\FWLanguage::getLanguageParameter($lang, 'lang')); $objTemplate->setVariable(array('LANG_FULL' => $langFull, 'LANG_SHORT' => $langShort)); $objTemplate->parse('language'); } $groupedBorderWidth -= 2; foreach ($this->similarPages as $nodeId => $arrPageIds) { $node = $nodeRepo->find($nodeId); $margin = ($node->getLvl() - 1) * 15; $nodeWidth = $groupedBorderWidth - $margin; $width = ($groupedBorderWidth - 10) / count($this->arrMigrateLangIds); $index = 0; $last = count($arrPageIds) - 1; foreach ($arrPageIds as $pageLangId => $pageId) { if ($index === 0) { $pageWidth = $width - 24; } elseif ($index === $last) { $pageWidth = $width - $margin; } else { $pageWidth = $width; } $index++; $page = $pageRepo->find($pageId); if ($page) { $langCode = strtoupper(\FWLanguage::getLanguageCodeById($page->getLang())); $objTemplate->setVariable(array('CLASS' => '', 'DATA_ID' => 'data-id="' . $pageId . '"', 'DATA_LANG' => 'data-lang="' . $langCode . '"', 'TITLE' => $page->getTitle(), 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;')); } else { $langCode = strtoupper(\FWLanguage::getLanguageCodeById($pageLangId)); $objTemplate->setVariable(array('CLASS' => 'no-page', 'DATA_ID' => '', 'DATA_LANG' => '', 'TITLE' => 'Keine Seite', 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;')); } $objTemplate->parse('groupedPage'); } $objTemplate->setVariable(array('ID' => $nodeId, 'LEVEL' => $node->getLvl(), 'SORT' => $node->getLft(), 'STYLE' => 'width: ' . $nodeWidth . 'px; margin-left: ' . $margin . 'px;')); $objTemplate->parse('groupedNode'); } return $objTemplate->get(); }
$basePath = realpath(dirname(__FILE__)); if (!@(include_once $basePath . '/config/config.php')) { die('Unable to load file ' . $basePath . '/config/config.php'); } require_once $basePath . '/classloader.inc.php'; @header('content-type: text/html; charset=' . ($useUtf8 ? 'UTF-8' : 'ISO-8859-1')); if (!@(include_once ASCMS_LIBRARY_PATH . '/PEAR/HTML/Template/Sigma/Sigma.php')) { die('Unable to load file ' . ASCMS_LIBRARY_PATH . '/PEAR/HTML/Template/Sigma/Sigma.php'); } if (!@(include_once $basePath . '/common.class.php')) { die('Unable to load file ' . $basePath . '/common.class.php'); } if (!@(include_once $basePath . '/installer.class.php')) { die('Unable to load file ' . $basePath . '/installer.class.php'); } if (!@(include_once $basePath . '/../core/Env.class.php')) { die('Unable to load file ' . $basePath . '/../core/Env.class.php'); } $objCommon = new CommonFunctions(); $objInstaller = new Installer(); $objCommon->initLanguage(); $objTpl = new HTML_Template_Sigma($templatePath); $objTpl->setErrorHandling(PEAR_ERROR_DIE); $objTpl->loadTemplateFile('index.html'); $objTpl->setVariable('CHARSET', $useUtf8 ? 'UTF-8' : 'ISO-8859-1'); $objTpl->setVariable($_ARRLANG); $objInstaller->checkOptions(); $objInstaller->getNavigation(); $objInstaller->getPage(); $objInstaller->getContentNavigation(); $objTpl->show();