Beispiel #1
0
<?php

N2Loader::import('libraries.form.element.text');
N2Loader::import('libraries.browse.browse');
N2ImageHelper::init();
N2Loader::import('libraries.image.aviary');
class N2ElementImage extends N2ElementText
{
    protected $attributes = array();
    private $fixed = false;
    function fetchElement()
    {
        $fixed = N2XmlHelper::getAttribute($this->_xml, 'fixed');
        if ($fixed == '1') {
            $this->fixed = true;
        }
        N2ImageAviary::init();
        $html = parent::fetchElement();
        $params = array();
        N2ImageHelper::initLightbox();
        N2JS::addInline("new NextendElementImage('" . $this->_id . "', " . json_encode($params) . " );");
        if ($this->fixed) {
            $aviary = '';
            $html .= '<div id="' . $this->_id . '_preview" class="n2-form-element-preview n2-form-element-preview-fixed n2-border-radius" style="' . $this->getImageStyle() . '">
                ' . $aviary . '
            </div>';
        } else {
            $aviary = '';
            $html .= $aviary;
        }
        return $html;