/** * Decorates the data into a locale overview * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row containing the cell * @param int $rowNumber Number of the current row * @param array $remainingValues Array with all the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $data = $cell->getValue(); $value = ''; if (!$this->meta->isValidData($data)) { $cell->setValue($value); return; } if (isset($data->dataLocale) && $data->dataLocale != $this->currentLocale) { $row->appendToClass(self::STYLE_UNLOCALIZED); } $ids = $this->localizedModel->getLocalizedIds($data->id); foreach ($this->locales as $locale) { if (array_key_exists($locale, $ids)) { $localeString = '<strong>' . $locale . '</strong>'; } else { $localeString = $locale; } if ($this->action !== null) { $anchor = new Anchor($localeString, $this->action . '/' . $data->id . '/' . $locale); $localeString = $anchor->getHtml(); } $value .= ($value == '' ? '' : ' ') . $localeString; } $cell->setValue($value); }
/** * Adds the header row to the table based on the header decorators * @return null */ protected function addHeader() { if (!$this->hasHeaderDecorators) { return; } $row = new Row(); $row->appendToClass(self::STYLE_HEADER); foreach ($this->columnDecorators as $columnDecorator) { $cell = new HeaderCell(); $headerDecorator = $columnDecorator->getHeaderDecorator(); if ($headerDecorator) { $headerDecorator->decorate($cell, $row, 0, array()); } $row->addCell($cell); } parent::setHeader($row); }
/** * Adds a data row to the export * @param zibo\library\html\table\Row $row Data row * @return null */ public function addExportDataRow(Row $row, $isGroupRow) { $cells = $row->getCells(); foreach ($cells as $cell) { $value = $cell->getValue(); $cell->setValue(nl2br($value)); } if ($isGroupRow) { $row->appendToClass('group'); } else { if ($this->zebraIndex) { $row->appendToClass('even'); $this->zebraIndex = 0; } else { $row->appendToClass('odd'); $this->zebraIndex = 1; } } $this->rows[] = $row; }