/** * Export action method * * @param int $tid * @return void */ public function export($tid) { $entities = new Model\Entity(['tid' => $tid]); $type = new Model\EntityType(); $type->getById($tid); if (!isset($type->id)) { $this->redirect(BASE_PATH . APP_URI . '/entities'); } if ($this->services['acl']->isAllowed($this->sess->user->role, 'entity-type-' . $type->id, 'export')) { $rows = $entities->getAllForExport($tid); $data = new Data($rows); $data->serialize('csv', ['omit' => 'type_id']); $data->outputToHttp($type->name . '_' . date('Y-m-d') . '.csv'); } else { $this->redirect(BASE_PATH . APP_URI . '/entities/' . $tid); } }
/** * Remove action method * * @return void */ public function remove() { if ($this->request->isPost()) { $type = new Model\EntityType(); $type->remove($this->request->getPost()); } $this->sess->setRequestValue('removed', true); $this->redirect(BASE_PATH . APP_URI . '/entities/types'); }