コード例 #1
0
 /**
  * @param $result Table
  */
 public function afterHtmlBuilderMultipleBuild(Table $result)
 {
     if ($this->in_multiple == 'build') {
         $table = $result;
         $length = count($table->body->rows) - 1;
         if ($this->count->count > $length) {
             // vertical scrollbar
             $vertical_scroll_bar = new Standard_Cell();
             $vertical_scroll_bar->addClass('vertical');
             $vertical_scroll_bar->addClass('scrollbar');
             $vertical_scroll_bar->setAttribute('rowspan', 1000000);
             $vertical_scroll_bar->setData('start', 0);
             $vertical_scroll_bar->setData('length', $length);
             $vertical_scroll_bar->setData('total', $this->count->count);
             $link = '/Html_Edit_Multiple/output/' . Namespaces::shortClassName($this->property->getDeclaringClass()) . SL . Dao::getObjectIdentifier($this->property->getObject()) . SL . $this->property->name . SL . '?move=';
             $up = new Anchor($link . 'up');
             $up->addClass('up');
             $position = new Anchor($link . 1);
             $position->addClass('position');
             $down = new Anchor($link . 'down');
             $down->addClass('down');
             $vertical_scroll_bar->setContent($up . $position . $down);
             // add vertical scrollbar cells to multiple (collection or map) table
             $table->head->rows[0]->addCell(new Header_Cell(), 0);
             $table->body->rows[0]->addCell($vertical_scroll_bar, 0);
         }
         $this->in_multiple = '';
     }
 }
コード例 #2
0
ファイル: Html_Builder_Type.php プロジェクト: TuxBoy/Demo-saf
 /**
  * @param $conditions string[] the key is the name of the condition, the value is the name of the
  *   value that enables the condition
  * @param $filters string[] the key is the name of the filter, the value is the name of the form
  *   element containing its value
  * @return string
  */
 public function buildObject($conditions = null, $filters = null)
 {
     $class_name = $this->type->asString();
     // visible input
     $input = new Input(null, strval($this->value));
     $input->setAttribute('autocomplete', 'off');
     $input->setAttribute('data-combo-class', Names::classToSet($class_name));
     if (!$this->readonly) {
         if ($filters) {
             $html_filters = [];
             $old_name = $this->name;
             foreach ($filters as $filter_name => $filter_value) {
                 $this->name = $filter_value;
                 $name = $this->getFieldName('', false);
                 $html_filters[] = $filter_name . '=' . $name;
             }
             $this->name = $old_name;
             $input->setAttribute('data-combo-filters', join(',', $html_filters));
         }
         if ($conditions) {
             $html_conditions = [];
             $old_name = $this->name;
             foreach ($conditions as $condition_name => $condition_value) {
                 $this->name = $condition_name;
                 $name = $this->getFieldName('', false);
                 $html_conditions[] = $name . '=' . $condition_value;
             }
             $this->name = $old_name;
             $input->setAttribute('data-conditions', join(';', $html_conditions));
         }
         $input->addClass('autowidth');
         $input->addClass('combo');
         // id input
         $id_input = new Input($this->getFieldName('id_'), $this->value ? Dao::getObjectIdentifier($this->value) : '');
         $id_input->setAttribute('type', 'hidden');
         $id_input->addClass('id');
         // 'add' / 'edit' anchor
         $fill_combo = isset($this->template) ? ['fill_combo' => $this->template->getFormId() . DOT . $this->getFieldName('id_', false)] : '';
         $edit = new Anchor(View::current()->link($this->value ? get_class($this->value) : $class_name, Feature::F_ADD, null, $fill_combo), 'edit');
         $edit->addClass('edit');
         $edit->setAttribute('target', Target::BLANK);
         $edit->setAttribute('title', '|Edit ¦' . Names::classToDisplay($class_name) . '¦|');
         // 'more' button
         $more = new Button('more');
         $more->addClass('more');
         $more->setAttribute('tabindex', -1);
         $this->setOnChangeAttribute($id_input);
         return $id_input . $input . $more . $edit;
     }
     return $input;
 }