function _init() { parent::_init(); $this->contentType = 'text/xml'; __Paths::set('APPLICATION_PAGE_TYPE', __Paths::get('CORE_CLASSES') . 'org/glizy/oaipmh/pageTypes/'); $this->addMetadataFormat('oai_dc', 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd', 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'dc', 'http://purl.org/dc/elements/1.1/'); }
function __construct() { $this->application = org_glizy_ObjectValues::get('org.glizy', 'application'); $templatePath = __Paths::get('APPLICATION_TO_ADMIN_TEMPLATE'); if (!$templatePath) { $tempPath = __Config::get('APPLICATION_TO_ADMIN_TEMPLATE'); __Paths::set('APPLICATION_TO_ADMIN_TEMPLATE', $tempPath ? $tempPath : __Paths::get('BASE') . __Config::get('STATIC_FOLDER') . 'templates'); } }
public function export($languageId = 1, $languageCode = null, $menuIdArray = array(), $title = null, $subtitle = null, $creditPageId = null, $isExhibitionActive = null) { __Paths::set('APPLICATION_TEMPLATE_DEFAULT', __Paths::get('STATIC_DIR') . 'movio/templates/Default/'); $menuIdArray = array_flip($menuIdArray); $menuIdArray = array_fill_keys(array_keys($menuIdArray), 1); $this->medias = array(); $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy'); // scorre tutti i menù $menus = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Menu'); $menus->load('getAllMenu', array('params' => array('languageId' => $languageId))); foreach ($menus as $ar) { $menuId = $ar->menu_id; // salta tutte le pagine che non sono in menuIdArray if (!$menuIdArray[$menuId]) { continue; } $contentVO = $contentProxy->readContentFromMenu($menuId, $languageId); $contentJson = array(); foreach ($contentVO as $k => $v) { if ($k == '__title') { $contentJson['title'] = $v; continue; } if (@strpos($k, '__') === 0) { continue; } if (is_object($v)) { $contentJson[$k] = $this->convertObjectToArray($v); } else { if (@strpos($v, '{"id"') === 0) { $v = $this->addMedia($v); } $contentJson[$k] = $v; } } $arMobile = org_glizy_objectFactory::createModel('movio.models.Mobilecontents'); // informaizoni da salvare per il menu: // menuId, parent, titolo, pageType, type, contenuto // salvare solo i menu visibili // creare una tabella apposta e salvarci i dati dentro // if ($ar->menudetail_isVisible) { $arMobile->content_menuId = $menuId; $arMobile->content_pageType = $ar->menu_pageType; $arMobile->content_parent = $ar->menu_parentId; $arMobile->content_type = $ar->menu_type; $arMobile->content_title = $ar->menudetail_title; if ($arMobile->content_pageType == 'Storyteller') { $contentJson = $this->processStoryTeller($contentJson); } elseif ($arMobile->content_pageType == 'Photogallery') { $contentJson = $this->processPhotoGallery($contentJson); } elseif ($arMobile->content_pageType == 'Photogallery_category') { $arMobile->content_pageType = 'Photogallery'; $contentJson = $this->processPhotoGalleryCategory($contentJson); } elseif ($arMobile->content_pageType == 'ImageHotspot') { $contentJson = $this->processImageHotspot($contentJson); } elseif ($arMobile->content_pageType == 'Timeline') { $contentJson = $this->processTimeline($menuId, $contentJson); } elseif ($arMobile->content_pageType == 'Page') { $contentJson = $this->processPage($contentJson); } elseif ($arMobile->content_pageType == 'Exhibition') { $contentJson = $this->processExhibition($contentJson); $contentJson['isActive'] = $isExhibitionActive ? 1 : 0; } elseif ($arMobile->content_pageType == 'DigitalExhibition') { $contentJson = $this->processDigitalExhibition($contentJson); } elseif ($arMobile->content_pageType == 'Home') { $contentJson['title'] = $title; $contentJson['subtitle'] = $subtitle; } elseif ($arMobile->content_pageType == 'Video') { $contentJson = $this->processVideo($contentJson); } elseif ($arMobile->content_pageType == 'Cover') { $contentJson = $this->processCover($contentJson); } elseif ($arMobile->content_pageType == 'GoogleMap') { $contentJson = $this->processGoogleMap($contentJson); } elseif ($arMobile->content_pageType == 'Graph') { $contentJson = $this->processGraph($contentJson, $menuId, $languageCode); } if ($menuId == $creditPageId) { $arMobile->content_pageType = 'Credits'; $arMobile->content_parent = 0; } $arMobile->content_content = json_encode($contentJson); $contentId = $arMobile->save(); $it = org_glizy_objectFactory::createModelIterator('org.glizycms.core.models.Content'); $fulltextAr = $it->where("id", $menuId)->whereLanguageIs($languageId)->selectIndex('fulltext', 'document_index_fulltext_name', 'document_index_fulltext_value')->first(); if ($fulltextAr->document_index_fulltext_value) { $ar = org_glizy_objectFactory::createModel('movio.modules.publishApp.models.Mobilefulltext'); $ar->mobilefulltext_FK_content_id = $contentId; $ar->mobilefulltext_text = str_replace(' ##', '', $fulltextAr->document_index_fulltext_value); $ar->mobilefulltext_title = $contentJson['title']; $ar->mobilefulltext_subtitle = $contentJson['subtitle']; $ar->save(); } // quando menu_pageType è Entity c'è da scorrere tutti i contenuti dell'entità // e caricare i dati // salvare // documenId, titolo, contenuto if ($arMobile->content_pageType == 'Entity') { $parent = $arMobile->content_id; $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $it = __ObjectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityDocument'); $it->whereTypeIs('entity' . $contentJson['entitySelect']); foreach ($it as $arEntitySelect) { $documentId = $arEntitySelect->document_id; $c = __ObjectFactory::createComponent('movio.modules.ontologybuilder.views.components.EntityToJSON', $application, $parent, 'glz:EntityToJSON', $documentId); $c->setAttribute('visible', true); $c->process(); $c->render(); $medias = $c->getMedias(); $this->addMediaArray($medias); $graphCode = $c->getGraph(); $this->addGraph($languageCode, $documentId, $graphCode, 'document'); $jsonEntity = $c->getJson(); $jsonEntity['graph'] = 'graph/document/' . $languageCode . '/' . $documentId . '.svg'; $jsonEntity['content'] = $this->processText($jsonEntity['content']); $arContentMobile = org_glizy_objectFactory::createModel('movio.models.Mobilecontents'); $arContentMobile->content_documentId = $documentId; $arContentMobile->content_pageType = 'EntityChild'; $arContentMobile->content_parent = $parent; $arContentMobile->content_title = $arEntitySelect->title; $arContentMobile->content_content = json_encode($jsonEntity); $contentId = $arContentMobile->save(); $fulltextAr = org_glizy_objectFactory::createModel('movio.modules.publishApp.models.DocumentIndexFulltext'); $result = $fulltextAr->find(array('document_index_fulltext_FK_document_detail_id' => $arEntitySelect->document_detail_id)); if ($result) { $ar = org_glizy_objectFactory::createModel('movio.modules.publishApp.models.Mobilefulltext'); $ar->mobilefulltext_FK_content_id = $contentId; $ar->mobilefulltext_text = str_replace(' ##', '', $fulltextAr->document_index_fulltext_value); $ar->mobilefulltext_title = $arEntitySelect->title; $ar->mobilefulltext_subtitle = $arEntitySelect->subtitle; $ar->save(); } } } } } }
<?php require_once "../core/core.inc.php"; $application = org_glizy_ObjectFactory::createObject('org.glizycms.core.application.AdminApplication', 'application', '../', '../application/'); __Paths::set('APPLICATION_TO_ADMIN_TEMPLATE', '../static/movio/templates/'); $application->useXmlSiteMap = true; $application->setLanguage('it'); $application->run();