当前位置: 首页>>代码示例>>PHP>>正文


PHP Lesson::save方法代码示例

本文整理汇总了PHP中Lesson::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Lesson::save方法的具体用法?PHP Lesson::save怎么用?PHP Lesson::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lesson的用法示例。


在下文中一共展示了Lesson::save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Lesson();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Lesson'])) {
         $model->attributes = $_POST['Lesson'];
         if ($model->save()) {
             Yii::app()->user->setFlash('info', '<span class="single-name">' . $model->singleName() . '</span> <b>' . $model->name . '</b> ' . Yii::app()->params['postActions'][Yii::app()->controller->action->id] . '!');
             $this->redirect(array('/lesson'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:BigMacckk,项目名称:kepsch,代码行数:18,代码来源:LessonController.php

示例2: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl();
     $model = new Lesson();
     if (isset($_POST['Lesson'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Lesson'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('lesson_create', array('model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:18,代码来源:LessonController.php

示例3: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl();
     $model = new Lesson();
     if (isset($_POST['Lesson'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Lesson'];
         $model->teacher_id = 88888888;
         $model->check_status = 1;
         $model->actual_students = 0;
         $model->arrivals = 0;
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('lessonRecommend_create', array('model' => $model));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:22,代码来源:LessonRecommendController.php

示例4: testFind

 function testFind()
 {
     $name = "John Doe";
     $password = "password";
     $email = "johndoe@osa.biz";
     $signed_in = 0;
     $test_user = new User($name, $password, $email, $signed_in);
     $test_user->save();
     $course_title = "Literature";
     $subject = "English";
     $course_description = "Deconstructing English literature.";
     $user_id = $test_user->getId();
     $test_course = new Course($course_title, $subject, $course_description, $user_id);
     $test_course->save();
     $unit_title = "Into the Wild";
     $unit_description = "The life and death of Chris McCandless.";
     $course_id = $test_course->getId();
     $test_unit = new Unit($unit_title, $unit_description, $course_id);
     $test_unit->save();
     $lesson_title = "Into the Wild: Chapter 1";
     $objective = "Students will read and discuss Chapter 1";
     $materials = "Books, discussion packets, pencils";
     $body = "Lorem ipsum etc etc blah blah blah blah...";
     $unit_id = $test_unit->getId();
     $test_lesson = new Lesson($lesson_title, $objective, $materials, $body, $unit_id);
     $test_lesson->save();
     $lesson_title2 = "The Catcher in the Rye: Chapter 3";
     $objective2 = "Students will read and discuss Chapter 3";
     $materials2 = "Books, essay prompts, pens";
     $body2 = "Blah blah blah etc etc lorem ipsum...";
     $test_lesson2 = new Lesson($lesson_title2, $objective2, $materials2, $body, $unit_id);
     $test_lesson2->save();
     $result = Lesson::find($test_lesson->getId());
     $this->assertEquals($test_lesson, $result);
 }
开发者ID:kylepratuch,项目名称:EdBuilder,代码行数:35,代码来源:LessonTest.php

示例5: actionYoukuPlayList

 /**
  * 一次性导入优酷视频
  * Enter description here ...
  * @param unknown_type $courseId
  */
 public function actionYoukuPlayList($courseId = 0)
 {
     if (isset($_POST['url'])) {
         $url = $_POST['url'];
         //			$output = Yii::app()->curl->get($_POST['url']);
         //			$partern = "";
         Yii::import('ext.SimpleHTMLDOM.SimpleHTMLDOM');
         // Create DOM from URL or file
         $simpleHTML = new SimpleHTMLDOM();
         $html = $simpleHTML->file_get_html($url);
         $urlDict = array('playlist' => array('pattern' => "/\\/playlist_show\\/id_/i", 'selector' => '#list1_1 .items  li.v_title a'), 'episode' => array('pattern' => "/\\/show_page\\/id_/i", 'selector' => '#episode li.ititle_w a'));
         foreach ($urlDict as $key => $item) {
             if (preg_match($item['pattern'], $url)) {
                 $type = $key;
                 $selector = $item['selector'];
                 break;
             }
         }
         // Find all images
         foreach ($html->find($selector) as $elem) {
             $lesson = new Lesson();
             $lesson->courseId = $courseId;
             $lesson->title = $elem->getAttribute("title") ? $elem->getAttribute("title") : $elem->innertext;
             $pattern = "/id_(.*)\\/?\\.html/i";
             preg_match($pattern, $elem->href, $matches);
             if ($matches[1]) {
                 //		http://player.youku.com/player.php/sid/XNTk5MTQ3OTQ0/v.swf
                 $lesson->url = "http://player.youku.com/player.php/sid/{$matches['1']}/v.swf";
             } else {
                 continue;
             }
             $lesson->addTime = time();
             $lesson->save();
         }
         $this->redirect(array('lesson/editByCourse', 'courseId' => $courseId));
         Yii::app()->end();
     }
     $course = Course::model()->findByPk($courseId);
     $this->renderPartial("youkuPlayList", array('course' => $course), false, true);
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:45,代码来源:NoteController.php

示例6: foreach

    $unit = Unit::find($unit_id);
    $course = Course::find($course_id);
    //Deleting a unit should also delete orphaned lessons
    $lessons = $unit->getLessons();
    foreach ($lessons as $lesson) {
        $lesson->delete();
    }
    $unit->delete();
    $course_units = $course->getUnits();
    $user_id = $course->getUserId();
    return $app['twig']->render("course.html.twig", array('course' => Course::find($course_id), 'units' => $course_units, 'user' => User::find($user_id)));
});
//Add a lesson
$app->post("/add_lesson/{course_id}/{unit_id}", function ($course_id, $unit_id) use($app) {
    $new_lesson = new Lesson($_POST['lesson_title'], $_POST['lesson_objective'], $_POST['lesson_materials'], $_POST['lesson_body'], $unit_id);
    $new_lesson->save();
    $unit = Unit::find($unit_id);
    $course = Course::find($course_id);
    $user_id = $course->getUserId();
    return $app['twig']->render("unit.html.twig", array('unit' => $unit, 'lessons' => $unit->getLessons(), 'course' => $course, 'user' => User::find($user_id)));
});
//================= Lesson Routes ===============
//Show lesson
$app->get("/show_lesson/{id}", function ($id) use($app) {
    $lesson = Lesson::find($id);
    $unit_id = $lesson->getUnitId();
    $unit = Unit::find($unit_id);
    $course_id = $unit->getCourseId();
    $course = Course::find($course_id);
    $user_id = $course->getUserId();
    return $app['twig']->render("lesson.html.twig", array('lesson' => $lesson, 'unit' => $unit, 'course' => $course, 'user' => User::find($user_id)));
开发者ID:kylepratuch,项目名称:EdBuilder,代码行数:31,代码来源:app.php

示例7: actionAddLesson

 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));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:21,代码来源:DefaultController.php

示例8: actionCreateMany

 public function actionCreateMany($courseId)
 {
     $course = $this->loadCourse($courseId);
     if (isset($_POST['playList'])) {
         Yii::import('ext.videolink.VideoList');
         $videolist = new VideoList();
         $videos = $videolist->parse($_POST['playList']);
         $result = false;
         foreach ($videos as $item) {
             $mediaLink = new MediaLink();
             $mediaLink->title = $item['title'];
             $mediaLink->url = $item['url'];
             if ($mediaLink->save()) {
                 $lesson = new Lesson();
                 $lesson->title = $mediaLink->title ? $mediaLink->title : Yii::t('app', "未设置");
                 $lesson->mediaType = "link";
                 $lesson->mediaId = $mediaLink->id;
                 $lesson->courseId = $courseId;
                 $result = $lesson->save();
             }
         }
         if ($result) {
             Yii::app()->user->setFlash('success', Yii::t('app', '操作成功!'));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('app', '操作失败!'));
         }
     }
     $this->layout = "/layouts/nonav_column1";
     $this->render('create_many_fancy', array('course' => $course));
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:30,代码来源:LessonController.php


注:本文中的Lesson::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。