public function actionIphone6delete($id) { $model = \app\models\MIphone6Sub::findOne($id); $model->delete(); return $this->redirect(['iphone6sub']); }
public function actionIphone6sub() { $cat = isset($_GET['cat']) ? $_GET['cat'] : 0; $this->layout = 'wap'; $model = new \app\models\MIphone6Sub(); $cat = Yii::$app->request->get('cat', 0); $model->cat = $cat; if ($model->load(Yii::$app->request->post())) { if (!$model->save()) { U::W([$_GET, $_POST, $model->getErrors()]); Yii::$app->session->setFlash('success', '此身份证号码已存在!'); } else { Yii::$app->session->setFlash('success', '预订信息提交成功,请您敬侯佳音节!'); } return $this->refresh(); } $n = \app\models\MIphone6Sub::find()->where(['cat' => $cat])->count(); return $this->render('iphone6sub', ['model' => $model, 'n' => $n + 999]); }
</h1> <p> <?php echo Html::a('下载 <span class="glyphicon glyphicon-arrow-down"></span>', ['iphone6subdownload'], ['class' => 'btn btn-success']); ?> </p> <?php //echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table table-striped'], 'columns' => ['id', ['attribute' => 'cat', 'headerOptions' => array('style' => 'width:100px;'), 'value' => function ($model, $key, $index, $column) { return \app\models\MIphone6Sub::getCatName($model->cat); }, 'filter' => \app\models\MIphone6Sub::getCatName()], ['attribute' => 'user_name', 'headerOptions' => array('style' => 'width:200px;')], ['attribute' => 'user_contact', 'headerOptions' => array('style' => 'width:400px;')], ['attribute' => 'user_id'], ['attribute' => 'office_id'], ['attribute' => 'create_time'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{iphone6delete}', 'buttons' => ['iphone6delete' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', '确认要删除此预订用户?'), 'data-method' => 'post', 'data-pjax' => '0']); }]]]]); ?> </div> <?php /* // 'openid', // 'nickname', // 'title', <p> <?php echo Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?> </p>
<?php use yii\helpers\Html; //use yii\widgets\ActiveForm; use yii\bootstrap\ActiveForm; use yii\helpers\Url; $this->registerJsFile(Yii::$app->getRequest()->baseUrl . '/js/wechat.js?v0.1'); $this->title = \app\models\MIphone6Sub::getCatName($model->cat) . ' 预订'; //$this->params['breadcrumbs'][] = $this->title; ?> <?php $this->registerJs('$(".flash-success").animate({opacity: 1.0}, 3000).fadeOut("slow");', yii\web\View::POS_READY); ?> <h3><?php echo Html::encode($this->title); ?> <!--,祝您好运!--> <br>已有<span style="font-size:48px;color:#ff0000;"><?php echo $n; ?> </span>人预订</h3> <?php if (Yii::$app->session->hasFlash('success')) { ?> <div class="alert alert-success flash-success"> <?php echo Yii::$app->session->getFlash('success'); ?> </div> <?php