本文整理汇总了PHP中ExerciseLib::show_score方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::show_score方法的具体用法?PHP ExerciseLib::show_score怎么用?PHP ExerciseLib::show_score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExerciseLib
的用法示例。
在下文中一共展示了ExerciseLib::show_score方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_stats_table_by_attempt
/**
* Returns a category summary report
* @params int exercise id
* @params array pre filled array with the category_id, score, and weight
* example: array(1 => array('score' => '10', 'total' => 20));
*/
public static function get_stats_table_by_attempt($exercise_id, $category_list = array())
{
if (empty($category_list)) {
return null;
}
$category_name_list = TestCategory::getListOfCategoriesNameForTest($exercise_id);
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('Categories'));
$table->setHeaderContents(0, 1, get_lang('AbsoluteScore'));
$table->setHeaderContents(0, 2, get_lang('RelativeScore'));
$row = 1;
$none_category = array();
if (isset($category_list['none'])) {
$none_category = $category_list['none'];
unset($category_list['none']);
}
$total = array();
if (isset($category_list['total'])) {
$total = $category_list['total'];
unset($category_list['total']);
}
if (count($category_list) > 1) {
foreach ($category_list as $category_id => $category_item) {
$table->setCellContents($row, 0, $category_name_list[$category_id]);
$table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
$row++;
}
if (!empty($none_category)) {
$table->setCellContents($row, 0, get_lang('None'));
$table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
$row++;
}
if (!empty($total)) {
$table->setCellContents($row, 0, get_lang('Total'));
$table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
}
return $table->toHtml();
}
return null;
}
示例2: get_stats_table_by_attempt
/**
* Returns a category summary report
*
* @param int exercise id
* @param array prefilled array with the category_id, score, and weight example: array(1 => array('score' => '10', 'total' => 20));
* @param bool $categoryMinusOne shows category - 1 see BT#6540
* @return string
*/
public static function get_stats_table_by_attempt($exercise_id, $category_list = array(), $categoryMinusOne = false)
{
if (empty($category_list)) {
return null;
}
$category_name_list = Testcategory::getListOfCategoriesNameForTest($exercise_id, false);
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('Categories'));
$table->setHeaderContents(0, 1, get_lang('AbsoluteScore'));
$table->setHeaderContents(0, 2, get_lang('RelativeScore'));
$row = 1;
$none_category = array();
if (isset($category_list['none'])) {
$none_category = $category_list['none'];
unset($category_list['none']);
}
$total = array();
if (isset($category_list['total'])) {
$total = $category_list['total'];
unset($category_list['total']);
}
$em = Database::getManager();
$repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory');
$redefineCategoryList = array();
if (!empty($category_list) && count($category_list) > 1) {
$globalCategoryScore = array();
foreach ($category_list as $category_id => $category_item) {
$cat = $em->find('ChamiloCoreBundle:CQuizCategory', $category_id);
$path = $repo->getPath($cat);
$categoryName = $category_name_list[$category_id];
$index = 0;
if ($categoryMinusOne) {
$index = 1;
}
if (isset($path[$index])) {
$category_id = $path[$index]->getIid();
$categoryName = $path[$index]->getTitle();
}
if (!isset($globalCategoryScore[$category_id])) {
$globalCategoryScore[$category_id] = array();
$globalCategoryScore[$category_id]['score'] = 0;
$globalCategoryScore[$category_id]['total'] = 0;
$globalCategoryScore[$category_id]['title'] = '';
}
$globalCategoryScore[$category_id]['score'] += $category_item['score'];
$globalCategoryScore[$category_id]['total'] += $category_item['total'];
$globalCategoryScore[$category_id]['title'] = $categoryName;
}
foreach ($globalCategoryScore as $category_item) {
$table->setCellContents($row, 0, $category_item['title']);
$table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
$class = 'class="row_odd"';
if ($row % 2) {
$class = 'class="row_even"';
}
$table->setRowAttributes($row, $class, true);
$row++;
}
if (!empty($none_category)) {
$table->setCellContents($row, 0, get_lang('None'));
$table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
$row++;
}
if (!empty($total)) {
$table->setCellContents($row, 0, get_lang('Total'));
$table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
$table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
$table->setRowAttributes($row, 'class="row_total"', true);
}
return $table->toHtml();
}
return null;
}
示例3: array
if (!isset($category_list['none']['score'])) {
$category_list['none']['score'] = 0;
}
if (!isset($category_list['none']['total'])) {
$category_list['none']['total'] = 0;
}
if ($category_was_added_for_this_test == false) {
$category_list['none']['score'] += $my_total_score;
$category_list['none']['total'] += $my_total_weight;
}
if ($objExercise->selectPropagateNeg() == 0 && $my_total_score < 0) {
$my_total_score = 0;
}
$score = array();
if ($show_results) {
$score['result'] = get_lang('Score') . " : " . ExerciseLib::show_score($my_total_score, $my_total_weight, false, false);
$score['pass'] = $my_total_score >= $my_total_weight ? true : false;
$score['type'] = $answerType;
$score['score'] = $my_total_score;
$score['weight'] = $my_total_weight;
$score['comments'] = isset($comnt) ? $comnt : null;
}
unset($objAnswerTmp);
$i++;
$contents = ob_get_clean();
$question_content = '<div class="question_row">';
if ($show_results) {
//Shows question title an description
$question_content .= $objQuestionTmp->return_header(null, $counter, $score);
}
$counter++;
示例4: show_course_detail
/**
* Shows the user detail progress (when clicking in the details link)
* @param int $user_id
* @param string $course_code
* @param int $session_id
* @return string html code
*/
public static function show_course_detail($user_id, $course_code, $session_id)
{
$html = '';
if (isset($course_code)) {
$user_id = intval($user_id);
$session_id = intval($session_id);
$course = Database::escape_string($course_code);
$course_info = CourseManager::get_course_information($course);
$html .= Display::page_subheader($course_info['title']);
$html .= '<table class="data_table" width="100%">';
//Course details
$html .= '
<tr>
<th class="head" style="color:#000">' . get_lang('Exercises') . '</th>
<th class="head" style="color:#000">' . get_lang('Attempts') . '</th>
<th class="head" style="color:#000">' . get_lang('BestAttempt') . '</th>
<th class="head" style="color:#000">' . get_lang('Ranking') . '</th>
<th class="head" style="color:#000">' . get_lang('BestResultInCourse') . '</th>
<th class="head" style="color:#000">' . get_lang('Statistics') . ' ' . Display::return_icon('info3.gif', get_lang('OnlyBestResultsPerStudent'), array('align' => 'absmiddle', 'hspace' => '3px')) . '</th>
</tr>';
if (empty($session_id)) {
$user_list = CourseManager::get_user_list_from_course_code($course, $session_id, null, null, STUDENT);
} else {
$user_list = CourseManager::get_user_list_from_course_code($course, $session_id, null, null, 0);
}
// Show exercise results of invisible exercises? see BT#4091
$exercise_list = ExerciseLib::get_all_exercises($course_info, $session_id, false, null, false, 2);
$to_graph_exercise_result = array();
if (!empty($exercise_list)) {
$score = $weighting = $exe_id = 0;
foreach ($exercise_list as $exercices) {
$exercise_obj = new Exercise($course_info['real_id']);
$exercise_obj->read($exercices['id']);
$visible_return = $exercise_obj->is_visible();
$score = $weighting = $attempts = 0;
// Getting count of attempts by user
$attempts = Event::count_exercise_attempts_by_user(api_get_user_id(), $exercices['id'], $course_info['real_id'], $session_id);
$html .= '<tr class="row_even">';
$url = api_get_path(WEB_CODE_PATH) . "exercice/overview.php?cidReq={$course_info['code']}&id_session={$session_id}&exerciseId={$exercices['id']}";
if ($visible_return['value'] == true) {
$exercices['title'] = Display::url($exercices['title'], $url, array('target' => SESSION_LINK_TARGET));
}
$html .= Display::tag('td', $exercices['title']);
// Exercise configuration show results or show only score
if ($exercices['results_disabled'] == 0 || $exercices['results_disabled'] == 2) {
//For graphics
$best_exercise_stats = Event::get_best_exercise_results_by_user($exercices['id'], $course_info['real_id'], $session_id);
$to_graph_exercise_result[$exercices['id']] = array('title' => $exercices['title'], 'data' => $best_exercise_stats);
$latest_attempt_url = '';
$best_score = $position = $percentage_score_result = '-';
$graph = $normal_graph = null;
// Getting best results
$best_score_data = ExerciseLib::get_best_attempt_in_course($exercices['id'], $course_info['real_id'], $session_id);
$best_score = '';
if (!empty($best_score_data)) {
$best_score = ExerciseLib::show_score($best_score_data['exe_result'], $best_score_data['exe_weighting']);
}
if ($attempts > 0) {
$exercise_stat = ExerciseLib::get_best_attempt_by_user(api_get_user_id(), $exercices['id'], $course_info['real_id'], $session_id);
if (!empty($exercise_stat)) {
//Always getting the BEST attempt
$score = $exercise_stat['exe_result'];
$weighting = $exercise_stat['exe_weighting'];
$exe_id = $exercise_stat['exe_id'];
$latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercice/result.php?id=' . $exe_id . '&cidReq=' . $course_info['code'] . '&show_headers=1&id_session=' . $session_id;
$percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url);
$my_score = 0;
if (!empty($weighting) && intval($weighting) != 0) {
$my_score = $score / $weighting;
}
//@todo this function slows the page
$position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list);
$graph = self::generate_exercise_result_thumbnail_graph($to_graph_exercise_result[$exercices['id']]);
$normal_graph = self::generate_exercise_result_graph($to_graph_exercise_result[$exercices['id']]);
}
}
$html .= Display::div($normal_graph, array('id' => 'main_graph_' . $exercices['id'], 'class' => 'dialog', 'style' => 'display:none'));
if (empty($graph)) {
$graph = '-';
} else {
$graph = Display::url('<img src="' . $graph . '" >', $normal_graph, array('id' => $exercices['id'], 'class' => 'expand-image'));
}
$html .= Display::tag('td', $attempts, array('align' => 'center'));
$html .= Display::tag('td', $percentage_score_result, array('align' => 'center'));
$html .= Display::tag('td', $position, array('align' => 'center'));
$html .= Display::tag('td', $best_score, array('align' => 'center'));
$html .= Display::tag('td', $graph, array('align' => 'center'));
//$html .= Display::tag('td', $latest_attempt_url, array('align'=>'center', 'width'=>'25'));
} else {
// Exercise configuration NO results
$html .= Display::tag('td', $attempts, array('align' => 'center'));
$html .= Display::tag('td', '-', array('align' => 'center'));
$html .= Display::tag('td', '-', array('align' => 'center'));
//.........这里部分代码省略.........
示例5: sprintf
if ($row['start_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($row['start_time']));
}
if ($row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time']));
}
}
}
} else {
//Normal behaviour
//Show results
if ($my_result_disabled == 0 || $my_result_disabled == 2) {
if ($num > 0) {
$row_track = Database::fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt') . ' : ';
$attempt_text .= ExerciseLib::show_score($row_track['exe_result'], $row_track['exe_weighting']);
} else {
$attempt_text = get_lang('NotAttempted');
}
} else {
$attempt_text = get_lang('CantShowResults');
}
}
$class_tip = '';
if (empty($num)) {
$num = '';
} else {
$class_tip = 'link_tooltip';
//@todo use sprintf and show the results validated by the teacher
if ($num == 1) {
$num = $num . ' ' . get_lang('Result');
示例6: get_question_ribbon
/**
* Returns an HTML ribbon to show on top of the exercise result, with
* colouring depending on the success or failure of the student
* @param $score
* @param $weight
* @param bool $check_pass_percentage
* @return string
*/
public function get_question_ribbon($score, $weight, $check_pass_percentage = false)
{
$eventMessage = null;
$ribbon = '<div class="question_row">';
$ribbon .= '<div class="ribbon">';
if ($check_pass_percentage) {
$is_success = ExerciseLib::is_success_exercise_result($score, $weight, $this->selectPassPercentage());
// Color the final test score if pass_percentage activated
$ribbon_total_success_or_error = "";
if (ExerciseLib::is_pass_pourcentage_enabled($this->selectPassPercentage())) {
if ($is_success) {
$eventMessage = $this->getOnSuccessMessage();
$ribbon_total_success_or_error = ' ribbon-total-success';
} else {
$eventMessage = $this->getOnFailedMessage();
$ribbon_total_success_or_error = ' ribbon-total-error';
}
}
$ribbon .= '<div class="rib rib-total ' . $ribbon_total_success_or_error . '">';
} else {
$ribbon .= '<div class="rib rib-total">';
}
$ribbon .= '<h3>' . get_lang('YourTotalScore') . ": ";
$ribbon .= ExerciseLib::show_score($score, $weight, false, true);
$ribbon .= '</h3>';
$ribbon .= '</div>';
if ($check_pass_percentage) {
$ribbon .= ExerciseLib::show_success_message($score, $weight, $this->selectPassPercentage());
}
$ribbon .= '</div>';
$ribbon .= '</div>';
$ribbon .= $eventMessage;
return $ribbon;
}
示例7: api_get_course_id
$exercise_stat_info = Event::getExerciseResultsByUser($user_id, $exerciseId, api_get_course_id(), api_get_session_id());
if (!empty($exercise_stat_info)) {
$max_exe_id = max(array_keys($exercise_stat_info));
$last_attempt_info = $exercise_stat_info[$max_exe_id];
$attempt_html .= Display::div(get_lang('Date') . ': ' . api_get_local_time($last_attempt_info['exe_date']), array('id' => ''));
$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
if (!empty($last_attempt_info['question_list'])) {
foreach ($last_attempt_info['question_list'] as $question_data) {
$question_id = $question_data['question_id'];
$marks = $question_data['marks'];
$question_info = Question::read($question_id);
$attempt_html .= Display::div($question_info->question, array('class' => 'question_title'));
$attempt_html .= Display::div(get_lang('Score') . ' ' . $marks, array('id' => 'question_question_titlescore'));
}
}
$score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
$attempt_html .= Display::div(get_lang('YourTotalScore') . ' ' . $score, array('id' => 'question_score'));
} else {
$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
}
} else {
$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
}
} else {
$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
}
if ($origin == 'learnpath') {
Display::display_reduced_header();
} else {
Display::display_header($nameTools, 'Exercises');
}
示例8: array
$my_attempt_array = array();
$table_content = '';
/* Make a special case for IE, which doesn't seem to be able to handle the
* results popup -> send it to the full results page */
$browser = new Browser();
$current_browser = $browser->getBrowser();
$url_suffix = '';
$btn_class = 'ajax ';
if ($current_browser == 'Internet Explorer') {
$url_suffix = '&show_headers=1';
$btn_class = '';
}
if (!empty($attempts)) {
$i = $counter;
foreach ($attempts as $attempt_result) {
$score = ExerciseLib::show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
$attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?' . api_get_cidreq() . '&id=' . $attempt_result['exe_id'] . '&id_session=' . api_get_session_id() . '&height=500&width=950' . $url_suffix;
$attempt_link = Display::url(get_lang('Show'), $attempt_url, array('class' => $btn_class . 'btn'));
$teacher_revised = Display::label(get_lang('Validated'), 'success');
//$attempt_link = get_lang('NoResult');
//$attempt_link = Display::return_icon('quiz_na.png', get_lang('NoResult'), array(), ICON_SIZE_SMALL);
if ($attempt_result['attempt_revised'] == 0) {
$teacher_revised = Display::label(get_lang('NotValidated'), 'info');
}
$row = array('count' => $i, 'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG));
$attempt_link .= " " . $teacher_revised;
if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
$row['result'] = $score;
}
if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES)) || $objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) {
$row['attempt_link'] = $attempt_link;
示例9: scoreAttemptAction
//.........这里部分代码省略.........
}
$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'];
$my_total_score = $questionScore;
$my_total_weight = $questionWeighting;
$totalWeighting += $questionWeighting;
$score = array();
$score['result'] = get_lang('Score') . " : " . \ExerciseLib::show_score($my_total_score, $my_total_weight, false, false);
$score['pass'] = $my_total_score >= $my_total_weight ? true : false;
$score['type'] = $answerType;
$score['score'] = $my_total_score;
$score['weight'] = $my_total_weight;
$score['comments'] = isset($comnt) ? $comnt : null;
$contents = ob_get_clean();
$question_content = '<div class="question_row">';
$question_content .= $objQuestionTmp->return_header($objExercise->feedback_type, $counter, $score, $show_media, $mediaCounter);
$question_content .= '</table>';
// display question category, if any
$question_content .= \Testcategory::getCategoryNamesForQuestion($questionId);
$question_content .= $contents;
$defaultValue = isset($questionScoreTypeModel[$questionId]) ? $questionScoreTypeModel[$questionId] : null;
//$question_content .= \Display::select('options['.$questionId.']', $options, $defaultValue);
foreach ($options as $value => $score) {
$attributes = array();
if ($score->getId() == $defaultValue) {
$attributes = array('checked' => 'checked');
}
$question_content .= '<label>';
$question_content .= \Display::input('radio', 'options[' . $questionId . ']', $value, $attributes) . ' <span title="' . $score->getDescription() . '" data-toggle="tooltip" > ' . $score->getName() . ' </span>';
$question_content .= '</label>';
}
$question_content .= '</div>';
$exerciseContent .= $question_content;
$counter++;
}
$template = $this->get('template');
$template->assign('exercise', $exerciseContent);
$template->assign('exe_id', $exeId);
$template->assign('jury_id', $juryId);
$response = $this->get('template')->render_template($this->getTemplatePath() . 'score_attempt.tpl');
return new Response($response, 200, array());
}
示例10: foreach
if (!empty($best_score_data)) {
$best_score = ExerciseLib::show_score($best_score_data['exe_result'], $best_score_data['exe_weighting']);
}
// Exercise results
$counter = 1;
foreach ($exercise_data as $exercise_item) {
$result_list = $exercise_item['results'];
$exercise_info = $exercise_item['exercise_data'];
if ($exercise_info->start_time == '0000-00-00 00:00:00') {
$start_date = '-';
} else {
$start_date = $exercise_info->start_time;
}
if (!empty($result_list)) {
foreach ($result_list as $exercise_result) {
$platform_score = ExerciseLib::show_score($exercise_result['exe_result'], $exercise_result['exe_weighting']);
$my_score = 0;
if (!empty($exercise_result['exe_weighting']) && intval($exercise_result['exe_weighting']) != 0) {
$my_score = $exercise_result['exe_result'] / $exercise_result['exe_weighting'];
}
$position = ExerciseLib::get_exercise_result_ranking($my_score, $exercise_result['exe_id'], $my_exercise_id, $my_course_code, $session_id, $user_list);
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH) . "exercice/result.php?cidReq={$my_course_code}&id={$exercise_result['exe_id']}&id_session={$session_id}&show_headers=1", array('target' => SESSION_LINK_TARGET, 'class' => 'exercise-result-link'));
$my_real_array[] = array('status' => Display::return_icon('quiz.gif', get_lang('Attempted'), '', ICON_SIZE_SMALL), 'date' => $start_date, 'course' => $course_data['name'], 'exercise' => $exercise_info->exercise, 'attempt' => $counter, 'result' => $platform_score, 'best_result' => $best_score, 'position' => $position);
$counter++;
}
} else {
// We check the date validation of the exercise if the user can make it
if ($exercise_info->start_time != '0000-00-00 00:00:00') {
$allowed_time = api_strtotime($exercise_info->start_time, 'UTC');
if ($now < $allowed_time) {
continue;
示例11: api_get_cidreq
// else if not active
$actions .= ' <a href="' . $exercisePath . '?' . api_get_cidreq() . '&hpchoice=enable&page=' . $page . '&file=' . $path . '">' . Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL) . '</a>';
}
$actions .= '<a href="' . $exercisePath . '?' . api_get_cidreq() . '&hpchoice=delete&file=' . $path . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset) . ' ' . $title . "?") . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
$item .= Display::tag('td', $actions);
$tableRows[] = Display::tag('tr', $item);
} else {
// Student only
if ($active == 1) {
$attempt = ExerciseLib::getLatestHotPotatoResult($path, $userId, api_get_course_int_id(), api_get_session_id());
$nbrActiveTests = $nbrActiveTests + 1;
$item .= Display::tag('td', '<a href="showinframes.php?' . api_get_cidreq() . '&file=' . $path . '&cid=' . api_get_course_id() . '&uid=' . $userId . '" ' . (!$active ? 'class="invisible"' : '') . ' >' . $title . '</a>');
if (!empty($attempt)) {
$actions = '<a href="hotpotatoes_exercise_report.php?' . api_get_cidreq() . '&path=' . $path . '&filter_by_user=' . $userId . '">' . Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL) . '</a>';
$attemptText = get_lang('LatestAttempt') . ' : ';
$attemptText .= ExerciseLib::show_score($attempt['exe_result'], $attempt['exe_weighting']) . ' ';
$attemptText .= $actions;
} else {
// No attempts.
$attemptText = get_lang('NotAttempted') . ' ';
}
$item .= Display::tag('td', $attemptText);
if ($isDrhOfCourse) {
$actions = '<a href="hotpotatoes_exercise_report.php?' . api_get_cidreq() . '&path=' . $path . '">' . Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL) . '</a>';
$item .= Display::tag('td', $actions, array('class' => 'td_actions'));
}
$tableRows[] = Display::tag('tr', $item);
}
}
}
}
示例12: build_result_column
/**
* @param int $userId
* @param GradebookItem $item
* @param $ignore_score_color
* @return null|string
*/
private function build_result_column($userId, $item, $ignore_score_color, $forceSimpleResult = false)
{
$scoredisplay = ScoreDisplay::instance();
$score = $item->calc_score($userId);
if (!empty($score)) {
switch ($item->get_item_type()) {
// category
case 'C':
if ($score != null) {
if ($forceSimpleResult) {
return array('display' => $scoredisplay->display_score($score, SCORE_DIV), 'score' => $score, 'score_weight' => $score);
}
return array('display' => $scoredisplay->display_score($score, SCORE_DIV), 'score' => $score, 'score_weight' => $score);
} else {
return array('display' => null, 'score' => $score, 'score_weight' => $score);
}
break;
// evaluation and link
// evaluation and link
case 'E':
case 'L':
//if ($parentId == 0) {
$scoreWeight = [$score[1] > 0 ? $score[0] / $score[1] * $item->get_weight() : 0, $item->get_weight()];
//}
$display = $scoredisplay->display_score($score, SCORE_DIV);
$type = $item->get_item_type();
if ($type == 'L' && get_class($item) == 'ExerciseLink') {
$display = ExerciseLib::show_score($score[0], $score[1], false);
}
return array('display' => $display, 'score' => $score, 'score_weight' => $scoreWeight);
}
}
return array('display' => null, 'score' => null, 'score_weight' => null);
}
示例13: str_replace
$time_attemp = learnpathItem::get_scorm_time('js', $mytime);
$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
} else {
$time_attemp = ' - ';
}
if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
} else {
// Show only float when need it
if ($my_score == 0) {
$view_score = ExerciseLib::show_score(0, $my_maxscore, false);
} else {
if ($my_maxscore == 0) {
$view_score = $my_score;
} else {
$view_score = ExerciseLib::show_score($my_score, $my_maxscore, false);
}
}
}
$my_lesson_status = $row_attempts['status'];
if ($my_lesson_status == '') {
$my_lesson_status = learnpathitem::humanize_status('completed');
} elseif ($my_lesson_status == 'incomplete') {
$my_lesson_status = learnpathitem::humanize_status('incomplete');
}
$output .= '<tr class="' . $oddclass . '" >
<td></td>
<td>' . $extend_attempt_link . '</td>
<td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td>
<td colspan="2">' . $my_lesson_status . '</td>
<td colspan="2">' . $view_score . '</td>