コード例 #1
0
ファイル: trainings.php プロジェクト: qhyabdoel/hris_mujigae
<?php

if ($isform) {
    ?>
<div class="row">
	<a href="#training_id#create#0" class="btn btn-primary"><?php 
    echo at('Add Training');
    ?>
</a>
</div>
<?php 
}
?>

<?php 
$this->widget('DTGridView', array('id' => 'masters-employee-trainings-grid', 'itemsCssClass' => 'table datatable', 'dataProvider' => MastersEmployeeHistoryTrainings::model()->searchByEmployee($model->id), 'columns' => array(array('name' => 'id', 'header' => '#', 'htmlOptions' => array('style' => 'width:50px;')), array('name' => 'topic', 'header' => at('Topic')), array('name' => 'certificate_date', 'header' => at('Cert Date')), array('class' => 'CButtonColumn', 'htmlOptions' => array('style' => 'width: 80px'), 'buttons' => array('view' => array('url' => '"#training_id#view#".$data->id'), 'update' => array('url' => '"#training_id#update#".$data->id'), 'delete' => array('url' => 'createUrl("employee/trainings/delete", array("id"=>$data->id))'))))));
?>

<!-- Modal -->
<div class="modal fade" id="trainingsModal" tabindex="-1" role="dialog" aria-labelledby="trainingsModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="trainingsModalLabel">Training</h4>
      </div>
      <div class="modal-body" id="trainingsModalBody">
      <!-- tampilan dari ajax -->
      </div>
    </div>
  </div>
コード例 #2
0
 public function actionAjaxcreate($id)
 {
     $model = new MastersEmployeeHistoryTrainings();
     if ($id != '') {
         $model = MastersEmployeeHistoryTrainings::model()->findByPk($id);
     }
     // print_r($_POST);die();
     $model->employee_id = $_POST['employee_id'];
     $model->type_id = $_POST['type_id'];
     $model->is_internal = $_POST['is_internal'];
     $model->topic = $_POST['topic'];
     $model->trainer_name = $_POST['trainer_name'];
     $model->organizer = $_POST['organizer'];
     $model->training_date = $_POST['training_date'];
     $model->long_trained = $_POST['long_trained'];
     $model->certificate_date = $_POST['certificate_date'];
     $model->certificate_no = $_POST['certificate_no'];
     if ($model->save()) {
         $_POST['success'] = 1;
     } else {
         $_POST['success'] = 0;
     }
     $_POST['id'] = $id;
     $_POST['error_employee_id'] = '';
     $_POST['error_type_id'] = '';
     $_POST['error_is_internal'] = '';
     $_POST['error_topic'] = '';
     $_POST['error_trainer_name'] = '';
     $_POST['error_organizer'] = '';
     $_POST['error_training_date'] = '';
     $_POST['error_long_trained'] = '';
     $_POST['error_certificate_date'] = '';
     $_POST['error_certificate_no'] = '';
     if (isset($model->errors['employee_id'][0])) {
         $_POST['error_employee_id'] = $model->errors['employee_id'][0];
     }
     if (isset($model->errors['type_id'][0])) {
         $_POST['error_type_id'] = $model->errors['type_id'][0];
     }
     if (isset($model->errors['is_internal'][0])) {
         $_POST['error_is_internal'] = $model->errors['is_internal'][0];
     }
     if (isset($model->errors['topic'][0])) {
         $_POST['error_topic'] = $model->errors['topic'][0];
     }
     if (isset($model->errors['trainer_name'][0])) {
         $_POST['error_trainer_name'] = $model->errors['trainer_name'][0];
     }
     if (isset($model->errors['organizer'][0])) {
         $_POST['error_organizer'] = $model->errors['organizer'][0];
     }
     if (isset($model->errors['training_date'][0])) {
         $_POST['error_training_date'] = $model->errors['training_date'][0];
     }
     if (isset($model->errors['long_trained'][0])) {
         $_POST['error_long_trained'] = $model->errors['long_trained'][0];
     }
     if (isset($model->errors['certificate_date'][0])) {
         $_POST['error_certificate_date'] = $model->errors['certificate_date'][0];
     }
     if (isset($model->errors['certificate_no'][0])) {
         $_POST['error_certificate_no'] = $model->errors['certificate_no'][0];
     }
     echo json_encode($_POST);
 }
コード例 #3
0
ファイル: trainings.php プロジェクト: qhyabdoel/hris_mujigae

<?php 
$this->widget('DTGridView', array('id' => 'masters-employee-trainings-grid', 'itemsCssClass' => 'table datatable', 'dataProvider' => MastersEmployeeHistoryTrainings::model()->searchByEmployee($model->id), 'columns' => array(array('name' => 'id', 'header' => '#', 'htmlOptions' => array('style' => 'width:50px;')), array('name' => 'topic', 'header' => at('Topic')), array('name' => 'certificate_date', 'header' => at('Cert Date')))));