Author: Administrator
Inheritance: extends DBGrouponBiz
Beispiel #1
0
 public static function bizInfo($data)
 {
     $biz = ARBiz::model()->findByPk($data['biz_id']);
     if ($biz == null) {
         return '该商品没有对应商家';
     }
     $str = $biz->title . '<span style="color:teal;">[商户ID:' . $biz->id . ']</span>';
     return $str;
 }
Beispiel #2
0
 public function actionCreate()
 {
     $biz_id = Yii::app()->request->getParam('biz_id');
     if (empty($biz_id)) {
         $this->go('请选择具体的商家', Yii::app()->request->urlReferrer);
     }
     $biz = ARBiz::model()->findByPk($biz_id);
     if ($biz == null) {
         $this->go('该商家不存在', Yii::app()->request->urlReferrer);
     }
     $model = new ARBizShop('sell');
     $model->biz_id = $biz->id;
     $this->performAjaxValidation($model);
     if (Yii::app()->request->isPostRequest && !empty($_POST['ARBizShop'])) {
         $model->attributes = $_POST['ARBizShop'];
         if ($model->save()) {
             $this->go('<strong>分店添加成功</strong>', $_POST['return_url'], 'success');
         }
     }
     $this->render('create', array('model' => $model, 'biz' => $biz));
 }
Beispiel #3
0
 protected function loadBiz($id)
 {
     $model = ARBiz::model()->findByPk($id);
     if ($model == null) {
         throw new CHttpException(404, '找不到该商家');
     }
     return $model;
 }
Beispiel #4
0
 public function actionCreate()
 {
     Yii::import("xupload.models.XUploadForm");
     $biz_id = Yii::app()->request->getParam('biz_id');
     if (empty($biz_id)) {
         $this->go('请选择具体的商家', Yii::app()->request->urlReferrer);
     }
     $biz = ARBiz::model()->findByPk($biz_id);
     if ($biz == null) {
         $this->go('该商家不存在', Yii::app()->request->urlReferrer);
     }
     $model = new ARContract('sell');
     //        $attach = new ARGrouponAttach();
     $upload = new XUploadForm();
     $model->biz_id = $biz->id;
     //        $this->performAjaxValidation($model);
     if (Yii::app()->request->isPostRequest && !empty($_POST['ARContract'])) {
         //            dump($_POST);
         $model->attributes = $_POST['ARContract'];
         $model->create_id = Yii::app()->user->id;
         $model->sign_time = strtotime($model->sign_time);
         $model->online_time = strtotime($model->online_time);
         $model->end_time = strtotime($model->end_time);
         if ($model->save()) {
             $this->go('<strong>合同添加成功</strong>', $_POST['return_url'], 'success');
         }
     }
     $this->render('create', array('model' => $model, 'upload' => $upload, 'biz' => $biz));
 }
Beispiel #5
0
<?php

echo $form->textFieldRow($model, 'title', array('class' => 'span10'));
?>
        
<?php 
echo $form->textFieldRow($model, 'short_title');
?>

<?php 
echo $form->textFieldRow($model, 'sms_title');
?>

<?php 
echo $form->dropDownListRow($model, 'contract_id', ARContract::myContracts(), array('prompt' => '请选择', 'ajax' => array('type' => 'POST', 'url' => $this->createUrl('ajax/biz'), 'update' => '#ARGroupon_biz_id', 'data' => array('contract_id' => 'js:$("#ARGroupon_contract_id").val()'))));
echo $form->dropDownListRow($model, 'biz_id', ARBiz::myBiz($model->biz_id), array('prompt' => '请选择'));
?>


<?php 
echo $form->fileFieldRow($model, 'image');
echo $form->textFieldRow($model, 'sort', array('class' => 'span1'));