/** * Deletes an existing Book model and all related data. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionHarddelete($id) { $modelBook = $this->findModel($id); $modelBookForm = new BookForm($modelBook); if ($modelBookForm->deleteBook()) { Yii::info($id . '_harddelete', 'book'); Yii::$app->session->addFlash('success', Yii::t('app', 'Book was deleted successfully.')); return $this->redirect(['index']); } Yii::$app->session->addFlash('danger', Yii::t('app', 'Book was not deleted.')); return $this->redirect(['view', 'id' => $modelBook->id]); }
?> <?php echo $form->field($modelBook, 'type_id')->dropDownList(BookForm::createArrayMapTranslate(Type::className(), 'id', 'type')); ?> <?php echo $form->field($modelBook, 'status_id')->dropDownList(BookForm::createArrayMapTranslate(Status::className(), 'id', 'status')); ?> <?php echo $form->field($modelBook, 'category_id')->dropDownList(BookForm::createArrayMapTranslate(Category::className(), 'id', 'category_name')); ?> <?php echo $form->field($modelBook, 'library_id')->dropDownList(BookForm::createArrayMap(Library::className(), 'id', 'name')); ?> <?php echo $form->field($modelBook, 'edition')->textInput(); ?> <?php echo $form->field($modelBook, 'year')->widget(yii\widgets\MaskedInput::classname(), ['mask' => '9999']); ?> <div class="form-group"> <label class="control-label" for="book-key-words"><?php echo Yii::t('app', 'Key Words') . ' (' . Yii::t('app', 'Comma separated') . ')'; ?> </label>