public function renderCell(&$ar) { $media = org_glizycms_mediaArchive_MediaManager::getMediaByRecord($ar); $sizes = method_exists($media, 'getOriginalSizes') ? $media->getOriginalSizes() : array('width' => 0, 'height' => 0); $thumbnail = $media->getThumbnail(__Config::get('THUMB_WIDTH'), __Config::get('THUMB_HEIGHT'), __Config::get('ADM_THUMBNAIL_CROP'), __Config::get('ADM_THUMBNAIL_CROPPOS')); $ar->thumb_filename = $thumbnail['fileName']; $ar->thumb_w = $thumbnail['width']; $ar->thumb_h = $thumbnail['height']; $ar->media_w = $sizes['width']; $ar->media_h = $sizes['height']; if ($ar->media_title == '') { $ar->media_title = $ar->media_originalFileName; } if (!$ar->media_date) { $ar->media_date = ''; } if (!$ar->media_copyright) { $ar->media_copyright = ''; } if (!$ar->media_description) { $ar->media_description = ''; } $ar->__jsonMedia = org_glizycms_Glizycms::getMediaArchiveBridge()->getJsonFromAr($ar); $application = $this->application; $user = $application->_user; $ar->__url__ = $user->acl($application->getPageId(), 'edit') ? __Routing::makeUrl('actionsMVC', array('action' => 'edit', 'id' => $ar->media_id)) : false; $ar->__urlDelete__ = $user->acl($application->getPageId(), 'delete') ? __Routing::makeUrl('actionsMVC', array('action' => 'delete', 'id' => $ar->media_id)) : false; $ar->__urlDownload__ = org_glizycms_helpers_Media::getFileUrlById($ar->media_id); $ar->__urlPreview__ = org_glizycms_helpers_Media::getImageUrlById($ar->media_id, 800, 600); }
public function execute() { $authClass = org_glizy_ObjectFactory::createObject(__Config::get('glizy.authentication')); $authClass->logout(); org_glizy_helpers_Navigation::gotoUrl(GLZ_HOST); exit; }
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; }
/** * Init * * @return void * @access public */ function init() { // define the custom attributes $this->defineAttribute('bindTo', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('cssClass', false, __Config::get('glizy.formElement.cssClass'), COMPONENT_TYPE_STRING); $this->defineAttribute('cssClassLabel', false, __Config::get('glizy.formElement.cssClassLabel'), COMPONENT_TYPE_STRING); $this->defineAttribute('dataProvider', false, NULL, COMPONENT_TYPE_OBJECT); $this->defineAttribute('disabled', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('emptyValue', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('jsAction', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('label', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('multiSelect', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('rows', false, 1, COMPONENT_TYPE_INTEGER); $this->defineAttribute('readOnly', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('required', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('size', false, '', COMPONENT_TYPE_STRING); $this->defineAttribute('value', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('wrapLabel', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('insertInto', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('target', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('title', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('checkValues', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('searchCondition', false, '=', COMPONENT_TYPE_STRING); $this->defineAttribute('adm:suggest', false, NULL, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('adm:suggestAdd', false, NULL, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('adm:suggestDelimiter', false, ' ', COMPONENT_TYPE_STRING); $this->defineAttribute('outputOnlyValue', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('linkedTo', false, NULL, COMPONENT_TYPE_OBJECT); $this->defineAttribute('flip', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('setFirstValue', false, true, COMPONENT_TYPE_BOOLEAN); // call the superclass for validate the attributes parent::init(); }
/** * @param $msg * @param int $level * @param string $group * * @return bool|mixed * @throws Exception */ function log($msg, $level = GLZ_LOG_DEBUG, $group = '') { if (!$this->_check($level, $group)) { return false; } $t = explode(" ", microtime()); $params = array('@timestamp' => date("Y-m-d\\TH:i:s", $t[1]) . substr((string) $t[0], 1, 4) . date("P"), 'host' => !isset($_SERVER["SERVER_ADDR"]) ? 'console' : $_SERVER["SERVER_ADDR"], 'group' => $group, 'level' => $level, 'caller' => $this->getCallingName(), 'pid' => getmypid(), 'appName' => __Config::get('APP_NAME')); $message = array_merge($this->_message, $params); if (is_array($msg)) { $message = array_merge($message, $msg); } else { $message = array_merge($message, array('message' => $msg)); } // set_time_limit(0); $data = json_encode($message); $restUrl = $this->_host . $this->_index . '-' . date("Y.m.d") . '/' . $this->_type; $ch = curl_init($restUrl); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data))); if (!($result = curl_exec($ch))) { if (class_exists('org_glizy_Config') && org_glizy_Config::get('DEBUG') === true) { throw new Exception(curl_error($ch), curl_errno($ch)); } } curl_close($ch); return $result; }
public function __construct() { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); if (__Config::get('glizycms.speakingUrl') && !$application->isAdmin()) { $this->addEventListener(GLZ_EVT_START_COMPILE_ROUTING, $this); } }
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'); } }
public function execute() { $siteProp = unserialize(org_glizy_Registry::get(__Config::get('REGISTRY_SITE_PROP') . $this->application->getEditingLanguage(), '')); if ($siteProp) { $this->view->setData($siteProp); } }
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); } }
/** * Init * * @return void * @access public */ public function init() { $this->defineAttribute('global', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('adm:cssClass', false, __Config::get('glizy.formElement.admCssClass'), COMPONENT_TYPE_STRING); // call the superclass for validate the attributes parent::init(); }
private function loadSelectedImage($query) { foreach ($query['savedImage'] as $item) { $imgSrc = $item->edmPreview[0] ? $item->edmPreview[0] : __Config::get('movio.noImage.src'); $this->_content['records'][] = array('id' => $item->id, 'image' => $item->src, 'title' => $item->title, 'url' => $item->href); } }
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); } }
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()); }
public function getGraph($entityTypeId, &$visited, &$edges) { if ($visited[$entityTypeId]) { return ''; } else { $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityProperties = $entityTypeService->getEntityTypeProperties($entityTypeId); $graph = ''; $color = __Config::get('movio.graph.shapeColor'); $entityTypeName = $entityTypeService->getEntityTypeName($entityTypeId); if ($this->getAttribute('generateLinks')) { $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $ar = $entityResolver->getMenuVisibleEntity($entityTypeId); if ($ar) { $url = $this->makeUrl($ar->id, $ar->title); } } // se è il nodo da cui inizia la ricerca ricorsiva if (count($visited) == 0) { if (empty($url)) { $graph .= '"' . $this->escape($entityTypeName) . '" [label="<div class=\'main-node\'>' . $this->escape($entityTypeName) . '</div>",style="fill: #ddd"];' . PHP_EOL; } else { $graph .= '"' . $this->escape($entityTypeName) . '" [label="<div class=\'main-node\'><a href=\'' . $url . '\'>' . $this->escape($entityTypeName) . '</a></div>",style="fill: #ddd"];' . PHP_EOL; } } else { if ($url) { $graph .= '"' . $this->escape($entityTypeName) . '" [label="<div><a href=\'' . $url . '\'>' . $this->escape($entityTypeName) . '</a>"];' . PHP_EOL; } } $visited[$entityTypeId] = true; foreach ((array) $entityProperties as $entityProperty) { if ($entityProperty['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $entityProperty['entity_properties_target_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $entityProperty['entity_properties_type']); if (!$edges[$entityTypeName][$toEntityTypeName]) { $edges[$entityTypeName][$toEntityTypeName] = true; $graph .= '"' . $this->escape($entityTypeName) . '" -> "' . $this->escape($toEntityTypeName) . '" [label="' . $label . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $referenceRelations = $entityTypeService->getEntityTypeReferenceRelations($entityTypeId); foreach ((array) $referenceRelations as $referenceRelation) { if ($referenceRelation['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $referenceRelation['entity_properties_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $referenceRelation['entity_properties_type']); if (!$edges[$toEntityTypeName][$entityTypeName]) { $edges[$toEntityTypeName][$entityTypeName] = true; $graph .= '"' . $this->escape($toEntityTypeName) . '" -> "' . $this->escape($entityTypeName) . '" [label="' . $label . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $visited[$entityTypeId] = true; return $graph; } }
static function registerModule() { if (__Config::get('DEBUG')) { include_once 'Helpers.php'; self::$debugBar = org_glizy_ObjectFactory::createObject('org.glizy.debug.GlizyDebugBar'); org_glizy_ObjectFactory::createObject('org.glizy.debug.Whoops'); } }
protected function renderVisibilityButton($key, $row) { $output = ''; if ($this->canView && $this->canEdit) { $output .= __Link::makeLinkWithIcon('actionsMVCToggleVisibility', __Config::get($row->isVisible() ? 'glizy.datagrid.action.showCssClass' : 'glizy.datagrid.action.hideCssClass'), array('title' => $row->isVisible() ? __T('Hide') : __T('Show'), 'id' => $key, 'model' => $row->getClassName(false), 'action' => 'togglevisibility')); } return $output; }
/** * @return \Predis\Client|\PredisPhpdoc\Client */ public static function getConnection() { if (is_null(self::$predis)) { $host = __Config::get('glizy.database.caching.redis'); self::$predis = new Predis\Client($host ? $host : 'tcp://127.0.0.1:6379'); } return self::$predis; }
public function delete($recordId, $model) { $ar = org_glizy_objectFactory::createModel($model); if (__Config::get('ACL_MODULES')) { // permessi editing e visualizzazione record $this->addAclRelations($ar); } $ar->delete($recordId); }
/** * Init * * @return void * @access public */ function process() { $authClass = org_glizy_ObjectFactory::createObject(__Config::get('glizy.authentication')); if ($authClass) { $authClass->logout(); } org_glizy_helpers_Navigation::gotoUrl(GLZ_HOST); exit; }
public function execute($menuId) { $templateEnabled = __Config::get('glizycms.contents.templateEnabled'); if ($templateEnabled) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); $templateEnabled = $templateProxy->getTemplateAdmin() !== false; } $this->view->setAttribute('draw', $templateEnabled); }
function renderCell($key, $value) { if ($value == '1') { $value = '<span class="' . __Config::get('glizy.datagrid.checkbox.on') . '"></span>'; } else { $value = '<span class="' . __Config::get('glizy.datagrid.checkbox.off') . '"></span>'; } return $value; }
public function getGraph($entityTypeId, &$visited, &$edges, $firstNode = false) { if ($visited[$entityTypeId]) { return ''; } else { $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityProperties = $entityTypeService->getEntityTypeProperties($entityTypeId); $graph = ''; $color = __Config::get('movio.graph.shapeColor'); $entityTypeName = $entityTypeService->getEntityTypeName($entityTypeId); if ($this->getAttribute('generateLinks')) { $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $ar = $entityResolver->getMenuVisibleEntity($entityTypeId); if ($ar) { $url = 'URL="' . $this->makeUrl($ar->id, $ar->title) . '"'; } } // se è il nodo da cui inizia la ricerca ricorsiva if ($firstNode or empty($url)) { $s = $url ? $url . ', ' : ''; $graph .= '"' . $this->escape($entityTypeName) . '" [' . $s . 'label="<span>' . $this->escape($entityTypeName . ' ' . __Link::makeLinkWithIcon('actionsMVC', 'icon-pencil icon-white', array('action' => 'edit', 'id' => $entityTypeId, 'title' => __T('GLZ_RECORD_EDIT'))) . '<a href="' . __Link::makeURL('actionsMVC', array('action' => 'delete', 'id' => $entityTypeId)) . '" onclick="if (!confirm('' . __T('GLZ_RECORD_MSG_DELETE') . '')){return false}"><i class="icon-remove icon-white"></i></a>') . ' </span>"];' . PHP_EOL; } else { if ($url) { $graph .= '"' . $this->escape($entityTypeName) . '" [' . $url . '];' . PHP_EOL; } } $visited[$entityTypeId] = true; foreach ((array) $entityProperties as $entityProperty) { if ($entityProperty['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $entityProperty['entity_properties_target_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $entityProperty['entity_properties_type']); if (!$edges[$entityTypeName][$toEntityTypeName]) { $edges[$entityTypeName][$toEntityTypeName] = true; $graph .= '"' . $this->escape($entityTypeName) . '" -> "' . $this->escape($toEntityTypeName) . '" [label="' . $this->escape($label) . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $referenceRelations = $entityTypeService->getEntityTypeReferenceRelations($entityTypeId); foreach ((array) $referenceRelations as $referenceRelation) { if ($referenceRelation['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $referenceRelation['entity_properties_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $referenceRelation['entity_properties_type']); if (!$edges[$toEntityTypeName][$entityTypeName]) { $edges[$toEntityTypeName][$entityTypeName] = true; $graph .= '"' . $this->escape($toEntityTypeName) . '" -> "' . $this->escape($entityTypeName) . '" [label="' . $this->escape($label) . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $visited[$entityTypeId] = true; return $graph; } }
/** * Init * * @return void * @access public */ public function init() { $this->defineAttribute('mode', false, 'container', COMPONENT_TYPE_STRING); $this->defineAttribute('initialState', false, 'empty', COMPONENT_TYPE_STRING); $this->defineAttribute('editState', false, 'edit', COMPONENT_TYPE_STRING); $this->defineAttribute('editUrl', false, __Config::get('glizycms.speakingUrl'), COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('adm:cssClass', false, __Config::get('glizy.formElement.admCssClass'), COMPONENT_TYPE_STRING); // call the superclass for validate the attributes parent::init(); }
/** * Init * * @return void * @access public */ function init() { // define the custom attributes $this->defineAttribute('cssClass', false, 'entities big ico-box span11', COMPONENT_TYPE_STRING); $this->defineAttribute('cssClassLabel', false, __Config::get('glizy.formElement.cssClassLabel'), COMPONENT_TYPE_STRING); $this->defineAttribute('label', false, NULL, COMPONENT_TYPE_STRING); $this->defineAttribute('value', false, NULL, COMPONENT_TYPE_STRING); // call the superclass for validate the attributes parent::init(); }
function process() { $template = __Config::get('glizycms.form.buttonsPanel'); if ($template) { list($templateStart, $templateEnd) = explode('##CONTENT##', $template); $this->templateStart = str_replace('##ID##', $this->getid(), $templateStart); $this->templateEnd = $templateEnd; } parent::process(); }
public function render($application, $view, $templateData) { $templateData = $this->getTemplateDataFromCache($templateData); $siteProp = unserialize(org_glizy_Registry::get(__Config::get('REGISTRY_SITE_PROP') . $view->_application->getLanguage(), '')); $view->addOutputCode($templateData->css, 'css'); $view->addOutputCode($siteProp['title'], 'siteTitle'); $view->addOutputCode($siteProp['subtitle'], 'siteSubtitle'); $this->fixTemplateName($view); $this->addCustomOutput($view, $templateData); }
/** * Save the content for a menu * @param org_glizycms_contents_models_ContentVO $data Content to save * @param int $languageId Language id * @param boolean $publish Publish or save */ public function saveContent(org_glizycms_contents_models_ContentVO $data, $languageId, $publish = true, $setMenuTitle = true) { $speakingUrlProxy = __Config::get('glizycms.speakingUrl') ? org_glizy_ObjectFactory::createObject('org.glizycms.speakingUrl.models.proxy.SpeakingUrlProxy') : null; // TODO gestire meglio gli errori tramite eccezioni $menuId = (int) $data->getId(); if ($menuId) { $invalidateSitemapCache = false; $menuDocument = $this->readRawContentFromMenu($menuId, $languageId); $originalUrl = $menuDocument->url; $menuDocument->setDataFromContentVO($data); if ($speakingUrlProxy && $originalUrl != $menuDocument->url) { //valida l'url if (!$speakingUrlProxy->validate($menuDocument->url, $languageId, $menuId, 'org.glizycms.core.models.Content')) { return 'Url non valido perché già utilizzato'; } } // salva i dati if ($publish) { $menuDocument->publish(null, $data->getComment()); } else { $menuDocument->save(null, false, 'PUBLISHED', $data->getComment()); } if ($speakingUrlProxy && $originalUrl != $menuDocument->url) { // aggiorna l'url parlante $speakingUrlProxy = org_glizy_ObjectFactory::createModel('org.glizycms.speakingUrl.models.proxy.SpeakingUrlProxy'); if ($menuDocument->url) { $speakingUrlProxy->addUrl($menuDocument->url, $languageId, $menuId, 'org.glizycms.core.models.Content'); } else { $speakingUrlProxy->deleteUrl($languageId, $menuId, 'org.glizycms.core.models.Content'); } $invalidateSitemapCache = true; } // aggiorna il titolo della pagina $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $menuProxy->touch($menuId, $languageId); $menu = $menuProxy->getMenuFromId($menuId, $languageId); if ($setMenuTitle && $menu->menudetail_title != $menuDocument->title) { $menuProxy->rename($menuId, $languageId, $menuDocument->title); } // TODO implementare meglio if (strtolower($menu->menu_pageType) == 'alias') { $menu->menu_url = 'alias:' . $data->link; $menu->save(); $invalidateSitemapCache = true; } if ($invalidateSitemapCache) { $menuProxy->invalidateSitemapCache(); } $evt = array('type' => org_glizycms_contents_events_Menu::SAVE_CONTENT); $this->dispatchEvent($evt); return true; } else { // TODO: errore dati non validi } }
function init() { $this->defineAttribute('cssClass', false, __Config::get('glizy.searchFilters.cssClass'), COMPONENT_TYPE_STRING); $this->defineAttribute('wrapDiv', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('fieldset', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('rememberValues', false, true, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('rememberMode', false, 'persistent', COMPONENT_TYPE_STRING); $this->defineAttribute('setRequest', false, false, COMPONENT_TYPE_BOOLEAN); $this->defineAttribute('filterClass', false, '', COMPONENT_TYPE_STRING); parent::init(); }
public function execute($data) { $data = json_decode($data); $newData = array(); $newData['title'] = $data->title; $newData['address'] = $data->address; $newData['copyright'] = $data->copyright; $newData['slideShow'] = $data->slideShow; $newData['analytics'] = $data->analytics; org_glizy_Registry::set(__Config::get('REGISTRY_SITE_PROP') . $this->application->getEditingLanguage(), serialize($newData)); return true; }
function execute($sqliteDb) { if ($this->user->isLogged()) { $dbHost = __Config::get('DB_HOST'); $dbUser = __Config::get('DB_USER'); $dbPass = __Config::get('DB_PSW'); $dbName = __Config::get('DB_NAME'); $tables = array(array('name' => __Config::get('movio.modules.publishApp.mobileCodesTable'), 'type' => 'normal'), array('name' => __Config::get('movio.modules.publishApp.mobileContentsTable'), 'type' => 'normal'), array('name' => __Config::get('movio.modules.publishApp.mobileFulltextTable'), 'type' => 'fulltext')); $mysql2SqliteService = org_glizy_ObjectFactory::createObject('movio.modules.publishApp.service.Mysql2SqliteService'); $mysql2SqliteService->convert($dbHost, $dbUser, $dbPass, $dbName, $tables, $sqliteDb); } }