Example #1
0
 public function actionBuatArsip()
 {
     if ($this->isInsertAllowed()) {
         $model = new Arsip();
         if ($model->load(Yii::$app->request->post())) {
             $data = Yii::$app->request->post()['Arsip'];
             $model->nama = $data['nama'];
             $model->id_user = $data['id_user'];
             $model->waktu_arsip = date('Y-m-d H:i:s');
             $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
             $model->imageFile = file_get_contents($model->imageFile->tempName);
             $model->save();
             $this->redirect(['surat-arsip/arsip']);
         }
         return $this->render('buat_arsip', ['model' => $model]);
     } else {
         echo "You don't have access here";
         die;
     }
 }
Example #2
0
<?php

use yii\helpers\Html;
use app\models\Arsip;
$dataarsip = new Arsip();
?>

<div class="widget widget-blue">
    <div class="widget-title">
        Arsip
    </div>
    <div class="widget-content">
        <div class="row">
            <div class="col-md-12">
                <table class="table">
                    <tr>
                        <th>Nama Arsip</th>
                        <th>Waktu</th>
                        <th>File</th>
                    </tr>
                    <?php 
foreach ($dataarsip->showalldata() as $item => $value) {
    echo "<tr>";
    echo "<td>" . $value['nama'] . "</td>";
    echo "<td>" . $value['waktu_arsip'] . "</td>";
    echo "<td>" . Html::a("Show", Yii::$app->urlManager->createUrl(["surat-arsip/arsip", "id" => $value["id_arsip"]]), []) . "</td>";
    echo "</tr>";
}
?>
                </table>
            </div>
Example #3
0
<?php

use app\models\Arsip;
$id = Yii::$app->request->get()['id'];
$arsip = new Arsip();
$value = $arsip->showonedata($id);
echo '<td><img src="data:image/jpeg;base64,' . base64_encode($value['imageFile']) . '"/></td>';
Example #4
0
 public function showonedata($id)
 {
     return Arsip::findOne($id);
 }