getTranslator() public méthode

Get translator for datagrid
public getTranslator ( ) : Nette\Localization\ITranslator
Résultat Nette\Localization\ITranslator
Exemple #1
0
 /**
  * Render export button
  * @return Html
  */
 public function render()
 {
     $a = Html::el('a', ['class' => [$this->class], 'title' => $this->grid->getTranslator()->translate($this->getTitle()), 'href' => $this->link]);
     $this->tryAddIcon($a, $this->getIcon(), $this->grid->getTranslator()->translate($this->getTitle()));
     $a->addText($this->grid->getTranslator()->translate($this->text));
     if ($this->isAjax()) {
         $a->class[] = 'ajax';
     }
     return $a;
 }
Exemple #2
0
 /**
  * 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;
 }
Exemple #3
0
 /**
  * Render toolbar button
  * @return Html
  */
 public function renderButton()
 {
     $link = $this->createLink($this->grid, $this->href, $this->params);
     $a = Html::el('a')->href($link);
     $this->tryAddIcon($a, $this->getIcon(), $this->getText());
     $a->addText($this->grid->getTranslator()->translate($this->text));
     if ($this->title) {
         $a->title($this->grid->getTranslator()->translate($this->title));
     }
     if ($this->class) {
         $a->class($this->class);
     }
     return $a;
 }
Exemple #4
0
 /**
  * Generates control's HTML element.
  * @param  string
  * @return Nette\Utils\Html
  */
 public function getControl($caption = NULL)
 {
     $el = parent::getControl('');
     $el->type = 'submit';
     $el->class = $this->getClass();
     if ($this->getIcon()) {
         $el->addHtml(Html::el('span')->class(DataGrid::$icon_prefix . $this->getIcon()));
         if (strlen($this->getText())) {
             $el->addHtml(' ');
         }
     }
     $el->addText($this->grid->getTranslator()->translate($this->getText()));
     return $el;
 }
Exemple #5
0
 /**
  * Call export callback
  * @param  array    $data
  * @param  DataGrid $grid
  * @return void
  */
 public function invoke(array $data, DataGrid $grid)
 {
     $columns = $this->getColumns() ?: $grid->getColumns();
     $csv_data_model = new CsvDataModel($data, $columns, $grid->getTranslator());
     if ($grid->getPresenter() instanceof Nette\Application\UI\Presenter) {
         $grid->getPresenter()->sendResponse(new CSVResponse($csv_data_model->getSimpleData(), $this->name, $this->output_encoding, $this->delimiter));
         exit(0);
     }
 }
Exemple #6
0
 /**
  * @return Html
  */
 public function renderButton()
 {
     $button = Html::el('button')->type('button')->data('toggle', 'dropdown');
     $this->tryAddIcon($button, $this->getIcon(), $this->getText());
     if (!empty($this->attributes)) {
         $button->addAttributes($this->attributes);
     }
     $button->addText($this->grid->getTranslator()->translate($this->name));
     if ($this->hasCaret()) {
         $button->addHtml(' ');
         $button->addHtml('<i class="caret"></i>');
     }
     if ($this->getTitle()) {
         $button->title($this->grid->getTranslator()->translate($this->getTitle()));
     }
     if ($this->getClass()) {
         $button->class($this->getClass() . ' dropdown-toggle');
     }
     return $button;
 }
Exemple #7
0
 /**
  * Render row item detail button
  * @return Html
  */
 public function renderButtonAdd()
 {
     $a = Html::el('a')->data('datagrid-toggle-inline-add', TRUE);
     $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;
 }
Exemple #8
0
 /**
  * Translator helper
  * @param  string $message
  * @return string
  */
 protected function translate($message)
 {
     return $this->grid->getTranslator()->translate($message);
 }