Example #1
0
 /**
  * Logs in a user using the provided username and password.
  * @return boolean whether the user is logged in successfully
  */
 public function login()
 {
     if ($this->validate()) {
         $person = Person::findOne(['user_id' => $this->getUser()->id]);
         Status::login($person);
         return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
     }
     return false;
 }
Example #2
0
    <?php 
echo $form->field($model, 'task_start')->widget(\yii\jui\DatePicker::className(), ['options' => ['class' => 'form-control', 'readonly' => 'readonly'], 'dateFormat' => 'dd MMMM yyyy', 'clientOptions' => ['minDate' => 0, 'changeMonth' => true, 'changeYear' => true]]);
?>

<?php 
echo $form->field($model, 'task_end')->widget(\yii\jui\DatePicker::className(), ['options' => ['class' => 'form-control', 'readonly' => 'readonly'], 'dateFormat' => 'dd MMMM yyyy', 'clientOptions' => ['minDate' => 0, 'changeMonth' => true, 'changeYear' => true]]);
?>
   <?php 
echo $form->field($model, 'status')->dropDownList(Status::getTaskStatusList(), ['prompt' => 'Pilih']);
?>



    <?php 
echo $form->field($model, 'period')->dropDownList(Status::getPeriodList(), ['prompt' => 'Pilih']);
?>

   </div>

   <div class="col-lg-12">
    <div class="form-group">
      <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', '<i class="fa fa-save"></i> Simpan') : Yii::t('app', '<i class="fa fa-edit"></i> Update'), ['class' => $model->isNewRecord ? 'btn btn-lg btn-success' : 'btn btn-lg btn-primary']);
?>
      <?php 
echo Html::resetButton('<i class="fa fa-refresh"></i> ' . Yii::t('app', 'Batal'), ['class' => 'btn btn-lg btn-default']);
?>
      <?php 
echo Html::a('<i class="fa fa-arrow-left"></i> ' . Yii::t('app', 'Kembali'), ['index'], ['class' => 'btn btn-lg btn-warning']);
?>
Example #3
0
}, 'update' => function ($url, $model) {
    // jika tugas dari sama dengan user yang sedang login
    // maka tampilkan icon update
    if ($model->task_from === Yii::$app->user->getId()) {
        return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update')]);
    }
}]]]]);
Panel::end();
?>

<?php 
Modal::begin(['header' => 'Ubah Status Tugas', 'id' => 'modal-ubah-status-tugas', 'clientOptions' => ['backdrop' => false]]);
$colorList = Status::getTaskColorList();
echo '<div style="margin:0 auto" class="text-center">';
foreach ($colorList as $key => $val) {
    echo Html::a(Status::getTaskStatus($key), '#', ['class' => 'btn ' . $val . ' btn-md task-status', 'data-status' => $key]) . '&nbsp;';
}
echo '</div>';
Modal::end();
?>

<?php 
$this->registerJs('$(document).ready(function(){

    var id_status = "";

    $("body").on("click", ".modal-status", function(e){
        e.preventDefault();
        id_status = $(this).data("id");

        $("#modal-ubah-status-tugas").modal("show");
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['label' => 'Isi Tugas', 'value' => 'task_detail', 'format' => 'html', 'attribute' => 'task_detail', 'headerOptions' => ['class' => 'text-center']], ['label' => 'Tanggal Mulai', 'value' => function ($data) {
    $keterangan = date('d F Y', strtotime($data->task_start));
    return $keterangan;
}, 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['label' => 'Tanggal Selesai', 'value' => function ($data) {
    $keterangan = date('d F Y', strtotime($data->task_end));
    return $keterangan;
}, 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Lampiran', 'template' => '{download}', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'buttons' => ['download' => function ($url, $model) {
    if (!empty($model->attachment)) {
        return Html::a('<i class="fa fa-download fa-2x"></i>', Url::to(['download', 'id' => $model->id]), ['title' => 'Download Lampiran']);
    }
    return '-';
}]], ['value' => function ($model) {
    return Status::getPeriod($model->period);
}, 'attribute' => 'period', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'header' => 'Periode'], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Status Tugas', 'template' => '{update}', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'buttons' => ['update' => function ($url, $model) {
    $taskStatus = Status::getTaskStatus($model->status);
    $taskColor = Status::getTaskColor($model->status);
    return Html::a($taskStatus, '#', ['title' => Yii::t('app', 'Status Tugas'), 'data-id' => $model->id, 'class' => 'btn ' . $taskColor . ' btn-md modal-status']);
}]], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'buttons' => ['delete' => function ($url, $model) {
    $url = ['task/reply-delete', 'id' => $model->id];
    if ($model->task_to === Yii::$app->user->getId()) {
        return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Apakah anda yakin data tugas ini akan dihapus?')]);
    }
}, 'update' => function ($url, $model) {
    $url = ['task/reply-update', 'id' => $model->id];
    if ($model->task_to === Yii::$app->user->getId()) {
        return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update')]);
    }
}]]]]);
?>
</div>
Example #5
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ListView;
use yii\widgets\DetailView;
use app\components\Status;
use app\components\Panel;
/* @var $this yii\web\View */
/* @var $model app\models\Task */
$this->title = 'Detil Tugas : ' . $model->task_title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Tasks'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Panel::begin(['title' => $this->title, 'icon' => 'fa fa-file-text-o']);
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => [['label' => 'Judul Tugas', 'value' => $model->task_title], ['label' => 'Tanggal Mulai & Selesai Tugas', 'value' => date('d F Y', strtotime($model->task_start)) . ' s.d ' . date('d F Y', strtotime($model->task_end))], ['label' => 'Lampiran', 'value' => call_user_func(function ($model) {
    if (!empty($model->attachment)) {
        return Html::a('<i class="fa fa-download fa-2x"></i>', Url::to(['download', 'id' => $model->id]), ['title' => 'Download Lampiran']);
    }
}, $model), 'format' => 'html'], ['label' => 'Status Tugas', 'value' => Status::getTaskStatus($model->status)], ['label' => 'Periode Tugas', 'value' => Status::getPeriod($model->period)], ['label' => 'Detil Tugas', 'value' => $model->task_detail, 'format' => 'html']]]);
?>
     <?php 
echo Html::a('<i class="fa fa-arrow-left"></i> ' . Yii::t('app', 'Kembali'), ['index'], ['class' => 'btn btn-lg btn-warning']);
?>

<?php 
Panel::end();
Example #6
0
use app\components\Panel;
use kartik\alert\AlertBlock;
use yii\helpers\ArrayHelper;
use app\modules\user\models\AuthItem;
use app\modules\user\models\AuthRule;
use app\components\Status;
/* @var $this yii\web\View */
/* @var $searchModel app\models\PersonSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Manajemen Karyawan');
$this->params['breadcrumbs'][] = $this->title;
?>


<?php 
Panel::begin(['title' => $this->title, 'icon' => 'fa fa-file-text-o']);
echo AlertBlock::widget(['type' => AlertBlock::TYPE_ALERT, 'useSessionFlash' => true]);
?>
    <p>
        <?php 
echo Html::a('<i class="fa fa-plus"></i> ' . Yii::t('app', 'Tambah Data Karyawan'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>
<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['attribute' => 'full_name', 'value' => 'full_name', 'headerOptions' => ['class' => 'text-center']], ['value' => function ($model) {
    return Status::getGender($model->gender);
}, 'attribute' => 'gender', 'contentOptions' => ['class' => 'text-center'], 'filter' => Status::getGenderList(), 'headerOptions' => ['class' => 'text-center']], ['value' => 'user.assignment.itemName.name', 'attribute' => 'jabatan', 'filter' => ArrayHelper::map(AuthItem::find()->asArray()->all(), 'name', 'name'), 'headerOptions' => ['class' => 'text-center']], ['value' => 'user.assignment.itemName.rule_name', 'attribute' => 'divisi', 'filter' => ArrayHelper::map(AuthRule::find()->asArray()->all(), 'name', 'name'), 'headerOptions' => ['class' => 'text-center']], ['value' => 'user.email', 'attribute' => 'email', 'headerOptions' => ['class' => 'text-center']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['class' => 'text-center']]]]);
?>

<?php 
Panel::end();