function _setOutputFilter() { $filterName = $this->getAttribute('filter'); $tag = $this->getAttribute('tag'); // risovle il nome della classe if (file_exists(org_glizy_Paths::get('CORE_CLASSES') . 'org/glizy/filters/' . $filterName . '.php')) { $filterName = 'org.glizy.filters.' . $filterName; glz_import($filterName); } else { glz_import($filterName); } $className = str_replace('.', '_', $filterName); if (class_exists($className)) { // aggiunge il filtro per essere processato if ($this->getAttribute('mode') == 'PRE') { $outputFilters =& org_glizy_ObjectValues::get('org.glizy:components.Component', 'OutputFilter.pre'); } else { $outputFilters =& org_glizy_ObjectValues::get('org.glizy:components.Component', 'OutputFilter.post'); } if (!isset($outputFilters[$tag])) { $outputFilters[$tag] = array(); } $outputFilters[$tag][] = $className; } }
function _addJsCode() { if (!org_glizy_ObjectValues::get('org.glizy.googleMap', 'add', false)) { $rootComponent = $this->getRootComponent(); $rootComponent->addOutputCode(org_glizy_helpers_JS::linkJSfile('http://maps.google.com/maps/api/js?sensor=false'), 'head'); } }
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); } }
function renderCell($key, $value, $row) { $entityTypeId = str_replace('entity', '', $value); $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $entityTypeService = $application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); return $entityTypeService->getEntityTypeName($entityTypeId); }
/** * {@inheritdoc} */ public function collect() { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $result = array(); $result['pageId'] = $application->getPageId(); $result['routing'] = __Request::get('__routingName__') . ' > ' . __Request::get('__routingPattern__'); $result['controllers'] = implode(', ', $this->calledControllers); $user = $application->getCurrentUser(); $userData = array('id' => $user->id, 'firstName' => $user->firstName, 'lastName' => $user->lastName, 'email' => $user->email, 'groupId' => $user->groupId, 'backEndAccess' => $user->backEndAccess); $result['user'] = $this->getDataFormatter()->formatVar($userData); $menu = $application->getCurrentMenu(); $menuData = array('id' => $menu->id, 'title' => $menu->title, 'parentId' => $menu->parentId, 'pageType' => $menu->pageType, 'type' => $menu->type, 'depth' => $menu->depth); $result['menu'] = $this->getDataFormatter()->formatVar($menuData); // request $data = __Request::getAllAsArray(); $tempData = array(); foreach ($data as $k => $v) { if (strpos($k, '__') !== 0) { $tempData[$k] = $v; } } $result['__Request'] = $this->getDataFormatter()->formatVar($tempData); $result['__Config'] = $this->getDataFormatter()->formatVar(__Config::getAllAsArray()); $result['__Routing'] = $this->getDataFormatter()->formatVar(__Routing::getAllAsArray()); $result['__Session'] = $this->getDataFormatter()->formatVar(__Session::getAllAsArray()); return $result; }
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'); } }
function render_html() { if ($this->_application->getCurrentMenu()->printPdf && !org_glizy_ObjectValues::get('org.glizy.application', 'pdfMode')) { $url = GLZ_HOST . "/index.php?" . __Request::get('__url__') . "&printPdf=1"; $output = __Link::makeSimpleLink($this->getAttribute('label'), $url, '', 'printPdf'); $this->addOutputCode($output); } }
function __construct($options = array(), $level = GLZ_LOG_DEBUG, $group = '') { parent::__construct($options, $level, $group); $this->_ar = org_glizy_ObjectFactory::createModel('org.glizy.models.Log'); $this->application = org_glizy_ObjectValues::get('org.glizy', 'application'); // TODO //$this->_ar->enableQueue(); }
function __construct() { $this->application = org_glizy_ObjectValues::get('org.glizy', 'application'); $templatePath = __Paths::get('APPLICATION_TO_ADMIN_TEMPLATE'); if (!$templatePath) { $tempPath = __Config::get('APPLICATION_TO_ADMIN_TEMPLATE'); __Paths::set('APPLICATION_TO_ADMIN_TEMPLATE', $tempPath ? $tempPath : __Paths::get('BASE') . __Config::get('STATIC_FOLDER') . 'templates'); } }
function getPluginChain($name) { $name = strtolower($name); $pluginsInfo =& org_glizy_ObjectValues::get('org.glizy.plugins.PluginManager', 'pluginsInfo', array()); if (!isset($pluginsInfo[$name])) { $pluginsInfo[$name] = array(); } return $pluginsInfo[$name]; }
function init() { $this->_siteMapArray = array(); $this->_pageTypeMap = array(); $application =& org_glizy_ObjectValues::get('org.glizy', 'application'); $this->_user =& $application->getCurrentUser(); $this->isAdmin = $application->isAdmin(); $this->hidePrivatePage = org_glizy_Config::get('HIDE_PRIVATE_PAGE', true); }
public function render($outputMode = NULL, $skipChilds = false) { parent::render($outputMode, $skipChilds); if (!org_glizy_ObjectValues::get('org.glizycms.js', 'jsTree', false)) { org_glizy_ObjectValues::set('org.glizycms.js', 'jsTree', true); $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery-jstree/jquery.jstree.js')); $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery-jstree/jquery.cookie.js')); } }
/** * Listeners */ public function onProcessStart($evt) { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $rootComponent = $application->getRootComponent(); $c = org_glizy_ObjectFactory::createComponent('org.glizy.debug.views.components.DebugBar', $application, $rootComponent, 'debugBar', 'debugBar'); $c->init(); $rootComponent->addChild($c); $this->debugBar['time']->addMeasure('Booting', $this->startTime, microtime(true)); $this->debugBar['time']->startMeasure('application.process', 'Process'); }
public function execute($menuId) { if ($menuId) { parent::execute($menuId); // serve per impostare i filtri sui pagetype $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $arMenu = $menuProxy->getMenuFromId($menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); $this->setComponentsAttribute('pageParent', 'data', 'options=' . $arMenu->menu_pageType); } }
public function execute($menuId, $title) { // TODO: CONTROLLO ACL if ($menuId) { $languageId = org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId'); $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $menuProxy->rename($menuId, $languageId, $title); return true; } return false; }
function __construct($id, $groupId) { $this->id = $id; $this->groupId = $groupId; $this->application = org_glizy_ObjectValues::get('org.glizy', 'application'); $fileName = org_glizy_Paths::getRealPath('APPLICATION', 'config/acl.xml'); $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Acl'); $compiledFileName = $compiler->verify($fileName); include $compiledFileName; $this->_acl = $acl; }
function renderCell($key, $value, $row) { $application =& org_glizy_ObjectValues::get('org.glizy', 'application'); $media = org_glizycms_mediaArchive_MediaManager::getMediaByValues($row); $sizes = method_exists($media, 'getOriginalSizes') ? $media->getOriginalSizes() : array('width' => 0, 'height' => 0); // $scale = strpos( $application->getPageId(), 'picker' ) !== false ? 2 : 1; // vavr_dump(__Config::get('THUMB_WIDTH')); $scale = 1; $thumbnail = $media->getThumbnail(__Config::get('THUMB_WIDTH') / $scale, __Config::get('THUMB_HEIGHT') / $scale, __Config::get('ADM_THUMBNAIL_CROP'), __Config::get('ADM_THUMBNAIL_CROPPOS')); $title = !empty($media->title) ? $media->title : $media->fileName; return '<img src="' . $thumbnail['fileName'] . '" width="' . $thumbnail['width'] . '" height="' . $thumbnail['height'] . '" alt="' . $title . '" title="' . $title . '" data-id="' . $media->id . '" data-filename="' . $media->fileName . '" data-width="' . $sizes['width'] . '" data-height="' . $sizes['height'] . '" style="cursor: pointer;" />'; }
function isValid($fileName) { $fileName = realpath($fileName); // check if the file is already compiled in the same request // this is usefull in develop enviroment $c = org_glizy_ObjectValues::get($this->getClassName(), $fileName); if (!is_null($c)) { return true; } $cacheFileName = $this->_cacheObj->verify($fileName, org_glizy_Paths::get('CACHE') . get_class($this)); return $cacheFileName !== false; }
function __construct($fileName = '', $rootPath = '') { $this->fileName = org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE', $this->pathPrefix . $fileName); $this->rootPath = org_glizy_Paths::get('APPLICATION_TEMPLATE'); $application =& org_glizy_ObjectValues::get('org.glizy', 'application'); $this->currentMenu = $application->getCurrentMenu(); $this->language = $application->getLanguage(); if (!file_exists($this->fileName)) { org_glizy_Exception::show(500, "Template non trovato: " . $this->rootPath . $this->pathPrefix . $fileName, "", ""); exit; } }
public function execute($data) { $r = parent::execute($data); if ($r === true) { $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $arMenu = $menuProxy->getMenuFromId($this->menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); if ($arMenu->menu_type == org_glizycms_core_models_enum_MenuEnum::BLOCK) { return array('evt' => 'glizycms.pageEdit', 'message' => array('menuId' => $arMenu->menu_parentId)); } } return $r; }
function execute() { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $language = $application->getLanguage(); $fieldTypeService = $this->application->retrieveProxy('movio.modules.ontologybuilder.service.FieldTypeService'); $allTypes = $fieldTypeService->getAllTypes(); $fieldTypes = array(); foreach ($allTypes as $key => $value) { $fieldTypes[] = array('id' => $key, 'name' => $value['translation'][$language]); } return $fieldTypes; }
/** * Render * * @return void * @access public */ function render_html() { $folder = $this->getAttribute('folder'); $src = $this->getAttribute('src'); $type = $this->getAttribute('type'); $language = $this->_application->getLanguage(); $language2 = $language . '-' . strtoupper($language); $src = str_replace(array('##LANG##', '##LANG2##'), array($language, $language2), $src); if ($folder) { if (!org_glizy_ObjectValues::get('org.glizy.JS', 'run', false)) { org_glizy_ObjectValues::set('org.glizy.JS', 'run', true); $pageType = $this->_application->getPageType(); $state = __Request::get('action', ''); $params = __Request::getAllAsArray(); unset($params['__params__']); unset($params['__routingName__']); unset($params['__routingPattern__']); unset($params['__url__']); unset($params['__back__url__']); $params = json_encode($params); $jsCode = <<<EOD var GlizyApp = {}; GlizyApp.pages = {}; jQuery( function(){ \tif ( typeof( GlizyApp.pages[ '{$pageType}' ] ) != 'undefined' ) \t{ \t\tGlizyApp.pages[ '{$pageType}' ]( '{$state}', {$params} ); \t} }) EOD; $this->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head'); } // include tutta una cartella $jsFileName = $this->includeFolder($folder); if ($this->getAttribute('inline')) { $js = file_get_contents($jsFileName); if (strpos($js, '<script') !== false) { $this->addOutputCode($js); } else { $this->addOutputCode(org_glizy_helpers_JS::JScode($js, $type)); } } else { $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jsFileName . (__Config::get('DEBUG') ? '?' . microtime(true) : ''), null, $type)); } } else { if ($src) { $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($src, null, $type)); } else { $this->addOutputCode(org_glizy_helpers_JS::JScode($this->replaceLocale($this->getText()), $type)); } } }
function execute() { $application = org_glizy_ObjectValues::get('org.glizy', 'application'); $language = $application->getLanguage(); $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.RelationTypesDocument'); //$it->load('relationTypesFromLanguage', array('language' => $language)); $it->orderBy('translation'); $relationTypes = array(); foreach ($it as $ar) { $r = array('id' => $ar->key, 'name' => $ar->translation[$language] ? $ar->translation[$language] : $ar->key); $relationTypes[$r['id']] = $r; } return $relationTypes; }
/** * @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]; }
public function execute($data) { $this->directOutput = true; // TODO: controllo acl $contentProxy = org_glizy_objectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy'); $contentVO = $contentProxy->getContentVO(); $contentVO->setFromJson($data); $this->menuId = $contentVO->getId(); $r = $contentProxy->saveContent($contentVO, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId'), __Config::get('glizycms.content.history')); if ($r === true) { return true; } else { return array('errors' => array($r)); } }
function _render() { if ($this->getAttribute('addCoreJS') === true) { $this->_application->addJSLibCore(); } $template = NULL; // riordina l'array con i dati dell'editableRegions da passare alla classe template $templateOutput = array(); $atEnd = false; for ($j = 0; $j <= 1; $j++) { for ($i = 0; $i < count($this->_output); $i++) { if ($this->_output[$i]['atEnd'] === ($j == 0 ? false : true)) { if (array_key_exists($this->_output[$i]['editableRegion'], $templateOutput)) { $templateOutput[$this->_output[$i]['editableRegion']] .= $this->_output[$i]['code']; } else { $templateOutput[$this->_output[$i]['editableRegion']] = $this->_output[$i]['code']; } } if ($this->_output[$i]['atEnd'] === true) { $atEnd = true; } } if (!$atEnd) { break; } } if (org_glizy_ObjectValues::get('org.glizy.application', 'pdfMode')) { $template =& org_glizy_ObjectFactory::createObject('org.glizy.template.layoutManager.PDF', $this->getAttribute('templateFileName')); } else { switch ($this->getAttribute('templateType')) { case 'dwt': $template =& org_glizy_ObjectFactory::createObject('org.glizy.template.layoutManager.DWT', $this->getAttribute('templateFileName')); break; case 'phptal': $template =& org_glizy_ObjectFactory::createObject('org.glizy.template.layoutManager.PHPTAL', $this->getAttribute('templateFileName')); break; case 'php': $template =& org_glizy_ObjectFactory::createObject('org.glizy.template.layoutManager.PHP', $this->getAttribute('templateFileName')); break; } } $output = $template->apply($templateOutput); $this->applyOutputFilters('post', $output); return $output; }
public function execute($menuId) { // TODO controllo permessi if ($menuId) { // controlla se il menù è di tipo Block $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $arMenu = $menuProxy->getMenuFromId($menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); $previewUrl = GLZ_HOST . '/../?pageId=' . ($arMenu->menu_type != org_glizycms_core_models_enum_MenuEnum::BLOCK ? $menuId : $arMenu->menu_parentId); $this->setComponentsAttribute('preview', 'visible', true); $this->setComponentsAttribute('preview', 'url', $previewUrl); $this->setComponentsVisibility('saveAndClose', $arMenu->menu_type == org_glizycms_core_models_enum_MenuEnum::BLOCK); if ($arMenu->menu_type == org_glizycms_core_models_enum_MenuEnum::BLOCK) { $this->view->setAttribute('editUrl', false); $this->setComponentsAttribute('propertiesState', 'draw', false); $this->setComponentsAttribute('templateState', 'draw', false); } } }
public function execute($id) { $this->directOutput = true; $output = array(); $languageId = org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId'); $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy'); $itMenus = $menuProxy->getChildMenusFromId($id, $languageId, false); foreach ($itMenus as $subMenu) { $content = $contentProxy->readRawContentFromMenu($subMenu->menu_id, $languageId); $description = ''; if ($content) { $description = property_exists($content->content, 'text') ? $content->content->text : (property_exists($content->content, 'description') ? $content->content->description : ''); } $output[] = array('id' => $subMenu->menu_id, 'title' => $subMenu->menudetail_title, 'description' => glz_strtrim($description) . ' (' . $subMenu->menu_pageType . ')'); } return $output; }
public function process() { if ($this->getAttribute('mode') == 'container') { $this->emptySrc = __Routing::makeUrl('linkChangeAction', array('action' => $this->getAttribute('initialState'))); $this->editSrc = __Routing::makeUrl('linkChangeAction', array('action' => $this->getAttribute('editState'))) . '?menuId='; } else { $this->menuId = __Request::get('menuId'); // TODO: lanciare un'eccezione se l'id non è valido $menuProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.MenuProxy'); $menu = $menuProxy->getMenuFromId($this->menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); // TODO: il menù viene letto due volte, in questo codice ed in readContentFromMenu $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy'); $content = $contentProxy->readContentFromMenu($this->menuId, org_glizy_ObjectValues::get('org.glizy', 'editingLanguageId')); $this->setData($content); $this->addComponentsToEdit($menu); parent::process(); } }
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'); }