Example #1
0
    public function getSearchBox()
    {
        static $id_count = 0;
        if ($id_count) {
            $id = 'search_list_' . $id_count;
        } else {
            $id = 'search_list';
            $id_count++;
        }
        $values = $this->getLinkValues();
        unset($values['pager_search']);
        unset($values['go']);
        $form = new \Form($id);
        $form->useGetMethod();
        $form->addClass('form-inline');
        $form->setAction('index.php');
        //$form->appendCSS('bootstrap');
        foreach ($values as $k => $v) {
            $form->addHidden($k, $v);
        }
        $input_array[] = '<div style="width: 300px">';
        $form->setOpen(false);
        $input_array[] = $form->printTag();
        $input_array[] = implode("\n", $form->getHiddens());
        $si = $form->addTextField('pager_c_search', $this->search);
        $si->addClass('pager_c_search');
        $si->addClass('form-control');
        $si->setPlaceholder(_('Search'));
        $input_array[] = '<div class="input-group">';
        $input_array[] = (string) $si;
        $input_array[] = '<span class="input-group-btn">';
        if ($this->search_button) {
            $sub = $form->addSubmit('submit', 'Go')->addClass('btn btn-success');
            $input_array[] = (string) $sub;
        }
        $input_array[] = <<<EOF
<input type="submit" onclick="\$(this).parents('form').find('input.pager_c_search').val('');" class="btn btn-info" value="Clear" />
EOF;
        $input_array[] = '</span>';
        $input_array[] = '</div>';
        $input_array[] = '</form></div>';
        return implode("\n", $input_array);
    }
Example #2
0
                $search = array("-", ".rrd", $optionc);
                $replace = array(" :: ", "", $friendly);
                $prettyprint = ucwords(str_replace($search, $replace, $friendly));
                $optionslist[$optionc] = htmlspecialchars($prettyprint);
        }
    }
    return $optionslist;
}
include "head.inc";
display_top_tabs(make_tabs());
if ($input_errors && count($input_errors)) {
    print_input_errors($input_errors);
}
require_once 'classes/Form.class.php';
$form = new Form(new Form_Button('submit', 'Go!'));
$form->addClass('auto-submit');
$section = new Form_Section('Graph settings');
$group = new Form_Group('Options');
$group->add(new Form_Select('option', 'Graphs', $curoption, build_options()))->setHelp('Graph');
$group->add(new Form_Select('style', 'Style', $curstyle, $styles))->setHelp('Style');
$group->add(new Form_Select('period', 'Period', $curperiod, $periods))->setHelp('Period');
if ($curcat == 'custom') {
    $group->setHelp('Any changes to these option may not take affect until the next auto-refresh.');
}
$section->add($group);
if ($curcat == 'custom') {
    $section->addInput(new Form_Input('cat', null, 'hidden', 'custom'));
    $tz = date_default_timezone_get();
    $tz_msg = gettext("Enter date and/or time. Current timezone:") . " {$tz}";
    $start_fmt = strftime("%m/%d/%Y %H:%M:%S", $start);
    $end_fmt = strftime("%m/%d/%Y %H:%M:%S", $end);
Example #3
0
 /**
  * Формирует элементы формы с разбивкой на вкладки.
  */
 public function getForm(array $defaults = array(), $fieldName = null)
 {
     $tabs = array();
     // Сортировка
     if (null !== $fieldName) {
         uasort($this, array($this, 'sortByWeight'));
     }
     foreach ($this as $name => $ctl) {
         if (null !== $fieldName and $name != $fieldName) {
             continue;
         }
         if (!$ctl->isVisible()) {
             continue;
         }
         if (!($group = trim($ctl->group))) {
             $group = count($tabs) ? array_shift(array_keys($tabs)) : t('Основные сведения');
         }
         if ($ctl instanceof AttachmentControl) {
             $group = t('Файлы');
         }
         $ctl->value = $name;
         $tabs[$group][$name] = $ctl;
     }
     $form = new Form($defaults);
     // Несколько вкладок — филдсеты.
     if (count($tabs) > 1) {
         $form->addClass('tabbed');
         foreach ($tabs as $name => $controls) {
             $tab = $form->addControl(new FieldSetControl(array('name' => $name, 'label' => $name, 'tab' => true)));
             foreach ($controls as $control) {
                 $tab->addControl($control);
             }
         }
     } elseif (count($tabs) == 1) {
         foreach (array_shift($tabs) as $control) {
             $form->addControl($control);
         }
     }
     return $form;
 }