예제 #1
0
 function process()
 {
     $this->recordId = org_glizy_Request::get($this->getAttribute('idName'), NULL);
     if (is_null($this->recordId)) {
         return;
     }
     $dataProvider =& $this->getAttribute('dataProvider');
     if ($dataProvider) {
         $this->ar = $dataProvider->load($this->recordId);
         $processCell = org_glizy_ObjectFactory::createObject($this->getAttribute('processCell'), $this->_application);
         if ($processCell) {
             $ar =& $this->ar;
             call_user_func_array(array($processCell, 'renderCell'), array($ar, $this->getAttribute('processCellParams')));
         }
         $this->_content = org_glizy_ObjectFactory::createObject('org.glizy.components.RecordDetailVO', $this->ar);
         $ogTitle = $this->getAttribute('ogTitle');
         if ($ogTitle) {
             org_glizy_ObjectValues::set('org.glizy.og', 'title', $this->ar->{$ogTitle});
             if ($this->getAttribute('modifyBreadcrumbs')) {
                 $evt = array('type' => GLZ_EVT_BREADCRUMBS_UPDATE, 'data' => $this->ar->{$ogTitle});
                 $this->dispatchEvent($evt);
                 $evt = array('type' => GLZ_EVT_PAGETITLE_UPDATE, 'data' => $this->ar->{$ogTitle});
                 $this->dispatchEvent($evt);
             }
         }
         // TODO controllare che i dati siano stati caricati correttamento
     } else {
         // TODO generare errore, dataprovider non valid
     }
     $this->_content->__url__ = !is_null($this->getAttribute('routeUrl')) ? org_glizy_helpers_Link::makeURL($this->getAttribute('routeUrl'), $this->_content) : '';
     parent::process();
 }
예제 #2
0
 /**
  *	Verifica se il file è compilato, in casi affermativo restutuisce il path
  */
 function verify($fileName, $options = NULL)
 {
     // $fileName = realpath( $fileName );
     // check if the file is already compiled in the same request
     // this is usefull in develop enviroment
     $c = org_glizy_ObjectValues::get($this->getClassName(), $fileName);
     if (!is_null($c)) {
         return $c;
     }
     // può essere passato un nome di file per verificare
     // il caching. è utilizzato nel reamp dei pageType
     $verifyFileName = $options && isset($options['verifyFileName']) ? $options['verifyFileName'] : $fileName;
     $cacheFileName = $this->_cacheObj->verify($verifyFileName, org_glizy_Paths::get('CACHE') . get_class($this));
     if ($cacheFileName === false) {
         $this->_fileName = $fileName;
         $cacheFileName = $this->compile($options);
         if ($cacheFileName === false) {
             // TODO
             echo "FATAL ERROR " . $fileName;
             return false;
         }
     }
     org_glizy_ObjectValues::set($this->getClassName(), $fileName, $cacheFileName);
     return $cacheFileName;
 }
예제 #3
0
 public function render($outputMode = NULL, $skipChilds = false)
 {
     parent::render($outputMode, $skipChilds);
     if (!org_glizy_ObjectValues::get('org.glizycms.js', 'jsTree', false)) {
         org_glizy_ObjectValues::set('org.glizycms.js', 'jsTree', true);
         $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery-jstree/jquery.jstree.js'));
         $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery-jstree/jquery.cookie.js'));
     }
 }
예제 #4
0
 function switchEditingLanguage($id)
 {
     $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language');
     $ar->load($id);
     org_glizy_Session::set('glizy.editingLanguage', $ar->language_code);
     org_glizy_Session::set('glizy.editingLanguageId', $ar->language_id);
     org_glizy_Session::set('glizy.editingLanguageIsDefault', $ar->language_isDefault);
     org_glizy_ObjectValues::set('org.glizy', 'editingLanguageId', $ar->language_id);
 }
예제 #5
0
    /**
     * Render
     *
     * @return	void
     * @access	public
     */
    function render_html()
    {
        $folder = $this->getAttribute('folder');
        $src = $this->getAttribute('src');
        $type = $this->getAttribute('type');
        $language = $this->_application->getLanguage();
        $language2 = $language . '-' . strtoupper($language);
        $src = str_replace(array('##LANG##', '##LANG2##'), array($language, $language2), $src);
        if ($folder) {
            if (!org_glizy_ObjectValues::get('org.glizy.JS', 'run', false)) {
                org_glizy_ObjectValues::set('org.glizy.JS', 'run', true);
                $pageType = $this->_application->getPageType();
                $state = __Request::get('action', '');
                $params = __Request::getAllAsArray();
                unset($params['__params__']);
                unset($params['__routingName__']);
                unset($params['__routingPattern__']);
                unset($params['__url__']);
                unset($params['__back__url__']);
                $params = json_encode($params);
                $jsCode = <<<EOD
var GlizyApp = {};
GlizyApp.pages = {};
jQuery( function(){
\tif ( typeof( GlizyApp.pages[ '{$pageType}' ] ) != 'undefined' )
\t{
\t\tGlizyApp.pages[ '{$pageType}' ]( '{$state}', {$params} );
\t}
})
EOD;
                $this->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head');
            }
            // include tutta una cartella
            $jsFileName = $this->includeFolder($folder);
            if ($this->getAttribute('inline')) {
                $js = file_get_contents($jsFileName);
                if (strpos($js, '<script') !== false) {
                    $this->addOutputCode($js);
                } else {
                    $this->addOutputCode(org_glizy_helpers_JS::JScode($js, $type));
                }
            } else {
                $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jsFileName . (__Config::get('DEBUG') ? '?' . microtime(true) : ''), null, $type));
            }
        } else {
            if ($src) {
                $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($src, null, $type));
            } else {
                $this->addOutputCode(org_glizy_helpers_JS::JScode($this->replaceLocale($this->getText()), $type));
            }
        }
    }
예제 #6
0
파일: Input.php 프로젝트: GruppoMeta/Movio
    function render()
    {
        parent::render();
        $rootComponent =& $this->getRootComponent();
        if (!org_glizy_ObjectValues::get('org.glizy.JS.textext', 'add', false)) {
            org_glizy_ObjectValues::set('org.glizy.JS.textext', 'add', true);
            $core = __Paths::get('CORE');
            $output = <<<EOD
<link rel="stylesheet" type="text/css" href="{$core}/classes/org/glizycms/js/jquery/select2/select2.css" />
<script type="text/javascript" src="{$core}/classes/org/glizycms/js/jquery/select2/select2.min.js" charset="UTF-8"></script>
EOD;
            $rootComponent->addOutputCode($output, 'head');
        }
        $id = $this->getId();
        $content = $this->_content ? json_encode($this->_content) : '[]';
        $ajaxUrl = 'ajax.php?pageId=' . __Request::get('pageId') . '&ajaxTarget=' . $this->getId();
        $output = <<<EOD
<script type="text/javascript">
\$(function(){
\t\$('#{$id}').val('');
    \$('#{$id}').select2({
        multiple: true,
        ajax: {
            url: '{$ajaxUrl}',
            dataType: 'json',
            quietMillis: 100,
            data: function(term, page) {
                return {
                    q: term,
                };
            },
            results: function(data, page ) {
                return { results: data }
            }
        },
    });

    \$('#{$id}').select2('data', {$content});
});
</script>
EOD;
        $rootComponent->addOutputCode($output, 'head');
    }
예제 #7
0
파일: User.php 프로젝트: GruppoMeta/Movio
 function __construct($userInfo)
 {
     if (is_object($userInfo)) {
         $userInfo = (array) $userInfo;
     }
     $this->id = $userInfo['id'];
     $this->firstName = $userInfo['firstName'];
     $this->lastName = $userInfo['lastName'];
     $this->loginId = $userInfo['loginId'];
     $this->email = $userInfo['email'];
     $this->groupId = $userInfo['groupId'];
     $this->backEndAccess = $userInfo['backEndAccess'];
     $this->language = isset($userInfo['language']) ? $userInfo['language'] : '';
     $this->active = $userInfo['isActive'];
     $this->dateCreation = $userInfo['dateCreation'];
     // TODO gestire __Config::get('ACL_ENABLED')
     // creando un UserAcl che viene creato se __Config::get('ACL_ENABLED') = true
     $this->_acl = org_glizy_ObjectFactory::createObject(__Config::get('ACL_CLASS'), $this->id, $this->groupId);
     org_glizy_ObjectValues::set('org.glizy', 'userId', $this->id);
 }
예제 #8
0
 function getItems()
 {
     $oldCacheValue = __Config::get('QUERY_CACHING');
     __Config::set('QUERY_CACHING', $this->getAttribute('cache'));
     if (is_null($this->iterator)) {
         $this->process();
     }
     $items = org_glizy_ObjectValues::get('org.glizy.components.DataDictionary', $this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'));
     if (is_null($items)) {
         $items = __Session::get($this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'));
     }
     if (is_null($items)) {
         $items = $this->loadDictionary($this->getAttribute('field'), $this->getAttribute('query'), unserialize($this->getAttribute('queryParams')), $this->getAttribute('skipEmpty'), $this->getAttribute('delimiter'));
         org_glizy_ObjectValues::set('org.glizy.components.DataDictionary', $this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'), $items);
         if ($this->getAttribute('delimiter') != '') {
             __Session::set($this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'), $items);
         }
     }
     __Config::set('QUERY_CACHING', $oldCacheValue);
     return $items;
 }
예제 #9
0
    function render_html()
    {
        $tableClass = $this->getAttribute("cssClass");
        $id = $this->getId();
        $ajaxUrl = $this->getAjaxUrl();
        $colSpan = 0;
        $headers = '';
        $aoColumnDefs = array();
        foreach ($this->columns as $column) {
            if ($column['acl']) {
                if (!$this->_user->acl($column['acl']['service'], $column['acl']['action'])) {
                    continue;
                }
            }
            $colSpan++;
            $headers .= '<th';
            if (!$column['visible']) {
                $headers .= ' style="display:none;"';
            }
            if ($column['width']) {
                $headers .= ' width="' . $column['width'] . '%"';
            }
            $headers .= '>' . $column['headerText'] . '</th>';
            $aoColumnDefs[] = array("bSortable" => $column['sortable'], "bSearchable" => $column['searchable'], "aTargets" => array($colSpan - 1), "sType" => "html", "sClass" => $column['cssClass']);
        }
        $aoColumnDefs = json_encode($aoColumnDefs);
        if (!org_glizy_ObjectValues::get('jquery.dataTables', 'add', false)) {
            org_glizy_ObjectValues::set('jquery.dataTables', 'add', true);
            $staticDir = org_glizy_Paths::get('STATIC_DIR');
            $html = '<script type="text/javascript" src="' . $staticDir . '/jquery/datatables/media/js/jquery.dataTables.min.js"></script>';
            $html .= '<script type=""text/javascript" src="' . $staticDir . '/jquery/datatables/media/js/jquery.dataTables.bootstrap.js"></script>';
        }
        $cookieName = 'DataTables_' . __Config::get('SESSION_PREFIX') . $this->getId() . $this->_application->getPageId();
        $sLengthMenu = __T('records per page');
        $sEmptyTable = __T('No record found');
        $sZeroRecords = __T('No record found with current filters');
        $sInfo = __T('Showing _START_ to _END_ of _TOTAL_ entries');
        $sInfoEmpty = __T('Showing 0 to 0 of 0 entries');
        $sInfoFiltered = __T('filtered from _MAX_ total entries');
        $sLoadingRecords = __T('Loading...');
        $sProcessing = __T('Processing...');
        $Search = __T('Search');
        $sFirst = __T('First');
        $sLast = __T('Last');
        $sNext = __T('Next');
        $sPrevious = __T('Previous');
        $JQueryUI = $this->getAttribute('JQueryUI') ? 'true' : 'false';
        $minSearchLenght = $this->getAttribute('minSearchLenght');
        $html .= <<<EOD
        <table class="{$tableClass}" id="{$id}">
            <thead>
                <tr >
                    {$headers}
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="{$colSpan}" style="text-align: center" class="dataTables_empty">Loading data from server</td>
                </tr>
            </tbody>
        </table>
<script type="text/javascript">

// <![CDATA[
\$( function(){
    var table = \$('#{$id}').dataTable( {
        "sDom": "<'row-fluid filter-row clearfix'<'filter-box'l><'filter-box'f>r>t<'row-fluid clearfix'<'filter-box pull-left'i><'filter-box pull-right'p>>",
        "sPaginationType": "bootstrap",
        "oLanguage": {
            "sLengthMenu": "_MENU_ {$sLengthMenu}",
            "sEmptyTable": "No record found",
            "sZeroRecords": "{$sZeroRecords}",
            "sInfo": "{$sInfo}",
            "sInfoEmpty": "{$sInfoEmpty}",
            "sInfoFiltered": "({$sInfoFiltered})",
            "sLoadingRecords": "{$sLoadingRecords}",
            "sProcessing": "{$sProcessing}",
            "sSearch": "{$Search}:",
            "oPaginate": {
                "sFirst": "{$sFirst}",
                "sLast": "{$sLast}",
                "sNext": "{$sNext}",
                "sPrevious": "{$sPrevious}"
            }
        },
        "bJQueryUI": {$JQueryUI},
        "bServerSide": true,
        "sAjaxSource": "{$ajaxUrl}",
        "aoColumnDefs": {$aoColumnDefs},
        "bStateSave": true,
        "fnStateSave": function (oSettings, oData) {
            localStorage.setItem( "{$cookieName}", JSON.stringify(oData) );
        },
        "fnStateLoad": function (oSettings) {
            return JSON.parse( localStorage.getItem("{$cookieName}") );
        }
    } );

    \$('.dataTables_filter input')
        .unbind()
        .bind('keyup', function(e){
            if (\$(this).val().length > 0 && \$(this).val().length < {$minSearchLenght} && e.keyCode != 13) return;
            table.fnFilter(\$(this).val());
        })

    \$('#{$id}').data('dataTable', table);
});
// ]]>
</script>
EOD;
        $this->addOutputCode($html);
    }
예제 #10
0
파일: Input.php 프로젝트: GruppoMeta/Movio
    private function addTinyMCE($attachToElement)
    {
        if ($this->getAttribute('htmlEditor') === true) {
            $rootComponent =& $this->getRootComponent();
            if (!org_glizy_ObjectValues::get('org.glizy.JS.TinyMCE', 'add', false)) {
                org_glizy_ObjectValues::set('org.glizy.JS.TinyMCE', 'add', true);
                $rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('tiny_mce.js?v=' . GLZ_CORE_VERSION, 'tiny_mce/', false), 'head');
                $rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('Glizy_tiny_mce.js?v=' . GLZ_CORE_VERSION), 'head', true);
                $jsCode = 'Glizy.tinyCSS = "' . __Config::get('TINY_MCE_CSS') . '";';
                $jsCode .= 'Glizy.tinyMCE_plugins = "' . __Config::get('TINY_MCE_DEF_PLUGINS') . '";';
                $jsCode .= 'Glizy.tinyMCE_btn1 = "' . __Config::get('TINY_MCE_BUTTONS1') . '";';
                $jsCode .= 'Glizy.tinyMCE_btn2 = "' . __Config::get('TINY_MCE_BUTTONS2') . '";';
                $jsCode .= 'Glizy.tinyMCE_btn3 = "' . __Config::get('TINY_MCE_BUTTONS3') . '";';
                if (__Config::get('TINY_MCE_PLUGINS') != '') {
                    $jsCode .= 'Glizy.tinyMCE_plugins .= ",' . __Config::get('TINY_MCE_PLUGINS') . '";';
                }
                $rootComponent->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head');
            }
            if (!is_null($this->getAttribute('adm:tinyMCEplugin'))) {
                $pluginsNames = explode(',', $this->getAttribute('adm:tinyMCEplugin'));
                $pluginsPaths = array();
                for ($i = 0; $i < count($pluginsNames); $i++) {
                    $pos = strrpos($pluginsNames[$i], "/");
                    if ($pos !== false) {
                        $pluginsPaths[] = '../../../../../../' . $pluginsNames[$i];
                        $pluginsNames[$i] = substr($pluginsNames[$i], $pos + 1);
                    } else {
                        $pluginsPaths[] = $pluginsNames[$i];
                    }
                }
                if (count($pluginsPaths)) {
                    $jsCode = 'Glizy.tinyMCE_plugins += ",' . implode(',', $pluginsPaths) . '";';
                    $jsCode .= 'Glizy.tinyMCE_pluginsNames += ",' . implode(',', $pluginsNames) . '";';
                    $rootComponent->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head');
                }
            }
            if ($attachToElement) {
                $id = $this->getId();
                $jsCode = <<<EOD
jQuery(function(){
\tvar options = Glizy.tinyMCE_options;
\toptions.mode = "exact";
\toptions.elements = '{$id}';
\ttinyMCE.init( options );
});
EOD;
                //$this->addOutputCode(org_glizy_helpers_JS::JScode( $jsCode ));
            }
        }
    }
예제 #11
0
 function setOgValue()
 {
     $og = $this->getAttribute('og');
     if ($og) {
         org_glizy_ObjectValues::set('org.glizy.og', $og, $this->getOgValue());
     }
 }
예제 #12
0
 private function checkSwitchLanguage()
 {
     $language = org_glizy_Request::get('language', NULL);
     if (!is_null($language) && $language != $this->_language) {
         // cambio lingua
         $this->log("change language", GLZ_LOG_SYSTEM);
         $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language');
         $ar->language_code = $language;
         $ar->find();
         org_glizy_Session::set('glizy.language', $ar->language_code);
         org_glizy_Session::set('glizy.languageId', $ar->language_id);
         org_glizy_ObjectValues::set('org.glizy', 'languageId', $ar->language_id);
         $this->_languageId = $ar->language_id;
         $this->_language = $ar->language_code;
         // ricarica la struttura del sito per avere i titoli aggiornati
         $this->_initSiteMap(true);
         // controlla se il routing ha definito un urlResolver
         $speakingUrlManager = $this->retrieveProxy('org.glizycms.speakingUrl.Manager');
         $urlResolver = $speakingUrlManager->getResolver(__Request::get('cms:urlResolver', 'org.glizycms.core.models.Content'));
         $url = $urlResolver->makeUrlFromRequest();
         org_glizy_helpers_Navigation::gotoUrl($url);
     }
 }
예제 #13
0
파일: zoom.php 프로젝트: GruppoMeta/Movio
<?php

$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL;
$w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : 0;
if (is_null($id)) {
    exit;
}
if (!defined('GLZ_LOADED')) {
    require_once 'core/core.inc.php';
    org_glizy_Paths::init('application', '');
    org_glizy_Config::init();
    if (file_exists(org_glizy_Paths::get('APPLICATION_STARTUP'))) {
        // if the startup folder is defined all files are included
        glz_require_once_dir(org_glizy_Paths::get('APPLICATION_STARTUP'));
    }
    org_glizy_ObjectValues::set('org.glizy', 'languageId', 1);
}
$zoomFile = __Paths::get('CACHE') . '/zoom_' . $id . '_' . $w . '.xml';
if (!file_exists($zoomFile)) {
    glz_import('org.glizycms.mediaArchive.MediaManager');
    set_time_limit(0);
    $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
    if (preg_match('/\\.tif$/', $media->fileName)) {
        $mediaInfo = $media->getResizeImage(2000, 2000);
        $media->fileName = $mediaInfo['fileName'];
    }
    set_include_path(implode(PATH_SEPARATOR, array(realpath('application/libs/openzoom/'), get_include_path())));
    require 'Oz/Deepzoom/ImageCreator.php';
    $converter = new Oz_Deepzoom_ImageCreator(254, 1, "jpg", 0.8);
    $converter->create(realpath($media->getFileName()), $zoomFile);
}
예제 #14
0
파일: url.php 프로젝트: GruppoMeta/Movio
<?php

require_once "core/core.inc.php";
org_glizy_ObjectValues::set('org.glizy', 'editingLanguageId', 1);
$application = org_glizy_ObjectFactory::createObject('org.glizycms.core.application.Application', 'application');
org_glizy_Paths::addClassSearchPath('admin/application/classes/');
$application->runSoft();
$req = __Request::get('req');
$timestamp = __Request::get('timestamp');
$languageCode = __Request::get('languageCode');
$action = __Request::get('action');
if ($languageCode) {
    $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language');
    $result = $ar->find(array('language_code' => $languageCode));
    if ($result) {
        org_glizy_ObjectValues::set('org.glizy', 'editingLanguageId', $ar->language_id);
    } else {
        header("Content-Type: application/json");
        echo json_encode('NO_LANGUAGE');
        die;
    }
}
if ($req == 'checkUrl') {
    $result = array('status' => true);
} else {
    if ($req == 'news') {
        $it = org_glizy_ObjectFactory::createModelIterator('movio.modules.news.models.News');
        if ($timestamp) {
            $it->where('document_detail_modificationDate', date('Y-m-d H:i:s', $timestamp), '>');
        }
        $result = array();
예제 #15
0
 function login()
 {
     $this->log("login", GLZ_LOG_SYSTEM);
     if (org_glizy_Session::get('glizy.userLogged')) {
         $this->log("user is logged", GLZ_LOG_SYSTEM);
         $user = org_glizy_Session::get('glizy.user');
         // crea l'utente
         $this->_user =& org_glizy_ObjectFactory::createObject('org.glizy.application.User', $user);
         org_glizy_ObjectValues::setByReference('org.glizy', 'user', $this->_user);
         org_glizy_ObjectValues::set('org.glizy', 'userId', $this->_user->id);
         if (org_glizy_Config::get('USER_LOG')) {
             $this->log("log user access", GLZ_LOG_SYSTEM);
             $arLog =& org_glizy_ObjectFactory::createModel('org.glizy.models.UserLog');
             $arLog->load($user['logId']);
             $arLog->userlog_FK_user_id = $user['id'];
             $arLog->save();
         }
     } else {
         $this->log("user not logged", GLZ_LOG_SYSTEM);
         // utente finto
         $user = 0;
         // crea l'utente
         $this->_user =& org_glizy_ObjectFactory::createObject('org.glizy.application.User', $user);
         org_glizy_ObjectValues::setByReference('org.glizy', 'user', $this->_user);
         org_glizy_ObjectValues::set('org.glizy', 'userId', 0);
     }
 }