コード例 #1
0
 /**
  * The attributes excluded from the model's JSON form.
  *
  * @var array
  */
 public function getNamaHukumanAttribute()
 {
     $name = $this->attributes['id_master_hukuman'];
     $data = Hukuman::find($name);
     if ($data) {
         return $data->nama_hukuman;
     }
     return '-';
 }
コード例 #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //
     $data = array('hukuman' => Hukuman::DropdownHukuman());
     return Response::json($data);
 }
コード例 #3
0
ファイル: _form.php プロジェクト: eoctav/simpeg-yii
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_hukuman');
?>
		<?php 
$this->widget('ext.chosen.Chosen', array('name' => 'DataHukuman[id_master_hukuman]', 'value' => $model->id_master_hukuman, 'data' => array('' => 'Semua') + CHtml::listData(Hukuman::model()->findAll(), 'id_hukuman', 'nama_hukuman')));
?>

		<?php 
echo $form->error($model, 'id_master_hukuman');
?>
	</div>

	<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 
コード例 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $hukuman = Hukuman::find($id);
     if ($hukuman->delete()) {
         return Response::json(array('success' => TRUE));
     }
 }
コード例 #5
0
 /**
  * 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 Hukuman the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Hukuman::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }