/** * Decorates the role in the provided cell * @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 $remainingRows Array with the values of the remaining rows * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingRows) { $role = $cell->getValue(); if (!$role instanceof RoleData) { $cell->setValue(''); return; } $html = $role->name; if ($this->action) { $anchor = new Anchor($html, $this->action . $role->id); $html = $anchor->getHtml(); } if ($role->permissions || $role->isSuperRole) { $html .= '<div class="info">'; if ($role->isSuperRole) { $html .= $this->translator->translate(self::TRANSLATION_SUPER_ROLE) . '<br />'; } if ($role->permissions) { $permissions = array(); foreach ($role->permissions as $permission) { $permissions[] = $permission->getPermissionCode(); } asort($permissions); $html .= $this->translator->translate(self::TRANSLATION_PERMISSIONS) . ': ' . implode(', ', $permissions); } $html .= '</div>'; } $cell->setValue($html); }
/** * Decorates the user in the provided cell * @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 $remainingRows Array with the values of the remaining rows * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingRows) { $user = $cell->getValue(); if (!$user instanceof UserData) { $cell->setValue(''); return; } $html = $user->username; if ($this->action) { $anchor = new Anchor($html, $this->action . $user->id); $html = $anchor->getHtml(); } $userEmail = $user->getUserEmail(); $userRoles = $user->getUserRoles(); $html .= '<div class="info">'; if ($userEmail) { $html .= $userEmail . '<br />'; } if (!$user->isActive) { $html .= $this->translator->translate(self::TRANSLATION_INACTIVE) . '<br />'; } if ($userRoles) { $roles = array(); foreach ($userRoles as $role) { $roles[] = $role->getRoleName(); } $html .= $this->translator->translate(self::TRANSLATION_ROLES) . ': ' . implode(', ', $roles); } $html .= '</div>'; $cell->setValue($html); }
/** * 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(); if (!$this->meta->isValidData($data)) { $cell->setValue(''); } $title = $this->meta->formatData($data, DataFormatter::FORMAT_TITLE); $teaser = ''; if ($this->hasTeaserFormat) { $teaser = $this->meta->formatData($data, DataFormatter::FORMAT_TEASER); } $value = $this->getImageHtml($data); if ($this->action) { if (!$title) { $title = $this->meta->getName() . ' ' . $data->id; } $anchor = new Anchor($title, $this->action . $data->id); $value .= $anchor->getHtml(); } else { $value .= $title; } if ($teaser) { $value .= '<div class="info">' . $teaser . '</div>'; } $cell->setValue($value); }
/** * 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 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); }
/** * 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; } $fieldName = $field->getName(); if ($this->fieldAction) { $anchor = new Anchor($fieldName, $this->fieldAction . $fieldName); $value = $anchor->getHtml(); } else { $value = $fieldName; } $value .= '<div class="info">'; if ($field instanceof RelationField) { if ($field instanceof BelongsToField) { $relationType = 'belongsTo'; } elseif ($field instanceof HasOneField) { $relationType = 'hasOne'; } else { if ($field instanceof HasManyField) { $relationType = 'hasMany'; } } $relationModelName = $field->getRelationModelName(); $linkModelName = $field->getLinkModelName(); $foreignKeyName = $field->getForeignKeyName(); if ($this->modelAction) { $anchor = new Anchor($relationModelName, $this->modelAction . $relationModelName); $relationModelName = $anchor->getHtml(); if ($linkModelName) { $anchor = new Anchor($linkModelName, $this->modelAction . $linkModelName); $linkModelName = $anchor->getHtml(); } } $parameters = array('type' => $relationType, 'model' => $relationModelName, 'link' => $linkModelName, 'foreignKey' => $foreignKeyName); if ($linkModelName) { if ($foreignKeyName) { $value .= $this->translator->translate('orm.label.relation.type.link.fk', $parameters); } else { $value .= $this->translator->translate('orm.label.relation.type.link', $parameters); } } else { if ($foreignKeyName) { $value .= $this->translator->translate('orm.label.relation.type.fk', $parameters); } else { $value .= $this->translator->translate('orm.label.relation.type', $parameters); } } } else { $value .= $this->translator->translate('orm.label.field.type', array('type' => $field->getType())) . '<br />'; $defaultValue = $field->getDefaultValue(); if (!String::isEmpty($defaultValue)) { $value .= $this->translator->translate('orm.label.value.default') . ': ' . $defaultValue; } } $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 namespace value of the cell * @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 * @return null|boolean When used as group decorator, return true to display the group row, false or null otherwise */ public function decorate(Cell $cell, Row $row, $rowNumber, array $values) { $value = $cell->getValue(); if ($value instanceof ModuleNamespace) { $value = $this->getNamespaceHtml($value); } $cell->setValue($value); }
/** * Decorates the cell * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row of 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|boolean */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $cronJob = $cell->getValue(); if (!$cronJob instanceof CronJob) { return; } $value = $this->decorateCronJob($cronJob); $cell->setValue($value); }
/** * 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 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(); if (!$this->meta->isValidData($data)) { $cell->setValue(''); } $value = $this->meta->formatData($data, $this->format); $cell->setValue($value); }
/** * 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) { $value = $cell->getValue(); $label = $this->getLabelFromValue($value); $href = $this->getHrefFromValue($value); $anchor = new Anchor($label, $href); $this->processAnchor($anchor, $value); $cell->setValue($anchor->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 with the details of the permission in the cell * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row which contains the cell * @param integer $rowNumber Current row number * @param array $remainingValues Array with the values of the remaining rows of the table * @return null|boolean */ public function decorate(Cell $cell, Row $row, $rowNumber, array $values) { $permission = $cell->getValue(); if (!$permission instanceof Permission) { $cell->setValue(); return; } $html = $permission->getPermissionDescription() . '<div class="info">' . $permission->getPermissionCode() . '</div>'; $cell->setValue($html); }
/** * 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 * @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; } if (!$field->isLocalized()) { $cell->setValue(''); return; } $cell->setValue($this->getLocalizedImageHtml()); }
/** * 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 * @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 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 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 formatted information about the module in it * @param zibo\library\html\table\Cell $cell The cell to decorate * @param zibo\library\html\table\Row $row The row containing the cell * @param integer $rowNumber The number of the current row * @param array $remainingValues Array with the values of the remaining rows * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $html = ''; $module = $cell->getValue(); $id = $module['name'] . ucFirst($module['namespace']); $html .= $this->getModulesHtml($module['dependencies'], $id, 'dependencies', 'modules.label.depends.module', 'modules.label.depends.modules'); $html .= $this->getModulesHtml($module['usage'], $id, 'usage', 'modules.label.used.module', 'modules.label.used.modules'); if ($html != '') { $html = '<div class="info">' . $html . '</div>'; } $html = '<span class="module">' . $this->getNameHtml($module) . '</span>' . $html; $cell->setValue($html); }
/** * Decorates the cell containing a ForumRanking * @param Cell $cell * @param Row $row * @param integer $rowNumber * @param array $remainingValues * @return null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $ranking = $cell->getValue(); $value = $ranking->name; if ($this->action) { $anchor = new Anchor($value, $this->action . $ranking->id); $value = $anchor->getHtml(); } $value .= '<div class="info">'; $value .= $this->translator->translate(self::TRANSLATION_POSTS, array('posts' => $ranking->numPosts, 'stars' => $ranking->stars)); $value .= '</div>'; $cell->setValue($value); }
/** * Decorates the module value of the cell with it's version * @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 $values Array with the remaining rows * @return null|boolean When used as group decorator, return true to display the group row, false or null otherwise */ public function decorate(Cell $cell, Row $row, $rowNumber, array $values) { $module = $cell->getValue(); $version = $module->getVersion(); if ($this->action) { $anchor = new Anchor($version, $this->action . $version); $value = $anchor->getHtml(); } else { $value = $version; } $value .= $this->getDependenciesHtml('dependencies-' . $version, $module->getDependencies()); $cell->setValue($value); }
/** * Decorates the cell with a checkbox for the permission in the cell * @param zibo\library\html\table\Cell $cell Cell to decorate * @param zibo\library\html\table\Row $row Row which contains the cell * @param integer $rowNumber Current row number * @param array $remainingValues Array containing the values of the remaining rows of the table * @return boolean|null */ public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues) { $permission = $cell->getValue(); if (!$permission instanceof Permission) { $cell->setValue(); return; } $field = $this->createField($permission); if ($this->role->isPermissionAllowed($permission->getPermissionCode())) { $field->setValue($permission); } $cell->setValue($field->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 ($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 * @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; } $label = $field->getLabel(); if (!$label) { $cell->setValue(''); return; } $value = $this->translator->translate($label); $value .= '<div class="info">' . $label . '</div>'; $cell->setValue($value); }
/** * 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 connection with it's definition * @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(); $dsn = $connection->getDriver()->getDsn()->__toString(); $value = $connection->getName(); if ($value == $this->defaultConnection) { $value = '<strong>' . $value . '</strong>'; } if ($this->action) { $anchor = new Anchor($value, $this->action . $connection->getName()); $value = $anchor->getHtml(); } $value .= '<div class="info">' . $dsn . '</div>'; $cell->setValue($value); }
/** * 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(); $title = '#' . $data->id . ': ' . $data->getJobClassName(); $anchor = new Anchor($title, $this->action . $data->id); $translationVars = array('queue' => $data->queue, 'date' => $this->locale->formatDate($data->dateAdded, 'j F Y H:i:s')); if ($data->dateScheduled) { $translationKey = self::TRANSLATION_INFO_SCHEDULED; $translationVars['scheduled'] = $this->locale->formatDate($data->dateScheduled, 'j F Y H:i:s'); } else { $translationKey = self::TRANSLATION_INFO; } $value = $anchor->getHtml(); $value .= '<div class="info">' . $this->translator->translate($translationKey, $translationVars) . '</div>'; $cell->setValue($value); }