src/AppBundle/Controller/Testpaper/TestpaperController.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Testpaper;
use Biz\Task\Service\TaskService;
use Biz\Testpaper\TestpaperException;
use Biz\User\Service\UserService;
use AppBundle\Common\ArrayToolkit;
use Biz\Course\Service\CourseService;
use Biz\System\Service\SettingService;
use AppBundle\Controller\BaseController;
use Topxia\Service\Common\ServiceKernel;
use Biz\Activity\Service\ActivityService;
use Biz\Question\Service\QuestionService;
use Biz\Testpaper\Service\TestpaperService;
use Symfony\Component\HttpFoundation\Request;
use Biz\Activity\Service\TestpaperActivityService;
use AppBundle\Common\Exception\AccessDeniedException;
class TestpaperController extends BaseController
{
//由于学习引擎改造,这里的 lessonId 等于 activityId
public function doTestpaperAction(Request $request, $testId, $lessonId)
{
$user = $this->getUser();
$testpaper = $this->getTestpaperService()->getTestpaperByIdAndType($testId, 'testpaper');
if (empty($testpaper)) {
$this->createNewException(TestpaperException::NOTFOUND_TESTPAPER());
}
if ('draft' === $testpaper['status']) {
return $this->createMessageResponse('info', $this->getServiceKernel()->trans('该试卷未发布,如有疑问请联系老师!'));
}
if ('closed' === $testpaper['status']) {
return $this->createMessageResponse('info', $this->getServiceKernel()->trans('该试卷已关闭,如有疑问请联系老师!'));
}
$result = $this->testpaperActivityCheck($lessonId, $testpaper);
if (!$result['result']) {
return $this->createMessageResponse('info', $result['message']);
}
$fields = $this->getTestpaperFields($lessonId);
$testpaperResult = $this->getTestpaperService()->startTestpaper($testpaper['id'], $fields);
if ('doing' === $testpaperResult['status']) {
return $this->redirect($this->generateUrl('testpaper_show', array('resultId' => $testpaperResult['id'])));
}
return $this->redirect(
$this->generateUrl('testpaper_result_show', array('resultId' => $testpaperResult['id']))
);
}
public function doTestAction(Request $request, $resultId)
{
$testpaperResult = $this->getTestpaperService()->getTestpaperResult($resultId);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。