/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $ekstra = Ekstra::find($id); if ($ekstra->logo_ekstra) { $fotolama = $ekstra->logo_ekstra; $filepath = public_path() . DIRECTORY_SEPARATOR . 'uploads/ekstra' . DIRECTORY_SEPARATOR . $ekstra->logo_ekstra; try { File::delete($filepath); } catch (FileNotFoundException $e) { } } $ekstra->delete(); return Redirect::back()->with('pesan', "<div class='alert alert-info'>Data Berhasil dihapus</div>"); }
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'tr-ekstra-form', 'type' => 'horizontal', 'enableAjaxValidation' => false, 'focus' => array($model, 'nis'))); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->textFieldRow($model, 'nis', array('class' => 'span5', 'hint' => 'Silahkan tekan tombol <a href="#" onclick=$("#mydialog").dialog("open"); return false; class="btn submit">+</a> untuk melihat daftar siswa.')); ?> <?php $ekstra = CHtml::listData(Ekstra::model()->findAll(array('order' => 'id_ekstra ASC')), 'id_ekstra', 'nama_ekstra'); ?> <?php echo $form->dropDownListRow($model, 'id_ekstra', $ekstra, array('class' => 'span5', 'empty' => '-- Pilih Ekstrakurikuler--')); ?> <?php echo $form->dropDownListRow($model, 'nilai_ekstra', array('A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E'), array('class' => 'span5', 'empty' => '-- Pilih Nilai --')); ?> <?php $bulan = date('m'); if ($bulan < 7) { $smt = 2; //jika th 2(1-6) maka tahun-1/tahun-2 2012/2013 $th_ajar = date('Y') - 1 . '/' . date('Y'); } elseif ($bulan < 13 && $bulan > 6) {
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Ekstra::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }