function remove() { $response = $this->get_response(); $accounts = $response->html->request()->get($this->identifier_name); $form = $response->form; if ($accounts !== '') { require_once $this->openqrm->get('basedir') . '/plugins/hybrid-cloud/web/class/hybrid-cloud.class.php'; $resource = new hybrid_cloud(); $submit = $form->get_elements('submit'); $submit->handler = 'onclick="wait();"'; $form->add($submit, 'submit'); $submit = $form->get_elements('cancel'); $submit->handler = 'onclick="cancel();"'; $form->add($submit, 'cancel'); $i = 0; foreach ($accounts as $id) { $name = $resource->get_name($id); $d['param_f' . $i]['label'] = $name; $d['param_f' . $i]['object']['type'] = 'htmlobject_input'; $d['param_f' . $i]['object']['attrib']['type'] = 'checkbox'; $d['param_f' . $i]['object']['attrib']['name'] = $this->identifier_name . '[' . $i . ']'; $d['param_f' . $i]['object']['attrib']['value'] = $id; $d['param_f' . $i]['object']['attrib']['checked'] = true; $i++; } $form->add($d); if (!$form->get_errors() && $response->submit()) { $hc = new hybrid_cloud(); $errors = array(); $message = array(); foreach ($accounts as $id) { $hc->get_instance_by_id($id); $hc->remove($id); $form->remove($this->identifier_name . '[' . $id . ']'); $message[] = sprintf($this->lang['msg_removed'], $hc->account_name); } if (count($errors) === 0) { $response->msg = join('<br>', $message); } else { $msg = array_merge($errors, $message); $response->error = join('<br>', $msg); } } } else { $response->msg = ''; } return $response; }