本文整理汇总了PHP中ExerciseLib::getExerciseResult方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::getExerciseResult方法的具体用法?PHP ExerciseLib::getExerciseResult怎么用?PHP ExerciseLib::getExerciseResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExerciseLib
的用法示例。
在下文中一共展示了ExerciseLib::getExerciseResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scoreAttemptAction
/**
* @Route("/score-attempt/{exeId}/jury/{juryId}")
* @Method({"GET"})
*/
public function scoreAttemptAction($exeId, $juryId)
{
$userId = $this->getUser()->getUserId();
$trackExercise = \ExerciseLib::get_exercise_track_exercise_info($exeId);
if (empty($trackExercise)) {
$this->createNotFoundException();
}
/** @var \Chamilo\CoreBundle\Entity\Jury $jury */
$jury = $this->getRepository()->find($juryId);
if (empty($jury)) {
$this->createNotFoundException('Jury does not exists');
}
if ($jury->getExerciseId() != $trackExercise['exe_exo_id']) {
$this->createNotFoundException('Exercise attempt is not related with this jury.');
}
$members = $jury->getMembers();
$criteria = Criteria::create()->where(Criteria::expr()->eq("userId", $userId))->setFirstResult(0)->setMaxResults(1);
/** @var JuryMembers $member */
$member = $members->matching($criteria)->first();
if (empty($member)) {
$this->createNotFoundException('You are not part of the jury.');
}
$students = $member->getStudents();
$criteria = Criteria::create()->where(Criteria::expr()->eq("userId", $trackExercise['exe_user_id']))->setFirstResult(0)->setMaxResults(1);
/** @var JuryMembers $member */
$student = $students->matching($criteria)->first();
if (empty($student)) {
$this->createNotFoundException('You are not assigned to this user.');
}
// Setting member only for president.
if ($this->isGranted('ROLE_JURY_PRESIDENT')) {
// Relating user with president
if ($member) {
$this->getManager()->getRepository('Chamilo\\CoreBundle\\Entity\\JuryMembers')->assignUserToJuryMember($trackExercise['exe_user_id'], $member->getId());
}
}
$questionScoreTypeModel = array();
$criteria = array('exeId' => $exeId, 'juryUserId' => $userId);
$trackJury = $this->getManager()->getRepository('Chamilo\\CoreBundle\\Entity\\TrackAttemptJury')->findBy($criteria);
if ($trackJury) {
$this->get('session')->getFlashBag()->add('info', "You already review this exercise attempt.");
/** @var TrackAttemptJury $track */
foreach ($trackJury as $track) {
$questionScoreTypeModel[$track->getQuestionId()] = $track->getQuestionScoreNameId();
}
}
$questionList = explode(',', $trackExercise['data_tracking']);
$exerciseResult = \ExerciseLib::getExerciseResult($trackExercise);
$counter = 1;
$objExercise = new \Exercise($trackExercise['c_id']);
$objExercise->read($trackExercise['exe_exo_id']);
$totalScore = $totalWeighting = 0;
$show_media = true;
$tempParentId = null;
$mediaCounter = 0;
$media_list = array();
$modelType = $objExercise->getScoreTypeModel();
$options = array();
if ($modelType) {
/** @var \Chamilo\CoreBundle\Entity\QuestionScore $questionScoreName */
$questionScore = $this->get('orm.em')->getRepository('Chamilo\\CoreBundle\\Entity\\QuestionScore')->find($modelType);
if ($questionScore) {
$items = $questionScore->getItems();
/** @var \Chamilo\CoreBundle\Entity\QuestionScoreName $score */
foreach ($items as $score) {
$options[$score->getId() . ':' . $score->getScore()] = $score;
}
}
} else {
return $this->createNotFoundException('The exercise does not contain a model type.');
}
$exerciseContent = null;
foreach ($questionList as $questionId) {
ob_start();
$choice = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : null;
// Creates a temporary Question object
/** @var \Question $objQuestionTmp */
$objQuestionTmp = \Question::read($questionId);
if ($objQuestionTmp->parent_id != 0) {
if (!in_array($objQuestionTmp->parent_id, $media_list)) {
$media_list[] = $objQuestionTmp->parent_id;
$show_media = true;
}
if ($tempParentId == $objQuestionTmp->parent_id) {
$mediaCounter++;
} else {
$mediaCounter = 0;
}
$counterToShow = chr(97 + $mediaCounter);
$tempParentId = $objQuestionTmp->parent_id;
}
$questionWeighting = $objQuestionTmp->selectWeighting();
$answerType = $objQuestionTmp->selectType();
$question_result = $objExercise->manageAnswers($exeId, $questionId, $choice, 'exercise_show', array(), false, true, true);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
//.........这里部分代码省略.........