Exemple #1
0
 public function outputInForm()
 {
     $input = new CInput();
     $input->name = $this->name;
     $input->value = $this->value;
     $input->rows = isset($this->config['rows']) ? $this->config['rows'] : 1;
     $input->style = 'width:500px';
     //
     return $input->generate();
 }
 public function addValue($name, $value, $checked = null)
 {
     $this->count++;
     $id = str_replace(array('[', ']'), array('_'), $this->name) . '_' . $this->count;
     $radio = new CInput('radio', $this->name, $value);
     $radio->attr('id', zbx_formatDomId($id));
     if (strcmp($value, $this->value) == 0 || !is_null($checked) || $checked) {
         $radio->attr('checked', 'checked');
     }
     $label = new CLabel($name, $id);
     $outerDiv = new CDiv(array($radio, $label));
     if ($this->orientation == self::ORIENTATION_HORIZONTAL) {
         $outerDiv->addClass('inlineblock');
     }
     parent::addItem($outerDiv);
 }
Exemple #3
0
 public function __construct($name = 'textbox', $value = '', $readonly = false, $maxlength = 255)
 {
     parent::__construct('text', $name, $value);
     $this->setReadonly($readonly);
     $this->caption = null;
     $this->setAttribute('maxlength', $maxlength);
 }
 public function __construct($name = 'number', $value = '0', $maxlength = 20, $readonly = false, $allowempty = false, $allownegative = true)
 {
     parent::__construct('text', $name, $value);
     $this->setReadonly($readonly);
     $this->setAttribute('maxlength', $maxlength);
     $this->setAttribute('style', 'text-align: right;');
     $this->onChange('validateNumericBox(this, ' . ($allowempty ? 'true' : 'false') . ', ' . ($allownegative ? 'true' : 'false') . ');');
 }
 public function __construct($name = 'number', $value = '0', $size = 20, $readonly = 'no', $allowempty = false, $allownegative = true)
 {
     parent::__construct('text', $name, $value);
     $this->setReadonly($readonly);
     $this->attr('size', $size);
     $this->attr('maxlength', $size);
     $this->attr('style', 'text-align: right;');
     $this->addAction('onchange', 'validateNumericBox(this, ' . ($allowempty ? 'true' : 'false') . ', ' . ($allownegative ? 'true' : 'false') . ');');
 }
 public function parseValue($name, $value)
 {
     if (is_array($value)) {
         foreach ($value as $key => $item) {
             if (is_null($item)) {
                 continue;
             }
             $this->parseValue($name . '[' . $key . ']', $item);
         }
         return null;
     }
     if (strpos($value, "\n") === false) {
         $hiddenVar = new CInput('hidden', $name, $value, null, $this->element_id);
         $hiddenVar->removeAttribute('class');
     } else {
         $hiddenVar = new CTextArea($name, $value);
         $hiddenVar->setAttribute('class', 'hidden');
     }
     $this->var_container[] = $hiddenVar;
 }
Exemple #7
0
 private function parseValue($name, $value)
 {
     if (is_array($value)) {
         foreach ($value as $key => $item) {
             if (is_null($item)) {
                 continue;
             }
             $this->parseValue($name . '[' . $key . ']', $item);
         }
         return null;
     }
     if (strpos($value, "\n") === false) {
         $hiddenVar = new CInput('hidden', $name, $value);
         if ($this->element_id !== null) {
             $hiddenVar->setId($this->element_id);
         }
     } else {
         $hiddenVar = (new CTextArea($name, $value))->addStyle('display: none;');
     }
     $this->var_container[] = $hiddenVar;
 }
Exemple #8
0
 public function __construct($name = 'textbox', $value = '', $size = 20, $readonly = false, $maxlength = 255)
 {
     parent::__construct('text', $name, $value);
     $this->setReadonly($readonly);
     $this->caption = null;
     $this->tag_body_start = '';
     $this->setAttribute('size', $size);
     $this->setAttribute('maxlength', $maxlength);
     // require for align input field using css width
     if ($size == ZBX_TEXTBOX_STANDARD_SIZE) {
         $this->setAttribute('style', 'width: ' . ZBX_TEXTAREA_STANDARD_WIDTH . 'px;');
     }
 }
Exemple #9
0
 public function main()
 {
     require_once CONTROL_PATH . 'input.php';
     require_once CONTROL_PATH . 'htmlarea.php';
     //
     $oSubject = new CInput();
     $oRecipient = new CInput();
     $oContent = new CHtmlarea();
     $oSubject->name = 'subject';
     $oRecipient->name = 'to';
     $oContent->name = 'content';
     // width:99%
     $oSubject->style = 'width:300px;';
     $oRecipient->style = 'width:300px;';
     // Собираем данные для отображения
     $szTitle = 'Отправка письма';
     $aBegin = array('Почта' => '#', $szTitle => '#');
     $aButton = array('Перейти к настройке smtp' => 'config.php', 'История отсылки почты' => 'logs.php');
     // Отображаем
     $design = CMSDesign::getInstance();
     $design->begin($aBegin, $szTitle);
     $design->documentBegin();
     $design->header($szTitle);
     $design->buttons($aButton);
     $design->br();
     $design->formBegin('index.php');
     $design->submit('submit', _msg('Послать'));
     $design->tableBegin();
     $design->row2cell('Получатель (адрес email)', $oRecipient->generate());
     $design->row2cell('Тема письма', $oSubject->generate());
     $design->row2cell('Сообщение', $oContent->generate());
     $design->TableEnd();
     $design->submit('submit', _msg('Послать'));
     $design->formEnd();
     $design->end();
     $this->output();
 }
 public function __construct($name = 'file', $value = '')
 {
     parent::__construct('file', $name, $value);
     $this->setFile($value);
 }
 public function __construct($name = 'checkbox', $checked = 'no', $action = null, $value = 'yes')
 {
     parent::__construct('checkbox', $name, $value, 'checkbox pointer');
     $this->setAttribute('onclick', $action);
     $this->setChecked($checked);
 }
 public function __construct($name = 'button', $caption = '', $action = null, $class = null)
 {
     parent::__construct('button', $name, $caption, $class);
     $this->addAction('onclick', $action);
     return $this;
 }
Exemple #13
0
 public function __construct($name = 'password', $value = '', $size = 50, $maxlength = 255)
 {
     parent::__construct('password', $name, $value);
     $this->setAttribute('size', $size);
     $this->setAttribute('maxlength', $maxlength);
 }
Exemple #14
0
 public function __construct($name = 'file')
 {
     parent::__construct('file', $name);
 }
Exemple #15
0
 public function __construct($name = 'checkbox', $value = '1')
 {
     parent::__construct('checkbox', $name, $value);
     $this->setChecked(false);
 }
Exemple #16
0
 protected static function outputUrlFormFields()
 {
     $design = CMSDesign::getInstance();
     $control = new CInput();
     $control->name = 'sitemap_url_key';
     $control->value = self::$sitemap['url_key'];
     $control->style = 'width:99%';
     $design->row2cell('Виртуальный путь', $control->generate());
 }