function _init() { parent::_init(); $this->contentType = 'text/xml'; __Paths::set('APPLICATION_PAGE_TYPE', __Paths::get('CORE_CLASSES') . 'org/glizy/oaipmh/pageTypes/'); $this->addMetadataFormat('oai_dc', 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd', 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'dc', 'http://purl.org/dc/elements/1.1/'); }
protected function createZip($exportPath, $zipPath) { require_once __Paths::get('APPLICATION') . '/libs/dZip.inc.php'; $zip = new dZip($zipPath); $this->addFolderToZip($zip, $exportPath, $exportPath); $zip->save(); }
/** * Submit dello step2D, � stata scelta la tabella * * @param string $oldState * @return void */ function executeLater_step2Csv($oldState) { // controlla se � stato ftto submit if (strtolower(__Request::get('action', '')) == 'next') { // sposta il file caricato nella cache if (isset($_FILES['mbCsvFile']) && !empty($_FILES['mbCsvFile']) && !empty($_FILES['mbCsvFile']['name'])) { $file = $_FILES['mbCsvFile']; $file_path = $file['tmp_name']; $file_name = $file['name']; $file_destname = __Paths::getRealPath('CACHE') . md5(time() . $file_name) . '.csv'; if (move_uploaded_file($file_path, $file_destname)) { $moduleName = explode('.', $file_name); $options = array('filePath' => $file_destname, 'enclosure' => __Request::get('mbCsvEnclose', ';'), 'delimiter' => __Request::get('mbCsvSeparate', ';')); $this->_parent->refreshToState('step3', array('mbTable' => $this->getModuleName($moduleName[0]), 'mbTableDB' => __Request::get('table'), 'mbName' => $moduleName[0], 'mbModuleType' => 'csv', 'mbCsvOptions' => $options)); } else { // errore $this->_parent->validateAddError(__T('Errore nel caricamento del file')); } @unlink($file_destname); } else { // errore $this->_parent->validateAddError(__T('Errore nel caricamento del file')); } } }
private function getTemplateDataFromCache($templateData) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); // $templateProxy->invalidateCache(); $cache = $templateProxy->getTemplateCache(); $cssFileName = __Paths::get('CACHE') . md5($this->getClassName() . '_' . $templateData->__id) . '.css'; $self = $this; $templateData = $cache->get($cssFileName, array(), function () use($self, $templateData, $cssFileName) { $newTemplateData = new StdClass(); $newTemplateData->footerLogo = ''; $self->updateTemplateData($templateData); $self->compileCss($templateData, $cssFileName); $templateData->footerLogo = @json_decode($templateData->footerLogo); if ($templateData->footerLogo && $templateData->footerLogo->id) { $image = org_glizy_helpers_Media::getImageById($templateData->footerLogo->id); if ($templateData->footerLogoLink) { $image = __Link::formatLink($templateData->footerLogoLink, $templateData->footerLogoTitle, $image); } $newTemplateData->footerLogo = $image; } $newTemplateData->css = $templateData->css; return $newTemplateData; }); return $templateData; }
function execute($languages, $menuIdArray, $title, $subtitle, $creditPageId, $isExhibitionActive) { if ($this->user->isLogged()) { $languages = is_array($languages) ? $languages : array($languages); $exportPath = __Paths::get('CACHE') . 'export/'; $mediaPath = $exportPath . 'media/'; $graphPath = $exportPath . 'graph/'; $zipFolder = __Paths::get('BASE') . 'export/'; $zipFile = $zipFolder . 'mobileContents.zip'; $creditPageId = str_replace('internal:', '', $creditPageId); $steps = array(); $steps[] = array('action' => 'PrepareExport', 'params' => array('exportPath' => $exportPath, 'languages' => $languages, 'mediaPath' => $mediaPath, 'graphPath' => $graphPath, 'zipFolder' => $zipFolder, 'zipFile' => $zipFile)); $steps[] = array('action' => 'ExportCodes'); foreach ($languages as $languageId) { $ar = __ObjectFactory::createModel('org.glizycms.core.models.Language'); $ar->load($languageId); $sqliteDb = $exportPath . $ar->language_name . '.db'; $languageCode = $ar->language_code; $steps[] = array('action' => 'Export', 'params' => array('mediaPath' => $mediaPath, 'languageId' => $languageId, 'languageCode' => $languageCode, 'menuIdArray' => $menuIdArray, 'title' => $title, 'subtitle' => $subtitle, 'creditPageId' => $creditPageId, 'isExhibitionActive' => $isExhibitionActive)); $steps[] = array('action' => 'Mysql2Sqlite', 'params' => array('exportPath' => $exportPath, 'sqliteDb' => $sqliteDb)); } $steps[] = array('action' => 'CreateJSON', 'params' => array('exportPath' => $exportPath, 'languages' => $languages)); $steps[] = array('action' => 'CreateZip', 'params' => array('exportPath' => $exportPath, 'mediaPath' => $mediaPath, 'zipFile' => $zipFile)); return $steps; } }
function render() { parent::render(); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/d3.v3.min.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/dagre-d3.min.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/graphlib-dot.min.js')); }
function execute() { $tableName = $this->parent->getTableName(); $sitemapCustom = __Paths::get('APPLICATION_TO_ADMIN') . 'startup/modules_custom.php'; if (file_exists($sitemapCustom)) { $output = file_get_contents($sitemapCustom); } else { $output = <<<EOD <?php \$application = org_glizy_ObjectValues::get('org.glizy', 'application' ); if (\$application) { if (!\$application->isAdmin()) { __Paths::addClassSearchPath( __Paths::get( 'APPLICATION_CLASSES' ).'userModules/' ); } //modules_custom.php } EOD; } // cancella entry già presenti $output = preg_replace("/\\/\\/\\sstart\\s" . $tableName . "\\/\\/([^\\/])*\\/\\/\\send\\s" . $tableName . "\\/\\//i", "", $output); // aggiunge la nuova entry $output = str_replace('//modules_custom.php', '// start ' . $tableName . '//' . GLZ_COMPILER_NEWLINE2 . $tableName . '_Module::registerModule();' . GLZ_COMPILER_NEWLINE2 . '// end ' . $tableName . '//' . GLZ_COMPILER_NEWLINE2 . '//modules_custom.php', $output); $r = file_put_contents($sitemapCustom, $output); return true; }
function execute($languageCode, $id, $svg, $type) { if ($this->user->isLogged()) { $exportPath = __Paths::get('CACHE') . 'export/'; $graphPath = $exportPath . 'graph/' . $type . '/' . $languageCode . '/' . $id . '.svg'; file_put_contents($graphPath, $svg); } }
public function initCache() { $cacheDir = __Paths::get('CACHE') . 'doctrine'; @mkdir($cacheDir); if (!self::$isLibLoaded) { self::loadLibrary(); } self::$cacheDriver = new \Doctrine\Common\Cache\PhpFileCache($cacheDir); }
function __construct($content, $pageId, $pageUrl) { GlizyClassLoader::addLib('Gregwar\\Captcha', __Paths::get('APPLICATION_LIBS') . 'captcha'); $this->content = $content; $this->pageId = $pageId; $this->pageUrl = $pageUrl; $this->count = count($this->content); $this->sessionEx = new org_glizy_SessionEx($pageId); $this->captchaBuilder = new Gregwar\Captcha\CaptchaBuilder(); }
function execute($exportPath, $zipFile) { if ($this->user->isLogged()) { require_once __Paths::get('APPLICATION') . '/libs/dZip.inc.php'; $zip = new dZip($zipFile); $this->addFolderToZip($zip, $exportPath, $exportPath); $zip->save(); org_glizy_Registry::set('movio/modules/publishApp/lastUpdate', strval(time())); } }
function execute() { $tableName = $this->parent->getTableName(); $sitemapCustom = __Paths::get('APPLICATION_TO_ADMIN') . 'startup/modules_custom.php'; if (file_exists($sitemapCustom)) { $output = file_get_contents($sitemapCustom); $output = preg_replace("/\\/\\/\\sstart\\s" . $tableName . "\\/\\/([^\\/])*\\/\\/\\send\\s" . $tableName . "\\/\\//i", "", $output); $r = file_put_contents($sitemapCustom, $output); } return true; }
public function execute($data) { // TODO: controllo acl $data = json_decode($data); if ($data && property_exists($data, 'template')) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); $templateProxy->setSelectedTemplate($data->template); org_glizy_cache_CacheFile::cleanPHP(__Paths::get('APPLICATION_TO_ADMIN_CACHE')); return true; } return false; }
public function render_html_onStart() { if ($this->getAttribute('mode') == 'container') { $this->addOutputCode('<iframe id="js-glizycmsPageEdit" src="" data-emptysrc="' . $this->emptySrc . '" data-editsrc="' . $this->editSrc . '"></iframe>'); $corePath = __Paths::get('CORE'); $jQueryPath = $corePath . 'classes/org/glizycms/js/jquery/'; $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.min.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.default.css')); } else { $this->addOutputCode('<div id="message-box"></div>'); parent::render_html_onStart(); } }
public function __construct() { $this->source = __Paths::get('APPLICATION_TO_ADMIN') . 'config/fieldTypes.xml'; $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => -1, 'readControlType' => '', 'fileExtension' => '.php'); $cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options); $cacheFileName = $cacheObj->verify($this->source, get_class($this)); if ($cacheFileName === false) { $this->loadXml(); $cacheObj->save(serialize($this->typeMap), NULL, get_class($this)); $cacheObj->getFileName(); } else { $this->typeMap = unserialize(file_get_contents($cacheFileName)); } }
public static function getSiteTemplatePath() { $templateName = org_glizy_Registry::get(__Config::get('REGISTRY_TEMPLATE_NAME'), ''); if (empty($templateName)) { $templateName = __Config::get('glizycms.template.default'); } $templatePath = __Paths::get('TEMPLATE_FOLDER'); if (empty($templatePath)) { // TODO verificare perché il path è sbagliato ed è necessartio mettere ../ $templatePath = __Paths::get('APPLICATION_STATIC') . 'templates/'; } $templatePath .= $templateName; return '../' . $templatePath; }
/** * @param int $n * * @return mixed * @throws Exception */ static function &getConnection($n = 0) { static $instance = array(); if (!isset($instance['__' . $n])) { $options = array(); $sufix = $n == 0 ? '' : '#' . $n; switch (__Config::get('DB_TYPE' . $sufix)) { case 'sqlite': $dsn = 'sqlite:' . __Paths::getRealPath('APPLICATION', 'data/' . __Config::get('DB_NAME' . $sufix)); $dbUser = ''; $dbPassword = ''; break; default: $socket = __Config::get('DB_SOCKET' . $sufix); $socket = empty($socket) ? '' : ';unix_socket=' . $socket; $dsn = 'mysql:dbname=' . __Config::get('DB_NAME' . $sufix) . ';host=' . __Config::get('DB_HOST' . $sufix) . $socket; $dbUser = __Config::get('DB_USER' . $sufix); $dbPassword = __Config::get('DB_PSW' . $sufix); if (__Config::get('CHARSET') == 'utf-8') { $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"); } if (__Config::get('DB_MYSQL_BUFFERED_QUERY')) { $options[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = true; } break; } $i = 0; $lastException = null; while (!isset($instance['__' . $n])) { try { if ($i < 3) { $instance['__' . $n] = new Connection($dsn, $dbUser, $dbPassword, $options); } else { break; } } catch (Exception $e) { $i++; $lastException = $e; $eventInfo = array('type' => GLZ_LOG_EVENT, 'data' => array('level' => GLZ_LOG_ERROR, 'group' => 'glizy.sql', 'message' => array('errorMessage' => $e->getMessage(), 'errorCode' => $e->getCode(), 'attempt' => $i))); $evt = org_glizy_ObjectFactory::createObject('org.glizy.events.Event', org_glizy_ObjectValues::get('org.glizy', 'application'), $eventInfo); org_glizy_events_EventDispatcher::dispatchEvent($evt); } } if (!isset($instance['__' . $n])) { throw new Exception($lastException->getMessage(), $lastException->getCode(), $lastException); } } return $instance['__' . $n]; }
protected function getTemplateDataFromCache($templateData) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); // $templateProxy->invalidateCache(); $cache = $templateProxy->getTemplateCache(); $cssFileName = __Paths::get('CACHE') . md5($this->getClassName() . '_' . $templateData->__id) . '.css'; $self = $this; $templateData = $cache->get($cssFileName, array(), function () use($self, $templateData, $cssFileName) { $newTemplateData = new StdClass(); $newTemplateData->footerLogo = ''; $self->compileCss($templateData, $cssFileName); $self->fixTemplateData($templateData, $newTemplateData); $newTemplateData->css = $templateData->css; return $newTemplateData; }); return $templateData; }
function render($application, $view, $templateData) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); // $templateProxy->invalidateCache(); $cache = $templateProxy->getTemplateCache(); $cssFileName = __Paths::get('CACHE') . md5($this->getClassName() . '_' . $templateData->__id) . '.css'; $self = $this; $templateData = $cache->get($cssFileName, array(), function () use($self, $templateData, $view, $cssFileName) { $self->updateTemplateData($templateData); $self->compileCss($templateData, $cssFileName); return $templateData; }); $view->addOutputCode($templateData->css, 'css'); $this->renderTemplateHeader($view, $templateData); if (!in_array($view->getAttribute('templateFileName'), array('1col.php', '2cols.php', '3cols.php', 'cover.php'))) { $view->setAttribute('templateFileName', '2cols.php'); } }
function _render_html() { if (!empty($this->mediaUrl)) { $attributes = $this->_content; if (is_string($this->mediaUrl) && (!is_null($this->getAttribute('width')) || !is_null($this->getAttribute('height')))) { if (strpos($this->mediaUrl, 'http://') === 0) { $extension = pathinfo(parse_url($this->mediaUrl, PHP_URL_PATH), PATHINFO_EXTENSION); $cacheFileName = 'external_' . md5($this->mediaUrl) . '.' . $extension; $cacheFilePath = __Paths::get('CACHE') . $cacheFileName; // scarica il file e lo mette in cache if (!file_exists($cacheFilePath)) { @file_put_contents($cacheFilePath, @file_get_contents($this->mediaUrl)); } $params = array('media_id' => 0, 'media_fileName' => $cacheFilePath); $this->media = __ObjectFactory::createObject('org.glizycms.mediaArchive.media.Image', $params); } $this->media->allowDownload = true; $thumbnail = $this->media->getResizeImage($this->getAttribute('width'), $this->getAttribute('height'), $this->getAttribute('crop'), $this->getAttribute('cropOffset'), false, false); $attributes['src'] = $thumbnail['fileName']; $attributes['width'] = $thumbnail['width']; $attributes['height'] = $thumbnail['height']; $this->_content['src'] = $thumbnail['fileName']; $this->_content['width'] = $thumbnail['width']; $this->_content['height'] = $thumbnail['height']; } unset($attributes['mediaUrl']); unset($attributes['zoom']); unset($attributes['size']); unset($attributes['mediaType']); $this->_content['__html__'] = '<img ' . $this->_renderAttributes($attributes) . '/>'; if ($this->getAttribute('zoom') || $useZoom) { $this->_application->addLightboxJsCode(); $attributes = array(); $attributes['title'] = $this->_content['title']; $thumbnail = $this->media->getResizeImage(__Config::get('IMG_WIDTH_ZOOM'), __Config::get('IMG_HEIGHT_ZOOM')); $attributes['href'] = $thumbnail['fileName']; $attributes['rel'] = 'milkbox' . ($this->getAttribute('group') != '' ? '[' . $this->getAttribute('group') . ']' : ''); $attributes['class'] = $zoomCssClass; $this->_content['__html__'] = org_glizy_helpers_Html::renderTag('a', $attributes, true, $this->_content['__html__']); } } else { $this->_content['__html__'] = ''; } }
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'); }
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; } }
public function init() { if (isset($_SERVER['GLIZY_APPNAME'])) { $serverName = $_SERVER['GLIZY_APPNAME']; $filename = 'filesystem_' . $serverName . '.xml'; } else { $filename = 'filesystem.xml'; } $this->source = __Paths::get('APPLICATION_TO_ADMIN') . 'config/' . $filename; if (!file_exists($this->source)) { $this->source = __Paths::get('APPLICATION') . 'config/' . $filename; } $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => -1, 'readControlType' => '', 'fileExtension' => '.php'); $cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options); $cacheFileName = $cacheObj->verify($this->source, get_class($this)); if ($cacheFileName === false) { $this->loadXml(); $cacheObj->save(serialize($this->fileSystemMap), NULL, get_class($this)); $cacheObj->getFileName(); } else { $this->fileSystemMap = unserialize(file_get_contents($cacheFileName)); } $this->init = true; }
function render() { $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile(__Paths::get('APPLICATION_CLASSES') . 'movio/modules/publishApp/static/progressBar.css'), 'head'); $output = <<<EOD <script type="text/javascript"> \$(function() { var state = 'progress'; (function (\$) { \t\$.fn.animateProgress = function (progress, callback) { \t\t\tjQuery.fx.off = false; \t\t\t//var myduration = (progress - old_progress) * 1000 * (durata_totale_stimata / 100); \t\t\told_progress = progress; \t\t\treturn this.each(function () { \t\t\t\t\$(this).animate({ \t\t\t\t\twidth: String(progress) + '%' \t\t\t\t}, { \t\t\t\t\t//duration: myduration, \t\t\t\t\teasing: 'swing', \t\t\t\t\tstep: function (progress) { \t\t\t\t\t\tif (state === 'progress') { \t\t\t\t\t\t\tjQuery.fx.off = false; \t\t\t\t\t\t\tvar labelEl = \$('.ui-label', this), \t\t\t\t\t\t\t\tvalueEl = \$('.value', labelEl); \t\t\t\t\t\t\tif (Math.ceil(progress) < 20) { \t\t\t\t\t\t\t\tlabelEl.hide(); \t\t\t\t\t\t\t} else { \t\t\t\t\t\t\t\tif (labelEl.is(":hidden")) { \t\t\t\t\t\t\t\t\tlabelEl.fadeIn(); \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t} \t\t\t \t\tvalueEl.text(Math.ceil(progress) + '%'); } \t\t\t\t\t}, \t\t\t\t\tcomplete: function (scope, i, elem) { \t\t\t\t\t\tif (callback) { \t\t\t\t\t\t\tscope = 0; \t\t\t\t\t\t\tcallback.call(this, i, elem); \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t}); \t\t\t}); \t\t}; \t}(jQuery)); \tvar resetProgressBar = function () { \t\tjQuery.fx.off = true; \t\t\$('#progress_bar .ui-progress').width("0%"); \t\t\$('#progress_bar .ui-label').hide(); \t}; resetProgressBar(); }); </script> EOD; $output .= '<div id="progress_bar" class="ui-progress-bar ui-container"> <div class="ui-progress" style="width: 0%;"> <span class="ui-label" style="display:none;"><b class="value">0%</b></span> </div></div>'; $this->addOutputCode($output); }
private function decompressFiles($medias) { if (!property_exists($medias, '__expand')) { return $medias; } GlizyClassLoader::addLib('VIPSoft\\Unzip', __Paths::get('APPLICATION_LIBS') . 'VIPSoft/Unzip'); $copyProperties = function (&$properties, &$medias, &$tempMedias, $pos) { foreach ($properties as $v) { $tempMedias->{$v}[] = @$medias->{$v}[$pos]; } }; $properties = array_keys(get_object_vars($medias)); if (!in_array('media_title', $properties)) { $properties[] = 'media_title'; } $tempMedias = new StdClass(); foreach ($properties as $v) { $tempMedias->{$v} = array(); } $numUploaded = count($medias->__uploadFilename); for ($i = 0; $i < $numUploaded; $i++) { if (!$medias->__uploadFilename[$i]) { continue; } if ($medias->__expand[$i] == 1) { $unzipper = new VIPSoft\Unzip\Unzip(); $destFolder = $medias->__uploadFilename[$i] . md5(time()); $filenames = $unzipper->extract($medias->__uploadFilename[$i], $destFolder); foreach ($filenames as $f) { if (strpos($f, '__MACOSX') !== false || strpos($f, '.DS_Store') !== false) { continue; } $filename = $destFolder . '/' . $f; if (is_dir($filename)) { continue; } $pos = count($tempMedias->__uploadFilename); $copyProperties($properties, $medias, $tempMedias, $i); $info = pathinfo($filename); $tempMedias->__uploadFilename[$pos] = $filename; $tempMedias->__originalFileName[$pos] = $info['basename']; $tempMedias->media_title[$pos] = str_replace(array('_', '-'), ' ', $info['filename']); } } else { $copyProperties($properties, $medias, $tempMedias, $i); } } return $tempMedias; }
public static function getLocalePath($languageId) { return __Paths::getRealPath('APPLICATION_TO_ADMIN') . self::BASE_PATH . 'locale/' . $languageId . '.php'; }
public function getTemplateCache() { $cache = org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFunction', $this, -1, false, __Paths::getRealPath('APPLICATION_TO_ADMIN_CACHE')); return $cache; }
function __construct(&$application, &$parent, $tagName = '', $id = '', $originalId = '') { parent::__construct($application, $parent, $tagName, $id, $originalId); $debugBar = org_glizy_debug_Module::$debugBar; $this->debugbarRenderer = $debugBar->getJavascriptRenderer(GLZ_HOST . '/' . __Paths::get('CORE') . 'libs/DebugBar/Resources/'); }
/** * Render * * @return void * @access public */ function render($outputMode = NULL, $skipChilds = false) { $from = ''; $until = ''; $set = ''; $limitStart = 0; if (__Request::exists('resumptionToken')) { if (!__Request::exists('from') && !__Request::exists('until') && !__Request::exists('set') && !__Request::exists('metadataPrefix')) { // TODO controllare la data di scadenza del token $tokenId = __Request::get('resumptionToken'); $fileName = __Paths::get('CACHE') . $tokenId; if (file_exists($fileName)) { $info = unserialize(file_get_contents($fileName)); $limitStart = $info['limitEnd']; $filters = $info['filters']; $metadataPrefix = $info['metadataPrefix']; } else { $this->_application->setError('badResumptionToken', '', $tokenId); return; } } else { $this->_application->setError('exclusiveArgument'); return; } } else { // controlla i parametri ricevuti if (__Request::exists('from')) { $from = __Request::get('from'); if (!org_glizy_oaipmh_OaiPmh::checkDateFormat($from)) { $this->_application->setError('badGranularity', 'from', $from); return; } } if (__Request::exists('until')) { $until = __Request::get('until'); if (!org_glizy_oaipmh_OaiPmh::checkDateFormat($until)) { $this->_application->setError('badGranularity', 'until', $until); return; } } if (__Request::exists('set')) { $set = __Request::get('set'); } if (__Request::exists('metadataPrefix')) { $metadataPrefix = __Request::get('metadataPrefix'); } else { $this->_application->setError('missingArgument', 'metadataPrefix'); return; } $filters = array(); if ($from) { $filters[] = 'picoqueue_date >= ' . org_glizy_dataAccess_DataAccess::qstr($from); } if ($until) { $filters[] = 'picoqueue_date <= ' . org_glizy_dataAccess_DataAccess::qstr($until); } if ($set) { $filters[] = 'picoqueue_recordModule = ' . org_glizy_dataAccess_DataAccess::qstr($set); } } $metadata = $this->_application->getMetadataFormat(); if (isset($metadata[$metadataPrefix])) { // TODO //$inc_record = $metadata[$metadataPrefix]['myhandler']; } else { $this->_application->setError('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix); return; } $limitLength = __Config::get('oaipmh.maxRecords'); $it = org_glizy_ObjectFactory::createModelIterator('org.glizy.oaipmh.models.PicoQueue', 'all', array('filters' => $filters, 'limit' => array($limitStart, $limitLength), 'numRows' => true)); $num_rows = $it->count(); if ($num_rows > 0) { $oaiPrefix = __Config::get('oaipmh.oaiPrefix'); $countrec = 0; $output = '<ListRecords>'; $output .= org_glizy_oaipmh_OaiPmh::createResumptionToken('ListRecords', array('numRows' => $num_rows, 'limitStart' => $limitStart, 'limitEnd' => $limitStart + $limitLength, 'filters' => $filters, 'metadataPrefix' => $metadataPrefix)); while ($it->hasMore()) { $countrec++; $arC = $it->current(); $it->next(); $setClass = org_glizy_ObjectFactory::createObject($arC->picoqueue_recordModule, $this->_application); if (is_null($setClass)) { continue; } $setClass->loadRecord($arC->picoqueue_recordId); $identifier = $oaiPrefix . $arC->picoqueue_identifier; $datestamp = org_glizy_oaipmh_OaiPmh::formatDatestamp($arC->picoqueue_date); $status_deleted = $arC->picoqueue_action == 'delete' ? true : false; $output .= '<record>'; $output .= '<header'; if ($status_deleted) { $output .= ' status="deleted"'; } $output .= '>'; // use xmlrecord since we use stuff from database $output .= '<identifier>' . org_glizy_oaipmh_OaiPmh::encode($identifier) . '</identifier>'; $output .= '<datestamp>' . org_glizy_oaipmh_OaiPmh::encode($datestamp) . '</datestamp>'; if (!$status_deleted) { $output .= '<setSpec>' . org_glizy_oaipmh_OaiPmh::encode($arC->picoqueue_recordModule) . '</setSpec>'; } $output .= '</header>'; $output .= '<metadata>'; $output .= $setClass->getRecord($identifier); $output .= '</metadata>'; $output .= '</record>'; } $output .= '</ListRecords>'; $this->addOutputCode($output); } else { $this->_application->setError('noRecordsMatch'); } }
public function render_html_onEnd($value = '') { parent::render_html_onEnd(); $corePath = __Paths::get('CORE'); $jQueryPath = $corePath . 'classes/org/glizycms/js/jquery/'; $languageCode = $this->_application->getLanguage(); $language = $languageCode . '-' . strtoupper($languageCode); if ($this->getAttribute('newCode')) { $formEditPath = $corePath . 'classes/org/glizycms/js/formEdit2/'; $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/underscore/underscore-min.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEdit.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditStandard.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCheckbox.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditRepeat.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDate.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDateTime.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.it.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-datetimepicker-master/css/datetimepicker.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditColorPicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-colorpicker/js/bootstrap-colorpicker.min.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-colorpicker/css/bootstrap-colorpicker.min.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditGUID.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectFrom.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'select2/select2.min.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'select2/select2.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditTINYMCE.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditMediaPicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditFile.js')); //$this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $jQueryPath.'fineuploader.jquery/jquery.fineuploader.js' ) ); //$this->addOutputCode( org_glizy_helpers_CSS::linkCSSfile( $jQueryPath.'fineuploader.jquery/fineuploader.css' ) ); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.validVal-packed.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPermission.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPhotoGalleryCategory.js')); // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $formEditPath.'GlizyFormEditGoogleMaps.js' ) ); // $this->addOutputCode(org_glizy_helpers_JS::linkJSfile( 'http://maps.google.com/maps/api/js?sensor=false' )); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCmsPagePicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectPageType.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditUrl.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditModalPage.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/glizy-locale/' . $language . '.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.min.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.default.css')); $id = $this->getId(); $mediaPicker = $this->getMediaPickerUrl(); $AJAXAtion = $this->getAttribute('controllerName') ? $this->getAjaxUrl() : ''; $customValidation = $this->getAttribute('customValidation'); if ($customValidation) { $customValidation = 'customValidation: "' . $customValidation . '",'; } $tinyMceUrls = json_encode($this->getTinyMceUrls()); $jsCode = <<<EOD jQuery(function(){ if ( Glizy.tinyMCE_options ) { Glizy.tinyMCE_options.urls = {$tinyMceUrls}; } var myFormEdit = Glizy.oop.create("glizy.FormEdit", '{$id}', { AJAXAction: "{$AJAXAtion}", mediaPicker: {$mediaPicker}, formData: {$this->data}, {$customValidation} lang: GlizyLocale.FormEdit }); }); EOD; } else { $formEditPath = $corePath . 'classes/org/glizycms/js/formEdit/'; $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/underscore/underscore-min.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEdit.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditTINYMCE.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditFile.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditMediaPicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditGoogleMaps.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditGUID.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditColorPicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditValuesPreset.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDate.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDatetime.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.it.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-datetimepicker-master/css/datetimepicker.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-colorpicker/js/bootstrap-colorpicker.min.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-colorpicker/css/bootstrap-colorpicker.min.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/glizy-locale/' . $language . '.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'dropzone/dropzone.min.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'dropzone/css/basic2.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.validVal-packed.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCmsPagePicker.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectFrom.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'select2/select2.min.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.min.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPermission.js')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'select2/select2.css')); $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.default.css')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCheckbox.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile('http://maps.google.com/maps/api/js?sensor=false')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectPageType.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPhotoGalleryCategory.js')); $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditImageHotspot.js')); // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $formEditPath.'GlizyFormEditTreeSelect.js' ) ); // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $jQueryPath.'fancytree/jquery.fancytree-all.min.js' ) ); // $this->addOutputCode( org_glizy_helpers_CSS::linkCSSfile( $jQueryPath.'fancytree/skin-win7/ui.fancytree.min.css' ) ); $id = $this->getId(); $mediaPicker = $this->getMediaPickerUrl(); $AJAXAtion = $this->getAttribute('controllerName') ? $this->getAjaxUrl() : ''; $customValidation = $this->getAttribute('customValidation'); if ($customValidation) { $customValidation = 'customValidation: "' . $customValidation . '",'; } $tinyMceUrls = json_encode($this->getTinyMceUrls()); $jsCode = <<<EOD jQuery(function(){ if ( Glizy.tinyMCE_options ) { Glizy.tinyMCE_options.urls = {$tinyMceUrls}; } var ajaxUrl = "{$AJAXAtion}"; jQuery( "#{$id}" ).GlizyFormEdit({ AJAXAction: ajaxUrl ? ajaxUrl : Glizy.ajaxUrl, mediaPicker: {$mediaPicker}, formData: {$this->data}, {$customValidation} lang: GlizyLocale.FormEdit }); }); EOD; } $this->addOutputCode(org_glizy_helpers_JS::JScode($jsCode)); }