/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $pelatihan = Pelatihan::find($id); if ($pelatihan->delete()) { return Response::json(array('success' => TRUE)); } }
public function getNamaPelatihanAttribute() { $value = $this->attributes['id_master_pelatihan']; $data = Pelatihan::find($value); if ($data) { return $data->nama_pelatihan; } return '-'; }
echo $form->errorSummary($model); ?> <?php $model->id_pegawai = $id; ?> <?php echo $form->hiddenField($model, 'id_pegawai', array('class' => 'input-block-level')); ?> <div class="row"> <?php echo $form->labelEx($model, 'id_master_pelatihan'); ?> <?php $this->widget('ext.chosen.Chosen', array('name' => 'DataPelatihan[id_master_pelatihan]', 'value' => $model->id_master_pelatihan, 'data' => array('' => 'Semua') + CHtml::listData(Pelatihan::model()->findAll(), 'id_pelatihan', 'nama_pelatihan'))); ?> <?php echo $form->error($model, 'id_master_pelatihan'); ?> </div> <br> <div class="row"> <?php echo $form->labelEx($model, 'uraian'); ?> <?php echo $form->textArea($model, 'uraian', array('rows' => 6, 'cols' => 50, 'class' => 'input-block-level')); ?> <?php
/** * Show the form for creating a new resource. * * @return Response */ public function create() { // $data = array('latihan' => Pelatihan::DropdownPelatihan(), 'lokasi' => LokasiPelatihan::DropdownLokasiPelatihan()); return Response::json($data); }
/** * 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 $id the ID of the model to be loaded * @return Pelatihan the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Pelatihan::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }