public function action() { $checked = @array_keys($_POST['items']); if (is_array($checked) and !empty($checked)) { switch ($_POST['with-selected']) { case 'rebuild': foreach ($checked as $handle) { ElasticSearch::getIndex()->getType($handle)->delete(); ElasticSearch::createType($handle); redirect("{$this->uri}/mappings/"); } break; case 'delete': foreach ($checked as $handle) { $type = ElasticSearch::getIndex()->getType($handle); $type->delete(); } redirect("{$this->uri}/mappings/"); break; case 'reindex': $this->reindex = $checked; break; } } }