src/AppBundle/Controller/Course/CourseSetController.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Course;
use AppBundle\Common\Paginator;
use Biz\Course\CourseException;
use Biz\Task\Service\TaskService;
use AppBundle\Common\ArrayToolkit;
use Biz\Taxonomy\Service\TagService;
use Biz\Course\Service\CourseService;
use AppBundle\Controller\BaseController;
use Biz\Course\Service\CourseSetService;
use Biz\Taxonomy\Service\CategoryService;
use Symfony\Component\HttpFoundation\Request;
class CourseSetController extends BaseController
{
public function showAction(Request $request, $id)
{
$courseSet = $this->getCourseSetService()->getCourseSet($id);
$course = $this->getCourseService()->getCourse($courseSet['defaultCourseId']);
$previewAs = $request->query->get('previewAs');
if (empty($course)) {
$this->createNewException(CourseException::NOTFOUND_COURSE());
}
$this->getCourseSetService()->hitCourseSet($id);
return $this->redirect($this->generateUrl('course_show', array('id' => $course['id'], 'previewAs' => $previewAs)));
}
public function courseSetsBlockAction(array $courseSets, $view = 'list', $mode = 'default')
{
$userIds = array();
$service = $this->getCourseService();
$courseSets = array_map(function ($set) use (&$userIds, $service) {
$set['course'] = $service->getFirstPublishedCourseByCourseSetId($set['id']);
if (!empty($set['course']['teacherIds']) && is_array($set['course']['teacherIds'])) {
$userIds = array_merge($userIds, $set['course']['teacherIds']);
}
return $set;
}, $courseSets);
$users = $this->getUserService()->findUsersByIds($userIds);
return $this->render("course-set/block/course-block-{$view}.html.twig", array(
'courseSets' => $courseSets,
'users' => $users,
'mode' => $mode,
));
}
public function favoriteAction($id)
{
$success = $this->getCourseSetService()->favorite($id);
return $this->createJsonResponse($success);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。