/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = SpoonFilter::getGetValue('action', array('delete'), ''); // form id $formId = SpoonFilter::getGetValue('form_id', null, '', 'int'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('index') . '&error=no-items-selected'); } elseif ($action == '') { $this->redirect(BackendModel::createURLForAction('index') . '&error=no-action-selected'); } elseif (!BackendFormBuilderModel::exists($formId)) { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } else { // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendFormBuilderModel::deleteData($ids); } // define report $report = count($ids) > 1 ? 'items-' : 'item-'; // init var if ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('data') . '&id=' . $formId . '&report=' . $report); } }