Exemple #1
0
 /**
  * Finds the State model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return State the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = State::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #2
0
             $add_co = '';
         }
         echo "<td class='text-center'>" . EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_cadd . " " . $add_c . " " . $add_s . " " . $add_co . "</td>";
     } else {
         echo "<td class='text-center'>&nbsp;</td>";
     }
 } else {
     if ($s == 'emp_padd') {
         if ($sd['emp_master_emp_address_id'] != 0) {
             if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_city)) {
                 $add_c = "<br/>" . City::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_city)->city_name . ", ";
             } else {
                 $add_c = '';
             }
             if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_state)) {
                 $add_s = State::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_state)->state_name . ", ";
             } else {
                 $add_s = '';
             }
             if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_country)) {
                 $add_co = Country::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_country)->country_name;
             } else {
                 $add_co = '';
             }
             echo "<td class='text-center'>" . EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd . " " . $add_c . " " . $add_s . " " . $add_co . "</td>";
         } else {
             echo "<td>&nbsp;</td>";
         }
     } else {
         if ($s == 'emp_joining_date') {
             $jdate = EmpInfo::findOne($sd['emp_master_emp_info_id'])->{$s};
Exemple #3
0
    <?php 
$state_id = Yii::$app->user->identity->state_id;
$columns[] = ['class' => 'yii\\grid\\SerialColumn'];
$columns[] = ['attribute' => 'tools_id', 'format' => 'raw', 'value' => function ($data) {
    if ($data->tools_id > 0) {
        return \app\models\Tools::findOne($data->tools_id)->name;
    } else {
        return "-";
    }
}];
if ($state_id > 0) {
} else {
    $columns[] = ['attribute' => 'state_id', 'format' => 'raw', 'value' => function ($data) {
        if ($data->state_id > 0) {
            return \app\models\State::findOne($data->state_id)->name;
        } else {
            return "-";
        }
    }];
}
$columns[] = ['attribute' => 'year', 'headerOptions' => ['style' => 'width:75px;', 'class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']];
$columns[] = ['attribute' => 'quarter', 'headerOptions' => ['style' => 'width:75px;', 'class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']];
$columns[] = ['attribute' => 'param', 'headerOptions' => ['style' => 'width:75px;', 'class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']];
/*
$columns[] = [
  'attribute' => 'note',
  'headerOptions' => [
      'style' => 'width:75px;',
      'class' => 'text-center',
  ],
     }
 } else {
     if ($s == 'stu_padd') {
         if ($sd['stu_master_stu_address_id'] != 0) {
             if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_city)) {
                 $add_c = City::findOne(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_city);
                 if (!empty($add_c)) {
                     $add_city_c = $add_c->city_name . " , ";
                 } else {
                     $add_city_c = '';
                 }
             } else {
                 $add_c = '';
             }
             if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_state)) {
                 $add_s = State::findOne(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_state)->state_name . ", ";
             } else {
                 $add_s = '';
             }
             if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_country)) {
                 $add_co = Country::findOne(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd_country)->country_name;
             } else {
                 $add_co = '';
             }
             echo "<td style='text-align:center; width:400px;'>" . StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_padd . $add_city_c . " " . $add_s . " " . $add_co . "</td>";
         } else {
             echo "<td>&nbsp;</td>";
         }
     } else {
         if ($s == 'city') {
             if ($sd['stu_master_stu_address_id'] != 0) {