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); } }
/** * @return mixed|string */ static function get() { $args = func_get_args(); $code = array_shift($args); $values =& org_glizy_ObjectValues::get('org.glizy.locale.Locale'); if (!isset($values[$code])) { return glz_encodeOutput($code); } if (is_array($values[$code])) { return $values[$code]; } if (strpos($values[$code], '<') !== false) { return vsprintf($values[$code], $args); } return glz_encodeOutput(vsprintf($values[$code], $args)); }
function process() { if (is_null($this->getAttribute('value'))) { $menuId = $this->getAttribute('menuId'); $siteMap =& $this->_application->getSiteMap(); $this->currentMenu = is_null($menuId) ? $this->_application->getCurrentMenu() : $siteMap->getNodeById($menuId); if (is_null($this->getAttribute('menuDepth'))) { $this->_content = $this->currentMenu->title; } else { $this->currentMenu =& $this->currentMenu->parentNodeByDepth($this->getAttribute('menuDepth')); $this->_content = $this->currentMenu->title; } } else { $this->_content = glz_encodeOutput($this->getAttribute('value')); } if ($this->getAttribute('setSiteMapTitle')) { $menu = $this->_application->getCurrentMenu(); $menu->title = html_entity_decode($this->_content); } }
function process() { $this->_content = array(); $this->_content['label'] = $this->getAttribute('label'); $this->_content['cssClass'] = $this->getAttribute('cssClass'); $this->_content['current'] = ''; $this->_content['records'] = array(); $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language'); $iterator->orderBy('language_order'); if ($iterator->count()) { $editLanguageId = $this->_application->getEditingLanguageId(); foreach ($iterator as $ar) { if ($ar->language_id == $editLanguageId) { $this->_content['current'] = $ar->language_name; continue; } $url = org_glizy_helpers_Link::addParams(array('switchLanguage' => $ar->language_id)); $this->_content['records'][] = org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, $ar->language_name); } } }
function __construct(&$ar) { if (is_object($ar)) { $this->ar = $ar; $this->id = $ar->media_id; $this->fileName = $ar->media_fileName; $this->size = $ar->media_size; $this->type = $ar->media_type; $this->title = glz_encodeOutput($ar->media_title); $this->description = $ar->media_description; $this->creationDate = $ar->media_creationDate; $this->modificationDate = $ar->media_modificationDate; $this->category = $ar->media_category; $this->author = $ar->media_author; $this->date = $ar->media_date; $this->zoom = $ar->media_zoom; $this->originalFileName = $ar->media_originalFileName ? $ar->media_originalFileName : $ar->media_fileName; $this->copyright = $ar->media_copyright; $this->allowDownload = $ar->media_allowDownload; $this->watermark = $ar->media_watermark; } else { $this->id = $ar['media_id']; $this->fileName = $ar['media_fileName']; $this->size = $ar['media_size']; $this->type = $ar['media_type']; $this->title = glz_encodeOutput($ar['media_title']); $this->creationDate = $ar['media_creationDate']; $this->modificationDate = $ar['media_modificationDate']; $this->category = $ar['media_category']; $this->author = $ar['media_author']; $this->date = $ar['media_date']; $this->zoom = $ar['media_zoom']; $this->originalFileName = !empty($ar['media_originalFileName']) ? $ar['media_originalFileName'] : $ar['media_fileName']; $this->copyright = $ar['media_copyright']; $this->allowDownload = $ar['media_allowDownload']; $this->watermark = $ar['media_watermark']; } }
function render() { $dbServiceFactory = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.services.DbServiceFactory'); $dbService = $dbServiceFactory->createDbService(__Config::get('DB_TYPE')); $dbService->connect(__Config::get('DB_HOST'), __Config::get('DB_PORT'), __Config::get('DB_USER'), __Config::get('DB_PSW'), __Config::get('DB_NAME')); $tables = $dbService->getTableNames(); $attributes = array(); $attributes['id'] = $this->getId(); $attributes['name'] = $this->getOriginalId(); $attributes['class'] = $this->getAttribute('required') ? 'required' : ''; $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : ''; $attributes['title'] = $this->getAttributeString('title'); $attributes['onchange'] = $this->getAttribute('onChange'); if ($this->getAttribute('rows') > 1) { $attributes['size'] = $this->getAttribute('rows'); } $output = '<select ' . $this->_renderAttributes($attributes) . '>'; foreach ($tables as $item) { $output .= '<option value="' . glz_encodeOutput($item) . '">' . glz_encodeOutput($item) . '</option>'; } $output .= '</select>'; $output = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), $this->getAttribute('wrapLabel'), $output, array('class' => $this->getAttribute('required') ? 'required' : ''), false); $this->addOutputCode($output); }
function loadDetails() { if (is_integer($this->id)) { $application =& org_glizy_ObjectValues::get('org.glizy', 'application'); $ar =& org_glizy_ObjectFactory::createModel('org.glizycms.core.models.MenuDetail'); $ar->menudetail_FK_menu_id = $this->id; $ar->menudetail_FK_language_id = $application->getLanguageId(); $ar->find(); $values = $ar->getValuesAsArray(); foreach ($values as $k => $v) { $propName = str_replace('menudetail_', '', $k); if ($propName == 'id') { continue; } $this->{$propName} = glz_encodeOutput($v); } } }
function getContent() { $content = $this->getAttribute('html') ? $this->getText() : glz_encodeOutput($this->getText()); return $content; }
function getContent() { return glz_encodeOutput($this->getText()); }
/** * @param $output * * @return mixed */ function encodeOuput($output) { return glz_encodeOutput($output); }
function render() { $this->applyOutputFilters('pre', $this->_content); $output = ''; $attributes = array(); $attributes['id'] = $this->getId(); // $attributes['name'] = $this->getAttribute('name') != '' ? $this->getAttribute('name') : $this->getOriginalId(); $attributes['name'] = $this->getOriginalId(); $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : ''; $attributes['class'] = $this->getAttribute('cssClass'); $attributes['type'] = $this->getAttribute('type'); $attributes['onclick'] = $this->getAttribute('onclick'); $routeUrl = $this->getAttribute('routeUrl'); if ($routeUrl != '') { $attributes['onclick'] = 'location.href=\'' . __Link::makeUrl($routeUrl) . '\''; if (!is_null($this->getAttribute('confirmMessage'))) { $attributes['onclick'] = 'if (confirm(\'' . $this->getAttribute('confirmMessage') . '\')) ' . $attributes['onclick'] . '; else return false;'; } } $url = $this->getAttribute('url'); if ($url != '') { $attributes['onclick'] = 'location.href=\'' . $url . '\''; } $targetForm = $this->getAttribute('target'); if (!is_null($targetForm)) { $this->addTranslateInfo($targetForm->getCommadFieldName(), $this->getAttribute('label'), $this->getAttribute('value')); } else { $this->addTranslateInfo($this->getAttribute('name'), $this->getAttribute('label'), $this->getAttribute('value')); } if ($this->getAttribute('tag') == 'input') { $attributes['value'] = glz_encodeOutput($this->getAttribute('label')); $output .= '<input ' . $this->_renderAttributes($attributes) . ' />'; } else { $attributes['value'] = glz_encodeOutput($this->getAttribute('value')); if (strpos($attributes['value'], 'route:') === 0) { $attributes['value'] = __Link::makeUrl(str_replace('route:', '', $attributes['value'])); } $output .= '<button ' . $this->_renderAttributes($attributes) . '>' . $this->getAttributeString('label') . '</button>'; } $this->addOutputCode($output); }
public function render() { if (is_object($this->_content) && $this->_content->image && $this->_content->hotspots) { $media = org_glizycms_mediaArchive_MediaManager::getMediaById($this->_content->image); $speakingUrlManager = $this->_application->retrieveProxy('org.glizycms.speakingUrl.Manager'); if (is_object($media)) { $id = $this->getId(); $imageInfo = $media->getImageInfo(); $width = $imageInfo['width']; $height = $imageInfo['height']; $attributes = array(); $attributes['src'] = $media->getFileName(true); $attributes['width'] = $imageInfo['width']; $attributes['height'] = $imageInfo['height']; $attributes['alt'] = $media->title; $attributes['title'] = $media->title; $image = '<img ' . $this->_renderAttributes($attributes) . ' />'; $hotspots = ''; foreach ($this->_content->hotspots as $h) { $attributes = array(); $attributes['id'] = $id . '-' . $h->id; $attributes['class'] = 'movio-hotspot' . ($h->form == 'circle' ? '-circle' : ''); $attributes['style'] = 'display: block; top: ' . $h->top . 'px; left: ' . $h->left . 'px; height: ' . $h->height . 'px; width: ' . $h->width . 'px;'; if ($h->description) { $attributes['data-tooltip'] = glz_encodeOutput($h->description); } $link = ''; if ($h->type = 'linkEx' && $h->src) { $link = __Link::formatLink($h->src); } else { if ($h->type = 'link' && $h->srcInt) { $link = __Link::formatInternalLink($speakingUrlManager->makeUrl($h->srcInt)); } } if ($link) { $link = str_replace('<a ', '<a style="text-indent: -9999px; height: ' . $h->height . 'px; width: ' . $h->width . 'px; display: block;"', $link); } // <a target="_blank" style="height: 148px; width: 186px; display: block;" href="www.google.com" class="hotspot-circle"></a> $hotspots .= '<div ' . $this->_renderAttributes($attributes) . '>' . $link . '</div>'; } $css = trim('movio-hotspotContainer ' . $this->getAttribute('cssClass')); $output = <<<EOD <div id="{$id}" class="{$css}"> {$image} <div class="movio-imageHotspot-scale"> {$hotspots} </div> </div> <script src="static/jquery/jquery-transform/jquery.transform2d.js"></script> <script> jQuery( function(){ \$('div.movio-hotspotContainer').find('div[data-tooltip!=""]').qtip({ content: { attr: 'data-tooltip' }, position: { my: 'bottom left', at: 'bottom left', target: 'mouse' }, style: { classes: 'qtip-bootstrap' } }); var img = \$('div.movio-hotspotContainer img').first(); var scale = img.width() / parseInt(img.attr('width')); \$('.movio-imageHotspot-scale').css('transform', 'scale('+scale+','+scale+')'); }); </script> EOD; $this->addOutputCode($output); $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.qtip/jquery.qtip.min.js'), 'head'); $this->addOutputCode(org_glizy_helpers_CSS::linkStaticCSSfile('jquery/jquery.qtip/jquery.qtip.min.css'), 'head'); } } }
function &loadQuery($queryName, $options = array()) { org_glizy_dataAccess_DataAccess::selectDB($this->_connNumber); if ($this->_conn->debug) { echo '<b>' . $queryName . '</b><br>'; } if ($this->enableLog) { $eventInfo = array('type' => GLZ_LOG_EVENT, 'data' => array('level' => GLZ_LOG_DEBUG, 'group' => '', 'message' => 'loadQuery: ' . $queryName)); $evt = org_glizy_ObjectFactory::createObject('org.glizy.events.Event', $this, $eventInfo); org_glizy_events_EventDispatcher::dispatchEvent($evt); } if (!isset($options['sql'])) { $sql = $this->_getQuerySqlString($queryName); $sql = rtrim($sql, ';'); $params = isset($options['params']) ? $options['params'] : array(); $checkIntegrity = isset($options['checkIntegrity']) ? $options['checkIntegrity'] : true; if (!isset($options['filters'])) { $options['filters'] = array(); } if (!is_array($options['filters'])) { $options['filters'] = array($options['filters']); } if (strpos($sql, 'WHERE') === false) { foreach ($this->_fieldsList as $k => $v) { if (isset($v['defaultSelectValue']) && !isset($options['filters'][$k])) { if ($v['languageField'] === true || $v['versionField'] == true || $options['default'] !== false) { $options['filters'][$k] = $v['defaultSelectValue']; } } } } // se � definito un sito forza la condizione if (!is_null(__Config::get('SITE_ID')) && !is_null($this->_siteIdField) && !isset($options['filters'][$this->_siteIdField])) { $options['filters'][$this->_siteIdField] = __Config::get('SITE_ID'); } $sqlWhere = '('; foreach ($options['filters'] as $filterName => $filterValue) { if (!is_string($filterName)) { $sqlWhere .= $filterValue . ' AND '; continue; } else { if (!isset($this->_fieldsList[$filterName]) && $checkIntegrity) { continue; } } if ($this->_fieldsList[$filterName]['type'] == AR_TYPE_DATE || $this->_fieldsList[$filterName]['type'] == AR_TYPE_DATETIME) { if (is_array($filterValue) && $filterValue[0] == "=") { $filterValue = $filterValue[1]; } } if (!is_array($filterValue)) { switch ($this->_fieldsList[$filterName]['type']) { case AR_TYPE_DATE: case AR_TYPE_DATETIME: $sqlWhere .= $filterName . ' LIKE ' . org_glizy_dataAccess_DataAccess::qstr('%' . $filterValue . '%') . ' AND '; break; case AR_TYPE_INTEGER: case AR_TYPE_SITEID: case AR_TYPE_ENUM: if ($filterValue != '') { $sqlWhere .= $filterName . '= ' . org_glizy_dataAccess_DataAccess::qstr($filterValue) . ' AND '; } break; default: if ($this->_fieldsList[$filterName]['canEncode'] === false) { $filterValue = glz_encodeOutput($filterValue); } if (!empty($filterValue)) { $sqlWhere .= $filterName . ' LIKE ' . org_glizy_dataAccess_DataAccess::qstr('%' . $filterValue . '%') . ' AND '; } break; } } else { $sqlWhere .= $filterName . ' ' . $filterValue[0] . (isset($filterValue[1]) ? ' ' . org_glizy_dataAccess_DataAccess::qstr($filterValue[1]) : '') . ' AND '; } } $sqlWhere .= '1=1) '; // se � definita l'acl $sqlWhere .= $this->_addAclClause(); if (isset($options['categories'])) { $sqlWhere .= $this->_addAclCategoriesClause($options['categories']); } if (strripos($sql, 'WHERE') === false) { if (strripos($sql, 'ORDER') === false && strripos($sql, 'GROUP BY') === false) { $sql .= ' WHERE ' . $sqlWhere; } else { if (strripos($sql, 'GROUP BY') === false) { $sql = str_replace('ORDER', ' WHERE ' . $sqlWhere . ' ORDER ', $sql); } else { $sql = str_replace('GROUP BY', ' WHERE ' . $sqlWhere . ' GROUP BY', $sql); } } } else { $sql = str_replace('WHERE', 'WHERE ' . $sqlWhere . ' AND ', $sql); } $sql = str_replace('##W##', 'WHERE', $sql); if (isset($options['group'])) { if (strripos($sql, 'GROUP BY') !== false) { $sql .= ' GROUP BY ' . $options['group']; } } if (isset($options['order'])) { // TODO // controllare che i valori passati in orderBy siano delle colonne valide $order = is_array($options['order']) ? implode(',', $options['order']) : $options['order']; if (strripos($sql, 'ORDER') === false) { $order = ' ORDER BY ' . $order; } else { $order = ', ' . $order; } // if ( strripos( $sql, 'GROUP BY') !== false ) // { // list( $p1, $p2 ) = explode( 'GROUP BY', $sql ); // $sql = $p1.$order.' GROUP BY '.$p2; // } // else // { $sql .= $order; // } } } else { $sql = $options['sql']; } if (isset($options['numRows']) && $options['numRows'] == true) { if (stripos($sql, 'SELECT SQL_CALC_FOUND_ROWS') === false) { $pos = stripos($sql, 'SELECT'); $sql = 'SELECT SQL_CALC_FOUND_ROWS ' . substr($sql, $pos + 7); } } // esegue la paginazione if (isset($options['limit']) && !empty($options['limit'])) { if (is_string($options['limit'])) { list($limitStart, $limitLength) = explode(',', $options['limit']); } else { if (!isset($options['limit']['start'])) { $limitStart = $options['limit'][0]; $limitLength = $options['limit'][1]; } else { $limitStart = $options['limit']['start']; $limitLength = $options['limit']['pageLength']; } } if (stripos($sql, 'limit')) { $sql = preg_replace('/limit\\s*\\d*,\\s*?\\d$/i', '', $sql); } $rs =& $this->_execute($sql, $params, $limitLength, $limitStart); } else { $rs =& $this->_execute($sql, $params); } if ($this->_conn->ErrorNo()) { $this->triggerError($this->getClassName() . ': ' . $this->_conn->ErrorMsg() . " " . $sql); } $recordIterator = new org_glizy_dataAccess_RecordIterator($rs, get_class($this)); if (stripos($sql, 'SELECT SQL_CALC_FOUND_ROWS') !== false) { $rs2 = $this->execSql('SELECT FOUND_ROWS() as tot;'); $recordIterator->setCount($rs2->fields['tot']); } return $recordIterator; }
/** * @return string */ function encodePlainText() { return str_replace(array("\r\n", "\n", "\r"), "<br />", glz_encodeOutput(str_replace('<br />', "\r\n", $this->getText()))); }