Author: Jiulong Zhang (kowloon29320@163.com)
Inheritance: extends DBGrouponContract
Esempio n. 1
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));
 }
Esempio n. 2
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'));