/** * Render row item detail button * @param Row $row * @return Html */ public function renderButton($row) { $a = Html::el('a')->href($this->grid->link('getItemDetail!', ['id' => $row->getId()]))->data('toggle-detail', $row->getId())->data('toggle-detail-grid', $this->grid->getName()); $this->tryAddIcon($a, $this->getIcon(), $this->getText()); $a->addText($this->text); if ($this->title) { $a->title($this->grid->getTranslator()->translate($this->title)); } if ($this->class) { $a->class($this->class); } return $a; }
/** * Render row item detail button * @param Row $row * @return Html */ public function renderButton($row) { $a = Html::el('a')->href($this->grid->link('getItemDetail!', ['id' => $row->getId()]))->data('toggle-detail', $row->getId())->data('toggle-detail-grid', $this->grid->getName()); if ($this->icon) { $a->add(Html::el('span')->class(DataGrid::$icon_prefix . $this->icon)); if (strlen($this->text)) { $a->add(' '); } } $a->add($this->text); if ($this->title) { $a->title($this->title); } if ($this->class) { $a->class($this->class); } return $a; }
/** * Render item detail button * @param mixed $item * @return Html */ public function renderButton($item) { if (is_object($item)) { $id_value = $item->{$this->grid->getPrimaryKey()}; } else { $id_value = $item[$this->grid->getPrimaryKey()]; } $a = Html::el('a')->href($this->grid->link('getItemDetail!', ['id' => $id_value]))->data('toggle-detail', $id_value)->data('toggle-detail-grid', $this->grid->getName()); if ($this->icon) { $a->add(Html::el('span')->class(DataGrid::$icon_prefix . $this->icon)); if (strlen($this->text)) { $a->add(' '); } } $a->add($this->text); if ($this->title) { $a->title($this->title); } if ($this->class) { $a->class($this->class); } return $a; }
/** * Pass "sub"-form submission forward to custom submit function * @param Form $form * @return void */ public function submitted(Form $form) { if (!isset($form['group_action']['submit']) || !$form['group_action']['submit']->isSubmittedBy()) { return; } $values = $form->getValues(); $values = $values['group_action']; if ($values->group_action === 0 || is_null($values->group_action)) { return; } /** * @todo Define items IDs */ $http_ids = $form->getHttpData(Form::DATA_LINE | Form::DATA_KEYS, strtolower($this->datagrid->getName()) . '_group_action_item[]'); $ids = array_keys($http_ids); $id = $values->group_action; $this->group_actions[$id]->onSelect($ids, isset($values->{$id}) ? $values->{$id} : NULL); $form['group_action']['group_action']->setValue(NULL); }