示例#1
0
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $user = Akun::model()->find('username=?', array($this->username));
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if ($user->password !== crypt($this->password, $user->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->errorCode = self::ERROR_NONE;
             $this->setState('role', $user->kode_role);
             if ($user->kode_role != '1' && $user->kode_role != '2') {
                 if ($user->kode_role != '6') {
                     $this->setState('id_personil', $user->id_personil);
                     $puskaji = Bidang::findPuskajiByBidang($user->id_personil);
                     $this->setState('puskaji', $puskaji->id);
                     $bidang = Bidang::findBidangByPersonil($user->id_personil);
                     $this->setState('bidang', $bidang[0]['id']);
                 }
             }
             //$this->setState('kabupaten',$user->kode_kabkot);
             //$this->setState('password',$user->password);
         }
     }
     return !$this->errorCode;
     //if(!isset($users[$this->username]))
     //	$this->errorCode=self::ERROR_USERNAME_INVALID;
     //elseif($users[$this->username]!==$this->password)
     //	$this->errorCode=self::ERROR_PASSWORD_INVALID;
     //else
     //	$this->errorCode=self::ERROR_NONE;
     //return !$this->errorCode;
 }
 public function store()
 {
     // 2.1 Retrieve Parameters to variables
     $transidmerchant = \Input::get('TRANSIDMERCHANT');
     $statuscode = \Input::get('STATUSCODE');
     $transdate = \Input::get('TRANSDATE');
     $ptype = \Input::get('PTYPE');
     $totalamount = \Input::get('AMOUNT');
     $result = strtoupper(\Input::get('RESULT'));
     $xtrainfo = strtoupper(\Input::get('EXTRAINFO'));
     $status = false;
     $order = \Order::where('kodeOrder', $transidmerchant)->first();
     if ($order) {
         echo "Order tidak ditemukan..";
     }
     if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') {
         // 2.2 Cross check with MYSHORTCART Database Table
         // $true = 1 : transaction found, 0 : transaction not found
         if ($result == 'SUCCESS') {
             //update order ke pembayaran diterima
             $order->status = 2;
             $order->save();
             $detail_konfirmasi = '<p>Doku MyshopCart Detail:<br> MerchantId : ' . $transidmerchant . '<br> Total : ' . $amount . '<br> Tanggal : ' . $transdate . '</p>';
             $setting = \Pengaturan::where('akunId', '=', $order->akunId)->first();
             $data = array('pelanggan' => $order->nama, 'pelangganalamat' => $order->alamat, 'pelangganphone' => $order->telp, 'toko' => $setting->nama, 'kodeorder' => $order->kodeOrder, 'tanggal' => $order->tanggalOrder, 'namaPengirim' => $order->konfirmasi == null ? '-' : $order->konfirmasi->nama, 'noRekening' => $order->konfirmasi == null ? '-' : $order->konfirmasi->noRekPengirim, 'rekeningTujuan' => $order->konfirmasi == null ? '-' : $order->konfirmasi->bank->atasNama . '<br>' . $order->konfirmasi->bank->noRekening . ' - ' . $order->konfirmasi->bank->bankdefault->nama, 'jumlah' => $order->konfirmasi == null ? '-' : $order->konfirmasi->jumlah, 'cart' => \View::make('admin.order.detailorder')->with('order', $order), 'namaEkspedisi' => $order->jenisPengiriman, 'noResi' => $order->noResi, 'tujuanPengiriman' => $order->alamat . ' - ' . $order->kota, 'linkRegistrasi' => \URL::to('member/create'), 'detailKonfirmasi' => $detail_konfirmasi);
             $order->fromEmail = $setting->email;
             $order->fromtoko = $setting->nama;
             $qtyProduk = $order->detailorder;
             $template = \Templateemail::where('akunId', '=', $order->akunId)->where('no', '=', 6)->first();
             $email = bind_to_template($data, $template->isi);
             $subject = bind_to_template($data, $template->judul);
             $a = \Mail::send('emails.email', array('data' => $email, 'nama' => '', 'web' => '', 'email' => '', 'telp' => '', 'jmlProduk' => '', 'metatag' => 0), function ($message) use($subject, $order) {
                 $message->from($order->fromEmail, $order->fromtoko);
                 $message->to($order->pelanggan->email, $order->pelanggan->nama)->cc($order->fromEmail)->subject($subject);
             });
         }
     }
     $akun = \Akun::find($order->akunId);
     if ($akun->alamatWeb != '') {
         $url = 'http://' . $akun->alamatWeb . '/konfirmasiorder/' . $order->id;
     } else {
         $url = 'http://' . $akun->alamatJarvis . '.' . \Config::get('app.domain') . '/konfirmasiorder/' . $order->id;
     }
     echo "Status : " . $status . " <a href='{$url}'> Klik disini jika halaman tidak terload..</a>";
     return \Redirect::to($url)->with('message', 'Success Update Order');
 }
 public function store()
 {
     // 2.1 Retrieve Parameters to variables
     $transidmerchant = \Input::get('TRANSIDMERCHANT');
     $statuscode = \Input::get('STATUSCODE');
     $transdate = \Input::get('TRANSDATE');
     $ptype = \Input::get('PTYPE');
     $totalamount = \Input::get('AMOUNT');
     $result = strtoupper(\Input::get('RESULT'));
     $xtrainfo = strtoupper(\Input::get('EXTRAINFO'));
     $status = false;
     if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') {
         // 2.2 Cross check with MYSHORTCART Database Table
         // $true = 1 : transaction found, 0 : transaction not found
         $order = \Order::where('kodeOrder', $transidmerchant)->first();
         if ($order) {
             $akun = \Akun::find($order->akunId);
             return \Redirect::to('http://' . $akun->alamatJarvis . '.' . \Config::get('app.domain') . '/konfirmasiorder/' . $order->id)->with('message', 'Success Update Order');
         }
     }
 }
示例#4
0
echo $form->labelEx($model, 'password');
?>
		<?php 
echo $form->passwordField($model, 'password', array('size' => 50, 'maxlength' => 50));
?>
		<?php 
echo $form->error($model, 'password');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'kode_role');
?>
		<?php 
echo $form->dropDownList($model, 'kode_role', Akun::getRoleList(), array('empty' => 'Pilih Role'));
?>
		<?php 
echo $form->error($model, 'kode_role');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'email');
?>
		<?php 
echo $form->textField($model, 'email', array('size' => 50, 'maxlength' => 50));
?>
		<?php 
echo $form->error($model, 'email');
示例#5
0
?>
    </thead>
    <tfoot>
      <tr>
      </tr>
    </tfoot>
    <tbody>
    	<?php 
$ii = 1;
foreach ($dataProvider as $data) {
    echo "<tr id=\"\">";
    echo "<td>" . $ii++ . "</td>";
    $pers = Personil::model()->findByPk($data->id_personil);
    echo "<td>" . $pers['nama'] . "</td>";
    echo "<td class=\"text-left\">" . $data->username . "</td>";
    $role = Akun::model()->getRole($data->kode_role);
    echo "<td class=\"text-left\">" . $role . "</td>";
    if (Yii::app()->user->getState('role') == Akun::ADMIN) {
        echo "<td class=\"text-left\">" . CHtml::link('Ubah', array('Akun/update', 'id' => $data->id)) . " |" . CHtml::link('Hapus', array('Akun/delete', 'id' => $data->id), array('submit' => array('Akun/delete', 'id' => $data->id), 'class' => 'delete', 'confirm' => 'Anda yakin untuk menghapus akun?')) . "</td>";
    }
    echo "</tr>";
}
?>
    </tbody>
  </table>

</div>
</div>

<link rel="stylesheet" type="text/css" href="<?php 
echo Yii::app()->request->baseUrl;
示例#6
0
echo $form->textField($model, 'telp', array('size' => 30, 'maxlength' => 30, 'class' => 'long'));
?>
		<?php 
echo $form->error($model, 'telp');
?>
	</div>

	<div class="form-row row">
		<?php 
echo $form->labelEx($model, 'kode_role');
?>
		<?php 
if (Yii::app()->user->getState('role') == 1) {
    echo $form->dropDownList($model, 'kode_role', Akun::getRoleList(), array('empty' => 'Pilih Role'));
} else {
    echo CHtml::textField('role', Akun::getRole(Yii::app()->user->getState('role')), array('disabled' => 'disabled'));
}
?>
		<?php 
echo $form->error($model, 'kode_role');
?>
	</div>

	<div class="form-row row">
		<?php 
echo $form->labelEx($model, 'kode_provinsi');
?>
		<?php 
if (Yii::app()->user->getState('role') == 1) {
    echo $form->dropDownList($model, 'kode_provinsi', Propinsi::model()->getProvinsiList(), array('empty' => 'Pilih Provinsi', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('kabupaten/dinamis'), 'data' => array('kode_provinsi' => 'js:this.value'), 'update' => '#' . CHtml::activeId($model, 'kode_kabkot'))));
} else {
示例#7
0
 /**
  * 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 Akun the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Akun::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }