/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Penjualan();
     $user = Datauser::model()->findByAttributes(array('username' => Yii::app()->user->name));
     $iduser = $user->iddatauser;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Penjualan'])) {
         $model->attributes = $_POST['Penjualan'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->idpenjualan));
         }
     }
     $this->render('create', array('model' => $model, 'iduser' => $iduser));
 }
Ejemplo n.º 2
0
 public function authenticate()
 {
     $username = $this->username;
     $password = $this->password;
     $user = Datauser::model()->find('username=?', array($username));
     if (!isset($user->username)) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if ($user->username !== null) {
             if ($user->password === null || $user->password != $this->password) {
                 $this->errorCode = self::ERROR_PASSWORD_INVALID;
             } else {
                 $this->_username = $user->username;
                 // $this->username = $user->username;
                 $this->errorCode = self::ERROR_NONE;
             }
         } else {
             $this->errorCode = self::ERROR_NONE;
         }
     }
     return !$this->errorCode;
 }
Ejemplo n.º 3
0
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('idpenjualan'));
?>
:</b>
	<?php 
echo CHtml::link(CHtml::encode($data->idpenjualan), array('view', 'id' => $data->idpenjualan));
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('nama user'));
?>
:</b>
	<?php 
echo CHtml::encode(Datauser::model()->findbypk($data->iddatauser)->nama);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('nama product'));
?>
:</b>
	<?php 
echo CHtml::encode(Product::model()->findbypk($data->idproduct)->nama);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('jumlah'));
?>