예제 #1
0
    function setDataBuy($vad, $id, $status, $type)
    {
        $model_produk = new TransaksiRequestPembelian();
        $idUsr = Yii::app()->user->getId();
        $profile = TransaksiRegistrasi::model()->get_data_profile($idUsr);
        $profile = (object) $profile;
        $user = Users::model()->findByPk($idUsr);
        $model = GalleryBarang::model()->findByPk($id);
        if ($type == 'POINT' && $user->POINT < $model->HARGA_POINT) {
            return false;
        } else {
            $model_produk->ID_USERS = $idUsr;
            $model_produk->ID_GALLERY_BARANG = $id;
            $model_produk->VAD = $vad;
            $model_produk->STATUS = $status;
            $model_produk->TYPE_PEMBELIAN = $type;
            $model_produk->save(false);
            if ($type == 'CASH') {
                Yii::import('application.extensions.phpmailer.JPhpMailer');
                $mail = new JPhpMailer();
                $mail->isSMTP();
                $mail->Debugoutput = 'html';
                $mail->Host = 'smtp.gmail.com';
                $mail->Port = 587;
                $mail->SMTPSecure = 'tls';
                $mail->SMTPAuth = true;
                $mail->Username = "******";
                $mail->Password = "******";
                $mail->setFrom('*****@*****.**', 'Admin Soniq');
                // $mail->addReplyTo('*****@*****.**', 'First Last');
                $mail->addAddress($profile->EMAIL, $profile->NAMA_LENGKAP);
                $mail->Subject = 'Konfirmasi Pembelian Produk Soniq';
                $mail->MsgHTML('<h1> Hello, ' . $profile->NAMA_LENGKAP . '</h1><br> 
					Anda Request Barang denganKODE BARANG : <b>' . $model->KODE_GALLERY . ' </b> dan 
					 NAMA BARANG : <b>' . $model->NAMA_GALLERY . '</b><br> Silahkan Transfer Biaya Pembelian Sebesar	: <b>' . $model->HARGA_CASH . '</b> Ke Rekening Berikut<br> 
					<br> Virtual ID anda : <b>' . $model_produk->VAD . '</b> <br> Terimakasih... ');
                $mail->send();
            } else {
                if ($type == 'POINT') {
                    $user->POINT = $user->POINT - $model->HARGA_POINT;
                    $user->save();
                }
            }
            return true;
        }
    }
예제 #2
0
    public function actionConfirmTopUp()
    {
        $id = Yii::app()->user->getId();
        $model = new TransaksiRequestTopupPoint();
        $user = Users::model()->findByPk($id);
        $model->ID_USERS = $id;
        $model->TANGGAL = date('Y-m-d');
        $model->STATUS = 0;
        $model->save();
        $profile = TransaksiRegistrasi::model()->get_data_profile($id);
        $profile = (object) $profile;
        Yii::app()->user->setFlash('Virtual Account', $user->VAS);
        Yii::app()->user->setFlash('Email', $profile->EMAIL);
        if (Yii::app()->user->hasFlash('Virtual Account')) {
            Yii::import('application.extensions.phpmailer.JPhpMailer');
            $mail = new JPhpMailer();
            $mail->isSMTP();
            $mail->Debugoutput = 'html';
            $mail->Host = 'smtp.gmail.com';
            $mail->Port = 587;
            $mail->SMTPSecure = 'tls';
            $mail->SMTPAuth = true;
            $mail->Username = "******";
            $mail->Password = "******";
            $mail->setFrom('*****@*****.**', 'Admin Soniq');
            // $mail->addReplyTo('*****@*****.**', 'First Last');
            $mail->addAddress($profile->EMAIL, $profile->NAMA_LENGKAP);
            $mail->Subject = 'Konfirmasi TopUP Point Soniq';
            $mail->MsgHTML('<h1> Hello, ' . $profile->NAMA_LENGKAP . '</h1><br>
			Silahkan Transfer Biaya ke Virtual Account Anda <b>' . $user->VAS . '</b><br>
			Nilai Point adalah biaya / 5000 <br>
			<br> Terimakasih');
            // $mail->send();
            $this->render('confirm');
        } else {
            $this->redirect(array('point/topup'));
        }
    }
예제 #3
0
 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         // echo $a."s"; die();
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate()) {
             if ($model->login()) {
                 $idUsr = Yii::app()->user->getId();
                 $criteria = new CDbCriteria();
                 $profile = TransaksiRegistrasi::model()->get_data_profile($idUsr);
                 if ($profile['STATUS_FIRST_LOGIN'] == 0) {
                     $this->redirect(Yii::app()->user->returnUrl . 'profile/changePass');
                 } else {
                     $this->redirect(Yii::app()->user->returnUrl . 'timeline');
                 }
             }
         }
     }
     // display the login form
     $this->render('login', array('model' => $model));
 }
예제 #4
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $id = Yii::app()->user->getId();
     if (empty($id)) {
         $this->redirect(Yii::app()->user->returnUrl . 'site/login');
     }
     $profile = TransaksiRegistrasi::model()->get_data_profile($id);
     $profile = (object) $profile;
     $criteria = new CDbCriteria();
     $model = new StatusUsers();
     $user = new Users();
     $komen = new Komentar();
     // $criteria->limit = 1;
     $criteria->order = 'ID_STATUS_USERS DESC';
     // $status = Status::model()->findAll($criteria);
     $status = $model->get_all_data();
     // $model->DATETIME_STATUS = $this->time_ago($_POST['DATETIME_STATUS']);
     if (isset($_POST['StatusUsers'])) {
         // $model->attributes=$_POST['Status'];
         // echo date('Y-m-d').'-'.time('H-i-s'); die();
         $model->ID_FANBASE = 1;
         $model->ID_USERS = Yii::app()->user->getId();
         $model->KONTEN = $_POST['StatusUsers']['KONTEN'];
         if ($model->save()) {
             $this->redirect(Yii::app()->user->returnUrl . 'timeline');
         }
     }
     if (isset($_POST['idstat'])) {
         $komen->ID_STATUS_USERS = $_POST['idstat'];
         $komen->ID_USERS = $id;
         $komen->KOMENTAR = $_POST['komen'];
         if ($komen->save()) {
             $this->redirect(Yii::app()->user->returnUrl . 'timeline');
         }
     }
     $this->render('index', array('model' => $model, 'status' => $status, 'profile' => $profile));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return TransaksiRegistrasi the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TransaksiRegistrasi::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #6
0
 public function actionUpdate()
 {
     $id = Yii::app()->user->getId();
     if (empty($id)) {
         $this->redirect(Yii::app()->user->returnUrl . 'site/login');
     }
     $criteria = new CDbCriteria();
     $profile = TransaksiRegistrasi::model()->get_data_profile($id);
     $model = TransaksiRegistrasi::model()->findByPk($profile['ID_REGISTRASI']);
     if (isset($_POST['TransaksiRegistrasi'])) {
         $model->attributes = $_POST['TransaksiRegistrasi'];
         if ($model->save()) {
             $this->redirect(array('profile/data'));
         }
     }
     $this->render('update', array('model' => $model));
 }