Example #1
0
 /**
  * Process
  *
  * @return	boolean	false if the process is aborted
  * @access	public
  */
 function process()
 {
     $acl = $this->getAttribute('acl');
     if (!empty($acl)) {
         list($service, $action) = explode(',', $acl);
         if (!$this->_user->acl($service, $action)) {
             $this->breakCycle();
             $this->addOutputCode("403 Forbidden");
             return;
         }
     }
     $this->loadContentFromDB();
     $this->loadTemplate();
     $this->sessionEx = org_glizy_ObjectFactory::createObject('org.glizy.SessionEx', $this->getId());
     $this->action = __Request::get($this->actionName);
     $oldAction = $this->sessionEx->get($this->actionName);
     foreach ($this->childComponents as $c) {
         if (is_a($c, 'org_glizy_mvc_components_State')) {
             $c->deferredChildCreation();
         }
     }
     $this->callController();
     $this->canCallController = true;
     $this->action = strtolower($this->action);
     $this->processChilds();
     $this->sessionEx->set($this->actionName, $oldAction);
 }
Example #2
0
 function apply(&$regionContent)
 {
     $this->checkRequiredValues($regionContent);
     foreach ($regionContent as $k => $v) {
         if (!isset(${$k})) {
             ${$k} = $v;
         } else {
             ${$k} .= $v;
         }
     }
     $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.LayoutManagerPHP');
     $compiledFileName = $compiler->verify($this->fileName);
     if ($compiledFileName === false) {
         $templateSource = @implode('', file($this->fileName));
         $templateSource = $this->fixUrl($templateSource);
         $compiledFileName = $compiler->compile($templateSource);
     }
     ob_start();
     include $compiledFileName;
     $templateSource = ob_get_contents();
     ob_end_clean();
     if (isset($regionContent['__body__'])) {
         $templateSource = $this->modifyBodyTag($regionContent['__body__'], $templateSource);
     }
     $templateSource = $this->fixLanguages($templateSource);
     return $templateSource;
 }
Example #3
0
 public function executeLater()
 {
     if ($this->user->isLogged() && $this->submit && $this->controller->validate()) {
         $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
         $ar->load($this->user->id);
         $email = org_glizy_Request::get('user_email', '');
         if ($email != $ar->user_loginId) {
             $ar2 = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
             if ($ar2->find(array('user_loginId' => $email)) && $ar2->user_id != $ar->user_id) {
                 $this->view->validateAddError('L\'email è già presente nel database, usare un\'altra email');
                 return;
             }
         }
         // TODO migliorare così siamo esposti a problemi di sicurezza
         $fields = $ar->getFields();
         foreach ($fields as $k => $v) {
             if ($k == 'user_password') {
                 continue;
             }
             if (__Request::exists($k)) {
                 $ar->{$k} = __Request::get($k);
             }
         }
         $password = __Request::get('user_password');
         if ($password) {
             $ar->user_password = glz_password($password);
         }
         $ar->user_loginId = $email;
         $ar->user_email = $email;
         $ar->save();
         $this->changeAction('modifyConfirm');
     }
 }
Example #4
0
 public function execute($data)
 {
     // TODO: controllo acl
     $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy');
     $templateProxy->saveEditData($data);
     return true;
 }
Example #5
0
 private function addDefaultComponents()
 {
     $id = '__id';
     $c = org_glizy_ObjectFactory::createComponent('org.glizy.components.Hidden', $this->_application, $this, 'glz:Hidden', $id, $id);
     $this->addChild($c);
     $c->init();
 }
Example #6
0
 public function execute()
 {
     $authClass = org_glizy_ObjectFactory::createObject(__Config::get('glizy.authentication'));
     $authClass->logout();
     org_glizy_helpers_Navigation::gotoUrl(GLZ_HOST);
     exit;
 }
Example #7
0
 public function execute($menuId)
 {
     // TODO: CONTROLLO ACL
     $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy');
     $menuProxy->deleteMenu($menuId);
     return true;
 }
Example #8
0
 function execute()
 {
     if (__Request::get('mbModuleType') == 'csv') {
         $tableName = $this->parent->getTableName();
         $fields = __Request::get('fieldName');
         $modelName = 'userModules.' . $tableName . '.models.Model';
         $fieldsMap = array();
         foreach ($fields as $f) {
             $col = str_replace('row_', '', $f);
             $fieldsMap[] = array($f, $col);
         }
         $ar = org_glizy_ObjectFactory::createModel($modelName);
         $csvIterator = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.services.CVSImporter', __Request::get('mbCsvOptions'));
         foreach ($csvIterator as $row) {
             if ($f) {
                 $ar->emptyRecord();
                 foreach ($fieldsMap as $f) {
                     $ar->{$f[0]} = $row->{$f[1]};
                 }
                 $ar->publish();
             }
         }
     }
     return true;
 }
Example #9
0
 public function executeLater()
 {
     if ($this->submit && $this->controller->validate()) {
         $email = org_glizy_Request::get('user_email', '');
         $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
         if ($ar->find(array('user_loginId' => $email))) {
             // TODO tradurre
             $this->view->validateAddError('L\'email è già presente nel database, usare un\'altra email o richiedere la password');
             return;
         }
         $fields = $ar->getFields();
         foreach ($fields as $k => $v) {
             if (__Request::exists($k)) {
                 $ar->{$k} = __Request::get($k);
             }
         }
         $ar->user_FK_usergroup_id = __Config::get('USER_DEFAULT_USERGROUP');
         $ar->user_isActive = __Config::get('USER_DEFAULT_ACTIVE_STATE');
         $ar->user_password = glz_password(__Request::get('user_password'));
         $ar->user_loginId = $email;
         $ar->user_email = $email;
         $ar->user_dateCreation = new org_glizy_types_DateTime();
         $ar->save();
         $this->changeAction('registrationConfirm');
     }
 }
Example #10
0
 public function publish()
 {
     $exportPath = __Paths::get('CACHE') . 'export/';
     $mediaPath = $exportPath . 'media/';
     $zipPath = __Paths::get('BASE') . 'export/' . 'mobileContents.zip';
     org_glizy_helpers_Files::deleteDirectory($exportPath);
     @unlink($zipPath);
     @mkdir($exportPath);
     @mkdir($mediaPath);
     $exportService = org_glizy_ObjectFactory::createObject('movio.modules.publishApp.service.ExportService');
     $exportService->export();
     $medias = $exportService->getMedias();
     foreach ($medias as $id => $fileName) {
         $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
         copy($media->getFileName(), $mediaPath . $fileName);
     }
     $dbHost = __Config::get('DB_HOST');
     $dbUser = __Config::get('DB_USER');
     $dbPass = __Config::get('DB_PSW');
     $dbName = __Config::get('DB_NAME');
     $tableName = __Config::get('movio.modules.publishApp.mobileContentsTable');
     $sqliteDb = $exportPath . __Config::get('movio.modules.publishApp.sqliteDbName');
     $mysql2SqliteService = org_glizy_ObjectFactory::createObject('movio.modules.publishApp.service.Mysql2SqliteService');
     $mysql2SqliteService->convert($dbHost, $dbUser, $dbPass, $dbName, $tableName, $sqliteDb);
     $this->createZip($exportPath, $zipPath);
     org_glizy_Registry::set('movio/modules/publishApp/lastUpdate', time());
 }
Example #11
0
 function process()
 {
     if (!$this->_application->isAdmin()) {
         $this->_content = array();
         $this->_content['label'] = $this->getAttribute('label');
         $this->_content['buttonLabel'] = $this->getAttribute('buttonLabel');
         $this->_content['comment'] = $this->getAttribute('comment');
         $this->_content['comment1'] = org_glizy_locale_Locale::get('GLZ_SEARCH_RESULT');
         $this->_content['value'] = org_glizy_Request::get('search', '');
         $this->_content['result'] = null;
         // preg_match( '/"([^"]*)"/i', $this->_content['value'], $match );
         // if ( count( $match ) )
         // {
         //     $searchArray2 = array( $match[ 1 ] );
         // }
         // else
         // {
         //     if ($this->getAttribute('explodeWords')) {
         //         $searchArray = explode(' ', $this->_content['value']);
         //         $searchArray2 = array();
         //         foreach ($searchArray as $word)
         //         {
         //             if (strlen($word)>=3) $searchArray2[] = $word;
         //         }
         //     } else {
         //         $searchArray2 = $this->_content['value'];
         //     }
         // }
         if (strlen($this->_content['value']) >= 3) {
             $pluginObj =& org_glizy_ObjectFactory::createObject('org.glizy.plugins.Search');
             $this->_content['result'] = $pluginObj->run(array('search' => $this->_content['value'], 'languageId' => $this->_application->getLanguageId()));
         }
         $this->_content['total'] = org_glizy_locale_Locale::get('GLZ_SEARCH_RESULT_TOTAL') . ' ' . count($this->_content['result']);
     }
 }
Example #12
0
 public function searchDocumentsByTerm($term, $id, $protocol = '', $filterType = '')
 {
     $result = array();
     if ($protocol && $protocol != $this->protocol) {
         return $result;
     }
     $languageId = $this->editLanguageId;
     $it = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Menu');
     if ($term) {
         $it->load('autocompletePagePicker', array('search' => '%' . $term . '%', 'languageId' => $languageId, 'menuId' => '', 'pageType' => $filterType));
     } else {
         if ($id) {
             if (!is_numeric($id) && strpos($id, $this->protocol) !== 0) {
                 return $result;
             } elseif (is_string($id)) {
                 $id = $this->getIdFromLink($id);
             }
             $it->load('autocompletePagePicker', array('search' => '', 'languageId' => $languageId, 'menuId' => $id));
         } else {
             return $result;
         }
     }
     foreach ($it as $ar) {
         $result[] = array('id' => $this->protocol . $ar->menu_id, 'text' => $ar->menudetail_title, 'path' => ltrim($ar->p1 . '/' . $ar->p2 . '/' . $ar->p3, '/') . '/' . $ar->menudetail_title);
     }
     return $result;
 }
Example #13
0
 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;
 }
Example #14
0
 function &current()
 {
     $fields = $this->_rs->fields;
     $activeRecord =& org_glizy_ObjectFactory::createModel($this->_recordClassName);
     $activeRecord->loadFromArray($fields);
     return $activeRecord;
 }
Example #15
0
 public static function compile($compiler, &$node, &$registredNameSpaces, &$counter, $parent = 'NULL')
 {
     if ($node->hasAttribute('src')) {
         $src = $node->getAttribute('src');
         if (strpos($src, '.xml') === strlen($src) - 4) {
             $src = substr($src, 0, -4);
         }
         $pageType = org_glizy_ObjectFactory::resolvePageType($src) . '.xml';
         $path = $compiler->getPath();
         $fileName = $path . $pageType;
         if (!file_exists($fileName)) {
             $fileName = glz_findClassPath($src);
             if (is_null($fileName)) {
                 // TODO: file non trovato visualizzare errore
             }
         }
         $compiler2 = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Component');
         $compiledFileName = $compiler2->verify($fileName);
         $className = GLZ_basename($compiledFileName);
         $componentId = $node->hasAttribute('id') ? $node->getAttribute('id') : '';
         $compiler->_classSource .= '// TAG: ' . $node->nodeName . ' ' . $node->getAttribute('src') . GLZ_COMPILER_NEWLINE2;
         $compiler->_classSource .= 'if (!$skipImport) {' . GLZ_COMPILER_NEWLINE2;
         $compiler->_classSource .= 'org_glizy_ObjectFactory::requireComponent(\'' . $compiledFileName . '\', \'' . addslashes($fileName) . '\')' . GLZ_COMPILER_NEWLINE;
         $compiler->_classSource .= '$n' . $counter . ' = new ' . $className . '($application, ' . $parent . ')' . GLZ_COMPILER_NEWLINE;
         $compiler->_classSource .= $parent . '->addChild($n' . $counter . ')' . GLZ_COMPILER_NEWLINE;
         $compiler->_classSource .= '}' . GLZ_COMPILER_NEWLINE;
     }
 }
Example #16
0
 function compile($options)
 {
     $this->initOutput();
     // esegue il parsing del file di configurazione
     $xml = org_glizy_ObjectFactory::createObject('org.glizy.parser.XML');
     $xml->loadAndParseNS($this->_fileName);
     $services = $xml->getElementsByTagName('AclService');
     $this->output .= '$acl = array();';
     foreach ($services as $service) {
         $name = strtolower($service->getAttribute('name'));
         $default = $service->hasAttribute('default') ? $service->getAttribute('default') : 'true';
         $this->output .= '$acl[\'' . $name . '\'] = array(\'default\' => ' . $default . ', \'rules\' => array(';
         $rules = $service->getElementsByTagName('AclAction');
         foreach ($rules as $rule) {
             $name = strtolower($rule->getAttribute('name'));
             $allowGroups = $rule->getAttribute('allowGroups');
             $allowGroups = !empty($allowGroups) ? 'array(\'' . str_replace(',', '\', \'', $allowGroups) . '\')' : 'array()';
             $allowUsers = $rule->getAttribute('allowUsers');
             $allowUsers = !empty($allowUsers) ? 'array(\'' . str_replace(',', '\', \'', $allowUsers) . '\')' : 'array()';
             $this->output .= '\'' . $name . '\' => array(\'allowGroups\' => ' . $allowGroups . ', \'allowUsers\' => ' . $allowUsers . '), ';
         }
         $this->output .= '))' . GLZ_COMPILER_NEWLINE;
     }
     return $this->save();
 }
Example #17
0
 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);
     }
 }
Example #18
0
 /**
  * Process
  *
  * @return	boolean	false if the process is aborted
  * @access	public
  */
 function process()
 {
     $tagContent = $this->getText();
     if (empty($tagContent)) {
         // richiede il contenuto al padre
         $tagContent = $this->_parent->loadContent($this->getId());
         $this->setText($tagContent);
     }
     if ($this->_parent->_tagname == 'glz:Page') {
         if (strpos($this->getText(), '.xml') !== false) {
             // crea i componenti leggendoli dal pageType specificato
             $fileName = org_glizy_Paths::getRealPath('APPLICATION_PAGE_TYPE', $this->getText());
             if (!empty($fileName)) {
                 $originalRootComponent =& $this->_application->getRootComponent();
                 $this->_pageTypeObj =& org_glizy_ObjectFactory::createPage($this->_application, preg_replace('/.xml$/', '', $this->getText()));
                 $rootComponent =& $this->_application->getRootComponent();
                 $rootComponent->init();
                 $this->_application->_rootComponent =& $originalRootComponent;
                 for ($i = 0; $i < count($rootComponent->childComponents); $i++) {
                     $rootComponent->childComponents[$i]->remapAttributes($this->getId() . '-');
                     $this->addChild($rootComponent->childComponents[$i]);
                     $rootComponent->childComponents[$i]->_parent =& $this;
                 }
                 $this->processChilds();
             }
         } else {
             $newComponent =& org_glizy_ObjectFactory::createComponent($this->getText(), $this->_application, $this, '', '', '');
             $newComponent->init();
             $this->addChild($newComponent);
             $this->processChilds();
         }
     }
 }
Example #19
0
 public function execute()
 {
     $c = $this->view->getComponentById('dp');
     if (stripos($this->application->getPageId(), 'picker') !== false) {
         // picker
         $sessionEx = org_glizy_ObjectFactory::createObject('org.glizy.SessionEx', $c->getId());
         $mediaType = org_glizy_Request::get('mediaType', '');
         if (empty($mediaType)) {
             $mediaType = $sessionEx->get('mediaType', 'ALL', false, false);
         }
         if (!empty($mediaType) && strtoupper($mediaType) != 'ALL') {
             $sessionEx->set('mediaType', $mediaType, GLZ_SESSION_EX_PERSISTENT);
             $c->setAttribute('query', 'all' . ucfirst(strtolower(str_replace(',', '_', $mediaType))));
             // $this->setAttribute('filters', 'media_type IN (\''.str_replace(',', '\',\'',$mediaType).'\')');
         }
         if (stripos($this->application->getPageId(), 'tiny') !== false) {
             $this->setComponentsVisibility('buttonsBar', false);
         }
     } else {
         $query = str_replace('all', '', __Request::get('tabs_state', 'allMedia'));
         // $query = str_replace('mediaarchive_all', '', strtolower($this->application->getPageId()));
         if (empty($query) || $query == 'mediaarchive') {
             $query = 'media';
         }
         $query = 'all' . ucfirst($query);
         $c->setAttribute('query', $query);
     }
     // TODO  disabilitare il  pulsane aggiungi in base all'acl
 }
Example #20
0
 /**
  * Render
  *
  * @return	void
  * @access	public
  */
 function render($outputMode = NULL, $skipChilds = false)
 {
     $sets = $this->_application->getSets();
     if (!count($sets)) {
         $this->_application->setError('noSetHierarchy');
     } else {
         $metadataFormat = $this->_application->getMetadataFormat();
         $output = '<ListSets>';
         foreach ($sets as $v) {
             $setClass = org_glizy_ObjectFactory::createObject($v);
             if ($setClass) {
                 $info = $setClass->getSetInfo();
                 $output .= '<set>';
                 $output .= '<setSpec>' . org_glizy_oaipmh_OaiPmh::encode($info['setSpec']) . '</setSpec>';
                 $output .= '<setName>' . org_glizy_oaipmh_OaiPmh::encode($info['setName']) . '</setName>';
                 if (!empty($info['setDescription'])) {
                     $output .= '<setDescription>';
                     $output .= org_glizy_oaipmh_OaiPmh::openMetadataHeader($metadataFormat['oai_dc']);
                     $output .= '<dc:description>' . org_glizy_oaipmh_OaiPmh::encode($info['setDescription']) . '</dc:description>';
                     $output .= '<dc:creator>' . org_glizy_oaipmh_OaiPmh::encode($info['setCreator']) . '</dc:creator>';
                     $output .= org_glizy_oaipmh_OaiPmh::closeMetadataHeader($metadataFormat['oai_dc']);
                     $output .= '</setDescription>';
                 }
                 $output .= '</set>';
             }
         }
         $output .= '</ListSets>';
         $this->addOutputCode($output);
     }
 }
Example #21
0
 function process()
 {
     $params = __Request::get('params');
     $query = json_decode($params, true);
     $paginateClass = $this->getComponentById('paginate');
     $paginateClass->setRecordsCount();
     $limits = $paginateClass->getLimits();
     $start = $limits['start'] + 1;
     $checkBoxEnable = $query['imgCheckBox'] === "checkBoxEnable";
     $rows = 18;
     $diff = 0;
     if ($query['maxResult'] && !$checkBoxEnable && $start + $rows > $query['maxResult']) {
         $rows = $query['maxResult'] - $start + 1;
         $diff = 18 - $rows;
     }
     $this->_content = array('id' => $this->getId(), 'records' => array(), 'error' => null, 'params' => $params, 'rows' => $rows, 'currentOffset' => $limits['start']);
     $request = org_glizy_ObjectFactory::createObject('movio.modules.europeana.SendRequest');
     $response = $request->execute($query, $start, $rows);
     if (!$response->error) {
         $this->_content['records'] = $response->records;
         if ($checkBoxEnable) {
             $this->_content['imgCheckBox'] = true;
             $total = $response->totalResults;
         } else {
             $this->_content['imgCheckBox'] = false;
             $total = $response->totalResults ? $query['maxResult'] : 0;
         }
     } else {
         $this->_content['error'] = $response->error;
     }
     $this->_content['imgList'] = $query['imgList'] ? $query['imgList'] : array();
     $paginateClass->setRecordsCount($total - $diff, $rows);
 }
Example #22
0
 function render_html()
 {
     if (!__Config::get('MULTILANGUAGE_ENABLED')) {
         return false;
     }
     $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language', 'all', array('order' => 'language_order'));
     if ($iterator->count() > 1) {
         $output = '<ul class="' . $this->getAttribute('cssClass') . '" id="' . $this->getId() . '">';
         if ($this->getAttribute('separator') == 'start') {
             $output .= '<li class="separator">|</li>';
         }
         foreach ($iterator as $ar) {
             $url = __Link::addParams(array('language' => $ar->language_code));
             if ($ar->language_id == $this->_application->getLanguageId()) {
                 $output .= '<li class="' . $ar->language_code . '">' . org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, '', 'active') . '</li>';
             } else {
                 $output .= '<li class="' . $ar->language_code . '">' . org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url) . '</li>';
             }
         }
         if ($this->getAttribute('separator') == 'end') {
             $output .= '<li>|</li>';
         }
         $output .= '</ul>';
         $this->addOutputCode($output);
     }
 }
Example #23
0
 private function includeFolder($folder)
 {
     // controlla se il file in cache è valido
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => org_glizy_Config::get('CACHE_CODE'), 'readControlType' => '', 'fileExtension' => '.css');
     $cacheSignature = get_class($this) . $folder;
     $cacheObj = org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $cssFileName = $cacheObj->verify($cacheSignature);
     if ($cssFileName === false) {
         $cssFile = '';
         if ($dir_handle = @opendir($folder)) {
             while ($file_name = readdir($dir_handle)) {
                 if ($file_name != "." && $file_name != ".." && !is_dir("{$dir}/{$file_name}")) {
                     $f[] = $file_name;
                 }
             }
             sort($f);
             closedir($dir_handle);
             foreach ($f as $element) {
                 $cssCode = file_get_contents($folder . '/' . $element);
                 $cssFile .= $cssCode . "\n";
             }
         }
         if (__Config::get('DEBUG') !== false) {
             $cacheObj->save($cssFile, NULL, get_class($this));
         } else {
             $cacheObj->save($cssFile, NULL, $cacheSignature);
         }
         $cssFileName = $cacheObj->getFileName();
     }
     return $cssFileName;
 }
Example #24
0
 static function start()
 {
     if (!org_glizy_Session::isStarted()) {
         $sessionStore = org_glizy_Config::get('glizy.session.store');
         $prefix = org_glizy_Config::get('SESSION_PREFIX');
         $timeout = org_glizy_Config::get('SESSION_TIMEOUT');
         if ($sessionStore) {
             $storagePrefix = org_glizy_Config::get('glizy.session.store.prefix');
             if (!$storagePrefix) {
                 $storagePrefix = 'PHPSESSID';
             }
             $store = org_glizy_ObjectFactory::createObject($sessionStore, $timeout, $storagePrefix . $prefix);
             if (!$store) {
                 throw new Exception('Session Store don\'t exists: ' . $sessionStore);
             }
             session_set_save_handler($store);
         }
         if (!isset($_SESSION)) {
             org_glizy_Session::glz_session_start();
         }
         if (isset($_SESSION[$prefix . 'sessionLastAction']) && time() - $_SESSION[$prefix . 'sessionLastAction'] > $timeout) {
             $_SESSION = array();
         }
         $_SESSION[$prefix . 'sessionStarted'] = true;
         $_SESSION[$prefix . 'sessionLastAction'] = time();
     }
 }
Example #25
0
 function process_ajax()
 {
     $mode = $this->getAttribute('mode');
     $q = __Request::get('q');
     $result = array();
     if ($mode == 'users') {
         $it = org_glizy_ObjectFactory::createModelIterator('org.glizycms.userManager.models.UserGroup', 'all');
         $it->setOrFilters(array("user_firstName" => $q, "user_lastName" => $q, "user_loginId" => $q));
         foreach ($it as $ar) {
             $result[] = array('id' => $ar->user_id, 'text' => $ar->user_loginId);
         }
     } else {
         if ($mode == 'groups') {
             $it = org_glizy_ObjectFactory::createModelIterator('org.glizycms.userManager.models.UserGroup', 'all', array('filters' => array('usergroup_name' => $q)));
             foreach ($it as $ar) {
                 $result[] = array('id' => $ar->usergroup_id, 'text' => $ar->usergroup_name);
             }
         } else {
             $it = org_glizy_ObjectFactory::createModelIterator('org.glizycms.roleManager.models.Role', 'all', array('filters' => array('role_name' => $q)));
             foreach ($it as $ar) {
                 $result[] = array('id' => $ar->role_id, 'text' => $ar->role_name);
             }
         }
     }
     return $result;
 }
Example #26
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();
 }
Example #27
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');
     }
 }
Example #28
0
 function render()
 {
     $content = $this->getContent();
     $outputTitle = '';
     $outputImage = '';
     $outputProperty = '';
     $outputDescription = '';
     foreach ($this->items as $i) {
         $value = $content[$i['field']];
         if (glz_empty($value)) {
             continue;
         }
         if (is_array($value) && $value['__html__']) {
             $value = $value['__html__'];
         }
         $renderCell = $i['renderCell'];
         if (!empty($renderCell)) {
             if (!is_object($renderCell)) {
                 $renderCell =& org_glizy_ObjectFactory::createObject($renderCell);
                 $i['renderCell'] = $renderCell;
             }
             if (is_object($renderCell)) {
                 $value = $renderCell->renderCell($value);
             }
         }
         $label = $i['label'];
         if (preg_match("/\\{i18n\\:.*\\}/i", $label)) {
             $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $label);
             $label = org_glizy_locale_Locale::getPlain($code);
         }
         if ($i['type'] == 'title') {
             $outputTitle .= '<h2>' . $value . '</h2>';
         } else {
             if ($i['type'] == 'property') {
                 $outputProperty .= '<li><span>' . $label . ':</span> ' . $value . '</li>';
             } else {
                 if ($i['type'] == 'description') {
                     $outputDescription .= '<h3>' . $label . '</h3> ' . $value;
                 } else {
                     if ($i['type'] == 'image') {
                         $outputImage .= $value;
                     }
                 }
             }
         }
     }
     $cssClass = $this->getAttribute('cssClass');
     if ($outputProperty != '') {
         $outputProperty = '<ul>' . $outputProperty . '</ul>';
     }
     if ($outputImage != '') {
         $outputImage = '<dic class="row"><div class="three columns images">' . $outputImage . '</div>';
         $outputProperty = '<div class="eight columns">' . $outputProperty . '</div></div>';
     }
     $output = '<div id="' . $this->getOriginalId() . '"' . ($cssClass != "" ? ' class="' . $cssClass . '"' : '') . '>';
     $output .= $outputTitle . $outputImage . $outputProperty . $outputDescription;
     $output .= '</div>';
     $this->addOutputCode($output);
 }
Example #29
0
 function process()
 {
     $groupId = __Request::get('groupId');
     if ($groupId) {
         $entityProxy = org_glizy_ObjectFactory::createObject('movio.modules.ontologybuilder.models.proxy.EntityProxy');
         $this->_content = $entityProxy->getContentsByProfile($groupId);
     }
 }
Example #30
0
 function getItems()
 {
     $thesaurusProxy = org_glizy_ObjectFactory::createObject('movio.modules.thesaurus.models.proxy.ThesaurusProxy');
     $dictionaries = $thesaurusProxy->getAllDictionaries();
     foreach ($dictionaries as $dictionary) {
         $this->addItem($dictionary->getId(), $dictionary->title);
     }
 }