本文整理汇总了PHP中Lesson::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Lesson::getId方法的具体用法?PHP Lesson::getId怎么用?PHP Lesson::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lesson
的用法示例。
在下文中一共展示了Lesson::getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLesson
function addLesson($lesson_title, $lesson_parent_id = 0)
{
$lesson_object = new Lesson();
$lesson_object->setTitle($lesson_title)->setIsRoot(!$lesson_parent_id)->save();
if ($lesson_parent_id) {
$lesson_parent_object = new LessonParent();
$lesson_parent_object->setLessonId($lesson_object->getId())->setParentId($lesson_parent_id)->save();
}
return $lesson_object->getId();
}
示例2: 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);
}
示例3: deleteLesson
/**
*
* @param Lesson $lesson
* @param bool $keep
*/
public function deleteLesson(Lesson $lesson, $keep)
{
if ($keep) {
//TODO: not working!
$unsorted_lesson = $this->getLessonByName("Unsortiert");
$query = "UPDATE vocables SET lesson=" . $unsorted_lesson->getId() . " WHERE lesson=" . $lesson->getId();
$this->pdo->exec("UPDATE vocables SET lesson=" . $unsorted_lesson->getId() . " WHERE lesson=" . $lesson->getId());
} else {
$this->pdo->exec("DELETE FROM lessons WHERE lesson=" . $lesson->getId());
}
$this->pdo->exec("DELETE FROM lessons WHERE id=" . $lesson->getId());
}