示例#1
0
 /**
  * Ensure permissions are correctly set and then pass the component
  * along to the view.
  */
 public function render()
 {
     $this->component->getPermissions()->haltIfNotAllowed('export');
     $filters = [];
     if ($this->enableVisibilityFilter) {
         $filters[] = $this->getVisibilityFilter();
     }
     $filters[] = $this->component->getFieldGroupsFilter();
     $this->view->assign('component', $this->component)->assign('filters', $filters);
     return $this->renderView();
 }
示例#2
0
 public function getFieldGroupsFilter()
 {
     if (!$this->fieldGroupsFilter) {
         $this->fieldGroupsFilter = $this->component->getFieldGroupsFilter();
     }
     return $this->fieldGroupsFilter;
 }
示例#3
0
 /**
  * Pass a bunch of dependencies to the View.
  */
 public function render()
 {
     $listing = $this->component->getListing();
     $id = $this->request->getQuery($listing->getPrimaryKey()->getName());
     $fields = $this->component->getFields()->getVisibleFields();
     $data = $this->component->getListing()->fetchRow($fields, $id);
     $primaryKey = $this->component->getPrimaryModel()->getPrimaryKey();
     $params = array();
     foreach ($primaryKey as $field) {
         $params[$field] = $this->request->getQuery($field);
     }
     $this->view->assign(['params' => $params, 'fields' => $fields, 'singularTitle' => $this->component->getPrimaryModel()->getSingularTitle(), 'data' => $data, 'id' => $id, 'groupingFilter' => $this->component->getFieldGroupsFilter(), 'permissions' => $this->component->getPermissions(), 'isAjax' => $this->request->isAjax()]);
     // When requested over XHR, turn off the layout (admin shell chrome)
     if ($this->request->isAjax()) {
         $this->component->setShouldRenderLayout(false);
     }
     return $this->renderView();
 }
示例#4
0
 /**
  * Pass a whole log of stuff into the view.
  */
 public function render()
 {
     $fields = $this->component->getFields();
     $listing = $this->component->getListing();
     $filter = $this->component->getVisibilityFilter();
     $this->view->assign(['component' => $this->component, 'permissions' => $this->component->getPermissions(), 'singularTitle' => $this->component->getPrimaryModel()->getSingularTitle(), 'pluralTitle' => $this->component->getPrimaryModel()->getPluralTitle(), 'listing' => $listing, 'visibilityFilter' => $filter, 'groupingFilter' => $this->component->getFieldGroupsFilter(), 'fields' => $fields, 'debug' => Pimple::getResource('debug'), 'isSortable' => $this->component instanceof SortableListingInterface, 'page' => $this, 'createUrl' => $this->getCreateUrl()]);
     if ($this->component instanceof BulkActionProcessorInterface) {
         $this->view->assign(['bulkActions' => $this->component->getBulkActions(), 'bulkActionFailureMessage' => $this->bulkActionFailureMessage]);
     }
     return $this->renderView();
 }
示例#5
0
 /**
  * Pass a bunch of dependencies to the View.
  */
 public function render()
 {
     $listing = $this->component->getListing();
     $id = $this->request->getQuery($listing->getPrimaryKey()->getName());
     $fields = $this->component->getFields()->getVisibleFields();
     if ($this->component->getPermissions()->can('restore') && $listing->hasSelectModifier('SelectDeletedRecords')) {
         /* @var $deletedRecordsModifier \Dewdrop\Fields\Helper\SelectDeletedRecords */
         $deletedRecordsModifier = $listing->getSelectModifierByName('SelectDeletedRecords');
         $deletedRecordsModifier->disable();
     }
     $data = $listing->fetchRow($fields, $id);
     $primaryKey = $this->component->getPrimaryModel()->getPrimaryKey();
     $params = array();
     foreach ($primaryKey as $field) {
         $params[$field] = $this->request->getQuery($field);
     }
     $this->view->assign(['params' => $params, 'fields' => $fields, 'singularTitle' => $this->component->getPrimaryModel()->getSingularTitle(), 'data' => $data, 'id' => $id, 'groupingFilter' => $this->component->getFieldGroupsFilter(), 'permissions' => $this->component->getPermissions(), 'isAjax' => $this->request->isAjax()]);
     // When requested over XHR, turn off the layout (admin shell chrome)
     if ($this->request->isAjax()) {
         $this->component->setShouldRenderLayout(false);
     }
     return $this->renderView();
 }
示例#6
0
 public function assignDefaultViewArguments()
 {
     $this->view->assign(['component' => $this->component, 'isNew' => $this->isNew, 'fields' => $this->fields->getEditableFields($this->component->getFieldGroupsFilter()), 'model' => $this->model, 'rowEditor' => $this->rowEditor, 'request' => $this->request, 'invalidSubmission' => $this->invalidSubmission, 'saveButtonPosition' => $this->saveButtonPosition]);
 }
 /**
  * Render a filter form for the provided CrudInterface admin component.
  *
  * @param CrudInterface $component
  * @return string
  */
 public function directWithComponent(CrudInterface $component)
 {
     return $this->directWithArgs($component->getFields()->getFilterableFields($component->getFieldGroupsFilter()), $component->getListing()->getSelectModifierByName('SelectFilter'), $component->getPrimaryModel()->getPluralTitle());
 }
示例#8
0
 /**
  * Ensure the user is allowed to sort fields on this component.
  */
 public function init()
 {
     $this->component->getPermissions()->haltIfNotAllowed('sort-fields');
     $this->filter = $this->component->getFieldGroupsFilter();
 }