/** * Add a form action * @param $name Action name * @param $callback Action callback * @param $label Action label * @param $icon Action icon */ public function addAction($name, $callback, $label, $icon) { // creates the action button $button1 = new TButton($name); $button1->setAction($callback, $label); $button1->setImage($icon); // add the field to the form parent::addField($button1); // add a row for the button $row = $this->table->addRow(); $row->addCell($button1); }
/** * Add a form action * @param $label Action Label * @param $action TAction Object * @param $icon Action Icon */ public function addQuickAction($label, $action, $icon = 'ico_save.png') { // cria um botão de ação (salvar) $button = new TButton('save'); parent::addField($button); // define the button action $button->setAction($action, $label); $button->setImage($icon); if (!$this->has_action) { // creates the action table $this->actions = new TTable(); $this->action_row = $this->actions->addRow(); $row = $this->table->addRow(); $cell = $row->addCell($this->actions); $cell->colspan = 2; } // add cell for button $this->action_row->addCell($button); $this->has_action = TRUE; }
/** * Add a form action * @param $label Action Label * @param $action TAction Object * @param $icon Action Icon */ public function addQuickAction($label, TAction $action, $icon = 'ico_save.png') { $name = strtolower(str_replace(' ', '_', $label)); $button = new TButton($name); parent::addField($button); // define the button action $button->setAction($action, $label); $button->setImage($icon); if (!$this->has_action) { // creates the action table $this->actions = new TTable(); $this->action_row = $this->actions->addRow(); $row = $this->table->addRow(); $cell = $row->addCell($this->actions); $cell->colspan = 2; } // add cell for button $this->action_row->addCell($button); $this->has_action = TRUE; }