Example #1
0
 /**
  * Constructs a new queue table
  * @param string $formAction URL where the form of the table will point to
  * @param string $detailAction URL where the action of a queue job will point to
  * @return null
  */
 public function __construct($formAction, $detailAction, $translator)
 {
     $model = ModelManager::getInstance()->getModel(QueueModel::NAME);
     parent::__construct($model, $formAction);
     $this->addDecorator(new ZebraDecorator(new DetailDecorator($detailAction)));
     $this->addDecorator(new StatusDecorator($translator));
 }
 /**
  * Gets the HTML of this table. Makes sure there is a decorator added to the table
  * @return string
  */
 public function getHtml()
 {
     if (!$this->columnDecorators && !$this->groupDecorators) {
         $editAction = $this->basePath . '/' . ScaffoldController::ACTION_EDIT . '/';
         $dataDecorator = new DataDecorator($this->meta, $editAction);
         $dataDecorator = new ZebraDecorator($dataDecorator);
         $this->addDecorator($dataDecorator, null, true);
         if ($this->meta->isLocalized()) {
             $localizeDecorator = new LocalizeDecorator($this->model, $editAction);
             $this->addDecorator($localizeDecorator);
         }
     }
     return parent::getHtml();
 }
 /**
  * Creates a new board table
  * @return zibo\orm\scaffold\table\ModelTable
  */
 private function createBoardTable($categoryId, $tableAction, $boardAction = null)
 {
     $translator = $this->getTranslator();
     $model = $this->models[ForumBoardModel::NAME];
     $table = new ModelTable($model, $tableAction);
     $table->addDecorator(new ZebraDecorator(new OrderDecorator()));
     $table->addDecorator(new DataDecorator($model->getMeta(), $boardAction));
     $table->addAction($translator->translate(self::TRANSLATION_DELETE), array($this, 'deleteBoard'), $translator->translate(self::TRANSLATION_DELETE_CONFIRM));
     $table->setId('tableForumBoard');
     $query = $table->getModelQuery();
     $query->addCondition('{category} = %1%', $categoryId);
     $query->addOrderBy('{orderIndex} ASC');
     return $table;
 }