Esempio n. 1
0
 public function actionGetStatisctic()
 {
     $request = Yii::$app->request;
     $year = $request->post('year');
     $state = $request->post('negeri');
     $data['centerPoint'] = State::getPoint($state);
     $data['userpointarray'] = PersonalInformation::getUserPositionByYear($year);
     Yii::$app->response->format = 'json';
     // klu nk convert smue data jdi json
     echo json_encode($data);
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPi()
 {
     return $this->hasOne(PersonalInformation::className(), ['pi_id' => 'pi_id']);
 }
Esempio n. 3
0
 public static function actionSaveupdate()
 {
     $request = Yii::$app->request;
     $userID = $request->post('userID');
     $piID = $request->post('piID');
     $user = User::find()->where(array('id' => $userID))->one();
     $user->username = $request->post("username");
     $user->status = $request->post("userstatus");
     $user->updated_at = time();
     $user->update();
     //$user->auth_key = "vBZS7KGrvXesyOkgQhGYCY5KCZi6st5g";
     // $user->password_hash = "$2y$13$4cRqqw0nmEj5.NJRcJYaE.YUSh9DJaQsSpLM3OCicXckrCPoAgWYC";
     $personalinfo = PersonalInformation::find()->where(array('pi_id' => $piID))->one();
     $personalinfo->pi_name = $request->post("fullname");
     $personalinfo->pi_address_permanent = $request->post("permanentaddress");
     $personalinfo->pi_zipcode_permanent = $request->post("permanentzipcode");
     $personalinfo->pi_address = $request->post("address");
     $personalinfo->pi_zipcode = $request->post("zipcode");
     $personalinfo->pi_ic_or_passport = $request->post("icno");
     $personalinfo->pi_gender = $request->post("gender");
     $personalinfo->pi_phone_home = $request->post("phone");
     $personalinfo->pi_hp = $request->post("handphone");
     $personalinfo->pi_email_1 = $request->post("email_1");
     $personalinfo->pi_email_2 = $request->post("email_2");
     $personalinfo->update();
     // print_r($user->update());
     /*  print_r($personalinfo->getErrors());
         die();*/
 }
Esempio n. 4
0
use yii\helpers\ArrayHelper;
use backend\models\PersonalInformation;
/* @var $this yii\web\View */
/* @var $model backend\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="user-form">

    <?php 
$form = ActiveForm::begin();
?>

    
    <?php 
echo $form->field($model, 'pi_id')->dropDownList(ArrayHelper::map(PersonalInformation::find('pi_id', 'pi_name')->all(), 'pi_id', 'pi_name'), ['prompt' => 'Select Name']);
?>

    <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'auth_key')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'password_hash')->textInput(['maxlength' => true]);
?>

    <?php 
Esempio n. 5
0
 public function actionTestJoin()
 {
     //Yii::$app->message->display('I am Yii2.0 Programmer');
     echo Yii::$app->params['hostID'];
     $items = User::find()->joinWith(['pi' => function ($q) {
         $q->from(PersonalInformation::tableName() . ' p');
     }])->with(['userEducations' => function ($q) {
         $q->select(['id', 'ue_id', 'ei_id']);
     }])->select(['{{user}}.pi_id', 'id', 'username', 'password_hash', 'p.pi_name'])->where(['IN', 'pi_ic_or_passport', ['880214565399', '870507015025', '880906355448', '880722435283', 'B153796']])->asArray()->all();
     //print_r($items);
 }