예제 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Port();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Port'])) {
         $model->attributes = $_POST['Port'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
 public function actionAddInfo()
 {
     $port = new Port();
     $port->name = $_POST['title'];
     $port->description = $_POST['description'];
     $port->save();
     $this->redirect(Yii::app()->request->urlReferrer);
     //                        echo CJSON::encode(array('title'=>$_POST['title'], 'area'=>$_POST['area'], 'port'=>$_POST['port']));//Yii 的方法将数组处理成json数据
 }
예제 #3
0
 public function actionAdd_port()
 {
     $port = new Port();
     $port->name = $_POST['title'];
     $port->area = $_POST['area'];
     $port->description = $_POST['content'];
     if (isset($_POST['source'])) {
         /*
                                         $t = explode(',', $_POST['source']);
         				$id = '';
                                         foreach($t as $a)
                                         {
                                                 if($a != '')
                                                 {
                                                         $source = new Source;
                                                         $source->source = $a;
                                                         $source->save();
                                                         $id .= $source->id.','; 
                                                 }
         				
                                         }
         */
         $port->source = $_POST['source'];
     }
     if (isset($_POST['thumb'])) {
         /*
         $t = explode(',', $_POST['thumb']);
         $id = '';
         foreach($t as $a)
         {
         	if($a != '')
         	{
         		$thumb = new Thumb;
         		$thumb->thumb = $a;
         		$thumb->save();
         		$id .= $thumb->id.',';	
         	}
         }
         */
         $port->thumb = $_POST['thumb'];
     }
     $port->save();
     echo 1;
 }