/** * {@inheritdoc} */ public function editView($fields = array()) { self::$logger->debug('>>editView(fields=[' . var_export($fields, true) . '])'); $config = ConfigProvider::getInstance(); // the form ID $fields['formID'] = stripslashes(get_class($this->BO) . '_' . $this->BO->getOID()); // buffer form fields to $formFields $fields['formFields'] = $this->renderAllFields('edit'); // buffer HTML output for Create and Cancel buttons $button = new Button('submit', 'Save', 'saveBut'); $fields['saveButton'] = $button->render(); $js = "if(window.jQuery) {\n BootstrapDialog.show({\n title: 'Confirmation',\n message: 'Are you sure you wish to delete this item?',\n buttons: [\n {\n icon: 'glyphicon glyphicon-remove',\n label: 'Cancel',\n cssClass: 'btn btn-default btn-xs',\n action: function(dialogItself){\n dialogItself.close();\n }\n },\n {\n icon: 'glyphicon glyphicon-ok',\n label: 'Okay',\n cssClass: 'btn btn-default btn-xs',\n action: function(dialogItself) {\n \$('[id=\"" . ($config->get('security.encrypt.http.fieldnames') ? base64_encode(SecurityUtils::encrypt('ActiveRecordOID')) : 'ActiveRecordOID') . "\"]').attr('value', '" . $this->BO->getOID() . "');\n \$('#deleteForm').submit();\n dialogItself.close();\n }\n }\n ]\n });\n }"; $button = new Button($js, 'Delete', 'deleteBut'); $fields['deleteButton'] = $button->render(); $viewState = ViewState::getInstance(); $start = $viewState->get('selectedStart'); if (isset($fields['cancelButtonURL'])) { $button = new Button("document.location = '" . $fields['cancelButtonURL'] . "'", 'Back to List', 'cancelBut'); } else { $button = new Button("document.location = '" . FrontController::generateSecureURL('act=Alpha\\Controller\\ActiveRecordController&ActiveRecordType=' . get_class($this->BO) . '&start=' . $start . '&limit=' . $config->get('app.list.page.amount')) . "'", 'Back to List', 'cancelBut'); } $fields['cancelButton'] = $button->render(); // buffer security fields to $formSecurityFields variable $fields['formSecurityFields'] = self::renderSecurityFields(); // OID will need to be posted for optimistic lock checking $fields['version_num'] = $this->BO->getVersionNumber(); self::$logger->debug('<<editView [HTML]'); return View::loadTemplate($this->BO, 'edit', $fields); }