Exemple #1
0
 function init()
 {
     if (__Config::get('QUERY_CACHING_INIT')) {
         org_glizy_dataAccessDoctrine_DataAccess::initCache();
     }
     glz_loadLocale('org.glizycms.*');
     glz_loadLocale('org.glizycms.contents.*');
     glz_loadLocale('org.glizycms.languages.*');
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     if ($application) {
         if (!$application->isAdmin()) {
             org_glizy_ObjectFactory::remapClass('org.glizy.components.Page', 'org.glizycms.views.components.Page');
             org_glizy_ObjectFactory::remapClass('org.glizy.mvc.components.Page', 'org.glizycms.views.components.MvcPage');
             org_glizycms_userManager_fe_Module::registerModule();
         }
         // la creazione dell'istanza serve per il listener
         $speakingUrlManager = $application->registerProxy('org.glizycms.speakingUrl.Manager');
         // registra il resolver di default
         org_glizycms_speakingUrl_Manager::registerResolver(org_glizy_ObjectFactory::createObject('org.glizycms.speakingUrl.PageResolver'));
     }
     if (is_null(__Config::get('glizycms.sitemap.cacheLife'))) {
         __Config::set('glizycms.sitemap.cacheLife', 36000);
     }
     if (is_null(__Config::get('glizycms.content.history', ''))) {
         __Config::set('glizycms.content.history', true);
     }
     if (is_null(__Config::get('glizycms.content.history.comment', ''))) {
         __Config::set('glizycms.content.history.comment', false);
     }
     __Config::set('glizy.dataAccess.document.enableComment', __Config::get('glizycms.content.history.comment'));
     if (is_null(__Config::get('glizycms.pageEdit.editUrlEnabled', ''))) {
         __Config::set('glizycms.pageEdit.editUrlEnabled', true);
     }
     if (is_null(__Config::get('glizycms.mediaArchive.exifEnabled', ''))) {
         __Config::set('glizycms.mediaArchive.exifEnabled', false);
     }
     if (is_null(__Config::get('glizycms.speakingUrl', ''))) {
         __Config::set('glizycms.speakingUrl', false);
     }
     if (is_null(__Config::get('glizycms.content.showAllPageTypes', ''))) {
         __Config::set('glizycms.content.showAllPageTypes', true);
     }
     if (is_null(__Config::get('glizycms.form.actionLink.cssClass', ''))) {
         __Config::set('glizycms.form.actionLink.cssClass', 'btn action-link');
     }
     if (is_null(__Config::get('glizycms.print.enabled', ''))) {
         __Config::set('glizycms.print.enabled', false);
     }
     if (is_null(__Config::get('glizycms.print.pdf.enabled', ''))) {
         __Config::set('glizycms.print.pdf.enabled', false);
     }
     if (is_null(__Config::get('glizycms.mediaArchive.bridge', ''))) {
         __Config::set('glizycms.mediaArchive.bridge', 'org.glizycms.mediaArchive.Bridge');
     }
     self::$mediaArchiveBridge = org_glizy_ObjectFactory::createObject(__Config::get('glizycms.mediaArchive.bridge'));
     if ($application && __Config::get('glizycms.mediaArchive.mediaMappingEnabled')) {
         $application->registerProxy('org.glizycms.mediaArchive.services.MediaMappingService');
     }
 }
Exemple #2
0
 static function registerModule()
 {
     glz_loadLocale('movio.modules.thesaurus');
     $moduleVO = org_glizy_Modules::getModuleVO();
     $moduleVO->id = 'movio_thesaurus';
     $moduleVO->name = __T('movio_thesaurus');
     $moduleVO->description = '';
     $moduleVO->version = '1.0.0';
     $moduleVO->classPath = 'movio.modules.thesaurus';
     $moduleVO->author = 'META srl';
     $moduleVO->authorUrl = 'http://www.gruppometa.it';
     $moduleVO->pluginUrl = 'http://movio.beniculturali.it/';
     $moduleVO->siteMapAdmin = '<glz:Page pageType="movio.modules.thesaurus.views.Admin" id="movio_thesaurus" value="{i18n:' . $moduleVO->name . '}" icon="icon-circle-blank" adm:acl="*" />';
     org_glizy_Modules::addModule($moduleVO);
 }
Exemple #3
0
 function compile($options)
 {
     $this->initOutput();
     if (isset($options['pathTemplate'])) {
         $fileName = $options['pathTemplate'] . '/pageTypes/' . $options['pageType'];
         if (file_exists($fileName)) {
             $this->_fileName = $fileName;
         }
     }
     if (isset($options['mode'])) {
         $this->mode = $options['mode'];
     }
     $pageXml = org_glizy_ObjectFactory::createObject('org.glizy.parser.XML');
     if ($this->_fileName) {
         $pageXml->loadAndParseNS($this->_fileName);
     } else {
         throw new Exception('PageType not found ' . $options['pageType']);
     }
     $pageRootNode = $pageXml->documentElement;
     $registredNameSpaces = $pageXml->namespaces;
     $registredNameSpaces['glz'] = 'org.glizy.components';
     // $idPrefix 				= isset($options['idPrefix']) ? $options['idPrefix'] : '';
     $this->_path = $options['path'];
     // include i componenti usati
     foreach ($registredNameSpaces as $key => $value) {
         if ($key != 'glz' && substr($value, -1, 1) == '*' && !in_array($value, $this->_importedPaths)) {
             glz_loadLocale($value);
             $this->output .= 'glz_loadLocale(\'' . $value . '\')' . GLZ_COMPILER_NEWLINE;
             $this->_importedPaths[] = $value;
         }
     }
     $this->_className = glz_basename($this->_cacheObj->getFileName());
     $this->_classSource .= 'class ' . $this->_className . '{' . GLZ_COMPILER_NEWLINE2;
     $this->_classSource .= 'function ' . $this->_className . '(&$application, $skipImport=false, $idPrefix=\'\') {' . GLZ_COMPILER_NEWLINE2;
     $this->_classSource .= '$mode = "' . $this->mode . '"' . GLZ_COMPILER_NEWLINE;
     $counter = 0;
     $this->_compileXml($pageRootNode, $registredNameSpaces, $counter, '$application', '');
     $this->_classSource .= '}' . GLZ_COMPILER_NEWLINE2;
     $this->_classSource .= '}' . GLZ_COMPILER_NEWLINE2;
     $this->output .= $this->_classSource;
     $this->output .= $this->_customClassSource;
     return $this->save();
 }
Exemple #4
0
 function loadTree($forceReload = false)
 {
     if ($forceReload) {
         $this->init();
     }
     $menu = $this->getEmptyMenu();
     $menu['id'] = '__root__';
     $this->_siteMapArray[$menu['id']] = $menu;
     $files = array();
     $dir = org_glizy_Paths::getRealPath('APPLICATION_PAGE_TYPE');
     if ($dirHandle = @opendir($dir)) {
         while ($fileName = readdir($dirHandle)) {
             if ($fileName != '.' && $fileName != '..' && !is_dir($dir . '/' . $fileName) && strstr($fileName, '.xml') !== false) {
                 $files[] = $fileName;
             }
         }
         closedir($dirHandle);
     }
     //ordina il risultato alfabeticamente
     sort($files);
     // legge la localizzazione dei nomi dei pageType
     glz_loadLocale($dir);
     // crea i menù
     foreach ($files as $f) {
         $fileName = substr($f, 0, strrpos($f, '.'));
         $title = __T($fileName);
         if (empty($title)) {
             $title = $fileName;
         }
         $menu = $this->getEmptyMenu();
         $menu['id'] = strtolower($fileName);
         $menu['parentId'] = $this->_searchParent($menu['id']);
         $menu['pageType'] = $fileName;
         $menu['title'] = $title;
         $menu['type'] = substr($fileName, 0, 1) == '_' ? 'SYSTEM' : 'PAGE';
         $this->_siteMapArray[$menu['id']] = $menu;
     }
     $this->_makeChilds();
 }
Exemple #5
0
<?php

glz_loadLocale('movio');
glz_loadLocale('userModules.movio.ontologybuilder');
$application = org_glizy_ObjectValues::get('org.glizy', 'application');
if ($application) {
    org_glizycms_speakingUrl_Manager::registerResolver(org_glizy_ObjectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'));
    org_glizycms_speakingUrl_Manager::registerResolver(org_glizy_ObjectFactory::createObject('movio.modules.news.UrlResolver'));
    org_glizycms_speakingUrl_Manager::registerResolver(org_glizy_ObjectFactory::createObject('movio.modules.touristoperators.UrlResolver'));
}
movio_modules_news_Module::registerModule();
movio_modules_thesaurus_Module::registerModule();
movio_modules_touristoperators_Module::registerModule();
Exemple #6
0
/**
 * @param        $classPath
 * @param array  $classToReadFirst
 * @param string $path
 *
 * @return bool
 */
function glz_import($classPath, $classToReadFirst = array(), $path = '')
{
    static $loadedClass = array();
    $classPath = str_replace('.', '/', $classPath);
    $classPath = rtrim($classPath, '*');
    $origClassPath = $classPath;
    if (in_array($classPath, $loadedClass)) {
        return true;
    }
    if (empty($path)) {
        if (class_exists('org_glizy_Paths') && !is_null(org_glizy_Paths::get('APPLICATION_CLASSES'))) {
            $path = NULL;
            $searchPath = org_glizy_Paths::getClassSearchPath();
            foreach ($searchPath as $p) {
                $path = $p . $classPath;
                if (file_exists($p . $classPath) || file_exists($p . $classPath . '.php')) {
                    $path = $p;
                    break;
                }
            }
            if (is_null($path)) {
                // TODO
                // visualizzare errore
                echo "errore";
            }
        } else {
            $path = realpath(dirname(__FILE__)) . '/classes/';
        }
    }
    if (substr($classPath, -1, 1) == '/' || $classPath == '') {
        // import all file in the folder
        $classPath = rtrim($classPath, '/');
        glz_require_once_dir($path . $classPath, $classToReadFirst);
        glz_loadLocale($classPath);
    } else {
        // import a single file
        if (file_exists($path . $classPath . '.php')) {
            require_once $path . $classPath . '.php';
        } else {
            return false;
        }
    }
    $loadedClass[] = $origClassPath;
    return true;
}
Exemple #7
0
 function render()
 {
     // TODO: controllo acl
     $name = $this->getId();
     if (!$this->_user->acl($this->_application->getPageId(), 'new')) {
         $output = org_glizy_helpers_Html::hidden($name, $this->_content, array('class' => $this->getAttribute('cssClass')));
     } else {
         $pageTypes = array();
         if ($dh = @opendir(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'))) {
             // scan the pageType folder
             while ($fileName = readdir($dh)) {
                 // check if the item is a folder
                 if ($fileName != "." && $fileName != ".." && strpos($fileName, '.xml') !== false) {
                     if ($fileName == 'Common.xml') {
                         continue;
                     }
                     $pageTypes[] = preg_replace('/\\.xml/i', '', $fileName);
                 }
             }
             closedir($dh);
             glz_loadLocale(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'));
         } else {
             // can't open pageTypes folder
             // show the error
             new org_glizy_Exception(array('[%s] %s: %s', $this->getClassName(), GLZ_ERR_NO_PAGETYPE_FOLDER, org_glizy_Paths::get('APPLICATION_TO_ADMIN') . '/pageTypes/'));
         }
         $modules = org_glizy_Modules::getModules();
         foreach ($modules as $moduleVO) {
             if ($moduleVO->pageType) {
                 $pageTypes[] = $moduleVO->pageType;
             }
         }
         $output = '<option value=""></option>';
         $values = array(array($this->getAttribute('emptyValue'), '', 1, array(), 0));
         $modifyMode = $this->getAttribute('modify');
         foreach ($pageTypes as $item) {
             $moduleVO = null;
             foreach ($modules as $m) {
                 if ($m->pageType == $item) {
                     $moduleVO = $m;
                     break;
                 }
             }
             if ($moduleVO) {
                 if (!$moduleVO->show) {
                     continue;
                 }
                 if ($moduleVO->unique && (!$modifyMode || $modifyMode && $item != $this->_content)) {
                     $ar =& org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Menu');
                     $result = $ar->find(array('menu_pageType' => $item));
                     unset($ar);
                     if ($result) {
                         continue;
                     }
                 }
             }
             $pageName = __T($item);
             $output .= '<option value="' . $item . '"' . ($item == $this->_content ? ' selected' : '') . '>' . __T($item) . '</option>';
         }
         $attributes = array();
         $attributes['id'] = $this->getId();
         $attributes['name'] = $this->getOriginalId();
         $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
         $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
         $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
         $output = '<select ' . $this->_renderAttributes($attributes) . '>' . $output . '</select>';
         $cssClassLabel = $this->getAttribute('cssClassLabel');
         $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
         if ($this->getAttribute('wrapLabel')) {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
             $output = '';
         } else {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
         }
         $this->addOutputCode($this->applyItemTemplate($label, $output));
     }
 }
 protected function readFromFolder()
 {
     if ($this->getAttribute('showAllPageTypes')) {
         glz_loadLocale(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'));
         foreach (glob(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE') . '*.{xml}', GLOB_BRACE) as $file) {
             $pathInfo = pathinfo($file);
             if ($pathInfo['basename'] == 'Common.xml' || isset($this->items[$pathInfo['filename']])) {
                 continue;
             }
             $this->items[$pathInfo['filename']] = array('label' => __T($pathInfo['filename']), 'type' => $pathInfo['filename'], 'cssClass' => 'button-generic');
         }
     }
 }