/**
  * Handles the loading of a page, more in a functional than in an oop style
  *
  * @throws class_exception
  * @return string the generated page
  * @permissions view
  */
 protected function actionGeneratePage()
 {
     //Determine the pagename
     $objPageData = $this->getPageData();
     //react on portaleditor commands
     //pe to display, or pe to disable?
     if ($this->getParam("pe") == "false") {
         $this->objSession->setSession("pe_disable", "true");
     }
     if ($this->getParam("pe") == "true") {
         $this->objSession->setSession("pe_disable", "false");
     }
     //if using the pe, the cache shouldn't be used, otherwise strange things might happen.
     //the system could frighten your cat or eat up all your cheese with marshmallows...
     //get the current state of the portal editor
     $bitPeRequested = false;
     if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "true" && $this->objSession->getSession("pe_disable") != "true" && $this->objSession->isAdmin() && $objPageData->rightEdit()) {
         $bitPeRequested = true;
     }
     //If we reached up till here, we can begin loading the elements to fill
     if ($bitPeRequested) {
         $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($objPageData->getSystemid(), false, $this->getStrPortalLanguage());
     } else {
         $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($objPageData->getSystemid(), true, $this->getStrPortalLanguage());
     }
     //If there's a master-page, load elements on that, too
     $objMasterData = class_module_pages_page::getPageByName("master");
     $bitEditPermissionOnMasterPage = false;
     if ($objMasterData != null) {
         if ($bitPeRequested) {
             $arrElementsOnMaster = class_module_pages_pageelement::getElementsOnPage($objMasterData->getSystemid(), false, $this->getStrPortalLanguage());
         } else {
             $arrElementsOnMaster = class_module_pages_pageelement::getElementsOnPage($objMasterData->getSystemid(), true, $this->getStrPortalLanguage());
         }
         //and merge them
         $arrElementsOnPage = array_merge($arrElementsOnPage, $arrElementsOnMaster);
         if ($objMasterData->rightEdit()) {
             $bitEditPermissionOnMasterPage = true;
         }
     }
     //Load the template from the filesystem to get the placeholders
     $strTemplateID = $this->objTemplate->readTemplate("/module_pages/" . $objPageData->getStrTemplate(), "", false, true);
     //bit include the masters-elements!!
     $arrRawPlaceholders = array_merge($this->objTemplate->getElements($strTemplateID, 0), $this->objTemplate->getElements($strTemplateID, 1));
     $arrPlaceholders = array();
     //and retransform
     foreach ($arrRawPlaceholders as $arrOneRawPlaceholder) {
         $arrPlaceholders[] = $arrOneRawPlaceholder["placeholder"];
     }
     //Initialize the caches internal cache :)
     class_cache::fillInternalCache("class_element_portal", $this->getPagename(), null, $this->getStrPortalLanguage());
     //try to load the additional title from cache
     $strAdditionalTitleFromCache = "";
     $intMaxCacheDuration = 0;
     $objCachedTitle = class_cache::getCachedEntry(__CLASS__, $this->getPagename(), $this->generateHash2Sum(), $this->getStrPortalLanguage());
     if ($objCachedTitle != null) {
         $strAdditionalTitleFromCache = $objCachedTitle->getStrContent();
         self::$strAdditionalTitle = $strAdditionalTitleFromCache;
     }
     //copy for the portaleditor
     $arrPlaceholdersFilled = array();
     //Iterate over all elements and pass control to them
     //Get back the filled element
     //Build the array to fill the template
     $arrTemplate = array();
     /** @var class_module_pages_pageelement $objOneElementOnPage */
     foreach ($arrElementsOnPage as $objOneElementOnPage) {
         //element really available on the template?
         if (!in_array($objOneElementOnPage->getStrPlaceholder(), $arrPlaceholders)) {
             //next one, plz
             continue;
         } else {
             //create a protocol of placeholders filled
             //remove from pe-additional-array, pe code is injected by element directly
             $arrPlaceholdersFilled[] = array("placeholder" => $objOneElementOnPage->getStrPlaceholder(), "name" => $objOneElementOnPage->getStrName(), "element" => $objOneElementOnPage->getStrElement(), "repeatable" => $objOneElementOnPage->getIntRepeat());
         }
         //Build the class-name for the object
         /** @var  class_element_portal $objElement  */
         $objElement = $objOneElementOnPage->getConcretePortalInstance();
         //let the element do the work and earn the output
         if (!isset($arrTemplate[$objOneElementOnPage->getStrPlaceholder()])) {
             $arrTemplate[$objOneElementOnPage->getStrPlaceholder()] = "";
         }
         //cache-handling. load element from cache.
         //if the element is re-generated, save it back to cache.
         if (class_module_system_setting::getConfigValue("_pages_cacheenabled_") == "true" && $this->getParam("preview") != "1" && $objPageData->getStrName() != class_module_system_setting::getConfigValue("_pages_errorpage_")) {
             $strElementOutput = "";
             //if the portaleditor is disabled, do the regular cache lookups in storage. otherwise regenerate again and again :)
             if ($bitPeRequested) {
                 $strElementOutput = $objElement->getElementOutput();
             } else {
                 //pe not to be taken into account --> full support of caching
                 $strElementOutput = $objElement->getElementOutputFromCache();
                 if ($objOneElementOnPage->getIntCachetime() > $intMaxCacheDuration) {
                     $intMaxCacheDuration = $objOneElementOnPage->getIntCachetime();
                 }
                 if ($strElementOutput === false) {
                     $strElementOutput = $objElement->getElementOutput();
                     $objElement->saveElementToCache($strElementOutput);
                 }
             }
         } else {
             $strElementOutput = $objElement->getElementOutput();
         }
         //if element is disabled & the pe is requested, wrap the content
         if ($bitPeRequested && $objOneElementOnPage->getIntRecordStatus() == 0) {
             $arrPeElement = array();
             $arrPeElement["title"] = $this->getLang("pe_inactiveElement", "pages") . " (" . $objOneElementOnPage->getStrElement() . ")";
             $strElementOutput = $this->objToolkit->getPeInactiveElement($arrPeElement);
             $strElementOutput = class_element_portal::addPortalEditorSetActiveCode($strElementOutput, $objElement->getSystemid(), array());
         }
         $arrTemplate[$objOneElementOnPage->getStrPlaceholder()] .= $strElementOutput;
     }
     //pe-code to add new elements on unfilled placeholders --> only if pe is visible?
     if ($bitPeRequested) {
         //loop placeholders on template in order to remove already filled ones not being repeatable
         $arrRawPlaceholdersForPe = $arrRawPlaceholders;
         foreach ($arrPlaceholdersFilled as $arrOnePlaceholder) {
             foreach ($arrRawPlaceholdersForPe as &$arrOneRawPlaceholder) {
                 if ($arrOneRawPlaceholder["placeholder"] == $arrOnePlaceholder["placeholder"]) {
                     foreach ($arrOneRawPlaceholder["elementlist"] as $intElementKey => $arrOneRawElement) {
                         if ($arrOnePlaceholder["element"] == $arrOneRawElement["element"]) {
                             if (uniSubstr($arrOneRawElement["name"], 0, 5) == "master") {
                                 $arrOneRawPlaceholder["elementlist"][$intElementKey] = null;
                             } else {
                                 if ($arrOnePlaceholder["repeatable"] == "0") {
                                     $arrOneRawPlaceholder["elementlist"][$intElementKey] = null;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //array is now set up. loop again to create new-buttons
         $arrPePlaceholdersDone = array();
         $arrPeNewButtons = array();
         foreach ($arrRawPlaceholdersForPe as $arrOneRawPlaceholderForPe) {
             $strPeNewPlaceholder = $arrOneRawPlaceholderForPe["placeholder"];
             foreach ($arrOneRawPlaceholderForPe["elementlist"] as $arrOnePeNewElement) {
                 if ($arrOnePeNewElement == null) {
                     continue;
                 }
                 //check if the linked element exists
                 $objPeNewElement = class_module_pages_element::getElement($arrOnePeNewElement["element"]);
                 if ($objPeNewElement == null) {
                     continue;
                 }
                 //placeholder processed before?
                 $strArrayKey = $strPeNewPlaceholder . $objPeNewElement->getStrName();
                 if (in_array($strArrayKey, $arrPePlaceholdersDone)) {
                     continue;
                 } else {
                     $arrPePlaceholdersDone[] = $strArrayKey;
                 }
                 //create and register the button to add a new element
                 if (!isset($arrPeNewButtons[$strPeNewPlaceholder])) {
                     $arrPeNewButtons[$strPeNewPlaceholder] = "";
                 }
                 if (uniStripos($strArrayKey, "master") !== false) {
                     $strLink = "";
                     if ($objMasterData !== null) {
                         $strLink = class_element_portal::getPortaleditorNewCode($objMasterData->getSystemid(), $strPeNewPlaceholder, $objPeNewElement);
                     }
                 } else {
                     $strLink = class_element_portal::getPortaleditorNewCode($objPageData->getSystemid(), $strPeNewPlaceholder, $objPeNewElement);
                 }
                 $arrPeNewButtons[$strPeNewPlaceholder] .= $strLink;
             }
         }
         //loop pe-new code in order to add the wrappers and assign the code to the matching placeholder
         foreach ($arrPeNewButtons as $strPlaceholderName => $strNewButtons) {
             if (!isset($arrTemplate[$strPlaceholderName])) {
                 $arrTemplate[$strPlaceholderName] = "";
             }
             if ($strNewButtons != "") {
                 $strNewButtons = class_element_portal::getPortaleditorNewWrapperCode($strPlaceholderName, $strNewButtons);
             }
             $arrTemplate[$strPlaceholderName] .= $strNewButtons;
         }
         // add placeholder wrapping
         foreach ($arrTemplate as $strPlaceholder => $strContent) {
             $arrTemplate[$strPlaceholder] = class_carrier::getInstance()->getObjToolkit("portal")->getPePlaceholderWrapper($strPlaceholder, $strContent);
         }
     }
     //check if the additional title has to be saved to the cache
     if (self::$strAdditionalTitle != "" && self::$strAdditionalTitle != $strAdditionalTitleFromCache) {
         $objCacheEntry = class_cache::getCachedEntry(__CLASS__, $this->getPagename(), $this->generateHash2Sum(), $this->getStrPortalLanguage(), true);
         $objCacheEntry->setStrContent(self::$strAdditionalTitle);
         $objCacheEntry->setIntLeasetime(time() + $intMaxCacheDuration);
         $objCacheEntry->updateObjectToDb();
     }
     $arrTemplate["description"] = $objPageData->getStrDesc();
     $arrTemplate["keywords"] = $objPageData->getStrKeywords();
     $arrTemplate["title"] = $objPageData->getStrBrowsername();
     $arrTemplate["additionalTitle"] = self::$strAdditionalTitle;
     $arrTemplate["canonicalUrl"] = class_link::getLinkPortalHref($objPageData->getStrName(), "", $this->getParam("action"), "", $this->getParam("systemid"));
     //Include the $arrGlobal Elements
     $arrGlobal = array();
     $strPath = class_resourceloader::getInstance()->getPathForFile("/portal/global_includes.php");
     if ($strPath !== false) {
         include _realpath_ . $strPath;
     }
     $arrTemplate = array_merge($arrTemplate, $arrGlobal);
     //fill the template. the template was read before
     $strPageContent = $this->fillTemplate($arrTemplate, $strTemplateID);
     $strPageContent = $this->renderPortalEditorCode($objPageData, $bitEditPermissionOnMasterPage, $strPageContent);
     //insert the copyright headers. Due to our licence, you are NOT allowed to remove those lines.
     $strHeader = "<!--\n";
     $strHeader .= "Website powered by Kajona Open Source Content Management Framework\n";
     $strHeader .= "For more information about Kajona see http://www.kajona.de\n";
     $strHeader .= "-->\n";
     $intBodyPos = uniStripos($strPageContent, "</head>");
     $intPosXml = uniStripos($strPageContent, "<?xml");
     if ($intBodyPos !== false) {
         $intBodyPos += 0;
         $strPageContent = uniSubstr($strPageContent, 0, $intBodyPos) . $strHeader . uniSubstr($strPageContent, $intBodyPos);
     } else {
         if ($intPosXml !== false) {
             $intBodyPos = uniStripos($strPageContent, "?>");
             $intBodyPos += 2;
             $strPageContent = uniSubstr($strPageContent, 0, $intBodyPos) . $strHeader . uniSubstr($strPageContent, $intBodyPos);
         } else {
             $strPageContent = $strHeader . $strPageContent;
         }
     }
     return $strPageContent;
 }
 /**
  * Provides a form to set up the params needed to copy a single element from one placeholder to another.
  * Collects the target language, the target page and the target placeholder, invokes the copy-procedure.
  *
  * @throws class_exception
  * @return string , "" in case of success
  * @permissions edit
  */
 protected function actionCopyElement()
 {
     $strReturn = "";
     $this->setArrModuleEntry("template", "/folderview.tpl");
     $objSourceElement = new class_module_pages_pageelement($this->getSystemid());
     if ($objSourceElement->rightEdit($this->getSystemid())) {
         $objLang = null;
         if ($this->getParam("copyElement_language") != "") {
             $objLang = new class_module_languages_language($this->getParam("copyElement_language"));
         } else {
             $objLang = class_module_languages_language::getLanguageByName($this->getLanguageToWorkOn());
         }
         $objPage = null;
         if ($this->getParam("copyElement_page") != "") {
             $objPage = class_module_pages_page::getPageByName($this->getParam("copyElement_page"));
             if ($objPage == null) {
                 throw new class_exception("failed to load page " . $this->getParam("copyElement_page"), class_exception::$level_ERROR);
             }
             $objPage->setStrLanguage($objLang->getStrName());
             $objPage->initObject();
         } else {
             $objPage = new class_module_pages_page($objSourceElement->getPrevId());
         }
         //form header
         $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref("pages_content", "copyElement"), "formCopyElement");
         $strReturn .= $this->objToolkit->formInputHidden("copyElement_doCopy", 1);
         $strReturn .= $this->objToolkit->formInputHidden("systemid", $this->getSystemid());
         $strReturn .= $this->objToolkit->formHeadline($this->getLang("copyElement_element") . " " . $objSourceElement->getStrName() . "_" . $objSourceElement->getStrElement() . " (" . $objSourceElement->getStrTitle() . ")");
         //step one: language selection
         $arrLanguages = class_module_languages_language::getObjectList(true);
         $arrLanguageDD = array();
         foreach ($arrLanguages as $objSingleLanguage) {
             $arrLanguageDD[$objSingleLanguage->getSystemid()] = $this->getLang("lang_" . $objSingleLanguage->getStrName(), "languages");
         }
         $strReturn .= $this->objToolkit->formInputDropdown("copyElement_language", $arrLanguageDD, $this->getLang("copyElement_language"), $objLang->getSystemid());
         //step two: page selection
         $strReturn .= $this->objToolkit->formInputPageSelector("copyElement_page", $this->getLang("copyElement_page"), $objPage->getStrName(), "inputText", false);
         //step three: placeholder-selection
         //here comes the tricky part. load the template, analyze the placeholders and validate all those against things like repeatable and more...
         $strTemplate = $objPage->getStrTemplate();
         //load the placeholders
         $strTemplateId = $this->objTemplate->readTemplate("/module_pages/" . $strTemplate);
         $arrPlaceholders = $this->objTemplate->getElements($strTemplateId);
         $arrPlaceholdersDD = array();
         foreach ($arrPlaceholders as $arrSinglePlaceholder) {
             foreach ($arrSinglePlaceholder["elementlist"] as $arrSinglePlaceholderlist) {
                 if ($objSourceElement->getStrElement() == $arrSinglePlaceholderlist["element"]) {
                     if ($objSourceElement->getIntRepeat() == 1) {
                         //repeatable, ok in every case
                         $arrPlaceholdersDD[$arrSinglePlaceholder["placeholder"]] = $arrSinglePlaceholder["placeholder"];
                     } else {
                         //not repeatable - element already existing at placeholder?
                         $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($objPage->getSystemid(), false, $objLang->getStrName());
                         //loop in order to find same element-types - other elements may be possible due to piped placeholders, too
                         $bitAdd = true;
                         //var_dump($arrElementsOnPage);
                         foreach ($arrElementsOnPage as $objSingleElementOnPage) {
                             if ($objSingleElementOnPage->getStrElement() == $objSourceElement->getStrElement()) {
                                 $bitAdd = false;
                             }
                         }
                         if ($bitAdd) {
                             $arrPlaceholdersDD[$arrSinglePlaceholder["placeholder"]] = $arrSinglePlaceholder["placeholder"];
                         }
                     }
                 }
             }
         }
         $bitCopyingAllowed = true;
         if (count($arrPlaceholdersDD) == 0) {
             $strReturn .= $this->objToolkit->formTextRow($this->getLang("copyElement_err_placeholder"));
             $bitCopyingAllowed = false;
         } else {
             $strReturn .= $this->objToolkit->formInputDropdown("copyElement_placeholder", $arrPlaceholdersDD, $this->getLang("copyElement_placeholder"));
         }
         $strReturn .= $this->objToolkit->formTextRow($this->getLang("copyElement_template") . " " . $strTemplate);
         $strReturn .= $this->objToolkit->divider();
         $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("copyElement_submit"), "Submit", "", "inputSubmit", $bitCopyingAllowed);
         $strReturn .= $this->objToolkit->formClose();
         $strReturn .= "\n                <script type=\"text/javascript\">\n\n                \$(function() {\n                        var reloadForm = function() {\n                            setTimeout( function() {\n                                document.getElementById('copyElement_doCopy').value = 0;\n                                var formElement = document.getElementById('formCopyElement');\n                                formElement.submit();\n                            }, 100);\n\n                        };\n\n\t                    KAJONA.admin.copyElement_page.bind('autocompleteselect', reloadForm);\n\n\t                    var languageField = document.getElementById('copyElement_language');\n\t                    languageField.onchange = reloadForm;\n\n                        var pageField = document.getElementById('copyElement_page');\n\t                    pageField.onchange = reloadForm;\n\t             });\n\n                </script>";
         //any actions to take?
         if ($this->getParam("copyElement_doCopy") == 1) {
             $objNewElement = $objSourceElement->copyObject($objPage->getSystemid());
             $objNewElement->setStrLanguage($objLang->getStrName());
             $objNewElement->setStrPlaceholder($this->getParam("copyElement_placeholder"));
             if ($objNewElement->updateObjectToDb()) {
                 $this->setSystemid($objNewElement->getSystemid());
                 $strReturn = "";
                 $this->adminReload(class_link::getLinkAdminHref("pages_content", "list", "systemid=" . $objNewElement->getPrevId() . "&blockAction=1&peClose=1"));
             } else {
                 throw new class_exception("Error copying the pageelement " . $objSourceElement->getSystemid(), class_exception::$level_ERROR);
             }
         }
     } else {
         $strReturn = $this->getLang("commons_error_permissions");
     }
     return $strReturn;
 }
 /**
  * Returns a list of folders in the pages-database
  *
  * @return String
  * @permissions view
  * @autoTestable
  */
 protected function actionPagesFolderBrowser()
 {
     $strReturn = "";
     $intCounter = 1;
     $this->setArrModuleEntry("template", "/folderview.tpl");
     if ($this->getParam("CKEditorFuncNum") != "") {
         $strReturn .= "<script type=\"text/javascript\">window.opener.KAJONA.admin.folderview.selectCallbackCKEditorFuncNum = " . (int) $this->getParam("CKEditorFuncNum") . ";</script>";
     }
     //param init
     $bitPages = $this->getParam("pages") != "" ? true : false;
     $bitPageAliases = $this->getParam("pagealiases") != "" ? true : false;
     $bitPageelements = $this->getParam("elements") == "false" ? false : true;
     $bitFolder = $this->getParam("folder") != "" ? true : false;
     $strSystemid = $this->getSystemid() != "" ? $this->getSystemid() : class_module_system_module::getModuleByName("pages")->getSystemid();
     $strElement = $this->getParam("form_element") != "" ? $this->getParam("form_element") : "ordner_name";
     $strPageid = $this->getParam("pageid") != "" ? $this->getParam("pageid") : "0";
     $strLinkAddon = "" . ($bitPages ? "&pages=1" : "") . ($bitFolder ? "&folder=1" : "") . ($this->getParam("bit_link") != "" ? "&bit_link=1" : "") . (!$bitPageelements ? "&elements=false" : "") . ($bitPageAliases ? "&pagealiases=1" : "");
     $arrFolder = class_module_pages_folder::getFolderList($strSystemid);
     $objFolder = new class_module_pages_folder($strSystemid);
     $strLevelUp = "";
     if (validateSystemid($strSystemid) && $strSystemid != $this->getObjModule()->getSystemid()) {
         $strLevelUp = $objFolder->getPrevId();
     }
     //but: when browsing pages the current level should be kept
     if ($strPageid != "0") {
         $strLevelUp = $strSystemid;
     }
     $strReturn .= $this->objToolkit->formHeader("");
     $strAction = $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("select_page") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "', '" . _indexpath_ . "?page='+\$('#quickselect').val()]]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>");
     $strReturn .= $this->objToolkit->formInputPageSelector("quickselect", $this->getLang("folderview_quickselect"), "", "", false, false, $strAction);
     $strReturn .= $this->objToolkit->formClose(false);
     $strReturn .= $this->objToolkit->listHeader();
     //Folder to jump one level up
     if (!$bitPages || $strLevelUp != "" || $bitFolder) {
         $strAction = $this->objToolkit->listButton($strSystemid != "0" && $strLevelUp != "" || $strPageid != "0" ? class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $strLevelUp . $strLinkAddon . "&form_element=" . $strElement . ($this->getParam("bit_link") != "" ? "&bit_link=1" : ""), $this->getLang("commons_one_level_up"), $this->getLang("commons_one_level_up"), "icon_folderActionLevelup") : " ");
         if ($strSystemid == $this->getObjModule()->getSystemid() && (!$bitPages || $bitFolder)) {
             $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("commons_accept") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $this->getObjModule()->getSystemid() . "'], ['" . $strElement . "', '']]);\">" . class_adminskin_helper::getAdminImage("icon_accept"));
         }
         $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), "..", getImageAdmin("icon_folderOpen"), $strAction, $intCounter++);
     }
     if (count($arrFolder) > 0 && $strPageid == "0") {
         foreach ($arrFolder as $objSingleFolder) {
             if ($bitPages && !$bitFolder) {
                 $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSingleFolder->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("pages_ordner_oeffnen"), $this->getLang("pages_ordner_oeffnen"), "icon_folderActionOpen"));
                 $strReturn .= $this->objToolkit->simpleAdminList($objSingleFolder, $strAction, $intCounter++);
             } else {
                 $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSingleFolder->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("pages_ordner_oeffnen"), $this->getLang("pages_ordner_oeffnen"), "icon_folderActionOpen"));
                 $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("commons_accept") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $objSingleFolder->getSystemid() . "'], ['" . $strElement . "', '" . $objSingleFolder->getStrName() . "']]); \">" . class_adminskin_helper::getAdminImage("icon_accept"));
                 $strReturn .= $this->objToolkit->simpleAdminList($objSingleFolder, $strAction, $intCounter++);
             }
         }
     }
     $strReturn .= $this->objToolkit->listFooter();
     //Pages could be sent too
     if ($bitPages && $strPageid == "0") {
         $arrPages = class_module_pages_folder::getPagesInFolder($strSystemid);
         if (count($arrPages) > 0) {
             $strReturn .= $this->objToolkit->listHeader();
             /** @var $objSinglePage class_module_pages_page */
             foreach ($arrPages as $objSinglePage) {
                 $arrSinglePage = array();
                 //Should we generate a link ?
                 if ($this->getParam("bit_link") != "") {
                     $arrSinglePage["name2"] = class_link::getLinkPortalHref($objSinglePage->getStrName(), "", "", "", "", $this->getLanguageToWorkOn());
                 } else {
                     $arrSinglePage["name2"] = $objSinglePage->getStrName();
                 }
                 if ($objSinglePage->getIntType() == class_module_pages_page::$INT_TYPE_ALIAS) {
                     if (count(class_module_pages_folder::getPagesInFolder($objSinglePage->getSystemid())) == 0) {
                         $strAction = getImageAdmin("icon_treeBranchOpenDisabled");
                     } else {
                         $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSinglePage->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("page_sublist"), $this->getLang("page_sublist"), "icon_treeBranchOpen"));
                     }
                     if ($bitPageAliases) {
                         $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("select_page") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $objSinglePage->getSystemid() . "'],['" . $strElement . "', '" . $arrSinglePage["name2"] . "']]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>");
                     }
                     $strReturn .= $this->objToolkit->simpleAdminList($objSinglePage, $strAction, $intCounter++);
                 } else {
                     if (count(class_module_pages_folder::getPagesInFolder($objSinglePage->getSystemid())) == 0) {
                         $strAction = getImageAdmin("icon_treeBranchOpenDisabled");
                     } else {
                         $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $objSinglePage->getSystemid() . "&form_element=" . $strElement . $strLinkAddon, $this->getLang("page_sublist"), $this->getLang("page_sublist"), "icon_treeBranchOpen"));
                     }
                     if ($bitPageelements) {
                         $strAction .= $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "pagesFolderBrowser", "&systemid=" . $strSystemid . "&form_element=" . $strElement . "&pageid=" . $objSinglePage->getSystemid() . ($this->getParam("bit_link") != "" ? "&bit_link=1" : "") . ($bitPages ? "&pages=1" : "") . ($bitPageAliases ? "&pagealiases=1" : ""), $this->getLang("seite_oeffnen"), $this->getLang("seite_oeffnen"), "icon_folderActionOpen"));
                     }
                     $strAction .= $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("select_page") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "_id', '" . $objSinglePage->getSystemid() . "'],['" . $strElement . "', '" . $arrSinglePage["name2"] . "']]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>");
                     $strReturn .= $this->objToolkit->simpleAdminList($objSinglePage, $strAction, $intCounter++);
                 }
             }
             $strReturn .= $this->objToolkit->listFooter();
         }
     }
     //Load the list of pagelements available on the page
     if ($strPageid != "0") {
         $strReturn .= $this->objToolkit->divider();
         $arrPageelements = class_module_pages_pageelement::getElementsOnPage($strPageid, true, $this->getLanguageToWorkOn());
         $objPage = new class_module_pages_page($strPageid);
         if (count($arrPageelements) > 0) {
             $strReturn .= $this->objToolkit->listHeader();
             /** @var class_module_pages_pageelement $objOnePageelement */
             foreach ($arrPageelements as $objOnePageelement) {
                 $arrSinglePage = array();
                 //Should we generate a link ?
                 if ($this->getParam("bit_link") != "") {
                     $arrSinglePage["name2"] = class_link::getLinkPortalHref($objPage->getStrName(), "", "", "", "", $this->getLanguageToWorkOn()) . "#" . $objOnePageelement->getSystemid();
                 } else {
                     $arrSinglePage["name2"] = $objPage->getStrName() . "#" . $objOnePageelement->getSystemid();
                 }
                 $strAction = $this->objToolkit->listButton("<a href=\"#\" title=\"" . $this->getLang("seite_uebernehmen") . "\" rel=\"tooltip\" onclick=\"KAJONA.admin.folderview.selectCallback([['" . $strElement . "', '" . $arrSinglePage["name2"] . "']]);\">" . class_adminskin_helper::getAdminImage("icon_accept") . "</a>");
                 $strReturn .= $this->objToolkit->simpleAdminList($objOnePageelement, $strAction, $intCounter++);
             }
             $strReturn .= $this->objToolkit->listFooter();
         }
     }
     return $strReturn;
 }