/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Interview();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Interview'])) {
         $model->attributes = $_POST['Interview'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Exemple #2
0
 /**
  * 分配被试到面询专家
  */
 public static function allocExaminees($data, $interviewer_id)
 {
     try {
         $manager = new TxManager();
         $transaction = $manager->get();
         foreach ($data as $value) {
             $interview = new Interview();
             $interview->setTransaction($transaction);
             $interview->manager_id = $interviewer_id;
             $interview->examinee_id = $value['id'];
             if ($interview->save() == false) {
                 $transaction->rollback("数据插入失败");
             }
         }
         $transaction->commit();
         return true;
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }