Пример #1
0
 /**
  * Finds the UserActivity model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserActivity the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DataManagement::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #2
0
		<div class="navbar-custom-menu">

            <ul class="nav navbar-nav">

				<?php 
if (Yii::$app->user->isGuest) {
    ?>
				<li class="">
                    <?php 
    echo Html::a('Log In', ['/login'], ['data-method' => 'post', 'class' => 'btn btn-flat']);
    ?>
                    
                </li>
				<?php 
} else {
    $base = DataManagement::findOne(['nik' => Yii::$app->user->getId()]);
    $user = User::findOne(['id' => Yii::$app->user->getId()]);
    if (!empty($base)) {
        $name = $base->nama;
    } else {
        $name = $user->username;
    }
    ?>
                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <span class="hidden-xs">
                            <?php 
    echo $name;
    ?>
                        </span>
                    </a>
Пример #3
0
$data = BaseUpdatable::find()->select('nik')->where(['no_kk' => $model->id, 'status_keluarga' => 3])->asArray()->all();
$istri = BaseUpdatable::find()->select('nik')->where(['no_kk' => $model->id, 'status_keluarga' => 2])->one()['nik'];
$nik = "";
foreach ($data as $val) {
    if ($nik != "") {
        $nik .= ",";
    }
    $nik .= $val['nik'];
}
if (!empty($nik)) {
    $dataNama = DataManagement::find()->select('nama')->where('nik in (' . $nik . ')')->asArray()->all();
} else {
    $dataNama = [];
}
$namaIstri = DataManagement::findOne($istri)['nama'];
$nama = "";
foreach ($dataNama as $val) {
    if ($nama != "") {
        $nama .= ", ";
    }
    $nama .= $val['nama'];
}
?>
				<?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'kepala_keluarga', 'value' => DataManagement::findOne($model->kepala_keluarga)->nama], 'tanggal_terbit', 'tanggal_pembaruan', ['label' => 'Status', 'value' => $model->status == 1 ? 'Aktif' : 'Tidak Aktif'], ['label' => 'Anak', 'value' => $nama], ['label' => 'Istri', 'value' => $namaIstri]]]);
?>
			</div><!--box footer-->
		</div><!--box-->
    </div>
</div>
Пример #4
0
    private function exportAktivitasUser()
    {
        $isi = UserActivity::find()->orderBy('timestamp desc')->asArray()->all();
        //VarDumper::dump($isi,5678);
        $filename = 'Data_Aktivitas_User-' . Date('YmdGis') . '.xls';
        header("Content-type: application/msexcel");
        header("Content-Disposition: attachment; filename=" . $filename);
        header("Pragma: no-cache");
        header("Expires: 0");
        echo "<style> .str{ mso-number-format:\\@; } </style>";
        echo '<table border="1" width="100%">
			<thead>
				<tr>
					<th>NIK</th>
					<th>Nama</th>
					<th>Aksi</th>
					<th>Timestamp</th>
				</tr>
			</thead>';
        foreach ($isi as $data) {
            $nama = DataManagement::findOne($data['nik'])->nama;
            echo '
			<tr>
				<td>' . $data['nik'] . '</td>
				<td>' . $nama . '</td>
				<td>' . $data['action'] . '</td>
				<td>' . $data['timestamp'] . '</td>
			</tr>
			';
        }
    }