if ($model->save()) { echo json_encode('nollaMaksettu'); exit; } } $bod = ''; $bod .= ' <div style="font-size: 115%;"> <div class="panel panel-primary"> <div class="panel-heading">Tilaus</div> <div class="panel-body"> <p>' . $_POST['item_name'] . ', ' . $_POST['amount'] . '€</p> <p>Toiminta-aika: ' . $_POST['period'] . 'pv</p> </div> </div>'; $pt = PaytrailRajapinta::model()->findbypk(1); if (isset($pt->id)) { $DESCRIPTION = $_POST['item_name'] . ', Nro:' . $_POST['item_number']; $kauppiasvarmenne = $pt->kauppiasvarmenne; $MERCHANT_ID = $pt->merchant_id; $summa = $_POST['amount']; $success = "http://" . $_SERVER['SERVER_NAME'] . "/index.php/site/success"; $cancel = "http://" . $_SERVER['SERVER_NAME'] . "/index.php/site/cancel"; $notify = "http://" . $_SERVER['SERVER_NAME'] . "/index.php/site/notify"; $koodi = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 8)), 0, 8); $criteria = new CDbCriteria(); $criteria->order = " id DESC "; $criteria->condition = " user_id='" . Yii::app()->user->id . "' AND status=1 "; $order = Orders::model()->find($criteria); $stopVanha = ''; if (isset($order->id) and date("Ymd", strtotime($order->stop)) > date("Ymd")) {
/** * 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 PaytrailRajapinta the loaded model * @throws CHttpException */ public function loadModel($id) { $model = PaytrailRajapinta::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }