function createChildComponents() { $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $properties = $entityTypeService->getEntityTypeAttributeProperties(__Request::get('entityTypeId'), $this->_parent->getId()); $moduleId = $properties['entity_properties_params']; $this->_content['title'] = $this->data->text; $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Text', $this->_application, $this, 'glz:Text', 'title', 'title'); $this->addChild($c); $this->_content['url'] = __Routing::makeUrl($moduleId, array('document_id' => $this->data->id, 'title' => $this->data->text)); $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Text', $this->_application, $this, 'glz:Text', 'url', 'url'); $this->addChild($c); $module = org_glizy_Modules::getModule($moduleId); $ar = org_glizy_ObjectFactory::createModel($module->classPath . '.models.Model'); $ar->load($this->data->id); if ($ar->fieldExists('image')) { $this->_content['__image'] = $ar->image; $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Image', $this->_application, $this, 'glz:Image', '__image', '__image'); $c->setAttribute('width', __Config::get('THUMB_WIDTH')); $c->setAttribute('height', __Config::get('THUMB_HEIGHT')); $c->setAttribute('crop', true); $this->addChild($c); } else { $c =& org_glizy_ObjectFactory::createComponent('movio.modules.ontologybuilder.views.components.NoImage', $this->_application, $this, 'glz:Image', '__image', '__image'); $c->setAttribute('width', __Config::get('THUMB_SMALL_WIDTH')); $c->setAttribute('height', __Config::get('THUMB_SMALL_HEIGHT')); $this->addChild($c); } }
public function renderCell(&$ar) { $media = org_glizycms_mediaArchive_MediaManager::getMediaByRecord($ar); $sizes = method_exists($media, 'getOriginalSizes') ? $media->getOriginalSizes() : array('width' => 0, 'height' => 0); $thumbnail = $media->getThumbnail(__Config::get('THUMB_WIDTH'), __Config::get('THUMB_HEIGHT'), __Config::get('ADM_THUMBNAIL_CROP'), __Config::get('ADM_THUMBNAIL_CROPPOS')); $ar->thumb_filename = $thumbnail['fileName']; $ar->thumb_w = $thumbnail['width']; $ar->thumb_h = $thumbnail['height']; $ar->media_w = $sizes['width']; $ar->media_h = $sizes['height']; if ($ar->media_title == '') { $ar->media_title = $ar->media_originalFileName; } if (!$ar->media_date) { $ar->media_date = ''; } if (!$ar->media_copyright) { $ar->media_copyright = ''; } if (!$ar->media_description) { $ar->media_description = ''; } $ar->__jsonMedia = org_glizycms_Glizycms::getMediaArchiveBridge()->getJsonFromAr($ar); $application = $this->application; $user = $application->_user; $ar->__url__ = $user->acl($application->getPageId(), 'edit') ? __Routing::makeUrl('actionsMVC', array('action' => 'edit', 'id' => $ar->media_id)) : false; $ar->__urlDelete__ = $user->acl($application->getPageId(), 'delete') ? __Routing::makeUrl('actionsMVC', array('action' => 'delete', 'id' => $ar->media_id)) : false; $ar->__urlDownload__ = org_glizycms_helpers_Media::getFileUrlById($ar->media_id); $ar->__urlPreview__ = org_glizycms_helpers_Media::getImageUrlById($ar->media_id, 800, 600); }
public function process() { $this->_content = new org_glizycms_contents_views_components_SiteTreeViewVO(); $this->_content->addLabel = $this->getAttribute('addLabel'); $this->_content->title = $this->getAttribute('title'); $this->_content->ajaxUrl = $this->getAjaxUrl(); $this->_content->addUrl = __Routing::makeUrl('linkChangeAction', array('action' => 'add')); }
public function process() { if ($this->getAttribute('mode') == 'container') { $this->emptySrc = __Routing::makeUrl('linkChangeAction', array('action' => $this->getAttribute('initialState'))); $this->editSrc = __Routing::makeUrl('linkChangeAction', array('action' => $this->getAttribute('editState'))) . '?dictionaryId=' . __Request::get('dictionaryId') . '&termId='; } else { $termId = __Request::get('termId'); $thesaurusProxy = org_glizy_ObjectFactory::createObject('movio.modules.thesaurus.models.proxy.ThesaurusProxy'); $termVo = $thesaurusProxy->loadTerm($termId); $this->setData($termVo); parent::process(); } }
public function process() { if ($this->getAttribute('mode') == 'container') { $this->emptySrc = __Routing::makeUrl('linkChangeAction', array('action' => $this->getAttribute('initialState'))); $this->editSrc = __Routing::makeUrl('linkChangeAction', array('action' => $this->getAttribute('editState'))) . '?menuId='; } else { $this->menuId = __Request::get('menuId'); // TODO: lanciare un'eccezione se l'id non è valido $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $menu = $menuProxy->getMenuFromId($this->menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); // TODO: il menù viene letto due volte, in questo codice ed in readContentFromMenu $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy'); $content = $contentProxy->readContentFromMenu($this->menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); $this->setData($content); $this->addComponentsToEdit($menu); parent::process(); } }
function _makeNavigationMenu(&$node, $endDepth, &$menu, $skip = false) { $skip = !$skip ? $node->depth < $this->_startDepth : $skip; if ($node->type == 'BLOCK') { return true; } if ($node->depth > $endDepth) { return true; } if ($node->isVisible == 0) { return true; } if (is_string($node->isVisible) && preg_match("/\\{php\\:.*\\}/i", $node->isVisible)) { $phpcode = org_glizy_helpers_PhpScript::parse($node->isVisible); if (!eval($phpcode)) { return true; } } if ($node->type == 'SYSTEM' && !$skip) { return true; } if (!$this->_application->canViewPage($node->id)) { return true; } $nodeTitle = empty($node->titleLink) ? $node->title : $node->titleLink; $nodeDescription = empty($node->linkDescription) ? $nodeTitle : $node->linkDescription; $menuNode = array(); if (!$skip) { $menuNode['id'] = $node->id; $menuNode['title'] = $nodeTitle; $menuNode['label'] = $nodeDescription; $menuNode['depth'] = $node->depth; $menuNode['type'] = $node->pageType; $menuNode['cssClass'] = $node->cssClass; $menuNode['haveChild'] = $node->hasChildNodes(); if ($this->_currentMenuId == $node->id && !$this->getAttribute('forceLink')) { $menuNode['node'] = $nodeTitle; } else { $cssClass = $this->getAttribute('selectLink') && $this->_currentMenuId == $node->id ? $this->getAttribute('cssCurrent') : ''; if (empty($node->url)) { $linkParams = array('pageId' => $node->id, 'title' => $nodeDescription, 'label' => $nodeTitle, 'cssClass' => $cssClass, 'icon' => $node->icon); $menuNode['node'] = org_glizy_helpers_Link::makeLink('link', $linkParams); } else { $url = $node->url; if (strpos($url, 'route:') !== false) { $url = substr($url, 6); $url = __Routing::makeUrl($url, __Request::getAllAsArray()); } $menuNode['node'] = org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $url, $nodeDescription, $cssClass); } } if (!$this->getAttribute('selectLink')) { if (!$this->getAttribute('selectParent')) { $menuNode['selected'] = $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : ''; } else { $parentNode =& $this->_currentMenu->parentNodeByDepth($node->depth); if (is_object($parentNode) && $node->depth > 1) { $menuNode['selected'] = $parentNode->id == $node->id || $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : ''; } } } } if (count($menuNode)) { $menu[] = $menuNode; } if ($node->hasChildNodes()) { $childNodes =& $node->childNodes(); $tempMenu = array(); for ($i = 0; $i < count($childNodes); $i++) { $newEndDepth = max($this->_endDepth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0), $node->depth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0)); if ($this->getAttribute('showOnlyChilds')) { if (in_array($node->id, $this->_menuToOpen) || $this->_startMenu->depth == $node->depth || $this->_currentMenuId == $node->id || $this->getAttribute('drawAllChilds')) { $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu); } } else { $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu); } } if (count($tempMenu)) { $menuNode['node'] = $tempMenu; $menuNode['selected'] = ''; if ($this->getAttribute('flat') && count($menu)) { $menu = array_merge($menu, $menuNode['node']); } else { $menu[] = $menuNode; } } } if ($skip && count($menu)) { $menu = $menu[0]['node']; } }
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; }
/** * Render * * @return void * @access public */ function render() { // TODO tradurre le label $output = ''; $output .= '<table id="' . $this->getId() . '" class="js-modulesManager ' . $this->getAttribute('cssClass') . '">'; if ($this->getAttribute('label') != '') { $output .= '<caption>' . $this->getAttribute('label') . '</caption>'; } // disegna le colonne $output .= '<thead>'; $output .= '<tr>'; $output .= '<th class="name">Plugin</th>'; $output .= '<th>Descrizione</th>'; $output .= '<th class="actions"></th>'; $output .= '</tr>'; $output .= '<tfoot><tr><td colspan="3"></td></tr></tfoot>'; $output .= '<tbody>'; $origCssClass = explode(',', $this->getAttribute('cssClass')); $tempCssClass = array(); $modulesState = org_glizy_Modules::getModulesState(); $modules = org_glizy_Modules::getModules(); $this->sort($modules); foreach ($modules as $m) { // $moduleDescription = org_glizy_ObjectFactory::createObject( 'org.glizy.ModuleDescription', $m ); // if ( !empty( $m->pageType ) ) continue; $isEnabled = !isset($modulesState[$m->id]) || $modulesState[$m->id]; if (!count($tempCssClass)) { $tempCssClass = $origCssClass; } $cssClass = array_shift($tempCssClass); $cssClass .= ' ' . ($isEnabled ? 'enabled' : 'disabled'); $output .= '<tr class="' . $cssClass . '">' . '<td class="name">' . __T($m->name) . '</td>' . '<td>' . '<p class="description">' . $m->description . '</p>' . '<p class="info">Versione ' . $m->version . ' | ' . __Link::makeLink2(null, array('label' => $m->author, 'title' => 'Visita il sito dell\'autore', 'url' => $m->authorUrl, 'rel' => 'external')) . ' | ' . __Link::makeLink2(null, array('label' => 'Visita il sito del plugin', 'url' => $m->pluginUrl, 'rel' => 'external')) . '</p>' . '</td>' . '<td class="actions">' . (!$isEnabled ? '<a href="" data-action="enable" data-id="' . $m->id . '" class="js-modulesManagerAction action">abilita</a>' : '') . ($isEnabled ? '<a href="" data-action="disable" data-id="' . $m->id . '" class="js-modulesManagerAction action">disabilita</a>' : '') . ' ' . ($m->canDuplicated ? '<a href="' . __Routing::makeUrl('glizycmsModuleManagerDuplicate', array('pageId' => $this->pageId, 'id' => $m->id)) . '" class="action">duplica</a>' : '') . '</td>' . '</tr>'; } $output .= '</tbody>'; $output .= '</table>'; $output .= <<<EOD <script type="text/javascript"> jQuery(document).ready(function() { \t\$("table.js-modulesManager a.js-modulesManagerAction ").click( function( e ){ \t\te.stopPropagation(); \t\tif ( jQuery( this ).data( "action" ) == "uninstall" ) \t\t{ \t\t\tif ( !confirm( "Sei sicuro di voler rimuovere il plugin?") ) \t\t\t{ \t\t\t\treturn false; \t\t\t} \t\t} \t\t// jQuery.modal('<div></div>', { \t\t// \tclose: false, \t\t// \toverlayCss:{ \t\t// \t\tbackgroundColor:"#000" \t\t// \t}, \t\t// \toverlayClose: false \t\t// }); \t\tjQuery.ajax( { url: Glizy.ajaxUrl+jQuery( this ).data( "action" ), \t\t\t\t\ttype: 'POST', \t\t\t\t\tdata: { id: jQuery( this ).data( "id" ) }, \t\t\t\t\tsuccess: function( response, r, a ) { \t\t\t\t\t\tlocation.reload(); \t\t\t\t\t}}); \t\treturn false; \t}); }); </script> EOD; $this->addOutputCode($output); }
function createChildComponents() { $entityTypeId = $this->_content['entityTypeId']; $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Text', $this->_application, $this, 'glz:Text', 'title', 'title'); $this->addChild($c); $this->_content['url'] = __Routing::makeUrl('showEntityDetail', array('entityTypeId' => $entityTypeId, 'document_id' => $this->_content['document_id'])); $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Text', $this->_application, $this, 'glz:Text', 'url', 'url'); $this->addChild($c); $entityTypeService = $this->_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.image': if (is_null($this->_content['__image']) && $this->_content[$attribute]) { $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Image', $this->_application, $this, 'glz:Image', '__image', '__image'); $c->setAttribute('width', __Config::get('THUMB_WIDTH')); $c->setAttribute('height', __Config::get('THUMB_HEIGHT')); $c->setAttribute('crop', true); $this->addChild($c); $this->_content['__image'] = $this->_content[$attribute]; } break; } if (is_null($this->_content['__description']) && $ar->entity_properties_dublic_core == 'DC.Description' && $this->_content[$attribute]) { $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.LongText', $this->_application, $this, 'glz:LongText', '__description', '__description'); $c->setAttribute('adm:htmlEditor', true); $this->addChild($c); $this->_content['__description'] = glz_strtrim(strip_tags($this->_content[$attribute])); } } // controlla se esiste una lista media/immagini e ne prende la prima if (is_null($this->_content['__image'])) { foreach ($it as $ar) { $attribute = $entityTypeService->getAttributeIdByAr($ar); switch ($ar->entity_properties_type) { case 'attribute.imagelist': if (is_null($this->_content['__image']) && $this->_content[$attribute]) { $objectVars = get_object_vars($this->_content[$attribute]); $content = array_shift($objectVars); $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.Image', $this->_application, $this, 'glz:Image', '__image', '__image'); $c->setAttribute('width', __Config::get('THUMB_SMALL_WIDTH')); $c->setAttribute('height', __Config::get('THUMB_SMALL_HEIGHT')); $c->setAttribute('crop', true); $this->addChild($c); $this->_content['__image'] = $content[0]; } break; } } } // inserisce un'immagine di default if (is_null($this->_content['__image'])) { $c =& org_glizy_ObjectFactory::createComponent('movio.modules.ontologybuilder.views.components.NoImage', $this->_application, $this, 'glz:Image', '__image', '__image'); $c->setAttribute('width', __Config::get('THUMB_SMALL_WIDTH')); $c->setAttribute('height', __Config::get('THUMB_SMALL_HEIGHT')); $this->addChild($c); } if (is_null($this->_content['__description'])) { foreach ($it as $ar) { $attribute = $entityTypeService->getAttributeIdByAr($ar); if (is_null($ar->entity_properties_target_FK_entity_id) && preg_match('/text$/', $ar->entity_properties_type) && $this->_content[$attribute]) { $c =& org_glizy_ObjectFactory::createComponent('org.glizy.components.LongText', $this->_application, $this, 'glz:LongText', '__description', '__description'); $c->setAttribute('adm:htmlEditor', true); $this->addChild($c); $this->_content['__description'] = glz_strtrim(strip_tags($this->_content[$attribute])); } } } }
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; }