Esempio n. 1
0
 public function actionIndex2()
 {
     $searchModel = new SubjectSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $subjectId = Yii::$app->request->post('editableKey');
         $subject = Subject::findOne($subjectId);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Subject']);
         $post['Subject'] = $posted;
         if ($subject->load($post)) {
             if ($subject->subject_approval_status == 'Approved') {
                 $subject->subject_approved_by = Yii::$app->user->identity->username;
             } else {
                 $subject->subject_approved_by = null;
             }
             // $grade = Subject::findOne($subject->subject_id);
             // $grade->takenStatus = $subject->subject_taken_status;
             // $grade->save();
             $subject->save();
         }
         echo $out;
         return;
     }
     return $this->render('index2', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Esempio n. 2
0
 public function actionIndex2()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model = new Subject();
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model->scholar_scholar_id = $scholar->scholar_id;
                 $model->scholar_school_school_id = $scholar->school_school_id;
                 $searchModel = new SubjectSearch($model);
                 $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
                 return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             }
         }
     }
 }
Esempio n. 3
0
?>
<div class="scholar-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

<?php 
$exportedValues = [['class' => 'kartik\\grid\\ExpandRowColumn', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    $searchModel = new SubjectSearch();
    $searchModel->scholar_scholar_id = $model->scholar_id;
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
    return Yii::$app->controller->renderPartial('_dropdown', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
}], 'scholar_id', ['attribute' => 'scholar_first_name'], ['attribute' => 'scholar_middle_name'], ['attribute' => 'scholar_last_name'], ['class' => 'kartik\\grid\\ActionColumn']];
$export = ExportMenu::widget(['dataProvider' => $dataProvider, 'columns' => $exportedValues, 'noExportColumns' => [18], 'columnSelectorOptions' => ['label' => 'Columns', 'class' => 'btn btn-danger'], 'target' => '_blank', 'fontAwesome' => true, 'dropdownOptions' => ['label' => 'Export', 'class' => 'btn btn-success']]);
echo Html::a('Group By Scholar', ['index'], ['class' => 'btn btn-success']);
echo Html::a('Show Only Subject Records', ['index2'], ['class' => 'btn btn-success']);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model) {
    if (strcasecmp($model->allowance_allowance_area, 'NCR') != 0) {
        return ['class' => 'provincial-row'];
    } else {
        if (strcasecmp($model->allowance_allowance_area, 'NCR') == 0) {
            return ['class' => 'ncr-row'];