Пример #1
0
 /**
  * Assemble elements from the component and a Counter object and pass them along
  * to the view.
  */
 public function render()
 {
     $fields = $this->component->getFields();
     $selected = $fields->getVisibleFields()->getByQueryStringId($this->request->getQuery('group_field'));
     $counter = new Counter($selected, $fields, $this->component->getListing());
     $renderer = $this->view->csvCellRenderer();
     $this->component->setShouldRenderLayout(false);
     $this->view->assign(['title' => $this->component->getTitle(), 'selected' => $selected, 'fields' => $counter->buildRenderFields(), 'data' => $counter->fetchData($renderer), 'renderer' => $renderer]);
     return $this->renderView();
 }
Пример #2
0
 /**
  * Assemble elements from the component and a Counter object and pass them along
  * to the view.
  */
 public function render()
 {
     $fields = $this->component->getFields();
     $selected = null;
     $counter = null;
     $renderer = $this->view->tableCellRenderer();
     if ($this->request->getQuery('group_field')) {
         $selected = $fields->getVisibleFields()->getByQueryStringId($this->request->getQuery('group_field'));
         $counter = new Counter($selected, $fields, $this->component->getListing());
     }
     $this->view->assign(['title' => $this->component->getTitle(), 'model' => $this->component->getPrimaryModel(), 'fields' => $this->component->getFields(), 'listing' => $this->component->getListing(), 'renderer' => $renderer, 'selectedField' => $selected ? $selected->getQueryStringId() : null, 'countFields' => $counter ? $counter->buildRenderFields() : null, 'data' => $selected ? $counter->fetchData($renderer) : [], 'request' => $this->request]);
     return $this->renderView();
 }