本文整理匯總了PHP中Orders::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP Orders::model方法的具體用法?PHP Orders::model怎麽用?PHP Orders::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Orders
的用法示例。
在下文中一共展示了Orders::model方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateOrderStatus
public function updateOrderStatus()
{
//create an order class
$order = new Orders();
//check if the result array is empty or not
if (is_array($this->result)) {
//looping through each order
foreach ($this->result as $eachItem) {
//find the primary key of each order
$temp = $eachItem['U_id'];
//Perform check to ignore completed orders else indexing error occurs
if ($eachItem['status'] === 'Processing' or $eachItem['status'] === 'placed') {
if ($this->order_status[$temp] === "Processing") {
$order = Orders::model()->findByPk($temp);
$order->status = "Processing";
$order->save();
} else {
if ($this->order_status[$temp] === "Done") {
$order = Orders::model()->findByPk($temp);
$order->status = "Done";
$order->save();
} else {
if ($this->order_status[$temp] === "Delivering") {
$order = Orders::model()->findByPk($temp);
$order->status = "Delivering";
$order->save();
}
}
}
}
}
}
}
開發者ID:nsawant942,項目名稱:Canteen-Management-Software-System--Witwatersrand,代碼行數:33,代碼來源:DisplayOrder.php
示例2: actionLogin
public function actionLogin()
{
switch ($_GET['model']) {
case 'viivakoodi':
if (isset($_POST['username']) and isset($_POST['password'])) {
$criteria = new CDbCriteria();
$criteria->order = " id DESC ";
$criteria->condition = " \n\t\t\tusername='" . $_POST['username'] . "' \n\t\t\tAND password='" . md5($_POST['password']) . "' \n\t\t";
$user = User::model()->find($criteria);
if (!isset($user->id)) {
$this->_sendResponse(200, "userError");
exit;
}
$criteria = new CDbCriteria();
$criteria->order = " id DESC ";
$criteria->condition = " \n\t\t\tuser_id='" . $user->id . "'\n\t\t\tAND CURDATE() BETWEEN start AND stop \n\t\t\tAND status=1 \n\t\t";
$order = Orders::model()->find($criteria);
if (!isset($order->id)) {
$this->_sendResponse(200, 'Käyttöaika umpeutunut. Osta aikaa käyttääksesi ohjelmaa.');
exit;
}
if (isset($user->id) and isset($order->id)) {
$this->_sendResponse(200, $user->id);
}
} else {
$this->_sendResponse(200, "Jotain on väärin");
}
break;
}
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Contracts();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_GET['byorder']) and is_numeric($_GET['byorder'])) {
$order_id = (int) $_GET['byorder'];
$model->order_id = $order_id;
$model->order = Orders::model()->findByPk($order_id);
$model->name = $model->order->name;
$model->client_id = $model->order->client_id;
$model->sum = Yii::app()->db->createCommand()->select('SUM(cost*quantity) as order_sum')->from('{{works}}')->where('{{works}}.order_id = ' . $order_id)->queryScalar();
$model->num = Yii::app()->db->createCommand()->select('max(num*1) as max')->from('{{contracts}}')->queryScalar();
$model->num = $model->num + 1;
if (isset($_POST['Contracts'])) {
// CVarDumper::dump($_POST['Contracts'],10,true);die;
$model->attributes = $_POST['Contracts'];
if ($model->save()) {
$msg = 'Договор #' . $model->id . ' - ' . $model->name . ' для ' . $model->client->name . ' создан';
Yii::app()->user->setFlash('success', $msg);
Yii::app()->logger->write($msg);
if (isset($order_id)) {
$this->redirect(array('orders/view', 'id' => $order_id));
} else {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
}
$model->date = $model->isNewRecord ? date('Y-m-d') : $model->date;
$this->render('create', array('model' => $model));
}
示例4: actionOrderView
public function actionOrderView()
{
$id = $_REQUEST['id'];
$cri = new CDbCriteria(array('condition' => 'order_id =' . $id));
$model = Orders::model()->find($cri);
$this->render('orderView', array('model' => $model));
}
示例5: actionWechatResult
public function actionWechatResult()
{
$order_code = $_GET['order_code'];
Orders::model()->updateAll(array('status' => 2), 'order_code=:order_code', array(':order_code' => $order_code));
$this->_seoTitle = '支付成功';
$result = 'success';
$this->render('alipay_result', array('result' => $result, 'order_code' => $order_code));
}
示例6: loadModel
/**
* 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 Orders the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Orders::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例7: deleteOrder
public function deleteOrder($id)
{
$result = Orders::model()->findByAttributes(array('id' => $id));
$result->status = '0';
if ($result->save()) {
$data = array('code' => 200, 'message' => 'SUCCESS');
}
return $data;
}
示例8: actionIndex
/**
* 發貨單
*/
public function actionIndex()
{
$order_id = $this->post('order_id');
$order_info = Orders::model()->find('order_id = :order_id', array(':order_id' => $order_id));
$dlycorp_list = Dlycorp::model()->findAll("disabled = 'false'");
$Delivery = new Delivery();
$addr_info = $Delivery->AreaToAddr($order_info['ship_area']);
echo $this->renderPartial('index', array('order_id' => $order_id, 'order_info' => $order_info, 'dlycorp_list' => $dlycorp_list, 'addr_info' => $addr_info), true);
}
示例9: tearDown
protected function tearDown()
{
// /*delete all productOrders*/
ProductOrders::model()->deleteAll();
/*delete all products*/
Product::model()->deleteAll();
/*delete all orders*/
Orders::model()->deleteAll();
parent::tearDown();
}
開發者ID:kevindaus,項目名稱:Order-Billing-Inventory-System-Marcials-Furniture,代碼行數:10,代碼來源:WeeklySalesReportTest.php
示例10: tearDown
public function tearDown()
{
/*delete all productOrders*/
ProductOrders::model()->deleteAll();
/*delete all products*/
Product::model()->deleteAll();
/*delete all orders*/
Orders::model()->deleteAll();
/*delete all customers*/
Customer::model()->deleteAll();
}
開發者ID:kevindaus,項目名稱:Order-Billing-Inventory-System-Marcials-Furniture,代碼行數:11,代碼來源:AnnualReportTest.php
示例11: actionDelete
/**
* Deletes a particular model.
* If deletion is successful, the browser will be redirected to the 'admin' page.
* @param integer $id the ID of the model to be deleted
*/
public function actionDelete($id)
{
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
$model = $this->loadModel($id);
if (Orders::model()->count('client_id=' . $id) == 0) {
if ($model->delete()) {
$msg = 'Клиент #' . $model->id . ' - ' . $model->name . ' удалён';
Yii::app()->user->setFlash('success', $msg);
Yii::app()->logger->write($msg);
}
} else {
$msg = 'Клиент #' . $model->id . ' [' . $model->name . '] НЕ удалён - есть заказы';
Yii::app()->user->setFlash('notice', $msg);
Yii::app()->logger->write($msg);
}
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if (!isset($_GET['ajax'])) {
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
} else {
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
}
}
示例12: CDbCriteria
<div class="row">
<div class="col-sm-12">
<div class="alert alert-default" style="background: #93be0c; color: white">
<h3>Täytä pakolliset kentät. ' . Yii::app()->user->pakkolisetKentaat . '</h3>
</div>
</div>
</div>
';
}
} else {
$content = '';
$asetukset = Asetukset::model()->findbypk(1);
$criteria = new CDbCriteria();
$criteria->order = " id DESC ";
$criteria->condition = " \n\t\tuser_id='" . Yii::app()->user->id . "'\n\t";
$order = Orders::model()->find($criteria);
$ilmaiseksi = '';
if (isset($asetukset->kokeilu_aika) and $asetukset->kokeilu_aika > 0 and !isset($order->id)) {
$ilmaiseksi .= '
<form action="' . Yii::app()->request->baseUrl . '/index.php/site/index" method="post">
<input name="ilmaiseksi" type="hidden" value="true">
<input type="submit" class="btn btn-success btn-block" value="Kokeile ilmaiseksi ' . $asetukset->kokeilu_aika . ' päivää!">
</form>
';
}
$content .= '
<div class="alert alert-info">
<h2>
Tällä tunnuksella ei ole voimassa olevaa käyttöaikaa.
</h2>
<p>
示例13: Orders
$model = new Orders();
$model->user_id = Yii::app()->user->id;
$model->period = $_POST['period'];
$model->status = 0;
$model->sahkoposti = $sahkoposti;
$model->start = $start;
$model->alennus_prosentti = $_POST['alennus'];
$model->hinta = $_POST['amount'];
$model->koodi = Yii::app()->user->id . $koodi;
$model->stop = date("Y-m-d", strtotime($start . " +" . $_POST['period'] . " day"));
if ($model->save()) {
$tilaus = $model->id;
$prep = "{$kauppiasvarmenne}|{$MERCHANT_ID}|{$summa}|{$tilaus}||{$DESCRIPTION}|EUR|{$success}|{$cancel}||{$notify}|S1|fi_FI||1||";
$auth = md5($prep);
$auth = strtoupper($auth);
Orders::model()->updatebypk($model->id, array('authcode' => $auth));
} else {
$bod .= 'Ei onnistu';
exit;
}
} else {
$bod .= 'Virhe! Tunnukset eivät täsmää!';
exit;
}
$bod .= '
<div class="alert alert-danger">
<p>Sinulla on 30 minuttia aikaa suorittaa maksu. Muussa tapauksessa aloita ajan ostaminen alusta.</p>
</div>
</div>
<form action="https://payment.paytrail.com/" method="post">
示例14:
<thead>
<tr>
<th><?php
echo Orders::model()->getAttributeLabel('id');
?>
</th>
<th><?php
echo Orders::model()->getAttributeLabel('catalogues_products__id');
?>
</th>
<th><?php
echo Orders::model()->getAttributeLabel('count');
?>
</th>
<th><?php
echo Orders::model()->getAttributeLabel('price');
?>
</th>
<?php
if (ProductsConfig::model()->_checkSwitchedPoints()) {
?>
<th><?php
echo Yii::t('app', 'Баллы за единицу');
?>
</th>
<?php
}
?>
</tr>
</thead>
<tbody>
示例15: CDbCriteria
<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-user"></i> Minun ostot</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-hover">
<tr>
<th>Aloitus</th>
<th>Lopetus</th>
<th>Sähköposti</th>
</tr>
<?php
$criteria = new CDbCriteria();
$criteria->condition = " user_id='" . Yii::app()->user->id . "' AND status=1 ";
$ord = Orders::model()->findAll($criteria);
foreach ($ord as $data) {
echo '
<tr>
<th>' . $data->start . '</th>
<th>' . $data->stop . '</th>
<th>' . $data->sahkoposti . '</th>
</tr>
';
}
?>
</table>
</div>
</div>
</div>