本文整理汇总了PHP中Lesson::getNewestLesson方法的典型用法代码示例。如果您正苦于以下问题:PHP Lesson::getNewestLesson方法的具体用法?PHP Lesson::getNewestLesson怎么用?PHP Lesson::getNewestLesson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lesson
的用法示例。
在下文中一共展示了Lesson::getNewestLesson方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveNewLesson
public function saveNewLesson()
{
if (!isset($_POST['nameEN']) || empty($_POST['nameEN']) || !isset($_POST['nameDE']) || empty($_POST['nameDE']) || !isset($_POST['points']) || empty($_POST['points'])) {
$this->getView()->addErrorMessage('Please fill out all fields!');
$this->addLesson();
} else {
$courseId = $this->secureString($_GET['id']);
$nameEN = $this->secureString($_POST['nameEN']);
$nameDE = $this->secureString($_POST['nameDE']);
$points = $this->secureString($_POST['points']);
if (Lesson::createLesson($courseId, $nameEN, $nameDE, $points)) {
$this->getView()->addSuccessMessage('Lesson was successfully added.');
} else {
$this->getView()->addErrorMessage('Lesson could not be added!');
}
$this->defaultAction();
// create default tutorial page
$newLesson = Lesson::getNewestLesson($courseId);
$lessonId = $newLesson->getId();
$filePath = PAGE_DIR . "lessons/{$courseId}-{$lessonId}.html";
FileFunctions::createFile($filePath, "New lesson <strong>" . $newLesson->getName('en') . "</strong>");
}
}