public function actionUpdate($id) { $model = $this->loadModel($id); $file = new File(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); $model->date_registration = Tools::DateTimeToShow($model->date_registration, '/', false); if (isset($_POST['Car']) && isset($_POST['File'])) { $model->attributes = $_POST['Car']; $file->attributes = $_POST['File']; $model->date_registration = Tools::dateToSave($model->date_registration); $file->file = CUploadedFile::getInstance($file, 'file'); if ($file->file != null) { if (file_exists(Yii::app()->params['pathUpload'] . $model->pic) && $model->pic != 'noimage.jpg') { unlink(Yii::app()->params['pathUpload'] . $model->pic); } if ($file->file != null) { $filename = time() . '.' . $file->file->getExtensionName(); $file->file->saveAs(Yii::app()->params['pathUpload'] . $filename); $model->pic = $filename; } } if ($model->save()) { $this->redirect(array('view', 'id' => $model->car_id)); } } $this->render('update', array('model' => $model, 'file' => $file)); }
public function actionUpdate($id) { $model = $this->loadModel($id); if ($model->status != 1) { throw new CHttpException(404, 'ไม่สามารถแก้ไขคำรองได้ เนื่องจากคำร้องได้ผ่านการรับเรื่องแล้ว กรุณาตรวจสอบ'); } $model->departure_time = Tools::DateTimeToShow($model->departure_time, '/', false); $model->back_time = Tools::DateTimeToShow($model->back_time, '/', false); $file = new FileOther(); // $startOld = $model->departure_time; // $endOld = $model->back_time; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['PaperApproval']) && isset($_POST['FileOther'])) { $model->attributes = $_POST['PaperApproval']; $file->attributes = $_POST['FileOther']; $file->file = CUploadedFile::getInstance($file, 'file'); $model->validate(); $file->validate(); if ($model->getErrors() == null && $file->getErrors() == null) { $model->departure_time = Tools::dateToSave($model->departure_time); $model->back_time = Tools::dateToSave($model->back_time); if ($file->file != null) { if ($model->file != null) { if (file_exists(Yii::app()->params['pathUpload'] . $model->file)) { unlink(Yii::app()->params['pathUpload'] . $model->file); } } if ($file->file != null) { $filename = time() . '.' . $file->file->getExtensionName(); $file->file->saveAs(Yii::app()->params['pathUpload'] . $filename); $model->file = $filename; } } if ($model->save()) { $this->redirect(array('view', 'id' => $model->paper_approval_id)); } } } $this->render('update', array('model' => $model, 'file' => $file)); }
"> เพิ่มเติม </a>. </p> <small> <cite title="<?php echo $data->personnel->name; ?> "> <span style="font-weight: bold;"><i>ผู้เขียน</i> : </span> <?php echo $data->personnel->name; ?> <span style="font-size: 80%;"><i style="color: #ed9c28;"><?php echo Tools::DateTimeToShow($data->update_at, '/', true); ?> </i></span> </cite> </small> </blockquote> </div> <div style="display: none; "> <div id="data_<?php echo $data->news_id; ?> " style=" width: 720px;"> <div style="text-align: center;"> <?php echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, ''); ?>
<div style="width: 30%; float:left;"> <abbr>ตั้งแต่วันที่</abbr><abbr class="left-padding"><?php echo Tools::DateTimeToShow($model->date_start, '/', false); ?> </abbr> </div> <div style="width: 70%; float:left;"> <abbr class="padding-sub">เวลาออกเดินทาง</abbr> <abbr class="left-padding"><?php echo date('H : i', strtotime($model->time_start)); ?> </abbr><span class="left-padding-1">น.</span> </div> <div style="width: 30%; float:left;"> <abbr>กลับถึงวันที่</abbr><abbr class="left-padding"><?php echo Tools::DateTimeToShow($model->date_end, '/', false); ?> </abbr> </div> <br /> <abbr class="padding-sub">5. ข้าพเจ้ายินดีรับผิดชอบใช้จ่าย เพื่อเป็นการสนับสนุนกิจการของมหาวิทยาลัย ภายใน 7 วัน หลังจากเดินทางกลับ ตามรายละเอียด ดังนี้</abbr> <br /> <div style="width: 70%; float:left;"> <abbr class="padding-sub-1">5.1 ค่าบริการ</abbr> </div> <div style="width: 30%; float:left;"> <abbr>จำนวนเงิน</abbr><abbr class="left-padding"> <?php $total = 0; echo number_format($total += $model->days * $model->service_charge_in + $model->days * $model->service_charge_out); ?>
<li class="extra"> <?php echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 100px;')); ?> <p> <strong><?php echo $data->name; ?> </strong> <label><?php echo $data->tel; ?> </label> <b><a href="#show_detail_<?php echo $data->personnel_id; ?> " rel='facebox'>Read More</a></b> </p> <div id="show_detail_<?php echo $data->personnel_id; ?> " style='display: none;'> <?php echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 600px;')); $model = Personnel::model()->findByPk($data->personnel_id); $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('name', 'position.name', 'tel', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, "/", false))))); ?> </div> </li>
<?php $this->breadcrumbs = array($this->nameController => array('admin'), $model->name); $this->menu = array(array('label' => $this->labelController['Create'] . $this->nameController, 'url' => array('create'), 'icon' => 'fa-plus'), array('label' => $this->labelController['Update'] . $this->nameController, 'url' => array('update', 'id' => $model->personnel_id), 'icon' => 'fa-pencil'), array('label' => $this->labelController['Manage'] . $this->nameController, 'url' => array('admin'), 'icon' => 'fa-cog')); ?> <div class="col-lg-offset-2 col-lg-8"> <h2><?php echo $this->labelController['View'] . $this->nameController; ?> # <?php echo $model->name; ?> </h2> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('type' => 'raw', 'name' => 'pic', 'value' => CHtml::image(Yii::app()->params['pathUploadToShow'] . $model->pic, '', array('style' => 'width: 430px; text-align: center;'))), 'username', 'name', 'position.name', 'tel', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, "/", false))))); ?> </div>
<?php $this->breadcrumbs = array($this->nameController => array('admin'), $model->paper_no); $this->menu = array(array('label' => 'ส่งคำขอใช้รถยนต์ปรับอากาศ', 'url' => array('create', 'type_car_id' => 1), 'icon' => 'fa-plus'), array('label' => $this->labelController['Update'] . $this->nameController, 'url' => array('update', 'id' => $model->paper_approval_bus_id), 'icon' => 'fa-pencil'), array('label' => $this->labelController['Manage'] . $this->nameController, 'url' => array('admin'), 'icon' => 'fa-cog')); ?> <div class="col-lg-offset-2 col-lg-8"> <h2><?php echo $this->labelController['View'] . $this->nameController; ?> # <?php echo $model->paper_no; ?> </h2> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('member.name', 'paper_no', 'from_place', 'to_place', 'manager', 'place.name', 'days', array('name' => 'date_start', 'value' => Tools::DateTimeToShow($model->date_start, '/', false)), array('name' => 'date_end', 'value' => Tools::DateTimeToShow($model->date_end, '/', false)), array('name' => 'time_start', 'value' => date('h : i a', strtotime($model->time_start))), array('name' => 'service_charge_in', 'value' => number_format($model->service_charge_in * $model->days)), array('name' => 'service_charge_out', 'value' => number_format($model->service_charge_out * $model->days)), array('name' => 'service_charge_cleaning', 'value' => number_format($model->service_charge_cleaning * $model->days)), array('name' => 'allowances_driver', 'value' => number_format($model->allowances_driver * $model->days)), array('name' => 'allowances_employees', 'value' => number_format($model->allowances_employees * $model->days)), array('name' => 'service_room', 'value' => number_format($model->service_room * $model->days)), array('name' => 'service_room_multi', 'value' => number_format($model->service_room_multi * $model->days)), array('name' => 'status', 'value' => Status::$paper[$model->status] . ($model->accept3 != null ? ' (' . $model->accept3->personnel->name . ')' : '')), array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', true))))); $acceptDetail = array(); $acceptModel = $model->paperDetailBusAccept; if ($acceptModel != null) { ?> <h3>รายละเอียดรถบัสปรับอากาศ</h3> <?php $acceptDetail = array(array('name' => 'car.personnel_id', 'value' => $acceptModel->car->personnel->name), 'car.license_no', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($acceptModel->create_at, '/', true))); $this->widget('zii.widgets.CDetailView', array('data' => $acceptModel, 'attributes' => $acceptDetail)); } ?> </div>
</label> <div class="col-lg-4"> <?php echo $model->paperDetailAccept->car->license_no; ?> </div> </div> <div class="form-group"> <label class="col-lg-2 text-muted"> <?php echo $model->getAttributeLabel('paperDetailAccept.create_at'); ?> </label> <div class="col-lg-4"> <?php echo Tools::DateTimeToShow($model->paperDetailAccept->create_at, '/', true); ?> </div> <label class="col-lg-2 text-muted"> <?php echo $model->getAttributeLabel('paperDetailAccept.member.name'); ?> </label> <div class="col-lg-4"> <?php echo $model->paperDetailAccept->member->name; ?> </div> </div> <?php }
$html .= '<tr>'; $html .= '<th>ลำดับ</th>'; $html .= '<th>วันที่ยื่นคำร้อง</th>'; $html .= '<th>เลขที่เอกสาร</th>'; $html .= '<th>ไปราชการที่</th>'; $html .= '<th>ผู้รับผิดชอบ</th>'; $html .= '<th>ทะเบียนรถ</th>'; $html .= '<th>ผลการพิจารณา</th>'; $html .= '</tr>'; $html .= '</thead>'; $html .= '<tbody>'; $n = 1; foreach ($model as $m) { $html .= '<tr>'; $html .= '<td>' . $n . '</td>'; $html .= '<td>' . Tools::DateTimeToShow($m->create_at, "/", true) . '</td>'; $html .= '<td>' . $m->paper_no . '</td>'; $html .= '<td>' . $m->go . '</td>'; $html .= '<td>' . $m->member->name . '</td>'; if ($m->paperDetailAccept != null) { $html .= '<td>' . $m->paperDetailAccept->car->license_no . '</td>'; } else { $html .= '<td>-</td>'; } $html .= '<td>' . Status::$paper[$m->status] . '</td>'; $html .= '</tr>'; $n++; } $html .= '</tbody>'; $html .= '</table>'; //echo $html;
?> </td> <td height="0" colspan="2" class="txtGraySmall"><?php echo Tools::DateTimeToShow($model->departure_time, '/', false); ?> </td> <td height="13" class="txtGraySmall"> </td> </tr> <tr> <td height="25"> </td> <td height="25" class="txtBlackBold"><?php echo $model->getAttributeLabel('back_time'); ?> </td> <td height="25" colspan="2" class="txtGraySmall"><?php echo Tools::DateTimeToShow($model->back_time, '/', false); ?> </td> <td height="25" class="txtGraySmall"> </td> </tr> </table> <?php $this->widget('ext.EChosen.EChosen', array('target' => 'select')); if ($model->status == 1) { ?> <script type = "text/javascript" > $(document).ready(function() { $('[id^=ConditionAccept_condition_]').change(function() { // if($('[id^=ConditionAccept_condition_]').val() == 0){ if ($('#ConditionAccept_condition_0').is(':checked')) { $('#no_accept').hide();
<?php $this->breadcrumbs = array($this->nameController => array('admin'), $model->repair_id); $this->menu = array(array('label' => $this->labelController['Create'] . $this->nameController, 'url' => array('create'), 'icon' => 'fa-plus'), array('label' => $this->labelController['Update'] . $this->nameController, 'url' => array('update', 'id' => $model->repair_id), 'icon' => 'fa-pencil'), array('label' => $this->labelController['Manage'] . $this->nameController, 'url' => array('admin'), 'icon' => 'fa-cog')); ?> <div class="col-lg-8 col-lg-offset-2"> <h2><?php echo $this->labelController['View'] . $this->nameController; ?> # <?php echo $model->repair_id; ?> </h2> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('car.license_no', 'personnel.name', array('name' => 'amount', 'value' => number_format($model->amount)), array('type' => 'raw', 'name' => 'file', 'value' => CHtml::link($model->file, "/" . Yii::app()->params['pathUpload'] . $model->file, array('target' => '_bank'))), array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', true)), array('name' => 'update_at', 'value' => Tools::DateTimeToShow($model->update_at, '/', true))))); ?> </div>
<?php $this->breadcrumbs = array($this->nameController => array('admin'), $model->subject); $this->menu = array(array('label' => $this->labelController['Create'] . $this->nameController, 'url' => array('creates'), 'icon' => 'fa-plus'), array('label' => $this->labelController['Update'] . $this->nameController, 'url' => array('update', 'id' => $model->news_id), 'icon' => 'fa-pencil'), array('label' => $this->labelController['Manage'] . $this->nameController, 'url' => array('admin'), 'icon' => 'fa-cog')); ?> <div class="col-lg-offset-2 col-lg-8"> <h2><?php echo $this->labelController['View'] . $this->nameController; ?> # <?php echo $model->subject; ?> </h2> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('subject', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', true)), array('name' => 'update_at', 'value' => Tools::DateTimeToShow($model->update_at, '/', true)), 'description', array('type' => 'raw', 'name' => 'pic', 'value' => CHtml::image(Yii::app()->params['pathUpload'] . $model->pic, '', array('style' => 'width: 430px;')))))); ?> </div>
<h3><?php echo $data->subject; ?> </h3> <p> <?php echo Tools::subText($data->description, 100); ?> <a href="#show_detail_<?php echo $data->news_id; ?> " rel='facebox'>Read More</a> </p> </div> </div> <div id='show_detail_<?php echo $data->news_id; ?> ' style="display: none;"> <h2 style="font-style: italic;"><?php echo $data->subject; ?> </h2> <hr /> <?php echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 700px;')); $model = News::model()->findByPk($data->news_id); $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('description', array('name' => 'member_id', 'value' => $model->member->name), array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', true)), array('name' => 'update_at', 'value' => Tools::DateTimeToShow($model->update_at, '/', true))))); ?> </div>
<li class="extra"> <?php echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 100px;')); ?> <p> <strong><?php echo '[' . $data->license_no . ']' . $data->brand->name; ?> </strong> <b><a href="#show_detail_<?php echo $data->car_id; ?> " rel='facebox'>Read More</a></b> </p> </li> <div id="show_detail_<?php echo $data->car_id; ?> " style='display: none;'> <?php echo CHtml::image(Yii::app()->params['pathUpload'] . $data->pic, '', array('style' => 'width: 600px;')); $model = Car::model()->findByPk($data->car_id); $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('license_no', array('name' => 'date_registration', 'value' => Tools::DateTimeToShow($model->create_at, '/', false)), 'brand.name', 'engine_no', 'personnel.name', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', false))))); ?> </div>
public function actionUpdate($id) { $model = $this->loadModel($id); if ($model->status != 0) { throw new CHttpException(404, 'ไม่สามารถแก้ไขคำรองได้ เนื่องจากคำร้องได้ผ่านการรับเรื่องแล้ว กรุณาตรวจสอบ'); } $model->date_start = Tools::DateTimeToShow($model->date_start, '/', false); $model->date_end = Tools::DateTimeToShow($model->date_end, '/', false); $service_radio = 0; if ($model->service_charge_out > 0) { $service_radio = 1; } $service_room = 0; if ($model->service_room_multi > 0) { $service_room = 1; } $file = new FileOther(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['PaperApprovalBus']) && isset($_POST['FileOther'])) { $model->attributes = $_POST['PaperApprovalBus']; $file->attributes = $_POST['FileOther']; $service_radio = 0; if (isset($_POST['service-radio'])) { $service_radio = $_POST['service-radio']; } $service_room = 0; if (isset($_POST['service_room-radio'])) { $service_room = $_POST['service_room-radio']; } $file->file = CUploadedFile::getInstance($file, 'file'); if ($service_radio == 0) { $model->service_charge_out = 0; } if ($service_radio == 1) { $model->service_charge_in = 0; } if ($service_room == 0) { $model->service_room_multi = 0; } if ($service_room == 1) { $model->service_room = 0; } $model->validate(); $file->validate(); if ($model->getErrors() == null && $file->getErrors() == null) { $model->date_start = Tools::dateToSave($model->date_start); $model->date_end = Tools::dateToSave($model->date_end); if ($file->file != null) { if ($model->file != null) { if (file_exists(Yii::app()->params['pathUpload'] . $model->file)) { unlink(Yii::app()->params['pathUpload'] . $model->file); } } if ($file->file != null) { $filename = time() . '.' . $file->file->getExtensionName(); $file->file->saveAs(Yii::app()->params['pathUpload'] . $filename); $model->file = $filename; } } if ($model->save()) { $this->redirect(array('view', 'id' => $model->paper_approval_bus_id)); } } } $this->render('update', array('model' => $model, 'file' => $file, 'service_radio' => $service_radio, 'service_room' => $service_room)); }
<?php $this->breadcrumbs = array($this->nameController => array('admin'), $model->car_no); $this->menu = array(array('label' => $this->labelController['Create'] . $this->nameController, 'url' => array('create'), 'icon' => 'fa-plus'), array('label' => $this->labelController['Update'] . $this->nameController, 'url' => array('update', 'id' => $model->car_id), 'icon' => 'fa-pencil'), array('label' => $this->labelController['Manage'] . $this->nameController, 'url' => array('admin'), 'icon' => 'fa-cog')); ?> <div class="col-lg-offset-2 col-lg-8"> <h2><?php echo $this->labelController['View'] . $this->nameController; ?> # <?php echo $model->car_no; ?> </h2> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('type' => 'raw', 'name' => 'pic', 'value' => CHtml::image(Yii::app()->params['pathUploadToShow'] . $model->pic, '', array('style' => 'width: 430px; text-align: center;'))), 'license_no', array('name' => 'date_registration', 'value' => Tools::DateTimeToShow($model->date_registration, '/', false)), 'typeCar.name', 'brand.name', 'engine_no', 'personnel.name', array('name' => 'create_at', 'value' => Tools::DateTimeToShow($model->create_at, '/', false))))); ?> </div>