public function getGraph($entityTypeId, &$visited, &$edges) { if ($visited[$entityTypeId]) { return ''; } else { $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityProperties = $entityTypeService->getEntityTypeProperties($entityTypeId); $graph = ''; $color = __Config::get('movio.graph.shapeColor'); $entityTypeName = $entityTypeService->getEntityTypeName($entityTypeId); if ($this->getAttribute('generateLinks')) { $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $ar = $entityResolver->getMenuVisibleEntity($entityTypeId); if ($ar) { $url = $this->makeUrl($ar->id, $ar->title); } } // se è il nodo da cui inizia la ricerca ricorsiva if (count($visited) == 0) { if (empty($url)) { $graph .= '"' . $this->escape($entityTypeName) . '" [label="<div class=\'main-node\'>' . $this->escape($entityTypeName) . '</div>",style="fill: #ddd"];' . PHP_EOL; } else { $graph .= '"' . $this->escape($entityTypeName) . '" [label="<div class=\'main-node\'><a href=\'' . $url . '\'>' . $this->escape($entityTypeName) . '</a></div>",style="fill: #ddd"];' . PHP_EOL; } } else { if ($url) { $graph .= '"' . $this->escape($entityTypeName) . '" [label="<div><a href=\'' . $url . '\'>' . $this->escape($entityTypeName) . '</a>"];' . PHP_EOL; } } $visited[$entityTypeId] = true; foreach ((array) $entityProperties as $entityProperty) { if ($entityProperty['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $entityProperty['entity_properties_target_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $entityProperty['entity_properties_type']); if (!$edges[$entityTypeName][$toEntityTypeName]) { $edges[$entityTypeName][$toEntityTypeName] = true; $graph .= '"' . $this->escape($entityTypeName) . '" -> "' . $this->escape($toEntityTypeName) . '" [label="' . $label . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $referenceRelations = $entityTypeService->getEntityTypeReferenceRelations($entityTypeId); foreach ((array) $referenceRelations as $referenceRelation) { if ($referenceRelation['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $referenceRelation['entity_properties_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $referenceRelation['entity_properties_type']); if (!$edges[$toEntityTypeName][$entityTypeName]) { $edges[$toEntityTypeName][$entityTypeName] = true; $graph .= '"' . $this->escape($toEntityTypeName) . '" -> "' . $this->escape($entityTypeName) . '" [label="' . $label . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $visited[$entityTypeId] = true; return $graph; } }
public function execute($id, $model) { // TODO controllo ACL if ($id) { $contentproxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ModuleContentProxy'); $contentproxy->toggleVisibility($id, $model); org_glizy_helpers_Navigation::goHere(); } }
public function execute($id, $model) { // TODO controllo ACL if ($id) { $proxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ActiveRecordProxy'); $proxy->delete($id, $model); org_glizy_helpers_Navigation::goHere(); } }
public function executeLater($id) { // TODO controllo ACL if ($id) { $proxy = org_glizy_objectFactory::createObject('org.glizycms.languages.models.proxy.LanguagesProxy'); $proxy->delete($id); org_glizy_helpers_Navigation::goHere(); } }
public function getGraph($entityTypeId, &$visited, &$edges, $firstNode = false) { if ($visited[$entityTypeId]) { return ''; } else { $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityProperties = $entityTypeService->getEntityTypeProperties($entityTypeId); $graph = ''; $color = __Config::get('movio.graph.shapeColor'); $entityTypeName = $entityTypeService->getEntityTypeName($entityTypeId); if ($this->getAttribute('generateLinks')) { $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $ar = $entityResolver->getMenuVisibleEntity($entityTypeId); if ($ar) { $url = 'URL="' . $this->makeUrl($ar->id, $ar->title) . '"'; } } // se è il nodo da cui inizia la ricerca ricorsiva if ($firstNode or empty($url)) { $s = $url ? $url . ', ' : ''; $graph .= '"' . $this->escape($entityTypeName) . '" [' . $s . 'label="<span>' . $this->escape($entityTypeName . ' ' . __Link::makeLinkWithIcon('actionsMVC', 'icon-pencil icon-white', array('action' => 'edit', 'id' => $entityTypeId, 'title' => __T('GLZ_RECORD_EDIT'))) . '<a href="' . __Link::makeURL('actionsMVC', array('action' => 'delete', 'id' => $entityTypeId)) . '" onclick="if (!confirm('' . __T('GLZ_RECORD_MSG_DELETE') . '')){return false}"><i class="icon-remove icon-white"></i></a>') . ' </span>"];' . PHP_EOL; } else { if ($url) { $graph .= '"' . $this->escape($entityTypeName) . '" [' . $url . '];' . PHP_EOL; } } $visited[$entityTypeId] = true; foreach ((array) $entityProperties as $entityProperty) { if ($entityProperty['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $entityProperty['entity_properties_target_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $entityProperty['entity_properties_type']); if (!$edges[$entityTypeName][$toEntityTypeName]) { $edges[$entityTypeName][$toEntityTypeName] = true; $graph .= '"' . $this->escape($entityTypeName) . '" -> "' . $this->escape($toEntityTypeName) . '" [label="' . $this->escape($label) . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $referenceRelations = $entityTypeService->getEntityTypeReferenceRelations($entityTypeId); foreach ((array) $referenceRelations as $referenceRelation) { if ($referenceRelation['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $referenceRelation['entity_properties_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $referenceRelation['entity_properties_type']); if (!$edges[$toEntityTypeName][$entityTypeName]) { $edges[$toEntityTypeName][$entityTypeName] = true; $graph .= '"' . $this->escape($toEntityTypeName) . '" -> "' . $this->escape($entityTypeName) . '" [label="' . $this->escape($label) . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $visited[$entityTypeId] = true; return $graph; } }
public function execute($id) { if ($id) { $c = $this->view->getComponentById('__model'); $model = $c->getAttribute('value'); $proxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ActiveRecordProxy'); $data = $proxy->load($id, $model); $data['__id'] = $id; $this->view->setData($data); } }
function execute($entity) { $resultEntity = array(); $resultEntity['newProperties'] = array(); $entityModel = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.Entity'); $entityModel->load($entity['id']); $entityModel->entity_name = $entity['name']; $entityModel->entity_show_relations_graph = $entity['showRelationsGraph'] == 'true' ? 1 : 0; // se è una nuova entità if ($entity['id'] == '') { $id = $entityModel->save(); $resultEntity['id'] = $entity['id'] = $id; } $entityProperties = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.EntityProperties'); // elimina dal db le proprietà cancellate dall'utente foreach ((array) $entity['deletedRows'] as $id) { $entityProperties->delete($id); } // aggiorna i dati delle proprietà nel db for ($i = 0; $i < count($entity['properties']); $i++) { $property = $entity['properties'][$i]; $entityProperties->load($property['id']); $entityProperties->entity_properties_FK_entity_id = $entity['id']; $entityProperties->entity_properties_type = $property['type']; $entityProperties->entity_properties_target_FK_entity_id = $this->checkNull($property['target']); $entityProperties->entity_properties_label_key = $property['label']; $entityProperties->entity_properties_required = $property['required'] == 'true' ? 1 : 0; $entityProperties->entity_properties_show_label_in_frontend = $property['showLabelInFrontend'] == 'true' ? 1 : 0; $entityProperties->entity_properties_relation_show = $this->checkNull($property['relationShow']); $entityProperties->entity_properties_dublic_core = $this->checkNull($property['dcField']); $entityProperties->entity_properties_row_index = $this->checkNull($property['rowIndex']); $entityProperties->entity_properties_params = $this->checkNull($property['params']); $id = $entityProperties->save(); // se è una nuova proprietà if ($property['id'] == '') { $entity['properties'][$i]['id'] = $id; $resultEntity['newProperties'][] = $id; } } foreach ((array) $entity['relations'] as $relation) { $entityProperties->load($relation['id']); $entityProperties->entity_properties_reference_relation_show = $relation['show']; $entityProperties->save(); } $this->entityTypeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $this->entityTypeService->invalidate(); // $skinAttributesVO = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.models.vo.SkinAttributesVO'); $this->saveSkin($skinAttributesVO, $entity); $this->saveListSkin($skinAttributesVO, $entity); $entityModel->entity_skin_attributes = serialize($skinAttributesVO); $entityModel->save(); return $resultEntity; }
public function execute() { $entityId = __Request::get('entityId'); // TODO controllare se $entityId == 0 // se non è 0 e il contenuto non esiste bisogna visualizzare un errore $entityProxy = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.models.proxy.EntityProxy'); $data = $entityProxy->loadContent($entityId, 'DRAFT'); if ($data) { $data['__id'] = $entityId; } $this->view->setData($data); }
function execute($data) { $entityProxy = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.models.proxy.EntityProxy'); $id = $entityProxy->saveContent(json_decode($data)); $this->directOutput = true; // se ci sono stati errori di validazione if (is_array($id)) { return array('errors' => $id); } else { return array('set' => array('entityId' => $id)); } }
public function execute($id) { // TODO controllo ACL if ($id) { // read the module content $c = $this->view->getComponentById('__model'); $contentproxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ModuleContentProxy'); $data = $contentproxy->loadContent($id, $c->getAttribute('value'), 'DRAFT'); // TODO verifica se il record esiste $data['__id'] = $id; $this->view->setData($data); } }
public function createDbService($dbType) { if ($dbType == 'mysql') { return org_glizy_objectFactory::createObject('movio.modules.modulesBuilder.services.MysqlService', 11); } else { if ($dbType == 'pgsql') { return org_glizy_objectFactory::createObject('movio.modules.modulesBuilder.services.PgsqlService', 12); } else { $this->logAndMessage('Il dbms selezionato non è supportato', null, true); return null; } } }
public function execute($data) { // TODO controllo acl // TODO per motifi di sicurezza forse è meglio non passare il nome del model nella request // ma avere un controller specifico che estende quello base al quale viene passato il nome del model, come succede per Scaffold $proxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ActiveRecordProxy'); $result = $proxy->save(json_decode($data)); $this->directOutput = true; if ($result['__id']) { return array('set' => $result); } else { return array('errors' => $result); } }
public function execute($data) { $this->directOutput = true; // TODO: controllo acl $contentProxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy'); $contentVO = $contentProxy->getContentVO(); $contentVO->setFromJson($data); $this->menuId = $contentVO->getId(); $r = $contentProxy->saveContent($contentVO, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId'), __Config::get('glizycms.content.history')); if ($r === true) { return true; } else { return array('errors' => array($r)); } }
public function execute($data) { // TODO controllo acl // TODO per motifi di sicurezza forse è meglio non passare il nome del model nella request // ma avere un controller specifico che estende quello base al quale viene passato il nome del model, come succede per Scaffold $this->directOutput = true; $data = json_decode($data); $proxy = org_glizy_objectFactory::createObject('org.glizycms.languages.models.proxy.LanguagesProxy'); if ($proxy->findLanguageByCountry($data->language_FK_country_id)) { return array('errors' => array(__T('LANGUAGE_ALREADY_PRESENT'))); } $result = $proxy->save($data); if ($result['__id']) { return array('set' => $result); } else { return array('errors' => $result); } }
public function getDocumentGraph($entityTypeId, $documentId) { $edges = array(); $entityProxy = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.models.proxy.EntityProxy'); $data = $entityProxy->getRelations($documentId); // se non ci sono documenti correlati if (empty($data['relations']) && empty($data['reference_relations'])) { return ''; } $color = __Config::get('movio.graph.shapeColor'); $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $graphCode = '"' . $this->escape($data['title']) . '" [label="<div class=\'main-node\'>' . $this->escape($data['title']) . '</div>",style="rounded,filled", height=0.4, color="' . $color . '", fillcolor="' . $color . '", fontcolor=white, fontsize=13];' . PHP_EOL; foreach ($data['relations'] as $relation) { $url = $this->makeUrl($relation['entityTypeId'], $relation['document_id']); $graphCode .= '"' . $this->escape($relation['title']) . '" [label="<div><a href=\'' . $url . '\'>' . $this->escape($relation['title']) . '</a></div>"];' . PHP_EOL; $entityTypeName = $entityTypeService->getEntityTypeName($relation['entityTypeId']); if (!$edges[$data['title']][$entityTypeName]) { $graphCode .= '"' . $this->escape($data['title']) . '" -> "' . $entityTypeName . '";' . PHP_EOL; $edges[$data['title']][$entityTypeName] = true; } $graphCode .= '"' . $entityTypeName . '" -> "' . $this->escape($relation['title']) . '";' . PHP_EOL; $graphCode .= '"' . $entityTypeName . '" [label="<div>' . $entityTypeName . '</div>"];' . PHP_EOL; } $entityTypeName = $entityTypeService->getEntityTypeName($entityTypeId); $graphCode .= '"' . $entityTypeName . '" -> "' . $this->escape($data['title']) . '";' . PHP_EOL; $graphCode .= '"' . $entityTypeName . '" [label="<div>' . $entityTypeName . '</div>"];' . PHP_EOL; foreach ($data['reference_relations'] as $relation) { $url = $this->makeUrl($relation['entityTypeId'], $relation['document_id']); $graphCode .= '"' . $this->escape($relation['title']) . '" [label="<div><a href=\'' . $url . '\'>' . $this->escape($relation['title']) . '</a></div>"];' . PHP_EOL; if (!$edges[$relation['title']][$entityTypeName]) { $subEntityTypeName = $entityTypeService->getEntityTypeName($relation['entityTypeId']); /*$graphCode .= '"'.$this->escape($relation['title']).'" -> "'.$entityTypeName.'" [dir=back];'.PHP_EOL; $graphCode .= '"'.$subEntityTypeName.'" -> "'.$this->escape($relation['title']).'" [dir=back];'.PHP_EOL;*/ $graphCode .= '"' . $entityTypeName . '" -> "' . $this->escape($relation['title']) . '";' . PHP_EOL; $graphCode .= '"' . $this->escape($relation['title']) . '" -> "' . $subEntityTypeName . '";' . PHP_EOL; //$graphCode .= '"'.$this->escape($relation['title']).'" [label="<div>' . $this->escape($relation['title']) . '</div>"];'.PHP_EOL; $graphCode .= '"' . $subEntityTypeName . '" [label="<div>' . $subEntityTypeName . '</div>"];' . PHP_EOL; $edges[$data['title']][$entityTypeName] = true; } } return $graphCode; }
function findTerm($fieldName, $model, $query, $term, $proxyParams) { $oldMultisite = __Config::get('MULTISITE_ENABLED'); if ($proxyParams && property_exists($proxyParams, 'multisite') && !$proxyParams->multisite) { __Config::set('MULTISITE_ENABLED', false); } $document = org_glizy_objectFactory::createObject('org.glizy.dataAccessDoctrine.ActiveRecordDocument'); $document->addField(new org_glizy_dataAccessDoctrine_DbField($fieldName, Doctrine\DBAL\Types\Type::STRING, 255, false, null, '', false)); $it = $document->createRecordIterator()->select('index0.document_index_text_value')->where('document_type', 'glizycms.content')->groupBy('index0.document_index_text_value')->allStatuses(); if ($term != '') { $it->where($fieldName, '%' . $term . '%', 'LIKE'); } $it->orderBy($fieldName); $result = array(); foreach ($it as $ar) { $result[] = array('id' => $ar->document_index_text_value, 'text' => $ar->document_index_text_value); } __Config::set('MULTISITE_ENABLED', $oldMultisite); return $result; }
public function execute() { $entityTypeId = __Request::get('entityTypeId'); $visualization = $this->view->loadContent('visualization'); $this->setComponentsAttribute('list', 'entityTypeId', $entityTypeId); $this->setComponentsAttribute('list', 'visualization', $visualization); // simulate a new page in site structure // for update the navigation menu, breadcrumbs and page title $entityTypeService = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.service.EntityTypeService'); $title = $entityTypeService->getEntityTypeName($entityTypeId); $currentMenu = $this->application->getCurrentMenu(); $siteMap = $this->application->getSiteMap(); $menu = org_glizy_application_SiteMap::getEmptyMenu(); $menu['title'] = $title; $menu['id'] = $currentMenu->id + 100000; $menu['pageType'] = $currentMenu->pageType; $menu['url'] = __Request::get('__url__'); $siteMap->addChildMenu($currentMenu, $menu); $evt = array('type' => GLZ_EVT_SITEMAP_UPDATE, 'data' => $menu['id']); $this->dispatchEvent($evt); }
function process() { $entityProxy = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.models.proxy.EntityProxy'); $this->_content = $entityProxy->loadContentFrontend($this->getId()); $this->createChildComponents(); $this->initChilds(); $this->processChilds(); // simulate a new page in site structure // for update the navigation menu, breadcrumbs and page title $currentMenu =& $this->_application->getCurrentMenu(); $siteMap =& $this->_application->getSiteMap(); $menu = org_glizy_application_SiteMap::getEmptyMenu(); $menu['title'] = $this->_content['title']; $menu['id'] = $currentMenu->id + 100000; $menu['pageType'] = $currentMenu->pageType; // $menu['isVisible'] = false; $menu['url'] = __Request::get('__url__'); $siteMap->addChildMenu($currentMenu, $menu); //$this->_application->setPageId($menu['id']); $evt = array('type' => GLZ_EVT_SITEMAP_UPDATE, 'data' => $menu['id']); $this->dispatchEvent($evt); }
public function execute($query, $start, $rows) { $europeanaResponseVO = org_glizy_objectFactory::createObject('movio.modules.europeana.EuropeanaResponseVO'); if (__Config::get('DEBUG')) { error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('display_errors', 1); } $q = array(); $keySearch = explode(',', __Config::get('movio.europeana.searchFields')); foreach ($keySearch as $key) { if ($query[$key]) { $val = str_replace(' ', '+', trim($query[$key])); if ($key == "TYPE") { $val = strtoupper($val); } else { if ($key == "LANGUAGE") { $val = strtolower($val); } } $q[] = $key . ':"' . $val . '"'; } } $params = array('wskey' => __Config::get('movio.europeana.apiKey'), 'rows' => $rows ?: $query['maxResult'], 'start' => $start ?: 1, 'query' => implode($q, ' ')); $request = org_glizy_objectFactory::createObject('org.glizy.rest.core.RestRequest', __Config::get('movio.europeana.apiSearchUrl'), 'GET', $params); $request->execute(); $response = $request->getResponseBody(); $response = json_decode($response); if ($response && $response->success && $response->itemsCount > 0) { foreach ($response->items as $item) { $imgSrc = $item->edmPreview[0] ? $item->edmPreview[0] : __Config::get('movio.noImage.src'); $europeanaResponseVO->records[] = array('id' => $item->id, 'image' => $imgSrc, 'title' => $item->title, 'url' => $item->guid); } $europeanaResponseVO->totalResults = $response->totalResults; } else { $europeanaResponseVO->error = $response->error; } return $europeanaResponseVO; }
public function getPathFromMapping($map) { if (__Config::get('glizycms.mediaArchive.mediaMappingEnabled')) { $m = explode('/', $map, 2); $application = org_glizy_ObjectValues::get('org.glizy', 'application'); if ($application) { $mappingService = $application->retrieveProxy('org.glizycms.mediaArchive.services.MediaMappingService'); } else { $mappingService = org_glizy_objectFactory::createObject('org.glizycms.mediaArchive.services.MediaMappingService'); } $targetPath = $mappingService->getMapping($m[0]); $map = $m[1] ? $targetPath . '/' . $m[1] : $targetPath; } return $map; }
function execute($entityTypeId, $term) { $entityProxy = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.models.proxy.EntityProxy'); $entities = $entityProxy->findEntities($entityTypeId, $term); return $entities; }
public function getDocumentsWithTerm($termId) { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $entityTypeService = $application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $menuMap = array(); // TODO: non va bene l'implementazione perché scorre tutti i documenti // eseguire un filtro sui documenti del tipo di entità che ha una campo di tipo dizionario $it = org_glizy_ObjectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityDocument')->load('All'); $result = array(); foreach ($it as $ar) { $entityTypeId = $entityTypeService->getEntityTypeId($ar->getType()); if (!isset($menuMap[$entityTypeId])) { $arMenu = $entityResolver->getMenuVisibleEntity($entityTypeId); $menuMap[$entityTypeId] = $arMenu; } else { $arMenu = $menuMap[$entityTypeId]; } $thesaurusAttribute = $entityTypeService->getAttributeByType($entityTypeId, 'attribute.thesaurus'); $descriptionAttribute = $entityTypeService->getDescriptionAttribute($entityTypeId); // se l'entità di questo documento ha un campo di tipo thesaurus if ($arMenu && $thesaurusAttribute) { $thesaurusAttribute = $this->prepareThesaurusAttribute($thesaurusAttribute); foreach ($thesaurusAttribute as $attribute) { if ($ar->keyInDataExists($attribute)) { if (!is_array($ar->{$attribute})) { continue; } // si cerca nei tag il termine con id uguale a termId foreach ($ar->{$attribute} as $term) { if ($term->id == $termId) { $document_id = $ar->getId(); $result[] = array('id' => $document_id, 'title' => $ar->title, 'description' => glz_strtrim($descriptionAttribute && $ar->keyInDataExists($descriptionAttribute) ? $ar->{$descriptionAttribute} : '', 300), 'url' => __Routing::makeUrl('showEntityDetail', array('pageId' => $arMenu->id, 'entityTypeId' => $entityTypeId, 'document_id' => $document_id))); break; } } } } } } return $result; }
private function processTimeline($menuId, $contentJson) { $contentJson['text'] = $this->processText($contentJson['text']); $request = org_glizy_objectFactory::createObject('org.glizy.rest.core.RestRequest', GLZ_HOST_ROOT . '/ajax.php', 'GET', array('pageId' => $menuId, 'ajaxTarget' => 'timeline')); $request->execute(); $response = $request->getResponseBody(); $response = json_decode($response); $contentJson['timeline'] = $response->timeline; if ($contentJson['timeline']->date) { foreach ($contentJson['timeline']->date as $i => $item) { $media = $contentJson['timeline-timelineDef'][$i]->media->fileName; $thumbnail = $contentJson['timeline-timelineDef'][$i]->media->fileName; $item->asset->media = $media ? 'media/' . $media : ''; $item->asset->thumbnail = $item->asset->media; $item->asset->caption = $this->processText($contentJson['timeline-timelineDef'][$i]->mediaCaption); $item->text = $this->processText($contentJson['timeline-timelineDef'][$i]->text); } } unset($contentJson['timeline-timelineDef']); return $contentJson; }
private function resolveFileName() { // gestione mapping delle cartelle if (__Config::get('glizycms.mediaArchive.mediaMappingEnabled') && preg_match('/([^:]+):\\/\\/(.+)/', $this->fileName, $m)) { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); if ($application) { $mappingService = $application->retrieveProxy('org.glizycms.mediaArchive.services.MediaMappingService'); } else { $mappingService = org_glizy_objectFactory::createObject('org.glizycms.mediaArchive.services.MediaMappingService'); } $targetPath = $mappingService->getMapping($m[1]); $this->fileName = $targetPath . '/' . $m[2]; } if (strpos($this->fileName, '/') === false) { $file = org_glizy_Paths::get('APPLICATION_MEDIA_ARCHIVE') . ucfirst(strtolower($this->type)) . '/' . $this->fileName; } else { $file = $this->fileName; } return $file; }
public function getContentsByProfile($groupId) { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $entityTypeService = $application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $arGroup = org_glizy_objectFactory::createModel('org.glizycms.groupManager.models.UserGroup'); $arGroup->load($groupId); $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityDocument')->load('All')->where('profile', $arGroup->usergroup_name)->orderBy('title'); foreach ($it as $ar) { $entityTypeId = $entityTypeService->getEntityTypeId($ar->getType()); $descriptionAttribute = $entityTypeService->getDescriptionAttribute($entityTypeId); $arMenu = $entityResolver->getMenuVisibleEntity($entityTypeId); if ($arMenu) { $result[] = array('title' => $ar->title, 'description' => $descriptionAttribute && $ar->keyInDataExists($descriptionAttribute) ? $ar->{$descriptionAttribute} : '', 'url' => __Routing::makeUrl('showEntityDetail', array('pageId' => $arMenu->id, 'entityTypeId' => $entityTypeId, 'document_id' => $ar->getId()))); } } return $result; }