public static function getsidebarsform()
 {
     $idview = (int) tadminhtml::getparam('idview', 1);
     $view = tview::i($idview);
     $widgets = twidgets::i();
     $html = tadminhtml::i();
     $html->section = 'widgets';
     $args = targs::i();
     $args->idview = $idview;
     $lang = tlocal::i('views');
     $args->customsidebar = $idview == 1 ? '' : $view->theme->parse($html->getcheckbox('customsidebar', true));
     $args->adminurl = tadminhtml::getadminlink('/admin/views/widgets/', 'idwidget');
     $lang = tlocal::i('widgets');
     $result = $html->formhead($args);
     $count = count($view->sidebars);
     $sidebarnames = self::getsidebarnames($view);
     foreach ($view->sidebars as $i => $sidebar) {
         $orders = range(1, count($sidebar));
         foreach ($sidebar as $j => $_item) {
             $id = $_item['id'];
             $item = $widgets->getitem($id);
             $args->id = $id;
             $args->ajax = $_item['ajax'];
             $args->inline = $_item['ajax'] === 'inline';
             $args->disabled = $item['cache'] == 'cache' || $item['cache'] == 'nocache' ? '' : 'disabled="disabled"';
             $args->add($item);
             $args->sidebarcombo = tadminhtml::getcombobox("sidebar-{$id}", $sidebarnames, $i);
             $args->ordercombo = tadminhtml::getcombobox("order-{$id}", $orders, $j);
             $result .= $html->item($args);
         }
     }
     $result .= $html->formfooter();
     //all widgets
     $args->id_view = $idview;
     $result .= $html->addhead($args);
     foreach ($widgets->items as $id => $item) {
         $args->id = $id;
         $args->add($item);
         $args->checked = tsidebars::getpos($view->sidebars, $id) ? false : true;
         $result .= $html->additem($args);
     }
     $result .= $html->addfooter();
     return $html->fixquote($result);
 }