Пример #1
0
 protected function loadAcl($key)
 {
     // TODO: posstare questa parte di codice in un classe comune
     // e gestire in modo simile quando sono attivi i ruoli e quando no
     $pageId = $this->application->getPageId();
     if (__Config::get('ACL_ROLES')) {
         if (!$this->user->acl($pageId, 'all')) {
             $this->canView = $this->user->acl($pageId, 'visible');
             $this->canEdit = $this->user->acl($pageId, 'edit');
             $this->canDelete = $this->user->acl($pageId, 'delete');
             if ($this->canView) {
                 $ar = org_glizy_objectFactory::createModel('org.glizycms.contents.models.DocumentACL');
                 $ar->load($key);
                 if ($ar->__aclEdit) {
                     $roles = explode(',', $ar->__aclEdit);
                     $this->canEdit = $this->canDelete = $this->user->isInRoles($roles);
                 }
             }
         }
     } else {
         $this->canView = $this->user->acl($pageId, 'visible');
         $this->canEdit = $this->user->acl($pageId, 'edit');
         $this->canDelete = $this->user->acl($pageId, 'delete');
     }
 }
Пример #2
0
 function execute($id)
 {
     // TODO verificare permessi
     $ar = org_glizy_objectFactory::createModel('movio.modules.codes.models.Model');
     $ar->delete($id);
     return true;
 }
Пример #3
0
 function execute($id)
 {
     $label = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.EntityLabelsDocument');
     $label->delete($id);
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $localeService->invalidate();
 }
Пример #4
0
 function execute($entityId)
 {
     $entityModel = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.Entity');
     $entityModel->load($entityId);
     $language = $this->application->getEditingLanguage();
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $entity = array("id" => $entityModel->entity_id, "nameId" => $entityModel->entity_name, "nameText" => $localeService->getTranslation($language, $entityModel->entity_name), "showRelationsGraph" => $entityModel->entity_show_relations_graph);
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.Entity');
     $it->load('allButNot', array('entityId' => $entityId));
     $entity["entities"] = array();
     foreach ($it as $ar) {
         $entity["entities"][] = array("id" => $ar->entity_id, "name" => $localeService->getTranslation($language, $ar->entity_name));
     }
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityProperties');
     $it->load('entityPropertiesFromId', array('entityId' => $entityId));
     $entity["properties"] = array();
     foreach ($it as $ar) {
         $entity["properties"][] = array("id" => $ar->entity_properties_id, "type" => $ar->entity_properties_type, "target" => $ar->entity_properties_target_FK_entity_id, "labelId" => $ar->entity_properties_label_key, "labelText" => $localeService->getTranslation($language, $ar->entity_properties_label_key), "required" => $ar->entity_properties_required == 1, "showLabelInFrontend" => $ar->entity_properties_show_label_in_frontend == 1, "relationShow" => $ar->entity_properties_relation_show, "dcField" => $ar->entity_properties_dublic_core, "rowIndex" => $ar->entity_properties_row_index, 'params' => $ar->entity_properties_params);
     }
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityProperties');
     $it->load('entityRelationsFromId', array('entityId' => $entityId));
     $entity["relations"] = array();
     foreach ($it as $ar) {
         $entity["relations"][] = array("id" => $ar->entity_properties_id, "from" => $localeService->getTranslation($language, $ar->entity_name), "to" => $localeService->getTranslation($language, $entity["nameText"]), "show" => $ar->entity_properties_reference_relation_show);
     }
     return $entity;
 }
Пример #5
0
 function execute($pk, $name, $value)
 {
     $ar = org_glizy_objectFactory::createModel('movio.modules.codes.models.Model');
     if ($ar->load($pk)) {
         $ar->{$name} = $value;
         $ar->save();
     }
 }
Пример #6
0
 public function delete($recordId, $model)
 {
     $ar = org_glizy_objectFactory::createModel($model);
     if (__Config::get('ACL_MODULES')) {
         // permessi editing e visualizzazione record
         $this->addAclRelations($ar);
     }
     $ar->delete($recordId);
 }
Пример #7
0
 function execute($custom_code_mapping_description, $custom_code_mapping_code, $custom_code_mapping_link)
 {
     $ar = org_glizy_objectFactory::createModel('movio.modules.codes.models.Model');
     $ar->custom_code_mapping_description = $custom_code_mapping_description;
     $ar->custom_code_mapping_code = $custom_code_mapping_code;
     $ar->custom_code_mapping_link = $custom_code_mapping_link;
     $id = $ar->save();
     return $id;
 }
Пример #8
0
 public function execute($entityId)
 {
     // TODO controllo ACL
     if ($entityId) {
         $document = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.EntityDocument');
         $document->delete($entityId);
         org_glizy_helpers_Navigation::goHere();
     }
 }
Пример #9
0
 function execute($id)
 {
     // TODO verificare permessi
     $relation = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.RelationTypesDocument');
     $relation->delete($id);
     $entityTypeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService');
     $entityTypeService->invalidate();
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $localeService->invalidate();
     return true;
 }
Пример #10
0
 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;
 }
Пример #11
0
 function execute()
 {
     if ($this->user->isLogged()) {
         $it = org_glizy_objectFactory::createModelIterator('movio.modules.codes.models.Model');
         foreach ($it as $ar) {
             if (!$ar->custom_code_mapping_code) {
                 continue;
             }
             $arCode = org_glizy_objectFactory::createModel('movio.modules.publishApp.models.Codes');
             $arCode->mobilecode_code = $ar->custom_code_mapping_code;
             $arCode->mobilecode_link = $ar->custom_code_mapping_link;
             $arCode->save();
         }
     }
 }
Пример #12
0
 function execute()
 {
     $relation = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.RelationTypesDocument');
     $relation->load(__Request::get('pk'));
     $field = __Request::get('name');
     if (preg_match("/translation.(.+)/", $field, $m)) {
         $language = $m[1];
         $translation = $relation->translation;
         $translation[$language] = __Request::get('value');
         $relation->translation = $translation;
     } else {
         $relation->{$field} = __Request::get('value');
     }
     $relation->save();
     $entityTypeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService');
     $entityTypeService->invalidate();
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $localeService->invalidate();
 }
Пример #13
0
 function execute()
 {
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.Languages', 'all');
     $translation = array();
     foreach ($it as $ar) {
         $code = $ar->language_code;
         $word = __Request::get('translation_' . $code);
         $translation[$code] = $word;
         if ($word != '') {
             $key = $word;
         }
     }
     $label = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.EntityLabelsDocument');
     $label->key = $key;
     $label->translation = $translation;
     $id = $label->save();
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $localeService->invalidate();
     return $id;
 }
Пример #14
0
 function execute($id)
 {
     if ($id) {
         require_once __Paths::get('APPLICATION_LIBS') . 'phpqrcode/qrlib.php';
         $ar = org_glizy_objectFactory::createModel('movio.modules.codes.models.Model');
         $ar->load($id);
         $codeType = $ar->custom_code_mapping_code ? 'c' : 'm';
         $value = $codeType == 'c' ? $ar->custom_code_mapping_code : $ar->custom_code_mapping_link;
         $codeContents = GLZ_HOST_ROOT . ':' . $codeType . ':' . $value;
         $filePath = __Paths::get('CACHE') . $id . '.png';
         QRcode::png($codeContents, $filePath, QR_ECLEVEL_H, 4);
         header("Pragma: public");
         header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Cache-Control: private", false);
         header("Content-Type: image/png");
         header("Content-Transfer-Encoding: binary");
         header("Content-Disposition: attachment; filename=\"" . $id . '.png' . "\"");
         @readfile($filePath) or die;
     }
 }
Пример #15
0
 private function makeUrlFromId($id, $fullLink = false)
 {
     $ar = org_glizy_objectFactory::createModel($this->model);
     if ($ar->load($this->getIdFromLink($id))) {
         $siteMap = $this->application->getSiteMap();
         $menu = $siteMap->getMenuByPageType($this->pageType);
         if ($ar->document_detail_isVisible && $ar->document_detail_translated && $menu && $menu->isVisible) {
             if ($ar->keyInDataExists('url') && $ar->url) {
                 $language = $this->application->getLanguage();
                 $url = GLZ_HOST . '/' . $language . '/' . $ar->url;
             } else {
                 $url = __Link::makeUrl('movio_news', array('document_id' => $id, 'title' => $ar->title));
             }
             return $fullLink ? __Link::makeSimpleLink($ar->title, $url) : $url;
         }
     }
     // document not found, isn't visible or isn't traslated
     // go to entity page or home
     $speakingUrlManager = $this->application->retrieveProxy('org.glizycms.speakingUrl.Manager');
     return $fullLink ? '' : $speakingUrlManager->makeUrl('internal:' . ($menu ? $menu->id : __Config::get('START_PAGE')));
 }
Пример #16
0
 public function execute($id)
 {
     // cancella tutti i contenuti collegati al tipo di entità da cancellare
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityDocument');
     $it->load('allFromTypeAllStatusAllLanguages', array('entityTypeId' => $id));
     foreach ($it as $ar) {
         $ar->delete();
     }
     // cancella le proprietà collegate all'entità
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityProperties');
     $it->load('entityPropertiesFromId', array('entityId' => $id));
     foreach ($it as $ar) {
         $ar->delete();
     }
     // cancella l'entità
     $entity = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.Entity');
     $entity->delete($id);
     $entityTypeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService');
     $entityTypeService->invalidate();
     org_glizy_helpers_Navigation::goHere();
 }
Пример #17
0
 function execute($text, $key)
 {
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     $language = $application->getEditingLanguage();
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $keyLanguageCode = $localeService->keyAlreadyExists($lang, $key);
     if ($keyLanguageCode) {
         $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityLabelsDocument')->where('translation', $keyLanguageCode . ':' . $key);
         $entityLabels = $it->first();
         $temp = $entityLabels->translation;
         $temp[$language] = $text;
         $entityLabels->translation = $temp;
         $entityLabels->save();
         $localeService->invalidate();
     } else {
         $entityLabels = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.EntityLabelsDocument');
         $entityLabels->key = $text;
         $entityLabels->translation = array($language => $text);
         $entityLabels->save();
     }
     return $entityLabels->key;
 }
Пример #18
0
 function execute()
 {
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.Languages', 'all');
     $translation = array();
     foreach ($it as $ar) {
         $code = $ar->language_code;
         if (__Request::get('translation_' . $code)) {
             $translation[$code] = __Request::get('translation_' . $code);
             if (empty($key)) {
                 $key = $translation[$code];
             }
         }
     }
     $relation = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.RelationTypesDocument');
     $relation->key = $key;
     $relation->translation = $translation;
     $relation->cardinality = __Request::get('cardinality');
     $id = $relation->save();
     $entityTypeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService');
     $entityTypeService->invalidate();
     $localeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
     $localeService->invalidate();
     return $id;
 }
Пример #19
0
 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;
 }
Пример #20
0
 function __construct(&$application, &$parent, $tagName = '', $id = '', $originalId = '')
 {
     parent::__construct($application, $parent, $tagName, $id, $originalId);
     if (!__Request::get('entityTypeId')) {
         return;
     }
     $entityTypeId = __Request::get('entityTypeId');
     $entityModel = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.Entity');
     $entityModel->load($entityTypeId);
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', '__type', '__type');
     $c->setAttribute('label', 'Tipo');
     $c->setAttribute('value', __Tp($entityModel->entity_name));
     $c->setAttribute('disabled', true);
     $this->addChild($c);
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Hidden', $this->_application, $this, 'glz:Input', $entityTypeId, $entityTypeId);
     $c->setAttribute('name', 'entityTypeId');
     $c->setAttribute('value', $entityTypeId);
     $this->addChild($c);
     $entityId = __Request::get('entityId');
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Hidden', $this->_application, $this, 'glz:Input', $entityId, $entityId);
     $c->setAttribute('name', 'entityId');
     $c->setAttribute('value', $entityId);
     $this->addChild($c);
     $id = '__isVisible';
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Checkbox', $this->_application, $this, 'glz:Checkbox', $id, $id);
     $c->setAttribute('label', __Tp('Visible'));
     $c->setAttribute('data', 'type=checkbox');
     $this->addChild($c);
     $id = 'title';
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $id, $id);
     $c->setAttribute('label', __Tp('Title'));
     $c->setAttribute('required', true);
     $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
     $c->setAttribute('value', '');
     $this->addChild($c);
     $id = 'subtitle';
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $id, $id);
     $c->setAttribute('label', __Tp('Subtitle'));
     $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
     $c->setAttribute('value', '');
     $this->addChild($c);
     $id = 'url';
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $id, $id);
     $c->setAttribute('label', __Tp('URL'));
     $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
     $c->setAttribute('value', '');
     $this->addChild($c);
     $id = 'profile';
     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $id, $id);
     $c->setAttribute('label', __Tp('Profile'));
     $c->setAttribute('data', 'type=selectfrom;multiple=true;model=org.glizycms.groupManager.models.UserGroup;field=usergroup_name');
     $c->setAttribute('value', '');
     $this->addChild($c);
     $entityTypeService = $application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService');
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.EntityProperties');
     $it->load('entityPropertiesFromId', array('entityId' => $entityTypeId));
     foreach ($it as $ar) {
         $attribute = $entityTypeService->getAttributeIdByAr($ar);
         switch ($ar->entity_properties_type) {
             case 'attribute.text':
             case 'attribute.externalimage':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('type', 'text');
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.int':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('type', 'number');
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.longtext':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('type', 'multiline');
                 $c->setAttribute('rows', '10');
                 $c->setAttribute('cols', '90');
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.descriptivetext':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('type', 'multiline');
                 $c->setAttribute('rows', '10');
                 $c->setAttribute('cols', '90');
                 $c->setAttribute('htmlEditor', true);
                 $c->setAttribute('data', 'type=tinymce');
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.date':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('readOnly', true);
                 $c->setAttribute('type', 'text');
                 $c->setAttribute('data', 'type=date;date-format=yyyy-mm-dd');
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.externallink':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('type', 'url');
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.internallink':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizycms.views.components.PagePicker', $this->_application, $this, 'cms:PagePicker', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.openlist':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $proxyParams = json_encode(array('entityTypeId' => $entityTypeId));
                 $proxyParams = str_replace('"', '##', $proxyParams);
                 $c->setAttribute('data', 'type=selectfrom;multiple=false;add_new_values=true;proxy=movio.modules.ontologybuilder.models.proxy.EntityProxy;proxy_params=' . $proxyParams);
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.image':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('data', 'type=mediapicker;mediatype=IMAGE;preview=true');
                 $c->setAttribute('size', '90');
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.media':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('data', 'type=mediapicker;mediatype=ALL;preview=false');
                 $c->setAttribute('size', '90');
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.imagelist':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Fieldset', $this->_application, $this, 'glz:Fieldset', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('data', 'type=repeat;repeatMin=0;collapsable=false');
                 $subchild =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', 'attaches', 'attaches');
                 $subchild->setAttribute('label', 'Image');
                 $subchild->setAttribute('size', '90');
                 $subchild->setAttribute('data', 'type=mediapicker;mediatype=IMAGE;preview=true');
                 $c->addChild($subchild);
                 $this->addChild($c);
                 break;
             case 'attribute.medialist':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Fieldset', $this->_application, $this, 'glz:Fieldset', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('data', 'type=repeat;repeatMin=0;collapsable=false');
                 $subchild =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', 'attaches', 'attaches');
                 $subchild->setAttribute('label', 'Media');
                 $subchild->setAttribute('size', '90');
                 $subchild->setAttribute('data', 'type=mediapicker;mediatype=ALL;preview=false');
                 $c->addChild($subchild);
                 $this->addChild($c);
                 break;
                 // TODO
             // TODO
             case 'attribute.photogallery':
                 $c =& org_glizy_ObjectFactory::createComponent('movio.views.components.PhotogalleryCategory', $this->_application, $this, 'm:PhotogalleryCategory', $attribute, $attribute, true, 'edit');
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $this->addChild($c);
                 break;
             case 'attribute.europeanaRelatedContents':
                 $searchFields = __Config::get('movio.europeana.searchFields');
                 $rows = __Config::get('movio.europeana.rows');
                 $searchFieldsLabels = '';
                 $keyFieldsLabels = explode(',', __Config::get('movio.europeana.searchFieldsLabels'));
                 $last = count($keyFieldsLabels);
                 $counter = 0;
                 foreach ($keyFieldsLabels as $field) {
                     $counter++;
                     $searchFieldsLabels .= __T($field);
                     if ($counter < $last) {
                         $searchFieldsLabels .= ",";
                     }
                 }
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('data', 'type=europeanaRelatedContents;search_fields=' . $searchFields . ';search_fields_labels=' . $searchFieldsLabels . ';max_result=' . $rows);
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.JSscript', $this->_application, $this, 'glz:JSscript', '');
                 $c->setAttribute('folder', 'movio/modules/europeana/views/js');
                 $c->setAttribute('editableRegion', 'tail');
                 $this->addChild($c);
                 break;
             case 'attribute.thesaurus':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $proxyParams = json_encode(array('dictionaryId' => $ar->entity_properties_params));
                 $proxyParams = str_replace('"', '##', $proxyParams);
                 $c->setAttribute('data', 'type=selectfrom;multiple=true;add_new_values=false;proxy=movio.modules.thesaurus.models.proxy.ThesaurusProxy;format_selection=formatThesaurusSelection;format_result=formatThesaurusResult;return_object=true;proxy_params=' . $proxyParams);
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             case 'attribute.module':
                 $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                 $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                 $c->setAttribute('required', $ar->entity_properties_required == 1);
                 $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                 $proxyParams = json_encode(array('moduleId' => $ar->entity_properties_params));
                 $proxyParams = str_replace('"', '##', $proxyParams);
                 $c->setAttribute('data', 'type=selectfrom;multiple=true;proxy=movio.modules.ontologybuilder.models.proxy.ModelProxy;return_object=true;proxy_params=' . $proxyParams);
                 $c->setAttribute('value', '');
                 $this->addChild($c);
                 break;
             default:
                 // se l'attributo è una relazione
                 if (!is_null($ar->entity_properties_target_FK_entity_id)) {
                     $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Input', $this->_application, $this, 'glz:Input', $attribute, $attribute);
                     $c->setAttribute('label', __Tp($ar->entity_properties_label_key));
                     $c->setAttribute('required', $ar->entity_properties_required == 1);
                     $relation = $entityTypeService->getRelation($ar->entity_properties_type);
                     $c->setAttribute('data', 'type=entityselect;entity_type_id=' . $ar->entity_properties_target_FK_entity_id . ';cardinality=' . $relation['cardinality']);
                     $c->setAttribute('cssClass', __Config::get('glizy.formElement.admCssClass'));
                     $c->setAttribute('value', '');
                     $this->addChild($c);
                     break;
                 }
         }
     }
 }
Пример #21
0
 public function toggleVisibility($recordId, $model = '')
 {
     $document = org_glizy_objectFactory::createModel(!$model ? 'org.glizycms.core.models.Content' : $model);
     $document->load($recordId);
     $document->setVisible($document->isVisible() ? 0 : 1);
     $document->save();
 }
Пример #22
0
 public function getDictionaryById($dictionaryId)
 {
     $ar = org_glizy_objectFactory::createModel('movio.modules.thesaurus.models.Dictionary');
     $ar->load($dictionaryId);
     return movio_modules_thesaurus_models_DictionaryVO::createFromAr($ar);
 }
Пример #23
0
 protected function getPage($entityTypeId)
 {
     $siteMap = $this->application->getSiteMap();
     $ar = org_glizy_objectFactory::createModel('org.glizycms.core.models.Content');
     $ar->content = new StdClass();
     $ar->content->entitySelect = $entityTypeId;
     $ar->addFieldsToIndex(array('entitySelect' => 'text'));
     $menuDocument = $ar->createRecordIterator()->where('entitySelect', $entityTypeId);
     foreach ($menuDocument as $ar) {
         $menu = $siteMap->getNodeById($ar->id);
         // check if the page is visible
         if ($menu && $menu->isVisible && $menu->pageType == 'Entity') {
             return $menu;
         }
     }
     return null;
 }
Пример #24
0
 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();
                     }
                 }
             }
         }
     }
 }
Пример #25
0
 /**
  * @param string $classPath
  * @param string $queryName
  * @param array $options
  *
  * @return org_glizy_dataAccessDoctrine_RecordIterator
  * @throws org_glizy_compilers_CompilerException
  */
 static function &createModelIterator($classPath, $queryName = null, $options = array())
 {
     /** @var org_glizy_dataAccessDoctrine_ActiveRecord $ar */
     $ar = org_glizy_objectFactory::createModel($classPath);
     $it = $ar->createRecordIterator();
     if ($queryName) {
         $it->load($queryName, isset($options['params']) ? $options['params'] : null);
         if (isset($options['filters'])) {
             $it->setFilters($options['filters']);
         }
         if (isset($options['order'])) {
             $it->setOrderBy($options['order']);
         }
         if (isset($options['limit'])) {
             $it->limit($options['limit']);
         }
     }
     return $it;
 }