/**
  * Does the hard work: installs the module and registers needed constants
  *
  * @return string
  */
 public function install()
 {
     $strReturn = "";
     //search the master page
     $objMaster = class_module_pages_page::getPageByName("master");
     if ($objMaster != null) {
         $this->strMasterID = $objMaster->getSystemid();
     }
     if ($this->strMasterID != "") {
         $strReturn .= "Adding languageswitch to master page\n";
         $strReturn .= "ID of master page: " . $this->strMasterID . "\n";
         if (class_module_pages_element::getElement("languageswitch") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("masterlanguageswitch_languageswitch");
             $objPagelement->setStrName("masterswitch");
             $objPagelement->setStrElement("languageswitch");
             $objPagelement->updateObjectToDb($this->strMasterID);
             $strElementId = $objPagelement->getSystemid();
             $strReturn .= "ID of element: " . $strElementId . "\n";
             $strReturn .= "Element created.\n";
             $strReturn .= "Setting languageswitch template...\n";
             $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                            SET char1 = ?\n                            WHERE content_id = ? ";
             $this->objDB->_pQuery($strQuery, array("languageswitch.tpl", $strElementId));
         }
     }
     return $strReturn;
 }
Esempio n. 2
0
 public function testCopyPage()
 {
     $strTitle = generateSystemid();
     $objPage = new class_module_pages_page();
     $objPage->setStrName($strTitle);
     $objPage->setStrBrowsername(generateSystemid());
     $objPage->setStrSeostring(generateSystemid());
     $objPage->setStrDesc(generateSystemid());
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb();
     $strOldSystemid = $objPage->getSystemid();
     $objPagelement = new class_module_pages_pageelement();
     $objPagelement->setStrPlaceholder("text_paragraph");
     $objPagelement->setStrName("text");
     $objPagelement->setStrElement("paragraph");
     $objPagelement->updateObjectToDb($objPage->getSystemid());
     $objPagelement = new class_module_pages_pageelement($objPagelement->getSystemid());
     //and finally create the object
     /** @var $objElement class_element_paragraph_admin */
     $objElement = $objPagelement->getConcreteAdminInstance();
     $objElement->setStrTitle("autotest");
     $objElement->doBeforeSaveToDb();
     $objElement->updateForeignElement();
     $objElement->doAfterSaveToDb();
     //copy the page itself
     $objPage->copyObject();
     $strNewSystemid = $objPage->getSystemid();
     $this->flushDBCache();
     $objOldPage = new class_module_pages_page($strOldSystemid);
     $objNewPage = new class_module_pages_page($strNewSystemid);
     $this->assertNotEquals($objOldPage->getStrName(), $objNewPage->getStrName());
     $this->assertEquals($objOldPage->getStrBrowsername(), $objNewPage->getStrBrowsername());
     $this->assertEquals($objOldPage->getStrSeostring(), $objNewPage->getStrSeostring());
     $this->assertEquals($objOldPage->getStrDesc(), $objNewPage->getStrDesc());
     $this->assertEquals($objOldPage->getStrTemplate(), $objNewPage->getStrTemplate());
     $arrOldElements = class_module_pages_pageelement::getAllElementsOnPage($strOldSystemid);
     $arrNewElements = class_module_pages_pageelement::getAllElementsOnPage($strNewSystemid);
     $this->assertEquals(count($arrOldElements), count($arrNewElements));
     $this->assertEquals(1, count($arrOldElements));
     $this->assertEquals(1, count($arrNewElements));
     $objOldElement = $arrOldElements[0];
     $objNewElement = $arrNewElements[0];
     $this->assertEquals($objOldElement->getStrPlaceholder(), $objNewElement->getStrPlaceholder());
     $this->assertEquals($objOldElement->getStrLanguage(), $objNewElement->getStrLanguage());
     $this->assertEquals($objOldElement->getStrElement(), $objNewElement->getStrElement());
     /** @var class_element_paragraph_admin $objOldElementInstance */
     $objOldElementInstance = $objOldElement->getConcreteAdminInstance();
     $arrOldElementData = $objOldElementInstance->loadElementData();
     /** @var class_element_paragraph_admin $objNewElementInstance */
     $objNewElementInstance = $objNewElement->getConcreteAdminInstance();
     $arrNewElementData = $objNewElementInstance->loadElementData();
     $this->assertNotEquals($arrOldElementData["content_id"], $arrNewElementData["content_id"]);
     $this->assertEquals($arrOldElementData["paragraph_title"], $arrNewElementData["paragraph_title"]);
     $this->assertEquals($objOldElementInstance->getStrTitle(), $objNewElementInstance->getStrTitle());
     $this->assertEquals($objOldElementInstance->getStrTitle(), "autotest");
     $this->assertEquals($objNewElementInstance->getStrTitle(), "autotest");
     $objNewPage->deleteObjectFromDatabase();
     $objOldPage->deleteObjectFromDatabase();
 }
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  */
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating new page rssfeed...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("rssfeed");
     $objPage->setStrBrowsername("Rssfeed");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strPageId . "\n";
     $strReturn .= "Adding pagelement to new page\n";
     if (class_module_pages_element::getElement("rssfeed") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("rssfeed");
         $objPagelement->updateObjectToDb($strPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams = array("rssfeed.tpl", 10, "http://www.kajona.de/kajona_news.rss", $strElementId);
         } else {
             $arrParams = array("rssfeed.tpl", 10, "http://www.kajona.de/kajona_news_en.rss", $strElementId);
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                            SET char1 = ?,\n                                " . $this->objDB->encloseColumnName("int1") . " = ?,\n                                char2 = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Rssfeed element created.\n";
         } else {
             $strReturn .= "Error creating Rssfeed element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Rssfeed", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     return $strReturn;
 }
 public function testImportExport()
 {
     class_carrier::getInstance()->getObjRights()->setBitTestMode(true);
     $strName = generateSystemid();
     $strBrowsername = generateSystemid();
     $strSeoString = generateSystemid();
     $strDesc = generateSystemid();
     $objPage = new class_module_pages_page();
     $objPage->setStrName($strName);
     $objPage->setStrBrowsername($strBrowsername);
     $objPage->setStrSeostring($strSeoString);
     $objPage->setStrDesc($strDesc);
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb();
     $strPagesystemid = $objPage->getSystemid();
     $objPagelement = new class_module_pages_pageelement();
     $objPagelement->setStrPlaceholder("text_paragraph");
     $objPagelement->setStrName("text");
     $objPagelement->setStrElement("paragraph");
     $objPagelement->updateObjectToDb($objPage->getSystemid());
     $objElement = new class_element_paragraph_admin($objPagelement->getSystemid());
     $objElement->setSystemid($objPagelement->getSystemid());
     $objElement->loadElementData();
     $objElement->setStrTitle("para_title");
     $objElement->updateForeignElement();
     $objPagelement = new class_module_pages_pageelement($objPagelement->getSystemid());
     class_carrier::getInstance()->setParam("pageExport", $strName);
     $objPageExport = new class_systemtask_pageexport();
     $objPageExport->executeTask();
     $objPage->deleteObjectFromDatabase();
     class_orm_rowcache::flushCache();
     class_db::getInstance()->flushQueryCache();
     $this->assertNull(class_module_pages_page::getPageByName($strName));
     $this->assertFileExists(_realpath_ . _projectpath_ . "/temp/" . $strPagesystemid . ".xml");
     class_carrier::getInstance()->setParam("pageimport_file", _projectpath_ . "/temp/" . $strPagesystemid . ".xml");
     $objImport = new class_systemtask_pageimport();
     $objImport->executeTask();
     $objPage = class_module_pages_page::getPageByName($strName);
     $this->assertNotNull($objPage);
     $this->assertEquals($objPage->getStrName(), $strName);
     $this->assertEquals($objPage->getStrDesc(), $strDesc);
     $this->assertEquals($objPage->getStrSeostring(), $strSeoString);
     $this->assertEquals($objPage->getStrBrowsername(), $strBrowsername);
     $objElements = class_module_pages_pageelement::getAllElementsOnPage($objPage->getSystemid());
     $this->assertEquals(1, count($objElements));
     $objElements = $objElements[0];
     $this->assertEquals($objElements->getStrClassAdmin(), "class_element_paragraph_admin.php");
     $objElement = $objElements->getConcreteAdminInstance();
     $objElement->setSystemid($objElements->getSystemid());
     $objElement->loadElementData();
     $this->assertEquals("para_title", $objElement->getStrTitle());
     $objPage->deleteObjectFromDatabase();
 }
 /**
  * Invokes the element to do the work
  * If enabled, passes to addPortalEditorCode(). This adds the element-based pe-code.
  * If modules want to create pe code, they have to call the static method addPortalEditorCode
  * on their own!
  *
  * @return string
  */
 public function getElementOutput()
 {
     $strReturn = "";
     //load the data from the database
     $this->arrElementData = array_merge($this->getElementContent($this->objElementData->getSystemid()), $this->arrElementData);
     //wrap all in a try catch block
     try {
         if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "true" && $this->objSession->isAdmin() && class_carrier::getInstance()->getObjSession()->getSession("pe_disable") != "true") {
             //Check needed rights
             $objElement = class_objectfactory::getInstance()->getObject($this->getSystemid());
             if ($objElement->rightEdit()) {
                 $arrConfig = array();
                 $arrConfig["pe_module"] = "";
                 $arrConfig["pe_action"] = "";
                 if ($this->getArrModule("pe_module") != "") {
                     $arrConfig["pe_module"] = $this->getArrModule("pe_module");
                 }
                 if ($this->getArrModule("pe_action") != "") {
                     $arrConfig["pe_action"] = $this->getArrModule("pe_action");
                 }
                 $strReturn = $this->addPortalEditorCode($this->loadData(), $this->getSystemid(), $arrConfig, $this->arrElementData["page_element_ph_element"]);
             } else {
                 $strReturn = $this->loadData();
                 $strReturn = preg_replace('/data-kajona-editable=\\"([a-zA-Z0-9#_]*)\\"/i', "", $strReturn);
             }
         } else {
             $strReturn = $this->loadData();
             //strip the data-editable values - no use case for regular page views
             $strReturn = preg_replace('/data-kajona-editable=\\"([a-zA-Z0-9#_]*)\\"/i', "", $strReturn);
         }
     } catch (class_exception $objEx) {
         //An error occurred during content generation. redirect to error page
         $objEx->processException();
         //if available, show the error-page. on debugging-environments, the exception processing already die()d the process.
         if ($this->getPagename() != class_module_system_setting::getConfigValue("_pages_errorpage_")) {
             $this->portalReload(class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_")));
         }
         $strReturn = $objEx->getMessage();
     }
     //add an anchor to jump to, but exclude navigation-elements
     $strReturn = $this->getAnchorTag() . $strReturn;
     //apply element-based scriptlets
     $objScriptlets = new class_scriptlet_helper();
     $strReturn = $objScriptlets->processString($strReturn, interface_scriptlet::BIT_CONTEXT_PORTAL_ELEMENT);
     return $strReturn;
 }
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  */
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating new page contact...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("contact");
     $objPage->setStrBrowsername("Contact");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strPageId . "\n";
     $strReturn .= "Adding pagelement to new page\n";
     $objPagelement = new class_module_pages_pageelement();
     if (class_module_pages_element::getElement("form") != null) {
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("form");
         $objPagelement->updateObjectToDb($strPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "class_formular_contact.php";
             $arrParams[] = class_module_system_setting::getConfigValue("_system_admin_email_");
             $arrParams[] = "contact.tpl";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "class_formular_contact.php";
             $arrParams[] = class_module_system_setting::getConfigValue("_system_admin_email_");
             $arrParams[] = "contact.tpl";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_formular\n                        SET formular_class = ?,\n                            formular_email = ?,\n                            formular_template = ?\n                        WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Contact element created.\n";
         } else {
             $strReturn .= "Error creating Contact element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Contact", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("content_paragraph");
         $objPagelement->setStrName("content");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "";
             $arrParams[] = "Hinweis: Das Formular sendet per default die Anfragen an die E-Mail Adresse des Administrators.<br />\n                                Um diese Adresse zu ändern öffnen Sie bitte die Seite in der Administration und bearbeiten das Seitenelement &quot;Formular&quot;.<br /><br />";
             $arrParams[] = "";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "";
             $arrParams[] = "Note: By default, the form sends the messages to the administators email-address.<br />\n                               To change this address, open the current page using the administration and edit the page-element &quot;form&quot;.<br /><br />";
             $arrParams[] = "";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?,\n                                    paragraph_content = ?,\n                                    paragraph_image = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     return $strReturn;
 }
Esempio n. 7
0
 public function testPageElementDeleteSortingMultiLanguage()
 {
     $objPage = new class_module_pages_page();
     $objPage->setStrName("sortTest");
     $objPage->updateObjectToDb();
     $objPagelementb1 = new class_module_pages_pageelement();
     $objPagelementb1->setStrPlaceholder("b_test");
     $objPagelementb1->setStrName("b");
     $objPagelementb1->setStrElement("row");
     $objPagelementb1->setStrLanguage("a1");
     $objPagelementb1->updateObjectToDb($objPage->getSystemid());
     $objPagelementc1 = new class_module_pages_pageelement();
     $objPagelementc1->setStrPlaceholder("b_test");
     $objPagelementc1->setStrName("b");
     $objPagelementc1->setStrElement("row");
     $objPagelementc1->setStrLanguage("a2");
     $objPagelementc1->updateObjectToDb($objPage->getSystemid());
     $objPagelementb2 = new class_module_pages_pageelement();
     $objPagelementb2->setStrPlaceholder("b_test");
     $objPagelementb2->setStrName("b");
     $objPagelementb2->setStrElement("row");
     $objPagelementb2->setStrLanguage("a1");
     $objPagelementb2->updateObjectToDb($objPage->getSystemid());
     $objPagelementb3 = new class_module_pages_pageelement();
     $objPagelementb3->setStrPlaceholder("b_test");
     $objPagelementb3->setStrName("b");
     $objPagelementb3->setStrElement("row");
     $objPagelementb3->setStrLanguage("a1");
     $objPagelementb3->updateObjectToDb($objPage->getSystemid());
     $objPagelementc2 = new class_module_pages_pageelement();
     $objPagelementc2->setStrPlaceholder("b_test");
     $objPagelementc2->setStrName("b");
     $objPagelementc2->setStrElement("row");
     $objPagelementc2->setStrLanguage("a2");
     $objPagelementc2->updateObjectToDb($objPage->getSystemid());
     $objPagelementc3 = new class_module_pages_pageelement();
     $objPagelementc3->setStrPlaceholder("b_test");
     $objPagelementc3->setStrName("b");
     $objPagelementc3->setStrElement("row");
     $objPagelementc3->setStrLanguage("a2");
     $objPagelementc3->updateObjectToDb($objPage->getSystemid());
     $arrElements = class_module_pages_pageelement::getElementsByPlaceholderAndPage($objPage->getSystemid(), "b_test", "a1", false);
     $this->assertEquals(3, count($arrElements));
     $this->assertEquals(1, $arrElements[0]->getIntSort());
     $this->assertEquals($objPagelementb1->getSystemid(), $arrElements[0]->getSystemid());
     $this->assertEquals(2, $arrElements[1]->getIntSort());
     $this->assertEquals($objPagelementb2->getSystemid(), $arrElements[1]->getSystemid());
     $this->assertEquals(3, $arrElements[2]->getIntSort());
     $this->assertEquals($objPagelementb3->getSystemid(), $arrElements[2]->getSystemid());
     $arrElements = class_module_pages_pageelement::getElementsByPlaceholderAndPage($objPage->getSystemid(), "b_test", "a2", false);
     $this->assertEquals(3, count($arrElements));
     $this->assertEquals(1, $arrElements[0]->getIntSort());
     $this->assertEquals($objPagelementc1->getSystemid(), $arrElements[0]->getSystemid());
     $this->assertEquals(2, $arrElements[1]->getIntSort());
     $this->assertEquals($objPagelementc2->getSystemid(), $arrElements[1]->getSystemid());
     $this->assertEquals(3, $arrElements[2]->getIntSort());
     $this->assertEquals($objPagelementc3->getSystemid(), $arrElements[2]->getSystemid());
     $objPagelementb2->deleteObjectFromDatabase();
     $this->flushDBCache();
     $arrElements = class_module_pages_pageelement::getElementsByPlaceholderAndPage($objPage->getSystemid(), "b_test", "a1", false);
     $this->assertEquals(2, count($arrElements));
     $this->assertEquals(1, $arrElements[0]->getIntSort());
     $this->assertEquals($objPagelementb1->getSystemid(), $arrElements[0]->getSystemid());
     $this->assertEquals(2, $arrElements[1]->getIntSort());
     $this->assertEquals($objPagelementb3->getSystemid(), $arrElements[1]->getSystemid());
     $arrElements = class_module_pages_pageelement::getElementsByPlaceholderAndPage($objPage->getSystemid(), "b_test", "a2", false);
     $this->assertEquals(3, count($arrElements));
     $this->assertEquals(1, $arrElements[0]->getIntSort());
     $this->assertEquals($objPagelementc1->getSystemid(), $arrElements[0]->getSystemid());
     $this->assertEquals(2, $arrElements[1]->getIntSort());
     $this->assertEquals($objPagelementc2->getSystemid(), $arrElements[1]->getSystemid());
     $this->assertEquals(3, $arrElements[2]->getIntSort());
     $this->assertEquals($objPagelementc3->getSystemid(), $arrElements[2]->getSystemid());
     $objPage->deleteObjectFromDatabase();
 }
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  * @return string
  */
 public function install()
 {
     //search the master page
     $objMaster = class_module_pages_page::getPageByName("master");
     if ($objMaster != null) {
         $this->strMasterID = $objMaster->getSystemid();
     }
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn = "";
     $strReturn .= "Creating new mainnavigation-tree\n";
     $objNaviTree = new class_module_navigation_tree();
     $objNaviTree->setStrName("mainnavigation");
     $objNaviTree->setStrFolderId($strNaviFolderId);
     $objNaviTree->updateObjectToDb();
     $strTreeId = $objNaviTree->getSystemid();
     $strReturn .= "ID of new navigation-tree: " . $strTreeId . "\n";
     $strReturn .= "Creating new portalnavigation-tree\n";
     $objNaviTree = new class_module_navigation_tree();
     $objNaviTree->setStrName("portalnavigation");
     $objNaviTree->updateObjectToDb();
     $strTreePortalId = $objNaviTree->getSystemid();
     $strReturn .= "ID of new navigation-tree: " . $strTreePortalId . "\n";
     $strReturn .= "Creating navigation points\n";
     $objNaviPoint = new class_module_navigation_point();
     $objNaviPoint->setStrName("Home");
     $objNaviPoint->setStrPageI("index");
     $objNaviPoint->updateObjectToDb($strTreePortalId);
     if ($this->strMasterID != "") {
         $strReturn .= "Adding mainnavigation to master page\n";
         $strReturn .= "ID of master page: " . $this->strMasterID . "\n";
         if (class_module_pages_element::getElement("navigation") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("mastermainnavi_navigation");
             $objPagelement->setStrName("mastermainnavi");
             $objPagelement->setStrElement("navigation");
             $objPagelement->updateObjectToDb($this->strMasterID);
             $strElementId = $objPagelement->getSystemid();
             $strQuery = "UPDATE " . _dbprefix_ . "element_navigation\n                                SET navigation_id= ?,\n                                    navigation_template = ?\n                                WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, array($strTreeId, "mainnavi.tpl", $strElementId))) {
                 $strReturn .= "Navigation element created.\n";
             } else {
                 $strReturn .= "Error creating navigation element.\n";
             }
         }
         $strReturn .= "Adding portalnavigation to master page\n";
         $strReturn .= "ID of master page: " . $this->strMasterID . "\n";
         if (class_module_pages_element::getElement("navigation") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("masterportalnavi_navigation");
             $objPagelement->setStrName("masterportalnavi");
             $objPagelement->setStrElement("navigation");
             $objPagelement->updateObjectToDb($this->strMasterID);
             $strElementId = $objPagelement->getSystemid();
             $strQuery = "UPDATE " . _dbprefix_ . "element_navigation\n                                SET navigation_id= ?,\n                                    navigation_template = ?\n                                WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, array($strTreePortalId, "portalnavi.tpl", $strElementId))) {
                 $strReturn .= "Navigation element created.\n";
             } else {
                 $strReturn .= "Error creating navigation element.\n";
             }
         }
         $strReturn .= "Adding pathnavigation to master page\n";
         $strReturn .= "ID of master page: " . $this->strMasterID . "\n";
         if (class_module_pages_element::getElement("navigation") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("masterpathnavi_navigation");
             $objPagelement->setStrName("masterpathnavi");
             $objPagelement->setStrElement("navigation");
             $objPagelement->updateObjectToDb($this->strMasterID);
             $strElementId = $objPagelement->getSystemid();
             $strQuery = "UPDATE " . _dbprefix_ . "element_navigation\n                                SET navigation_id= ?,\n                                    navigation_template = ?\n                                WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, array($strTreeId, "breadcrumbnavi.tpl", $strElementId))) {
                 $strReturn .= "Navigation element created.\n";
             } else {
                 $strReturn .= "Error creating navigation element.\n";
             }
         }
     }
     $strReturn .= "Creating simple sitemap...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("sitemap");
     $objPage->setStrBrowsername("Sitemap");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb();
     $strSitemapId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strSitemapId . "\n";
     $strReturn .= "Adding sitemap to new page\n";
     if (class_module_pages_element::getElement("navigation") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("navigation");
         $objPagelement->updateObjectToDb($strSitemapId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_navigation\n                            SET navigation_id=?,\n                                navigation_template = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array($strTreeId, "sitemap.tpl", $strElementId))) {
             $strReturn .= "Sitemapelement created.\n";
         } else {
             $strReturn .= "Error creating sitemapelement.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strSitemapId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?\n                          WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array("Sitemap", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Creating navigation points\n";
     $objNaviPoint = new class_module_navigation_point();
     $objNaviPoint->setStrName("Sitemap");
     $objNaviPoint->setStrPageI("sitemap");
     $objNaviPoint->updateObjectToDb($strTreePortalId);
     $strReturn .= "ID of new navigation point " . $objNaviPoint->getSystemid() . ".\n";
     $objNaviPoint = new class_module_navigation_point();
     if ($this->strContentLanguage == "de") {
         $objNaviPoint->setStrName("Impressum");
     } else {
         $objNaviPoint->setStrName("Imprint");
     }
     $objNaviPoint->setStrPageI("imprint");
     $objNaviPoint->updateObjectToDb($strTreePortalId);
     $strReturn .= "ID of new navigation point " . $objNaviPoint->getSystemid() . ".\n";
     return $strReturn;
 }
Esempio n. 9
0
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     //search the index page
     $objIndex = class_module_pages_page::getPageByName("index");
     if ($objIndex != null) {
         $this->strIndexID = $objIndex->getSystemid();
     }
     $strReturn .= "Creating faqs\n";
     $objFaq1 = new class_module_faqs_faq();
     $objFaq2 = new class_module_faqs_faq();
     if ($this->strContentLanguage == "de") {
         $objFaq1->setStrQuestion("Was ist Kajona?");
         $objFaq1->setStrAnswer("Kajona ist ein Open Source Content Management System basierend auf PHP und einer Datenbank. Dank der modularen Bauweise ist Kajona einfach erweiter- und anpassbar.");
         $objFaq2->setStrQuestion("Wer entwickelt Kajona, wo gibt es weitere Infos?");
         $objFaq2->setStrAnswer("Kajona wird von einer Open Source Community entwickelt. Da Kajona ständig weiterentwickelt wird, sind wir jederzeit auf der Suche nach Helfern, seien es Programmierer, Grafiker, Betatester und auch Anwender. Weitere Informationen hierzu finden Sie auf <a href=\"http://www.kajona.de\">www.kajona.de</a>.");
     } else {
         $objFaq1->setStrQuestion("What is Kajona?");
         $objFaq1->setStrAnswer("Kajona is an open source content management system based on PHP and a database. Due to it's modular design, it can be extended and adopted very easily.");
         $objFaq2->setStrQuestion("Who develops Kajona, where can I find more infos?");
         $objFaq2->setStrAnswer("Kajona is being developed by an open source community. Since Kajona is still being developed, we are searching for contributors. Further information can be found at <a href=\"http://www.kajona.de\">www.kajona.de</a>.");
     }
     $strReturn .= "Saving faqs...\n";
     $objFaq1->updateObjectToDb();
     $objFaq2->updateObjectToDb();
     $strReturn .= "Creating faqs-page\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("faqs");
     $objPage->setStrBrowsername("FAQs");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strFaqsPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strFaqsPageId . "\n";
     $strReturn .= "Adding faqs-element to new page\n";
     if (class_module_pages_element::getElement("faqs") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("faqs");
         $objPagelement->updateObjectToDb($strFaqsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_faqs\n                            SET faqs_category= ?,\n                                faqs_template = ?\n                          WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array(0, "demo_foldable.tpl", $strElementId))) {
             $strReturn .= "faqselement created.\n";
         } else {
             $strReturn .= "Error creating faqselement.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strFaqsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                             SET paragraph_title = ?\n                           WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("FAQs", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     return $strReturn;
 }
 private function processSinglePage($arrPage, $bitReplaceExisting, $strTopFolderId)
 {
     $strReturn = "";
     $arrMetadata = $arrPage["metadata"][0];
     $arrElements = $arrPage["elements"][0]["element"];
     //create page itself
     $strPagename = $arrMetadata["pagename"][0]["value"];
     $strPrevId = "";
     //check if the exported prev-values may be used
     $strImportPrevName = $arrMetadata["prevname"][0]["value"];
     if ($strImportPrevName != "") {
         $objPage = class_module_pages_page::getPageByName($strImportPrevName);
         if ($objPage !== null) {
             $strPrevId = $objPage->getSystemid();
         }
     } elseif (validateSystemid($arrMetadata["previd"][0]["value"])) {
         $objRoot = class_objectfactory::getInstance()->getObject($arrMetadata["previd"][0]["value"]);
         if ($objRoot !== null) {
             $strPrevId = $arrMetadata["previd"][0]["value"];
         }
     }
     if ($strPrevId == "") {
         $strPrevId = $strTopFolderId;
     }
     //check if an existing page should be replaced
     if ($bitReplaceExisting) {
         $objPage = class_module_pages_page::getPageByName($strPagename);
         if ($objPage !== null) {
             $strPrevId = $objPage->getPrevId();
             $objPage->deleteObject();
         }
         class_carrier::getInstance()->getObjDB()->flushQueryCache();
     }
     $objPage = new class_module_pages_page();
     $objPage->setStrName($strPagename);
     $objPage->updateObjectToDb($strPrevId);
     $strPageId = $objPage->getSystemid();
     $strReturn .= "created page " . $objPage->getStrName() . "\n";
     //save propertysets
     $objLanguages = new class_module_languages_language();
     $strCurrentLanguage = $objLanguages->getStrAdminLanguageToWorkOn();
     $arrPropertysets = $arrMetadata["pageproperties"][0]["propertyset"];
     foreach ($arrPropertysets as $arrOnePropSet) {
         class_carrier::getInstance()->getObjDB()->flushQueryCache();
         $objLanguages->setStrAdminLanguageToWorkOn($arrOnePropSet["attributes"]["language"]);
         //reload page to save correct prop-sets
         $objPage = new class_module_pages_page($strPageId);
         $objPage->setStrLanguage($arrOnePropSet["language"][0]["value"]);
         $objPage->setStrBrowsername($arrOnePropSet["browsername"][0]["value"]);
         $objPage->setStrDesc($arrOnePropSet["description"][0]["value"]);
         $objPage->setStrKeywords($arrOnePropSet["keywords"][0]["value"]);
         $objPage->setStrTemplate($arrOnePropSet["template"][0]["value"]);
         $objPage->setStrSeostring($arrOnePropSet["seostring"][0]["value"]);
         $objPage->setStrLanguage($arrOnePropSet["language"][0]["value"]);
         $objPage->setStrAlias($arrOnePropSet["alias"][0]["value"]);
         $objPage->setStrTarget($arrOnePropSet["target"][0]["value"]);
         $objPage->setStrPath($arrOnePropSet["path"][0]["value"]);
         $objPage->updateObjectToDb();
         $strReturn .= "saved propertyset for language " . $objPage->getStrLanguage() . "\n";
     }
     $objLanguages->setStrAdminLanguageToWorkOn($strCurrentLanguage);
     //and import each element
     foreach ($arrElements as $arrSingleElement) {
         //validate if element exists
         $strElementName = $arrSingleElement["metadata"][0]["element"][0]["value"];
         if (class_module_pages_element::getElement($strElementName) !== null) {
             $objElement = new class_module_pages_pageelement();
             $objElement->setStrPlaceholder($arrSingleElement["metadata"][0]["placeholder"][0]["value"]);
             $objElement->setStrName($arrSingleElement["metadata"][0]["name"][0]["value"]);
             $objElement->setStrElement($arrSingleElement["metadata"][0]["element"][0]["value"]);
             $objElement->setStrTitle($arrSingleElement["metadata"][0]["title"][0]["value"]);
             $objElement->setStrLanguage($arrSingleElement["metadata"][0]["language"][0]["value"]);
             $objElement->updateObjectToDb($strPageId);
             //and the foreign table
             $strTable = $arrSingleElement["foreignTable"][0]["attributes"]["table"];
             $arrValues = array();
             foreach ($arrSingleElement["foreignTable"][0]["column"] as $arrColumn) {
                 $arrValues[$arrColumn["attributes"]["name"]] = isset($arrColumn["value"]) ? $arrColumn["value"] : "";
             }
             unset($arrValues["content_id"]);
             //and build the query itself
             $strQuery = "UPDATE " . class_carrier::getInstance()->getObjDB()->encloseTableName(_dbprefix_ . $strTable) . " SET ";
             $arrInsertValues = array();
             $arrEscapes = array();
             $arrColumns = class_carrier::getInstance()->getObjDB()->getColumnsOfTable(_dbprefix_ . $strTable);
             $arrColumns = array_map(function ($arrColumn) {
                 return $arrColumn["columnName"];
             }, $arrColumns);
             foreach ($arrValues as $strColumn => $strValue) {
                 if (!in_array($strColumn, $arrColumns)) {
                     continue;
                 }
                 $strQuery .= class_carrier::getInstance()->getObjDB()->encloseColumnName($strColumn) . " = ? ,";
                 $arrInsertValues[] = $strValue;
                 $arrEscapes[] = false;
             }
             $strQuery = uniSubstr($strQuery, 0, -1);
             $strQuery .= " WHERE content_id = ?";
             $arrInsertValues[] = $objElement->getSystemid();
             class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, $arrInsertValues, $arrEscapes);
             $strReturn .= "created element " . $objElement->getStrName() . "\n";
         } else {
             $strReturn .= "error: element " . $strElementName . " not existing";
         }
     }
     return $this->objToolkit->getPreformatted(array($strReturn));
 }
Esempio n. 11
0
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating voting\n";
     $objVoting = new class_module_votings_voting();
     if ($this->strContentLanguage == "de") {
         $objVoting->setStrTitle("Wie gefällt Ihnen unsere neue Webseite?");
     } else {
         $objVoting->setStrTitle("How do you like our new website?");
     }
     $objVoting->updateObjectToDb();
     $objAnswer1 = new class_module_votings_answer();
     $objAnswer2 = new class_module_votings_answer();
     $objAnswer3 = new class_module_votings_answer();
     if ($this->strContentLanguage == "de") {
         $objAnswer1->setStrText("Gefällt mir sehr gut!");
         $objAnswer2->setStrText("Ausbaufähig...");
         $objAnswer3->setStrText("Brennt im Kühlschrank immer Licht?");
     } else {
         $objAnswer1->setStrText("I like it!");
         $objAnswer2->setStrText("Well, work on it");
         $objAnswer3->setStrText("Sunglasses at night");
     }
     $objAnswer1->updateObjectToDb($objVoting->getSystemid());
     $objAnswer2->updateObjectToDb($objVoting->getSystemid());
     $objAnswer3->updateObjectToDb($objVoting->getSystemid());
     $strReturn .= "Creating voting-page\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("votings");
     $objPage->setStrBrowsername("Votings");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strFaqsPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strFaqsPageId . "\n";
     $strReturn .= "Adding votings-element 1 to new page\n";
     if (class_module_pages_element::getElement("faqs") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("votings");
         $objPagelement->updateObjectToDb($strFaqsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                            SET " . $this->objDB->encloseColumnName("int1") . " = ?,\n                                " . $this->objDB->encloseColumnName("char1") . " = ?,\n                                " . $this->objDB->encloseColumnName("char2") . " = ?\n                          WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array(0, $objVoting->getSystemid(), "votings.tpl", $strElementId))) {
             $strReturn .= "faqselement created.\n";
         } else {
             $strReturn .= "Error creating faqselement.\n";
         }
     }
     $strReturn .= "Adding votings-element 2 to new page\n";
     if (class_module_pages_element::getElement("faqs") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("votings");
         $objPagelement->updateObjectToDb($strFaqsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                            SET " . $this->objDB->encloseColumnName("int1") . " = ?,\n                                " . $this->objDB->encloseColumnName("char1") . " = ?,\n                                " . $this->objDB->encloseColumnName("char2") . " = ?\n                          WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array(1, $objVoting->getSystemid(), "votings.tpl", $strElementId))) {
             $strReturn .= "faqselement created.\n";
         } else {
             $strReturn .= "Error creating faqselement.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strFaqsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                             SET paragraph_title = ?\n                           WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Votings", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     return $strReturn;
 }
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  * @return string
  */
 public function install()
 {
     $strReturn = "";
     if (class_module_system_module::getModuleByName("mediamanager") == null) {
         return "Mediamanger not installed, skipping element\n";
     }
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating new downloads...\n";
     $objDownloads = new class_module_mediamanager_repo();
     $objDownloads->setStrTitle("Sample downloads");
     $objDownloads->setStrPath("/files/downloads");
     $objDownloads->updateObjectToDb();
     $strDownloadsID = $objDownloads->getSystemid();
     $objDownloads->syncRepo();
     $strReturn .= "Adding download-permissions for guests...\n";
     class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objDownloads->getSystemid(), "right2");
     $strReturn .= "Adding rating-permissions for guests...\n";
     class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objDownloads->getSystemid(), "right3");
     $strReturn .= "Creating new downloads page...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("downloads");
     $objPage->setStrBrowsername("Downloads");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strDownloadsPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strDownloadsPageId . "\n";
     $strReturn .= "Adding pagelement to new page\n";
     $objPagelement = new class_module_pages_pageelement();
     if (class_module_pages_element::getElement("downloads") != null) {
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("downloads");
         $objPagelement->updateObjectToDb($strDownloadsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_downloads\n                            SET download_id = ?,\n                                download_template = ?\n                            WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array($strDownloadsID, "downloads.tpl", $strElementId))) {
             $strReturn .= "downloads element created.\n";
         } else {
             $strReturn .= "Error creating downloads element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strDownloadsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Downloads", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     return $strReturn;
 }
Esempio n. 13
0
 /**
  * Does the hard work: installs the module and registers needed constants
  * @return string
  */
 public function install()
 {
     $strReturn = "";
     $strReturn .= "Shifting pages to first position...\n";
     $objPagesModule = class_module_system_module::getModuleByName("pages");
     $objPagesModule->setAbsolutePosition(3);
     $strReturn .= "Setting default template...\n";
     $objConstant = class_module_system_setting::getConfigByName("_pages_defaulttemplate_");
     $objConstant->setStrValue("standard.tpl");
     $objConstant->updateObjectToDb();
     $strReturn .= "Creating system folder...\n";
     $objFolder = new class_module_pages_folder();
     $objFolder->setStrName("_system");
     $objFolder->updateObjectToDb(class_module_system_module::getModuleByName("pages")->getSystemid());
     $strSystemFolderID = $objFolder->getSystemid();
     $strReturn .= "ID of new folder: " . $strSystemFolderID . "\n";
     $strReturn .= "Creating mainnavigation folder...\n";
     $objFolder = new class_module_pages_folder();
     $objFolder->setStrName("mainnavigation");
     $objFolder->updateObjectToDb(class_module_system_module::getModuleByName("pages")->getSystemid());
     $strMainnavigationFolderID = $objFolder->getSystemid();
     $strReturn .= "ID of new folder: " . $strSystemFolderID . "\n";
     $strReturn .= "Creating index-site...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("index");
     if ($this->strContentLanguage == "de") {
         $objPage->setStrBrowsername("Willkommen");
     } else {
         $objPage->setStrBrowsername("Welcome");
     }
     $objPage->setStrTemplate("home.tpl");
     $objPage->updateObjectToDb();
     $this->strIndexID = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $this->strIndexID . "\n";
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($this->strIndexID);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Willkommen";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Welcome";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-elements to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("content_paragraph|image");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($this->strIndexID);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Herzlichen Glückwunsch!";
             $arrParams[] = "Diese Installation von Kajona war erfolgreich. Wir wünschen viel Spaß mit Kajona V4.<br />\n                                Nehmen Sie sich die Zeit und betrachten Sie die einzelnen Seiten, die mit Beispielinhalten befüllt wurde. Sie gelangen jederzeit auf diese\n                                Seite durch den Link &quot;Home&quot; zurück.<br/>\n                                Um die Inhalte der Webseite zu verändern sollten Sie sich als erstes am Administrationsbereich <a href='_webpath_/admin'>anmelden</a>.\n                                Für weitere Informationen und Support besuchen Sie unsere Webseite: <a href=\"http://www.kajona.de\">www.kajona.de</a><br/>\n                                Das gesamte Kajona-Team wünscht viel Spa&szlig; beim Verwalten der Webseite mit Kajona!";
             $arrParams[] = "/files/images/upload/teaser.jpg";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Congratulations!";
             $arrParams[] = "This installation of Kajona was successful. Have fun using Kajona V4!<br />\n                                Take some time and watch the pages already created and have a look at the sample-contents assigned to those page.\n                                You may return to this page any time by clicking the &quot;home&quot; link.<br/>\n                                To modify the contents of this webpage you have to <a href='_webpath_/admin'>log in</a> at the administration-backend.\n                                For further information, support or proposals, please visit our website: <a href=\"http://www.kajona.de\">www.kajona.de</a><br/>\n                                The Kajona-Team hopes you'll enjoy managing your website with Kajona!";
             $arrParams[] = "/files/images/upload/teaser.jpg";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?,\n                                    paragraph_content =  ?,\n                                    paragraph_image = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("column1_paragraph|image");
         $objPagelement->setStrName("column1");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($this->strIndexID);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Teaser 1";
             $arrParams[] = "Dieser Text-Absatz befindet sich am Platzhalter column1_paragraph|image, der im Standard-Template links ausgerichtet ist. Sobald Sie sich am\n                                System <a href='_webpath_/admin'>angemeldet</a> haben und das Portal erneut aufrufen, wird der Portal-Editor angezeigt. Nutzen Sie Drag n Drop\n                                um diesen Text-Absatz an einen anderen Platzhalter in diesem Template zu verschieben. Einzige Voraussetzung hierfür ist, dass der Platzhalter\n                                Elemente des Typs paragraph zulässt.";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Teaser 1";
             $arrParams[] = "This paragraph is located at the placeholder column1_paragraph|image. The default-template aligns this placeholder to the left.\n                                As soon as you <a href='_webpath_/admin'>log in</a> at the administration-backend and reload the portal, the portal-editor is being shown.\n                                Use drag n drop to rearrange this placeholder and move it to another placeholder.\n                                The only limitation when dropping the element is, that the target-placeholder allows elements of the type paragraph.";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?,\n                                    paragraph_content =  ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("column2_paragraph|image");
         $objPagelement->setStrName("column2");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($this->strIndexID);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Teaser 2";
             $arrParams[] = "Der Platzhalter dieses Elementes lautet column2_paragraph|image. Daher ist er für alle anderen Absätze auf dieser Seite ein gültiger Ziel-Platzhalter,\n                                sobald ein Absatz per drag n drop verschoben wird. Verschieben Sie die Absätze auf dieser Seite, um ein erstes Gefühl hierfür zu bekommen.";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Teaser 2";
             $arrParams[] = "The placeholder of this paragraph is defined as column2_paragraph|image. Therefore it is a valid target-placeholder for other paragraphs on the current\n                                page. Try to move paragraph on this site in order so see how the possible drop-areas are being highlighted.";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?,\n                                    paragraph_content =  ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("column3_paragraph|image");
         $objPagelement->setStrName("column3");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($this->strIndexID);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Teaser 3";
             $arrParams[] = "Der Platzhalter dieses Elementes lautet column3_paragraph|image. Daher ist er für alle anderen Absätze auf dieser Seite ein gültiger Ziel-Platzhalter,\n                                sobald ein Absatz per drag n drop verschoben wird. Verschieben Sie die Absätze auf dieser Seite, um ein erstes Gefühl hierfür zu bekommen.";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Teaser 3";
             $arrParams[] = "The placeholder of this paragraph is defined as column3_paragraph|image. Therefore it is a valid target-placeholder for other paragraphs on the current\n                                page. Try to move paragraph on this site in order so see how the possible drop-areas are being highlighted.";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?,\n                                    paragraph_content =  ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     $strReturn .= "Creating master-page\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("master");
     $objPage->setStrBrowsername("master");
     $objPage->setStrTemplate("master.tpl");
     $objPage->updateObjectToDb($strSystemFolderID);
     $this->strMasterID = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $this->strMasterID . "\n";
     $strReturn .= "Creating error-site...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("error");
     if ($this->strContentLanguage == "de") {
         $objPage->setStrBrowsername("Fehler");
     } else {
         $objPage->setStrBrowsername("Error");
     }
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strSystemFolderID);
     $strErrorPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strErrorPageId . "\n";
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strErrorPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Fehler";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Error";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("content_paragraph|image");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strErrorPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Ein Fehler ist aufgetreten";
             $arrParams[] = "Während Ihre Anfrage ist leider ein Fehler aufgetreten.<br />Bitte versuchen Sie die letzte Aktion erneut.";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "An error occurred";
             $arrParams[] = "Maybe the requested page doesn\\'t exist anymore.<br />Please try it again later.";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                        SET paragraph_title = ?,\n                            paragraph_content = ?\n                        WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     $strReturn .= "Creating imprint-site...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("imprint");
     if ($this->strContentLanguage == "de") {
         $objPage->setStrBrowsername("Impressum");
     } else {
         $objPage->setStrBrowsername("Imprint");
     }
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strSystemFolderID);
     $strImprintPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strImprintPageId . "\n";
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strImprintPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Impressum";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Imprint";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("content_paragraph|image");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strImprintPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Impressum";
             $arrParams[] = "Bitte tragen Sie hier Ihre Kontaktdaten ein.<br />\n                               Nachname, Name<br />\n                               Straße und Hausnummer<br />\n                               PLZ, Ort<br />\n                               Telefon<br />\n                               E-Mail<br />\n                               <br />\n                               Site powered by <a href=\"http://www.kajona.de\" target=\"_blank\" title=\"Kajona CMS - empowering your content\">Kajona</a><br /><a href=\"http://www.kajona.de\" target=\"_blank\" title=\"Kajona CMS - empowering your content\"><img src=\"_webpath_/templates/default/pics/default/kajona_poweredby.png\" alt=\"Kajona\" /></a><br />";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Imprint";
             $arrParams[] = "Please provide your contact details.<br />\n                               Name, Forename<br />\n                               Street<br />\n                               Zip, City<br />\n                               Phone<br />\n                               Mail<br />\n                               <br />\n                               Site powered by <a href=\"http://www.kajona.de\" target=\"_blank\" title=\"Kajona CMS - empowering your content\">Kajona</a><br /><a href=\"http://www.kajona.de\" target=\"_blank\" title=\"Kajona CMS - empowering your content\"><img src=\"_webpath_/templates/default/pics/default/kajona_poweredby.png\" alt=\"Kajona\" /></a><br />";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                        SET paragraph_title = ?,\n                           paragraph_content = ?\n                      WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams, array(true, false))) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     $strReturn .= "Creating sample page...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("page_1");
     if ($this->strContentLanguage == "de") {
         $objPage->setStrBrowsername("Beispielseite 1");
     } else {
         $objPage->setStrBrowsername("Sample page 1");
     }
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strMainnavigationFolderID);
     $strSamplePageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strSamplePageId . "\n";
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strSamplePageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Beispielseite 1";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Sample page 1";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("content_paragraph|image");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strSamplePageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Standard-Absatz";
             $arrParams[] = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
             $arrParams[] = "/files/images/samples/IMG_3000.JPG";
             $arrParams[] = "http://www.kajona.de/";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Standard paragraph";
             $arrParams[] = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
             $arrParams[] = "/files/images/samples/IMG_3000.JPG";
             $arrParams[] = "http://www.kajona.de/";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?,\n                                paragraph_content = ?,\n                                paragraph_image = ?,\n                                paragraph_link = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     $strReturn .= "Creating sample subpage...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("subpage_1");
     if ($this->strContentLanguage == "de") {
         $objPage->setStrBrowsername("Beispiel-Unterseite 1");
     } else {
         $objPage->setStrBrowsername("Sample subpage 1");
     }
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strSamplePageId);
     $strSampleSubPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strSampleSubPageId . "\n";
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strSampleSubPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Beispiel-Unterseite 1";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Sample subpage 1";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("content_paragraph|image");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strSampleSubPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "Standard-Absatz auf Unterseite";
             $arrParams[] = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "Standard paragraph on subpage";
             $arrParams[] = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                            SET paragraph_title = ?,\n                                paragraph_content = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     return $strReturn;
 }
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  */
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating new postacomment page...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("postacomment");
     $objPage->setStrBrowsername("Postacomment");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strPostacommentPageID = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strPostacommentPageID . "\n";
     $strReturn .= "Adding pagelement to new page\n";
     if (class_module_pages_element::getElement("postacomment") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("postacomment");
         $objPagelement->updateObjectToDb($strPostacommentPageID);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                                SET char1 = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("postacomment_ajax.tpl", $strElementId))) {
             $strReturn .= "Postacomment element created.\n";
         } else {
             $strReturn .= "Error creating Postacomment element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strPostacommentPageID);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Postacomment Sample", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("text_paragraph");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strPostacommentPageID);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "";
             $arrParams[] = "Über das unten stehende Formular kann dieser Seite ein Kommentar hinzugefügt werden.";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "";
             $arrParams[] = "By using the form below, comments may be added to the current page. ";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                    SET paragraph_title = ?,\n                                        paragraph_content = ?\n                                  WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     return $strReturn;
 }
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating event\n";
     $objEvent = new class_module_eventmanager_event();
     $objEvent->setObjStartDate(new class_date());
     $objEvent->setObjEndDate(new class_date(time() + 3600));
     $objEvent->setIntRegistrationRequired(1);
     $objEvent->setIntEventStatus(2);
     if ($this->strContentLanguage == "de") {
         $objEvent->setStrTitle("Start der neuen Webseite mit Kajona");
         $objEvent->setStrDescription("Die neue Webseite ist online!<br />Als Basis dafür kommt das freie Open Source Content Management System <a href=\"http://www.kajona.de\">Kajona</a>, zum Einsatz.");
     } else {
         $objEvent->setStrTitle("Launch of the new website");
         $objEvent->setStrDescription("The new website is available!<br />The page is based on <a href=\"http://www.kajona.de\">Kajona</a>, a free open source content management system.");
     }
     $strReturn .= "Saving event...\n";
     $objEvent->updateObjectToDb();
     $strReturn .= "Creating events-page\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("events");
     $objPage->setStrBrowsername("Events");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strEventsPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strEventsPageId . "\n";
     $strReturn .= "Adding eventmanager-element to new page\n";
     if (class_module_pages_element::getElement("eventmanager") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("eventmanager");
         $objPagelement->updateObjectToDb($strEventsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_universal\n                            SET char1 = ?,\n                                " . $this->objDB->encloseColumnName("int1") . " = ?,\n                                " . $this->objDB->encloseColumnName("int2") . " = ?\n                          WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array("eventmanager.tpl", 0, 0, $strElementId))) {
             $strReturn .= "eventmanger-element created.\n";
         } else {
             $strReturn .= "Error creating eventmanager-element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strEventsPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                             SET paragraph_title = ?\n                           WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Events", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     return $strReturn;
 }
Esempio n. 16
0
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  */
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     //search the index page
     $objIndex = class_module_pages_page::getPageByName("index");
     $objMaster = class_module_pages_page::getPageByName("master");
     if ($objIndex != null) {
         $this->strIndexID = $objIndex->getSystemid();
     }
     if ($objMaster != null) {
         $this->strMasterID = $objMaster->getSystemid();
     }
     $strReturn .= "Creating new category...\n";
     $objNewsCategory = new class_module_news_category();
     $objNewsCategory->setStrTitle("TOP-News");
     $objNewsCategory->updateObjectToDb();
     $strCategoryID = $objNewsCategory->getSystemid();
     $strReturn .= "ID of new category: " . $strCategoryID . "\n";
     $strReturn .= "Creating news\n";
     $objNews = new class_module_news_news();
     if ($this->strContentLanguage == "de") {
         $objNews->setStrTitle("Erfolgreich installiert");
         $objNews->setStrText("Eine weitere Installation von Kajona V3 war erfolgreich. Für weitere Infomationen zu Kajona besuchen Sie www.kajona.de.");
         $objNews->setStrIntro("Kajona wurde erfolgreich installiert...");
     } else {
         $objNews->setStrTitle("Installation successful");
         $objNews->setStrText("Another installation of Kajona was successful. For further information, support or proposals, please visit our website: www.kajona.de");
         $objNews->setStrIntro("Kajona installed successfully...");
     }
     $objNews->setObjDateStart(new class_date());
     $objNews->setArrCats(array($strCategoryID));
     $objNews->updateObjectToDb();
     $strNewsId = $objNews->getSystemid();
     $strReturn .= "ID of new news: " . $strNewsId . "\n";
     $strReturn .= "Creating news\n";
     $objNews = new class_module_news_news();
     $objNews->setStrTitle("Sed non enim est");
     $objNews->setStrText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non enim est, id hendrerit metus. Sed tempor quam sed ante viverra porta. Quisque sagittis egestas tortor, in euismod sapien iaculis at. Nullam vitae nunc tortor. Mauris justo lectus, bibendum et rutrum id, fringilla eget ipsum. Nullam volutpat sodales mollis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis tempor ante eget justo blandit imperdiet. Praesent ut risus tempus metus sagittis fermentum eget eu elit. Mauris consequat ornare massa, a rhoncus enim sodales auctor. Duis lacinia dignissim eros vel mollis. Etiam metus tortor, pellentesque eu ultricies sit amet, elementum et dolor. Proin tincidunt nunc id magna volutpat lobortis. Vivamus metus quam, accumsan eget vestibulum vel, rutrum sit amet mauris. Phasellus lectus leo, vulputate eget molestie et, consectetur nec urna. ");
     $objNews->setStrIntro("Quisque sagittis egestas tortor");
     $objNews->setObjDateStart(new class_date());
     $objNews->setArrCats(array($strCategoryID));
     $objNews->updateObjectToDb();
     $strNewsId = $objNews->getSystemid();
     $strReturn .= "ID of new news: " . $strNewsId . "\n";
     $strReturn .= "Adding news element to the master-page...\n";
     if ($this->strMasterID != "") {
         if (class_module_pages_element::getElement("news") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("mastertopnews_news");
             $objPagelement->setStrName("mastertopnews");
             $objPagelement->setStrElement("news");
             $objPagelement->updateObjectToDb($this->strMasterID);
             $strElementId = $objPagelement->getSystemid();
             $strQuery = "UPDATE " . _dbprefix_ . "element_news\n                                SET news_category=?,\n                                    news_view = ?,\n                                    news_mode = ?,\n                                    news_order = ?,\n                                    news_amount = ?,\n                                    news_detailspage = ?,\n                                    news_template = ?\n                                WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, array($strCategoryID, 0, 0, 0, 10, "newsdetails", "demo.tpl", $strElementId))) {
                 $strReturn .= "Newselement created.\n";
             } else {
                 $strReturn .= "Error creating newselement.\n";
             }
         }
     }
     $strReturn .= "Creating news-detail\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("newsdetails");
     $objPage->setStrBrowsername("News");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb();
     $strNewsdetailsId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strNewsdetailsId . "\n";
     $strReturn .= "Adding newsdetails to new page\n";
     if (class_module_pages_element::getElement("news") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("news");
         $objPagelement->updateObjectToDb($strNewsdetailsId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_news\n                            SET news_category=?,\n                                news_view = ?,\n                                news_mode = ?,\n                                news_order = ?,\n                                news_amount = ?,\n                                news_detailspage = ?,\n                                news_template = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array($strCategoryID, 1, 0, 0, 20, "index", "demo.tpl", $strElementId))) {
             $strReturn .= "Newselement created.\n";
         } else {
             $strReturn .= "Error creating newselement.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strNewsdetailsId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("News", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Creating news-list-pge\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("news");
     $objPage->setStrBrowsername("News");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strNewslistId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strNewsdetailsId . "\n";
     $strReturn .= "Adding newsdetails to new page\n";
     if (class_module_pages_element::getElement("news") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("news");
         $objPagelement->updateObjectToDb($strNewslistId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_news\n                            SET news_category=?,\n                                news_view = ?,\n                                news_mode = ?,\n                                news_order = ?,\n                                news_amount = ?,\n                                news_detailspage = ?,\n                                news_template = ?\n                            WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array($strCategoryID, 0, 0, 0, 20, "newsdetails", "demo.tpl", $strElementId))) {
             $strReturn .= "Newselement created.\n";
         } else {
             $strReturn .= "Error creating newselement.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strNewslistId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Newslist", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Creating news-feed\n";
     $objNewsFeed = new class_module_news_feed();
     $objNewsFeed->setStrTitle("kajona news");
     $objNewsFeed->setStrUrlTitle("kajona_news");
     $objNewsFeed->setStrLink("http://www.kajona.de");
     if ($this->strContentLanguage == "de") {
         $objNewsFeed->setStrDesc("Dies ist ein Kajona demo news feed");
     } else {
         $objNewsFeed->setStrDesc("This is a Kajona demo news feed");
     }
     $objNewsFeed->setStrPage($objPage->getStrName());
     $objNewsFeed->setStrCat("0");
     $objNewsFeed->setIntAmount(25);
     $objNewsFeed->updateObjectToDb();
     $strNewsFeedId = $objNewsFeed->getSystemid();
     $strReturn .= "ID of new news-feed: " . $strNewsFeedId . "\n";
     $strReturn .= "Adding rating permissions...\n";
     class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), class_module_system_module::getModuleByName("news")->getSystemid(), class_rights::$STR_RIGHT_RIGHT3);
     return $strReturn;
 }
Esempio n. 17
0
 /**
  * Does the hard work: installs the module and registers needed constants
  *
  * @return string
  */
 public function install()
 {
     if (class_module_system_module::getModuleByName("mediamanager") == null) {
         return "Mediamanger not installed, skipping element\n";
     }
     $strReturn = "";
     //fetch navifolder-id
     $strNaviFolderId = "";
     $arrFolder = class_module_pages_folder::getFolderList();
     foreach ($arrFolder as $objOneFolder) {
         if ($objOneFolder->getStrName() == "mainnavigation") {
             $strNaviFolderId = $objOneFolder->getSystemid();
         }
     }
     $strReturn .= "Creating new gallery...\n";
     $objGallery = new class_module_mediamanager_repo();
     $objGallery->setStrTitle("Sample Gallery");
     $objGallery->setStrPath(_filespath_ . "/images/samples");
     $objGallery->setStrUploadFilter(".jpg,.png,.gif,.jpeg");
     $objGallery->setStrViewFilter(".jpg,.png,.gif,.jpeg");
     $objGallery->updateObjectToDb();
     $objGallery->syncRepo();
     $strGalleryID = $objGallery->getSystemid();
     $strReturn .= "Modify rights to allow guests to rate images...\n";
     class_carrier::getInstance()->getObjRights()->addGroupToRight(class_module_system_setting::getConfigValue("_guests_group_id_"), $objGallery->getSystemid(), "right3");
     $strReturn .= "Creating new gallery page...\n";
     $objPage = new class_module_pages_page();
     $objPage->setStrName("gallery");
     $objPage->setStrBrowsername("Gallery");
     $objPage->setStrTemplate("standard.tpl");
     $objPage->updateObjectToDb($strNaviFolderId);
     $strGalleryPageId = $objPage->getSystemid();
     $strReturn .= "ID of new page: " . $strGalleryPageId . "\n";
     $strReturn .= "Adding pagelement to new page\n";
     if (class_module_pages_element::getElement("gallery") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
         $objPagelement->setStrName("special");
         $objPagelement->setStrElement("gallery");
         $objPagelement->updateObjectToDb($strGalleryPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_gallery\n                            SET gallery_id = ?,\n                                gallery_mode = ?,\n                                gallery_template = ?,\n                                gallery_maxh_d = ?,\n                                gallery_maxw_d = ?,\n                                gallery_imagesperpage = ?,\n                                gallery_text = ?,\n                                gallery_text_x = ?,\n                                gallery_text_y = ?\n                            WHERE content_id = ? ";
         if ($this->objDB->_pQuery($strQuery, array($strGalleryID, 0, "gallery_imagelightbox.tpl", 600, 600, 0, "(c) kajona.de", 5, 15, $strElementId))) {
             $strReturn .= "Gallery element created.\n";
         } else {
             $strReturn .= "Error creating Gallery element.\n";
         }
     }
     $strReturn .= "Adding headline-element to new page\n";
     if (class_module_pages_element::getElement("row") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("headline_row");
         $objPagelement->setStrName("headline");
         $objPagelement->setStrElement("row");
         $objPagelement->updateObjectToDb($strGalleryPageId);
         $strElementId = $objPagelement->getSystemid();
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, array("Gallery", $strElementId))) {
             $strReturn .= "Headline element created.\n";
         } else {
             $strReturn .= "Error creating headline element.\n";
         }
     }
     $strReturn .= "Adding paragraph-element to new page\n";
     if (class_module_pages_element::getElement("paragraph") != null) {
         $objPagelement = new class_module_pages_pageelement();
         $objPagelement->setStrPlaceholder("text_paragraph");
         $objPagelement->setStrName("text");
         $objPagelement->setStrElement("paragraph");
         $objPagelement->updateObjectToDb($strGalleryPageId);
         $strElementId = $objPagelement->getSystemid();
         $arrParams = array();
         if ($this->strContentLanguage == "de") {
             $arrParams[] = "";
             $arrParams[] = "Alle Beispielbilder &copy; by kajona.de";
             $arrParams[] = $strElementId;
         } else {
             $arrParams[] = "";
             $arrParams[] = "All sample images &copy; by kajona.de";
             $arrParams[] = $strElementId;
         }
         $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                SET paragraph_title = ?,\n                                    paragraph_content = ?\n                                WHERE content_id = ?";
         if ($this->objDB->_pQuery($strQuery, $arrParams)) {
             $strReturn .= "Paragraph element created.\n";
         } else {
             $strReturn .= "Error creating paragraph element.\n";
         }
     }
     return $strReturn;
 }
 /**
  * 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;
 }
Esempio n. 19
0
 /**
  * Wrapper to load a single element and generate the image
  * @return void
  */
 private function generateMediamanagerImage()
 {
     if (class_module_system_module::getModuleByName("mediamanager") !== null) {
         $objElement = new class_module_pages_pageelement($this->strElementId);
         $objPortalElement = $objElement->getConcretePortalInstance();
         $objFile = new class_module_mediamanager_file($this->strSystemid);
         if (!$objFile->rightView()) {
             class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN);
             class_response_object::getInstance()->sendHeaders();
             return;
         }
         $arrElementData = $objPortalElement->getElementContent($objElement->getSystemid());
         class_session::getInstance()->sessionClose();
         if (is_file(_realpath_ . $objFile->getStrFilename())) {
             $objImage = new class_image2();
             $objImage->load($objFile->getStrFilename());
             $objImage->addOperation(new class_image_scale($arrElementData["gallery_maxw_d"], $arrElementData["gallery_maxh_d"]));
             $objImage->addOperation(new class_image_text($arrElementData["gallery_text"], $arrElementData["gallery_text_x"], $arrElementData["gallery_text_y"], 10, "#ffffff"));
             if (is_file(_realpath_ . $arrElementData["gallery_overlay"])) {
                 $objImageOverlay = new class_image2();
                 $objImageOverlay->load($arrElementData["gallery_overlay"]);
                 $objImage->addOperation(new class_image_overlay($arrElementData["gallery_overlay"], $arrElementData["gallery_text_x"], $arrElementData["gallery_text_y"]));
             }
             $objImage->setJpegQuality((int) $this->intQuality);
             $objImage->sendToBrowser();
             return;
         }
     }
     class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND);
     class_response_object::getInstance()->sendHeaders();
 }
Esempio n. 20
0
 /**
  * Does the hard work: installs the module and registers needed constants
  */
 public function install()
 {
     $strReturn = "";
     //fetch navifolder-id
     //navigations installed?
     $objModule = null;
     try {
         $objModule = class_module_system_module::getModuleByName("pages", true);
     } catch (class_exception $objException) {
         $objModule = null;
     }
     if ($objModule != null) {
         $strSystemFolderId = "";
         $arrFolder = class_module_pages_folder::getFolderList();
         foreach ($arrFolder as $objOneFolder) {
             if ($objOneFolder->getStrName() == "_system") {
                 $strSystemFolderId = $objOneFolder->getSystemid();
             }
         }
         //search the master page
         $objMaster = class_module_pages_page::getPageByName("master");
         if ($objMaster != null) {
             $this->strMasterID = $objMaster->getSystemid();
         }
         $strReturn .= "Adding search-element to master page\n";
         if ($this->strMasterID != "" && class_module_pages_element::getElement("search") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("mastersearch_search");
             $objPagelement->setStrName("mastersearch");
             $objPagelement->setStrElement("search");
             $objPagelement->updateObjectToDb($this->strMasterID);
             $strElementId = $objPagelement->getSystemid();
             $strQuery = "UPDATE " . _dbprefix_ . "element_search\n                                        SET search_template = ?,\n                                            search_amount = ?,\n                                            search_page = ?\n                                        WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, array("search_ajax_small.tpl", 0, "search", $strElementId))) {
                 $strReturn .= "Search element created.\n";
             } else {
                 $strReturn .= "Error creating search element.\n";
             }
         }
         $strReturn .= "Creating search page\n";
         $objPage = new class_module_pages_page();
         $objPage->setStrName("search");
         if ($this->strContentLanguage == "de") {
             $objPage->setStrBrowsername("Suchergebnisse");
         } else {
             $objPage->setStrBrowsername("Search results");
         }
         $objPage->setStrTemplate("standard.tpl");
         $objPage->updateObjectToDb($strSystemFolderId);
         $strSearchresultsId = $objPage->getSystemid();
         $strReturn .= "ID of new page: " . $strSearchresultsId . "\n";
         $strReturn .= "Adding search-element to new page\n";
         if (class_module_pages_element::getElement("search") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("special_news|guestbook|downloads|gallery|galleryRandom|form|tellafriend|maps|search|navigation|faqs|postacomment|votings|userlist|rssfeed|tagto|portallogin|portalregistration|portalupload|directorybrowser|lastmodified|tagcloud|downloadstoplist|flash|mediaplayer|tags|eventmanager");
             $objPagelement->setStrName("special");
             $objPagelement->setStrElement("search");
             $objPagelement->updateObjectToDb($strSearchresultsId);
             $strElementId = $objPagelement->getSystemid();
             $strQuery = "UPDATE " . _dbprefix_ . "element_search\n                                        SET search_template = ?,\n                                            search_amount = ?,\n                                            search_page = ?\n                                        WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, array("search_ajax.tpl", 0, "", $strElementId))) {
                 $strReturn .= "Search element created.\n";
             } else {
                 $strReturn .= "Error creating search element.\n";
             }
         }
         $strReturn .= "Adding headline-element to new page\n";
         if (class_module_pages_element::getElement("row") != null) {
             $objPagelement = new class_module_pages_pageelement();
             $objPagelement->setStrPlaceholder("headline_row");
             $objPagelement->setStrName("headline");
             $objPagelement->setStrElement("row");
             $objPagelement->updateObjectToDb($strSearchresultsId);
             $strElementId = $objPagelement->getSystemid();
             $arrParams = array();
             if ($this->strContentLanguage == "de") {
                 $arrParams = array("Suchergebnisse", $strElementId);
             } else {
                 $arrParams = array("Search results", $strElementId);
             }
             $strQuery = "UPDATE " . _dbprefix_ . "element_paragraph\n                                        SET paragraph_title = ?\n                                        WHERE content_id = ?";
             if ($this->objDB->_pQuery($strQuery, $arrParams)) {
                 $strReturn .= "Headline element created.\n";
             } else {
                 $strReturn .= "Error creating headline element.\n";
             }
         }
     }
     $strReturn .= "Creating navigation point.\n";
     //navigations installed?
     $objModule = null;
     try {
         $objModule = class_module_system_module::getModuleByName("navigation", true);
     } catch (class_exception $objException) {
         $objModule = null;
     }
     if ($objModule != null) {
         $objNavi = class_module_navigation_tree::getNavigationByName("portalnavigation");
         $strTreeId = $objNavi->getSystemid();
         $objNaviPoint = new class_module_navigation_point();
         if ($this->strContentLanguage == "de") {
             $objNaviPoint->setStrName("Suche");
         } else {
             $objNaviPoint->setStrName("Search");
         }
         $objNaviPoint->setStrPageI("search");
         $objNaviPoint->updateObjectToDb($strTreeId);
         $strReturn .= "ID of new navigation point: " . $objNaviPoint->getSystemid() . "\n";
     }
     return $strReturn;
 }