示例#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'));
        }
    }
 public function actionIndex()
 {
     $model = new TransaksiRegistrasi();
     $model_user = new Users();
     if (isset($_POST['TransaksiRegistrasi'])) {
         // 	if($model->validate() && $model_user->validate()){
         // 	echo "oke";
         // }else{
         // 	echo "ga oke";
         // }
         // die();
         $model->attributes = $_POST['TransaksiRegistrasi'];
         $cek = $model->validate();
         if ($cek) {
             // if($model->save()){
             $number = '';
             for ($i = 0; $i < 16; $i++) {
                 $number .= rand(0, 9);
             }
             $model->ID_FANBASE = 1;
             // $model->NO_SAKTI = $number;
             $model->VAD = $this->randomNumber(16);
             $model->STATUS_REKONSILIASI = 0;
             $model->STATUS_RELEASE = 0;
             $tgl = explode('/', $_POST['TransaksiRegistrasi']['TANGGAL']);
             $model->TANGGAL = $tgl[2] . '-' . $tgl[0] . '-' . $tgl[1];
             $model->VALIDASI_UPLOAD = 0;
             // print_r($model); die();
             $model->save(false);
             $model_user->ID_FANBASE = $model->ID_FANBASE;
             $model_user->ID_REGISTRASI = $model->ID_REGISTRASI;
             $model_user->ID_JENIS = 4;
             $model_user->VAS = '-';
             $model_user->STATUS = 0;
             $model_user->save(false);
             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($model->EMAIL, $model->NAMA_LENGKAP);
             $mail->Subject = 'Konfirmasi Registrasi Soniq';
             $mail->MsgHTML('<h1> Hello, ' . $model->NAMA_LENGKAP . '</h1><br> Virtual ID anda : <b>' . $model->VAD . '</b>');
             // $mail->Body    = '';
             // $mail->AltBody = 'This is a plain-text message body';
             //Attach an image file
             //$mail->addAttachment('images/phpmailer_mini.png');
             //send the message, check for errors
             // if (!$mail->send()) {
             // 	$res = "Email Gagal Dikirim";
             // }else {
             // 	$res = "Email Sudah Dikirm";
             // }
             $res = 'kirim email di matikan';
             Yii::app()->user->setFlash('Virtual ID', $model->VAD);
             Yii::app()->user->setFlash('Email', $model->EMAIL);
             Yii::app()->user->setFlash('Status', $res);
             // $data = array('vad'=>$model->VAD,'pwd'=>$model_user->PASSWORD,'email'=>$model->EMAIL);
             $this->redirect(array('confirm'));
         }
     }
     $this->render('create', array('model' => $model, 'model_user' => $model_user));
 }
示例#4
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));
 }
示例#5
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;
 }
示例#7
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));
 }