Пример #1
0
 function process()
 {
     parent::process();
     if (is_string($this->_content)) {
         $this->_content = unserialize($this->_content);
         if (!$this->_content) {
             $this->_content = array();
         }
     }
 }
Пример #2
0
 function init()
 {
     // define the custom attributes
     $this->defineAttribute('ajaxController', false, 'org.glizycms.contents.controllers.autocomplete.ajax.PagePicker', COMPONENT_TYPE_STRING);
     $this->defineAttribute('type', false, '', COMPONENT_TYPE_STRING);
     $this->defineAttribute('protocol', false, '', COMPONENT_TYPE_STRING);
     $this->defineAttribute('makeLink', false, false, COMPONENT_TYPE_BOOLEAN);
     $this->defineAttribute('multiple', false, false, COMPONENT_TYPE_BOOLEAN);
     parent::init();
 }
Пример #3
0
    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');
    }
Пример #4
0
    function render_html()
    {
        parent::render_html();
        if (!$this->getAttribute('readOnly')) {
            $id = $this->getId();
            $format = $this->getAttribute('showTime') ? 'GlizyLocale.datetime.format' : 'GlizyLocale.date.format';
            $minView = $this->getAttribute('showTime') ? '' : 'minView: \'month\',';
            $jsCode = <<<EOD
\$(function () {
\t\$("#{$id}").datetimepicker({
            language: 'it',
            format: {$format},
            {$minView}
            autoclose: true,
            todayHighlight: true
        });
});
EOD;
            $this->_parent->addOutputCode(org_glizy_helpers_JS::JScode($jsCode));
        }
    }