Ejemplo n.º 1
0
 public function actionAddLesson()
 {
     $this->_seoTitle = '名师 - 增加课程';
     $model = new Lesson();
     if (isset($_POST['Lesson'])) {
         $model->attributes = $_POST['Lesson'];
         $model->teacher_id = $this->_user['masterId'];
         if ($model->validate()) {
             $file = XUpload::upload($_FILES['attach']);
             if (is_array($file)) {
                 $model->pic = $file['pathname'];
                 @unlink($_POST['oAttach']);
                 @unlink($_POST['oThumb']);
             }
         }
         if ($model->save()) {
             $this->redirect(array('mylesson'));
         }
     }
     $this->render('addlesson', array('model' => $model));
 }