/** * Get the processed SQL statement from the Listing, pretty print it, and * pass it to our view script. */ public function render() { $this->component->getPermissions()->haltIfNotAllowed('debug'); $select = $this->component->getListing()->getModifiedSelect($this->component->getFields()); $this->view->formattedSql = SqlFormatter::format((string) $select); return $this->renderView(); }
/** * Pass all the component's fields to the view so we can render a grid * of information about them. */ public function render() { $this->component->getPermissions()->haltIfNotAllowed('debug'); $this->view->displayFields = new Fields(); $this->view->componentFields = $this->component->getFields(); return $this->renderView(); }
/** * Setup notification fields and pass various dependencies to the View. */ public function render() { $gateway = new NotificationGateway($this->component->getDb()); $select = $gateway->selectByComponent($this->component->getFullyQualifiedName()); $fields = $gateway->buildFields($this->component->url('notification-edit'), $this->component->getFields()); $this->view->assign(['fields' => $fields, 'listing' => new Listing($select, $gateway->field('dewdrop_notification_subscription_id')), 'component' => $this->component, 'componentModel' => $this->component->getPrimaryModel()]); return $this->renderView(); }
/** * Ensure the user has permissions to work with notifications in this component * and setup Fields and RowEditor objects. */ public function init() { $this->component->getPermissions()->haltIfNotAllowed('notifications'); $gateway = new NotificationGateway($this->component->getDb()); $this->fields = $gateway->buildFields($this->component->url('notification-edit'), $this->component->getFields()); $this->rowEditor = new RowEditor($this->fields, $this->request); $this->rowEditor->linkByQueryString('dewdrop_notification_subscriptions', 'dewdrop_notification_subscription_id'); $this->rowEditor->link(); }
/** * 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(); }
/** * Grab the selected visible columns from POST and save them back to * the visibility filter. * * @param ResponseHelper $responseHelper */ public function process(ResponseHelper $responseHelper) { $this->component->getPermissions()->haltIfNotAllowed('adjust-columns'); $selections = $this->request->getPost('visible_columns'); $applyToAllUsers = (bool) $this->request->getPost('apply_to_all_users', false); if (is_array($selections)) { /* @var $filter VisibilityFilter */ $filter = $this->component->getVisibilityFilter(); $filter->save($this->component->getFields(), $selections, $applyToAllUsers); } $responseHelper->redirectToAdminPage('index'); }
/** * Perform the actual tests using a ListingSortTest object and pass the * results to our view for rendering. */ public function render() { $this->component->getPermissions()->haltIfNotAllowed('debug'); $tester = new ListingSortTest($this->component->getFields(), $this->component->getListing()); $reflection = new ReflectionClass($this->component); $this->view->namespace = $reflection->getNamespaceName(); $this->view->component = $this->component; $this->view->results = $tester->run(); $this->view->displayFields = new Fields(); $this->view->componentFields = $this->component->getFields(); return $this->renderView(); }
/** * 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(); }
public function render() { $this->component->getPermissions()->haltIfNotAllowed('create'); $renderer = $this->view->editControlRenderer(); $rowEditor = $this->component->getRowEditor(); $field = $this->component->getFields()->get($this->request->getQuery('field')); $value = $this->request->getQuery('value'); $rowEditor->link(); if ($field instanceof ManyToManyField) { $field->setValue([$value]); } else { $field->setValue($value); } $this->component->setShouldRenderLayout(false); return $renderer->getControlRenderer()->render($field, 0); }
public function getFields() { if (!$this->fields) { $this->fields = $this->component->getFields(); } return $this->fields; }
/** * 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(); }
/** * 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(); }
/** * 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(); }
protected function getFields() { return $this->component->getFields($this->component->getFieldGroupsFilter()); }
/** * Pass some dependencies into the View. */ public function render() { $this->view->assign(['fieldGroups' => $this->filter->getConfigForFields($this->component->getFields()), 'component' => $this->component, 'fields' => $this->component->getFields()]); return $this->renderView(); }