src/AppBundle/Controller/Course/ChapterManageController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Course;
use Biz\Course\Service\CourseService;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Controller\BaseController;
class ChapterManageController extends BaseController
{
public function manageAction(Request $request, $courseId)
{
$course = $this->getCourseService()->tryManageCourse($courseId);
$chapterId = $request->query->get('chapterId', 0);
$chapter = $this->getCourseService()->getChapter($courseId, $chapterId);
if ('POST' == $request->getMethod()) {
$fields = $request->request->all();
$chapter = empty($chapter) ? $this->create($fields, $courseId) : $this->editor($chapterId, $courseId, $fields);
return $this->render('lesson-manage/chapter/item.html.twig', array(
'course' => $course,
'chapter' => $chapter,
));
}
$type = $request->query->get('type', 'chapter');
return $this->render('lesson-manage/chapter/modal.html.twig', array(
'course' => $course,
'type' => $type,
'chapter' => $chapter,
));
}
protected function editor($chapterId, $courseId, $fields)
{
return $this->getCourseService()->updateChapter($courseId, $chapterId, array('title' => $fields['title']));
}
protected function create($chapter, $courseId)
{
$chapter['courseId'] = $courseId;
return $this->getCourseService()->createChapter($chapter);
}
public function deleteAction(Request $request, $courseId, $chapterId)
{
$this->getCourseService()->deleteChapter($courseId, $chapterId);
return $this->createJsonResponse(array('success' => true));
}
public function publishAction(Request $request, $courseId, $chapterId)
{
$this->getCourseService()->tryManageCourse($courseId);
$this->getCourseService()->publishChapter($chapterId);
return $this->createJsonResponse(array('success' => true));
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。