示例#1
0
 public function __construct($label, $for = null)
 {
     parent::__construct('label', true, $label);
     if ($for !== null) {
         $this->setAttribute('for', zbx_formatDomId($for));
     }
 }
示例#2
0
 public function setAction($value = NULL)
 {
     if (is_null($value)) {
         return $this->attributes['action'] = $page['file'];
     }
     return parent::addAction('onclick', $value);
 }
示例#3
0
 public function __construct($value, $class = null, $id = null)
 {
     parent::__construct('li', 'yes');
     $this->addItem($value);
     $this->addClass($class);
     $this->attr('id', $id);
 }
示例#4
0
 /**
  * @param array $options['objectOptions'] 	an array of parameters to be added to the request URL
  *
  * @see jQuery.multiSelect()
  */
 public function __construct(array $options = [])
 {
     parent::__construct('div', true);
     $this->addClass('multiselect');
     $this->setId(zbx_formatDomId($options['name']));
     // url
     $url = new CUrl('jsrpc.php');
     $url->setArgument('type', PAGE_TYPE_TEXT_RETURN_JSON);
     $url->setArgument('method', 'multiselect.get');
     $url->setArgument('objectName', $options['objectName']);
     if (!empty($options['objectOptions'])) {
         foreach ($options['objectOptions'] as $optionName => $optionvalue) {
             $url->setArgument($optionName, $optionvalue);
         }
     }
     $params = ['url' => $url->getUrl(), 'name' => $options['name'], 'labels' => ['No matches found' => _('No matches found'), 'More matches found...' => _('More matches found...'), 'type here to search' => _('type here to search'), 'new' => _('new'), 'Select' => _('Select')]];
     if (array_key_exists('data', $options)) {
         $params['data'] = zbx_cleanHashes($options['data']);
     }
     foreach (['ignored', 'defaultValue', 'disabled', 'selectedLimit', 'addNew'] as $option) {
         if (array_key_exists($option, $options)) {
             $params[$option] = $options[$option];
         }
     }
     if (array_key_exists('popup', $options)) {
         foreach (['parameters', 'width', 'height'] as $option) {
             if (array_key_exists($option, $options['popup'])) {
                 $params['popup'][$option] = $options['popup'][$option];
             }
         }
     }
     zbx_add_post_js('jQuery("#' . $this->getAttribute('id') . '").multiSelect(' . CJs::encodeJson($params) . ');');
 }
示例#5
0
 public function addItem($value)
 {
     if (strtolower(get_class($value)) != 'carea') {
         return $this->error('Incorrect value for addItem [' . $value . ']');
     }
     return parent::addItem($value);
 }
示例#6
0
 public function bodyToString()
 {
     $ret = parent::bodyToString();
     $ret .= $this->srcParam->toString();
     $ret .= $this->embededFlash->toString();
     return $ret;
 }
示例#7
0
 public function addItem($value)
 {
     if (is_object($value) && zbx_strtolower(get_class($value)) != 'carea') {
         return $this->error('Incorrect value for addItem "' . $value . '".');
     }
     return parent::addItem($value);
 }
示例#8
0
 public function __construct($name = 'file', $value = '')
 {
     parent::__construct('input', 'no');
     $this->setClass('biginput');
     $this->setAttribute('type', 'file');
     $this->setName($name);
     $this->setFile($value);
 }
 public function addItem($value, $class = null, $id = null)
 {
     if (!is_null($value) && $this->emptyList) {
         $this->emptyList = false;
         $this->items = array();
     }
     parent::addItem($this->prepareItem($value, $class, $id));
 }
示例#10
0
function italic($str)
{
    if (is_array($str)) {
        foreach ($str as $key => $val) {
            if (is_string($val)) {
                $em = new CTag('em', true);
                $em->addItem($val);
                $str[$key] = $em;
            }
        }
    } elseif (is_string($str)) {
        $em = new CTag('em', true, '');
        $em->addItem($str);
        $str = $em;
    }
    return $str;
}
示例#11
0
 public function __construct($coords, $href, $alt, $shape)
 {
     parent::__construct('area', 'no');
     $this->setCoords($coords);
     $this->setShape($shape);
     $this->setHref($href);
     $this->setAlt($alt);
 }
示例#12
0
 public function __construct($name = '', $value = '0')
 {
     parent::__construct('input', 'no');
     $this->options['type'] = 'hidden';
     $this->options['name'] = $name;
     $this->options['id'] = $name;
     $this->setValue($value);
 }
function bold($str)
{
    if (is_array($str)) {
        foreach ($str as $key => $val) {
            if (is_string($val)) {
                $b = new CTag('strong', 'yes');
                $b->addItem($val);
                $str[$key] = $b;
            }
        }
    } else {
        $b = new CTag('strong', 'yes', '');
        $b->addItem($str);
        $str = $b;
    }
    return $str;
}
示例#14
0
 public function __construct($value, $caption = NULL, $selected = NULL, $enabled = NULL)
 {
     parent::__construct('option', 'yes');
     $this->tag_body_start = '';
     $this->options['value'] = $value;
     $this->addItem($caption);
     $this->setSelected($selected);
     $this->setEnabled($enabled);
 }
 public function __construct($value, $caption = null, $selected = null, $enabled = null)
 {
     parent::__construct('option', 'yes');
     $this->tag_body_start = '';
     $this->setAttribute('value', $value);
     $this->addItem($caption);
     $this->setSelected($selected);
     $this->setEnabled($enabled);
 }
示例#16
0
 public function __construct($src = null, $width = '100%', $height = '100%', $scrolling = 'no', $id = 'iframe')
 {
     parent::__construct('iframe', true);
     $this->setSrc($src);
     $this->setWidth($width);
     $this->setHeight($height);
     $this->setScrolling($scrolling);
     $this->setId($id);
 }
 public function __construct($value, $class = null, $id = null)
 {
     parent::__construct('li', 'yes');
     $this->addItem($value);
     $this->addClass($class);
     if (!empty($id)) {
         $this->setAttribute('id', $id);
     }
 }
示例#18
0
 public function __construct($name = 'button', $caption = '')
 {
     parent::__construct('button', true, $caption);
     $this->setAttribute('type', 'button');
     if ($name !== null) {
         $this->setId(zbx_formatDomId($name));
         $this->setAttribute('name', $name);
     }
 }
示例#19
0
 public function __construct($type = 'text', $name = 'textbox', $value = '')
 {
     parent::__construct('input');
     $this->setType($type);
     // if id is not passed, it will be the same as element name
     $this->setId(zbx_formatDomId($name));
     $this->setAttribute('name', $name);
     $this->setAttribute('value', $value);
     return $this;
 }
示例#20
0
 public function addItem($value, $class = null)
 {
     if (is_array($value)) {
         foreach ($value as $el) {
             parent::addItem($this->prepareItem($el, $class));
         }
     } else {
         parent::addItem($this->prepareItem($value, $class));
     }
 }
示例#21
0
 public function __construct($label, $for = null, $id = null)
 {
     parent::__construct('label', 'yes', $label);
     if (!is_null($id)) {
         $this->setAttribute('id', $id);
     }
     if (!is_null($for)) {
         $this->setAttribute('for', $for);
     }
 }
示例#22
0
 public function __construct($name = 'textarea', $value = '', $cols = 77, $rows = 7, $readonly = 'no')
 {
     parent::__construct('textarea', 'yes');
     $this->attributes['class'] = 'biginput';
     $this->attributes['name'] = $name;
     $this->attributes['rows'] = $rows;
     $this->attributes['cols'] = $cols;
     $this->setReadonly($readonly);
     $this->addItem($value);
 }
示例#23
0
 public function __construct($action = NULL, $method = 'post', $enctype = NULL)
 {
     parent::__construct('form', 'yes');
     $this->setMethod($method);
     $this->setAction($action);
     $this->setEnctype($enctype);
     if (isset($_COOKIE['zbx_sessionid'])) {
         $this->addVar('sid', substr($_COOKIE['zbx_sessionid'], 16, 16));
     }
 }
 public function __construct($label, $for = null, $id = null)
 {
     parent::__construct('label', 'yes', $label);
     if (!is_null($id)) {
         $this->attr('id', zbx_formatDomId($id));
     }
     if (!is_null($for)) {
         $this->attr('for', zbx_formatDomId($for));
     }
 }
示例#25
0
 public function __construct($value, $caption = null, $selected = null, $enabled = null)
 {
     parent::__construct('option', true);
     $this->setAttribute('value', $value);
     $this->addItem($caption);
     $this->setSelected($selected);
     if ($enabled !== null) {
         $this->setEnabled($enabled);
     }
 }
示例#26
0
 public function __construct($name = 'button', $caption = '', $action = NULL, $accesskey = NULL)
 {
     parent::__construct('input', 'no');
     $this->tag_body_start = '';
     $this->attributes['type'] = 'submit';
     $this->setAttribute('value', $caption);
     $this->attributes['class'] = 'button';
     $this->setName($name);
     $this->setAction($action);
     $this->setAccessKey($accesskey);
 }
示例#27
0
 public function __construct($name = 'button', $caption = '', $action = NULL, $submit = true)
 {
     parent::__construct('input', 'no');
     $this->tag_body_start = '';
     $this->attributes['type'] = $submit ? 'submit' : 'button';
     $this->setAttribute('value', $caption);
     $this->attributes['class'] = 'button';
     $this->attributes['id'] = $name;
     $this->setName($name);
     $this->setAction($action);
 }
示例#28
0
    /**
     * @param string $options['id']
     * @param string $options['name']
     * @param int    $options['value']
     */
    public function __construct(array $options = array())
    {
        parent::__construct('div', 'yes');
        $this->attr('id', isset($options['id']) ? $options['id'] : zbx_formatDomId($options['name']));
        $this->addClass('jqueryinputset control-severity');
        if (!isset($options['value'])) {
            $options['value'] = TRIGGER_SEVERITY_NOT_CLASSIFIED;
        }
        $items = array();
        $jsIds = '';
        $jsLabels = '';
        foreach (getSeverityCaption() as $severity => $caption) {
            $items[] = new CRadioButton($options['name'], $severity, null, $options['name'] . '_' . $severity, $options['value'] == $severity);
            $css = getSeverityStyle($severity);
            $label = new CLabel($caption, $options['name'] . '_' . $severity, $options['name'] . '_label_' . $severity);
            $label->attr('data-severity', $severity);
            $label->attr('data-severity-style', $css);
            if ($options['value'] == $severity) {
                $label->attr('aria-pressed', 'true');
                $label->addClass($css);
            } else {
                $label->attr('aria-pressed', 'false');
            }
            $items[] = $label;
            $jsIds .= ', #' . $options['name'] . '_' . $severity;
            $jsLabels .= ', #' . $options['name'] . '_label_' . $severity;
        }
        if ($jsIds) {
            $jsIds = substr($jsIds, 2);
            $jsLabels = substr($jsLabels, 2);
        }
        $this->addItem($items);
        insert_js('
			jQuery("' . $jsLabels . '").mouseenter(function() {
				jQuery("' . $jsLabels . '").each(function() {
					var obj = jQuery(this);

					if (obj.attr("aria-pressed") == "false") {
						obj.removeClass("ui-state-hover " + obj.data("severityStyle"));
					}
				});

				var obj = jQuery(this);

				obj.addClass(obj.data("severityStyle"));
			})
			.mouseleave(function() {
				jQuery("#' . $this->getAttribute('id') . ' [aria-pressed=\\"true\\"]").trigger("mouseenter");
			});

			jQuery("' . $jsIds . '").change(function() {
				jQuery("#' . $this->getAttribute('id') . ' [aria-pressed=\\"true\\"]").trigger("mouseenter");
			});', true);
    }
示例#29
0
 public function __construct($items = NULL, $class = NULL)
 {
     parent::__construct('span', 'yes');
     $this->setClass($class);
     $this->addItem($items);
     $this->tag_body_start = '';
     $this->tag_start = '';
     $this->tag_end = '';
     $this->tag_body_start = '';
     $this->tag_body_end = '';
 }
示例#30
0
 public function __construct($item = null, $class = null, $colspan = null, $width = null)
 {
     parent::__construct('td', 'yes');
     $this->addItem($item);
     $this->attr('class', $class);
     if (!empty($colspan)) {
         $this->attr('colspan', $colspan);
     }
     if (!empty($width)) {
         $this->attr('width', $width);
     }
 }