本文整理汇总了PHP中ExerciseLib::get_exercise_track_exercise_info方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::get_exercise_track_exercise_info方法的具体用法?PHP ExerciseLib::get_exercise_track_exercise_info怎么用?PHP ExerciseLib::get_exercise_track_exercise_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExerciseLib
的用法示例。
在下文中一共展示了ExerciseLib::get_exercise_track_exercise_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_not_allowed
break;
case 'csv':
default:
$export->exportCompleteReportCSV($documentPath, null, $loadExtraData, null, $_GET['exerciseId']);
exit;
break;
}
} else {
api_not_allowed(true);
}
}
//Send student email @todo move this code in a class, library
if (isset($_REQUEST['comments']) && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor || $allowCoachFeedbackExercises)) {
//filtered by post-condition
$id = intval($_GET['exeid']);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed();
}
$test = $track_exercise_info['title'];
$student_id = $track_exercise_info['exe_user_id'];
$session_id = $track_exercise_info['session_id'];
$lp_id = $track_exercise_info['orig_lp_id'];
//$lp_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$course_info = api_get_course_info();
// Teacher data
$teacher_info = api_get_user_info(api_get_user_id());
$from_name = api_get_person_name($teacher_info['firstname'], $teacher_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?id=' . $track_exercise_info['exe_id'] . '&' . api_get_cidreq() . '&show_headers=1&id_session=' . $session_id;
$my_post_info = array();
示例2: 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'];
//.........这里部分代码省略.........
示例3: get_exercise_result
/**
* Returns the exercise result
* @param int attempt id
* @return float exercise result
*/
public function get_exercise_result($exe_id)
{
$result = array();
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($exe_id);
if (!empty($track_exercise_info)) {
$totalScore = 0;
$objExercise = new Exercise();
$objExercise->read($track_exercise_info['exe_exo_id']);
if (!empty($track_exercise_info['data_tracking'])) {
$question_list = explode(',', $track_exercise_info['data_tracking']);
}
foreach ($question_list as $questionId) {
$question_result = $objExercise->manage_answer($exe_id, $questionId, '', 'exercise_show', array(), false, true, false, $objExercise->selectPropagateNeg());
$totalScore += $question_result['score'];
}
if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) {
$totalScore = 0;
}
$result = array('score' => $totalScore, 'weight' => $track_exercise_info['exe_weighting']);
}
return $result;
}
示例4: intval
<?php
/* For licensing terms, see /license.txt */
/**
* This file generates the ActionScript variables code used by the
* HotSpot .swf
* @package chamilo.exercise
* @author Toon Keppens, Julio Montoya adding hotspot "medical" support
*/
include '../inc/global.inc.php';
// Set vars
$questionId = intval($_GET['modifyAnswers']);
$exe_id = intval($_GET['exe_id']);
$objQuestion = Question::read($questionId);
$trackExerciseInfo = ExerciseLib::get_exercise_track_exercise_info($exe_id);
$objExercise = new Exercise(api_get_course_int_id());
$objExercise->read($trackExerciseInfo['exe_exo_id']);
$em = Database::getManager();
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
$picturePath = $documentPath . '/images';
$pictureName = $objQuestion->selectPicture();
$pictureSize = getimagesize($picturePath . '/' . $objQuestion->selectPicture());
$pictureWidth = $pictureSize[0];
$pictureHeight = $pictureSize[1];
$course_id = api_get_course_int_id();
// Init
$data = [];
$data['type'] = 'solution';
$data['lang'] = ['Square' => get_lang('Square'), 'Ellipse' => get_lang('Ellipse'), 'Polygon' => get_lang('Polygon'), 'HotspotStatus1' => get_lang('HotspotStatus1'), 'HotspotStatus2Polygon' => get_lang('HotspotStatus2Polygon'), 'HotspotStatus2Other' => get_lang('HotspotStatus2Other'), 'HotspotStatus3' => get_lang('HotspotStatus3'), 'HotspotShowUserPoints' => get_lang('HotspotShowUserPoints'), 'ShowHotspots' => get_lang('ShowHotspots'), 'Triesleft' => get_lang('Triesleft'), 'HotspotExerciseFinished' => get_lang('HotspotExerciseFinished'), 'NextAnswer' => get_lang('NextAnswer'), 'Delineation' => get_lang('Delineation'), 'CloseDelineation' => get_lang('CloseDelineation'), 'Oar' => get_lang('Oar'), 'ClosePolygon' => get_lang('ClosePolygon'), 'DelineationStatus1' => get_lang('DelineationStatus1')];
$data['image'] = $objQuestion->selectPicturePath();
$data['image_width'] = $pictureWidth;