/** * Decorates a cell which contains an Advertisement object * @param zibo\library\html\table\Cell $cell * @param zibo\library\html\table\Row $row * @param int $rowNumber * @param array $remainingValues * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $advertisement = $cell->getValue(); if (!$advertisement instanceof AdvertisementData) { return; } $cell->appendToClass('advertisement'); try { $image = new Image($advertisement->image); $image->appendToClass('data'); $image->setThumbnailer('crop', 50, 50); $value = $image->getHtml(); } catch (Exception $e) { $value = 'Could not load image: ' . $e->getMessage(); } $anchor = new Anchor($advertisement->name, $this->action . $advertisement->id); $value .= $anchor->getHtml(); if (!$advertisement->clicks) { $advertisement->clicks = '0'; } $translateParams = array('from' => $this->locale->formatDate($advertisement->dateStart), 'till' => $this->locale->formatDate($advertisement->dateStop), 'clicks' => $advertisement->clicks); $value .= '<div class="info">'; $value .= $advertisement->website . '<br />'; $value .= $this->translator->translate(self::TRANSLATION_DISPLAY, $translateParams) . '<br />'; $value .= $this->translator->translate(self::TRANSLATION_CLICKS, $translateParams); $value .= '</div>'; $cell->setValue($value); }
/** * Decorates the connection with a form option * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row of the cell to decorate * @param integer $rowNumber Number of the current row * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $connection = $cell->getValue(); $field = new OptionField(ExtendedTable::FIELD_ID, $connection->getName()); $field->setIsMultiple(true); $cell->appendToClass('action'); $cell->setValue($field->getHtml()); }
/** * Decorates the cell with a order handle for the category * @param zibo\library\html\table\Cell $cell * @param zibo\library\html\table\Row $row * @param integer $rowNumber * @param array $remainingValues * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $data = $cell->getValue(); $row->setId('data_' . $data->id); $cell->appendToClass('action'); $image = new Image(self::IMAGE_HANDLE); $image->appendToClass('handle'); $cell->setValue($image->getHtml()); }
/** * Decorates a table cell by setting an anchor to the cell based on the cell's value * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row which will contain the cell * @param int $rowNumber Number of the row in the table * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $cell->appendToClass(self::CLASS_ACTION); $file = $cell->getValue(); if (!$file instanceof File) { $cell->setValue(''); return; } parent::decorate($cell, $row, $rowNumber, $remainingValues); }
/** * Decorates the cell * @param zibo\library\html\table\Cell $cell Cell of the value 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 containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $dataFormat = $cell->getValue(); if (!$dataFormat instanceof DataFormat) { return; } $dataFormatName = $dataFormat->getName(); $button = $this->wizard->getField(DataFormatStep::BUTTON_REMOVE); $cell->setValue($button->getOptionHtml($dataFormatName)); $cell->appendToClass('action'); }
/** * Decorates the cell * @param zibo\library\html\table\Cell $cell Cell of the value 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 containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $index = $cell->getValue(); if (!$index instanceof Index) { return; } $indexName = $index->getName(); $button = $this->wizard->getField(IndexStep::BUTTON_REMOVE); $cell->setValue($button->getOptionHtml($indexName)); $cell->appendToClass('action'); }
/** * Decorates the cell with the option for the File * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row of the cell to decorate * @param integer $rowNumber Number of the current row * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $file = $cell->getValue(); if (!$file instanceof File) { return; } $fieldFactory = FieldFactory::getInstance(); $field = $fieldFactory->createField(FieldFactory::TYPE_OPTION, ExtendedTable::FIELD_ID, $file->getPath()); $field->setIsMultiple(true); $cell->appendToClass(FileActionDecorator::CLASS_ACTION); $cell->setValue($field->getHtml()); }
/** * Decorates the cell with an option field for the table actions * @param zibo\library\html\table\Cell $cell Cell which holds the data object * @param zibo\library\html\table\Row $row Row of the cell * @param integer $rowNumber Current row number * @param array $remainingValues Array with the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $values) { $data = $cell->getValue(); if (!is_object($data)) { $cell->setValue(''); return; } $field = new OptionField(ExtendedTable::FIELD_ID, $data->id); $field->setIsMultiple(true); $cell->appendToClass(ActionDecorator::STYLE_ACTION); $cell->setValue($field->getHtml()); }
/** * Decorates the cell with an option field for the table actions * @param zibo\library\html\table\Cell $cell Cell which holds the data object * @param zibo\library\html\table\Row $row Row of the cell * @param integer $rowNumber Current row number * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $modelField = $cell->getValue(); if (!$modelField instanceof ModelField) { $cell->setValue(''); return; } $field = new OptionField(ExtendedTable::FIELD_ID, $modelField->getName()); $field->setIsMultiple(true); $cell->appendToClass(ActionDecorator::STYLE_ACTION); $cell->setValue($field->getHtml()); }
/** * Decorates the cell * @param zibo\library\html\table\Cell $cell Cell of the value 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 containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $field = $cell->getValue(); if (!$field instanceof ModelField) { return; } $row->setId('field_' . $field->getName()); $cell->appendToClass('action'); $image = new Image(self::IMAGE_HANDLE); $image->appendToClass('handle'); $cell->setValue($image->getHtml()); }
/** * Decorates the data in the cell * @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 the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $data = $cell->getValue(); $class = $data->getStatusClass(); if ($data->isError) { $status = $this->translator->translate(self::TRANSLATION_ERROR); } elseif ($data->isInProgress) { $status = $this->translator->translate(self::TRANSLATION_PROGRESS); } else { $status = $this->translator->translate(self::TRANSLATION_WAITING); } $value = '<div class="' . $class . '"></div> ' . $status; $cell->setValue($value); $cell->appendToClass('status'); }
/** * Decorates a table cell by setting an anchor to the cell based on the cell's value * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row which will contain the cell * @param int $rowNumber Number of the row in the table * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $cell->appendToClass(self::CLASS_ACTION); $file = $cell->getValue(); if ($this->fileBrowser->isDirectory($file)) { $cell->setValue(''); return; } $extension = $file->getExtension(); if (array_key_exists($extension, $this->extensions)) { parent::decorate($cell, $row, $rowNumber, $remainingValues); } else { $cell->setValue(''); } }
/** * Decorates the cell with the action for the value of the cell * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row of the cell * @param integer $rowNumber Current row number * @param array $remainingValues Array containing the values of the remaining rows of the table * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $this->willDisplay = true; $this->isDisabled = false; $cell->appendToClass(self::STYLE_ACTION); $value = $cell->getValue(); parent::decorate($cell, $row, $rowNumber, $remainingValues); if (!$this->willDisplay) { $cell->setValue(''); return; } if (!$this->isDisabled) { return; } $label = $this->getLabelFromValue($value); $cell->setValue($label); }
/** * Sets a value to the provided cell * @param zibo\library\html\table\Cell $cell Cell to set a value to * @param string $value Value to set * @param string $style Style class for the cell * @return null */ private function setValue(Cell $cell, $value, $style) { $cell->appendToClass($style); $cell->setValue('<span>' . $value . '</span>'); }