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(); } } } } } } }
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='******'username'] . "' \n\t\t\tAND password='******'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; } }
/** * 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)); }
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)); }
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)); }
/** * 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; }
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; }
/** * 发货单 */ 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); }
protected function tearDown() { // /*delete all productOrders*/ ProductOrders::model()->deleteAll(); /*delete all products*/ Product::model()->deleteAll(); /*delete all orders*/ Orders::model()->deleteAll(); parent::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(); }
/** * 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.'); } }
<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>
$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">
<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>
<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>
<?php $this->breadcrumbs = array('Invoices Fkts' => array('index'), 'Manage'); $this->menu = array(array('label' => 'Создать', 'url' => array('create')), array('label' => 'Шаблоны', 'url' => array('invoicesFktTmpl/admin'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('invoices-fkt-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Управление счетами-фактурами</h1> <?php $this->widget('application.extensions.yii-flash.Flash', array('keys' => array('success', 'error', 'notice'), 'htmlOptions' => array('class' => 'flash'))); ?> <!-- flashes --> <p> Можно использовать (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> или <b>=</b>). </p> <?php echo CHtml::link('Продвинутый поиск', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'invoices-fkt-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'num', array('name' => 'order_id', 'value' => '$data->order->name', 'filter' => Orders::model()->listData()), array('name' => 'client_id', 'value' => '$data->client->name', 'filter' => CHtml::listData(Clients::model()->findAll(), 'id', 'name')), 'date', 'sum', array('name' => 'is_sign', 'value' => 'InvoicesFkt::model()->itemAlias("is_sign",$data->is_sign)'), array('class' => 'MyButtonColumn'))));
<?php /* @var $this SiteController */ $this->pageTitle = '首页'; $day = array('日', '一', '二', '三', '四', '五', '六'); $new_customer_num = User::model()->count('DATE(created)>=:today AND type="customer"', array(':today' => date('Y-m-d'))); $subscribe_num = Orders::model()->count('DATE(created) >= :today', array(':today' => date('Y-m-d'))); ?> <div class="content"> <div class="header"> <h1 class="page-title"><?php echo $this->pageTitle; ?> </h1> </div> <div class="container-fluid"> <div class="alert in alert-block fade alert-success"> 今天是 <?php echo date('Y-m-d'); ?> , 星期 <?php echo $day[date('w')]; ?> </div> <div class="alert in alert-block fade alert-success"> 新注册的用户数 : <?php echo $new_customer_num; ?> 。
<?php $this->breadcrumbs = array('Работы' => array('index'), 'Управление'); $this->menu = array(array('label' => 'Создать работу', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('works-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Управление работами/услугами</h1> <?php $this->widget('application.extensions.yii-flash.Flash', array('keys' => array('success', 'error', 'notice'), 'htmlOptions' => array('class' => 'flash'))); ?> <!-- flashes --> <p> Можно использовать (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> или <b>=</b>). </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'works-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'date', array('name' => 'client_id', 'value' => '$data->client->name', 'filter' => CHtml::listData(Clients::model()->findAll(array('order' => 'name')), 'id', 'name')), array('name' => 'order_id', 'value' => '$data->order->name', 'filter' => CHtml::listData(Orders::model()->findAll(array('order' => 'name')), 'id', 'name')), array('name' => 'act_id', 'value' => '!is_null($data->act_id)?$data->act->num:null', 'filter' => CHtml::listData(Acts::model()->findAll(array('order' => 'num')), 'id', 'num')), 'name', 'unit', 'cost', 'quantity', 'sum', 'location', array('class' => 'MyButtonColumn'))));
<?php $model = Orders::model()->findbypk($id); $hinta = str_replace(",", ".", $model->hinta); $hinta = (double) $hinta; $alv = $hinta * 0.24; $veroton = $hinta - $alv; $body = ''; $body .= '<br> <style> td { padding: 5px 7px;} </style> <div> MIINUS.FI<br> <h1>Kuitti Nro.' . $id . '</h1> <table style="width:100%"> <tr><td><b>Yritys:</b></td><td>Pilvilinna Production Oy</td></tr> <tr><td><b>Y-tunnus:</b></td><td>2082452-5</td></tr> <tr><td><b>Osoite:</b></td><td>Kourulantie 161, 26660 RAUMA</td></tr> <tr><td><b>ALV%:</b></td><td>24</td></tr> <tr><td><b>ALV:</b></td><td>' . number_format($alv, 2, ',', '') . ' €</td></tr> <tr><td><b>Veroton:</b></td><td>' . number_format($veroton, 2, ',', '') . ' €</td></tr> <tr><td><b>Yhteensä:</b></td><td>' . number_format($hinta, 2, ',', '') . ' €</td></tr> <tr><td><b>Aikaväli:</b></td><td>' . date("d.m.Y", strtotime($model->start)) . " - " . date("d.m.Y", strtotime($model->stop)) . '</td></tr> </table> </div> <hr> <table style="width:100%">
public static function Orderlistbyclients($client_id) { $orderList = Orders::model()->findAllByAttributes(array("client_id" => $client_id)); $order_ids = array(); foreach ($orderList as $order) { $order_ids[] = $order['order_id']; } return $order_ids; }
/** * 订单留言 */ public function actionMark() { $order_id = $_POST['order_id']; $order_info = Orders::model()->find('order_id = :order_id', array(':order_id' => $order_id)); $mark_text = $order_info->mark_text; if ($mark_text) { $mark_text = unserialize($mark_text); } echo $this->renderPartial('_order_mark', array('mark_text' => $mark_text), true); }
<?php $this->breadcrumbs = array('Payments' => array('index'), 'Manage'); $this->menu = array(array('label' => 'Создать платёж', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('payments-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Управление платежами</h1> <?php $this->widget('application.extensions.yii-flash.Flash', array('keys' => array('success', 'error', 'notice'), 'htmlOptions' => array('class' => 'flash'))); ?> <!-- flashes --> <p> Можно использовать (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> или <b>=</b>). </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'payments-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'date', 'sum', array('name' => 'client_id', 'value' => '$data->client->name', 'filter' => CHtml::listData(Clients::model()->findAll(array('order' => 'name')), 'id', 'name')), array('name' => 'order_id', 'value' => '$data->order->name', 'filter' => CHtml::listData(Orders::model()->findAll(array('order' => 'name')), 'id', 'name')), 'invoice_id', 'note', array('class' => 'MyButtonColumn'))));
<div class="row"> <?php echo $form->labelEx($model, 'client_id'); ?> <?php echo $form->dropDownList($model, 'client_id', CHtml::listData(Clients::model()->findAll(), 'id', 'name')); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'status'); ?> <?php echo $form->dropDownList($model, 'status', Orders::model()->itemAlias('status')); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'date'); ?> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('attribute' => 'date', 'model' => $model, 'value' => $model->date, 'language' => 'ru', 'options' => array('showAnim' => 'fold', 'changeYear' => true, 'changeMonth' => true, 'dateFormat' => 'yy-mm-dd'))); // echo $form->textField($model,'date'); ?> </div> <div class="row"> <?php
public function getClientId($order_id) { $result = Orders::model()->findByPk($order_id)->client_id; return $result; }
public function actionPayment($order_code) { $this->_seoTitle = '支付方式'; $uid = Yii::app()->session['uid']; $username = Yii::app()->session['username']; $orders = Orders::model()->find('uid=:uid and order_code=:order_code', array(':uid' => $uid, ':order_code' => $order_code)); $this->render('payment', array('orders' => $orders, 'order_code' => $order_code)); }
public function actionChangeClient() { $return_msg = ''; // Dumper::d($_POST['order_id']);die; if (Yii::app()->request->isAjaxRequest) { if (is_numeric($_POST['client_id'])) { $q = Orders::model()->listData((int) $_POST['client_id']); if (count($q) > 0) { foreach ($q as $key => $value) { $haOptions[] = array('value' => $key, 'text' => $value); } $return_msg = json_encode($haOptions); } else { $return_msg = json_encode('no'); } } else { $return_msg = '[{"value":"",text:"Некорректный формат запроса"}]'; } } else { $return_msg = '[{"value":"","text":"Некорректный формат запроса"}]'; } echo $return_msg; }
/** * HAS MANY relation * assume we have an orders and client model where we want to see all orders * by the client this user HAS ONE of. So this will return all orders * belonging this the users client. * @return */ public function orders() { return Orders::model()->findAllByAttributes(array('client_id' => $this->getPrimaryKey())); }
$this->breadcrumbs = array('Заказы' => array('admin'), $model->name); $this->menu = array(array('label' => 'Создать заказ', 'url' => array('create')), array('label' => 'Изменить заказ', 'url' => array('update', 'id' => $model->id)), array('label' => 'Удалить заказ', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Управление заказами', 'url' => array('admin'))); ?> <h1>Заказ #<?php echo $model->id; ?> </h1> <?php $this->widget('application.extensions.yii-flash.Flash', array('keys' => array('success', 'error', 'notice'), 'htmlOptions' => array('class' => 'flash'))); ?> <!-- flashes --> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'name', array('name' => 'client_id', 'value' => $model->client_name), array('name' => 'status', 'value' => Orders::model()->itemAlias("status", $model->status)), 'date', 'fixpay', 'note'))); $tabs = array('works' => array('title' => 'Работы', 'content' => $this->renderPartial('grid-works', array('model' => $model, 'dtprv' => $mdlWorks), true)), 'contracts' => array('title' => 'Договора', 'content' => $this->renderPartial('grid-contracts', array('model' => $model, 'dtprv' => $mdlContracts), true)), 'acts' => array('title' => 'Акты', 'content' => $this->renderPartial('grid-acts', array('model' => $model, 'dtprv' => $mdlActs), true)), 'invoices' => array('title' => 'Счета', 'content' => $this->renderPartial('grid-inv', array('model' => $model, 'dtprv' => $mdlInv), true)), 'invoicesFkt' => array('title' => 'Счета-фактуры', 'content' => $this->renderPartial('grid-invfkt', array('model' => $model, 'dtprv' => $mdlInvFkt), true)), 'payments' => array('title' => 'Платежи', 'content' => $this->renderPartial('grid-payments', array('model' => $model, 'dtprv' => $mdlPay), true))); if (Yii::app()->urlManager->showScriptName === true) { $url = Yii::app()->request->hostInfo . Yii::app()->request->baseUrl . '/index.php'; } else { $url = Yii::app()->request->hostInfo . Yii::app()->request->baseUrl; } $activeTab = str_replace($url, '', Yii::app()->request->urlReferrer); $activeTab = explode('/', $activeTab); //echo Yii::app()->request->urlReferrer; //CVarDumper::dump($activeTab,10,true);die; if (!key_exists('1', $activeTab)) { $activeTab[1] = 'works'; } $this->widget('CTabView', array('tabs' => $tabs, 'activeTab' => $activeTab[1]));
<div class="row"> <div class="col-md-12"> <div id="ticket_portlet" class="ticket_portlet"> <div class="row"> <div class="col-xs-2 ticket_icon"> <i class="fa fa-ticket fa-5x"></i> </div> <div class="col-xs-5"> <h2><?php echo CHtml::encode($model->ticket_title); ?> </h2> <div class="project_meta_details"> <?php $orderDetails = Orders::model()->findByAttributes(array("order_id" => $model->order_id)); $Total_amount = $orderDetails['currency'] . " " . $orderDetails['order_total']; $attrList = json_decode($orderDetails['order_Data']); $coupon_id = $orderDetails['coupon_id']; $couponDetails = Coupons::model()->findByAttributes(array("id" => $coupon_id)); $clientInfo = $attrList->userdata; $days = round($attrList->numofworkingday / 8); $fwdby = TicketAssign::model()->findByAttributes(array('ticket_id' => $ticket_id, 'fwd_to' => Yii::app()->session['user_data']['user_id'], 'status' => 1)); $fwd_name = ''; if (!empty($fwdby)) { $fwd_name = ucfirst(Users::model()->getUserName($fwdby->fwd_by)); } ?> <p>Client: <strong><a href=""></a> <?php echo ucfirst(Users::model()->getUserName($orderDetails['client_id']));
public function actionOrderNumber() { $this->pageTitle = 'Мобильный мир - статус заказа'; $this->menu = Category::model()->findAll(); $input = Yii::app()->request->getPost('input'); $input_int = (int) $input; if ($input_int != 0) { $model = Orders::model()->findByPk($input_int); if (gettype($model) != 'NULL') { $id = $model->id; $status = $model->status; if ($status == 0 && $id != 0) { $output = 'Новый'; } elseif ($status == 1 && $id != 0) { $output = 'В обработке'; } elseif ($status == 2 && $id != 0) { $output = 'Отправлен'; } elseif ($status == 3 && $id != 0) { $output = 'Доставлен'; } elseif ($status == 4 && $id != 0) { $output = 'Отменен'; } elseif ($status == 5 && $id != 0) { $output = 'Отменен навсегда'; } } else { $output = 'Данные отсутствуют'; } } else { $output = 'Неверный ввод'; } // если запрос асинхронный, то нам нужно отдать только данные if (Yii::app()->request->isAjaxRequest) { echo CHtml::encode($output); // Завершаем приложение Yii::app()->end(); } $this->render('orderNumber'); }