当前位置: 首页>>代码示例>>PHP>>正文


PHP Exercise::show_exercise_result_header方法代码示例

本文整理汇总了PHP中Exercise::show_exercise_result_header方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::show_exercise_result_header方法的具体用法?PHP Exercise::show_exercise_result_header怎么用?PHP Exercise::show_exercise_result_header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exercise的用法示例。


在下文中一共展示了Exercise::show_exercise_result_header方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_question_list_by_attempt

 /**
  * Display the exercise results
  * @param Exercise $objExercise
  * @param int $exe_id
  * @param bool $save_user_result save users results (true) or just show the results (false)
  */
 public static function display_question_list_by_attempt($objExercise, $exe_id, $save_user_result = false)
 {
     global $origin;
     // Getting attempt info
     $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
     // Getting question list
     $question_list = array();
     if (!empty($exercise_stat_info['data_tracking'])) {
         $question_list = explode(',', $exercise_stat_info['data_tracking']);
     } else {
         // Try getting the question list only if save result is off
         if ($save_user_result == false) {
             $question_list = $objExercise->get_validated_question_list();
         }
     }
     $counter = 1;
     $total_score = $total_weight = 0;
     $exercise_content = null;
     // Hide results
     $show_results = false;
     $show_only_score = false;
     if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS) {
         $show_results = true;
     }
     if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
         $show_only_score = true;
     }
     // Not display expected answer, but score, and feedback
     $show_all_but_expected_answer = false;
     if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) {
         $show_all_but_expected_answer = true;
         $show_results = true;
         $show_only_score = false;
     }
     if ($show_results || $show_only_score) {
         $user_info = api_get_user_info($exercise_stat_info['exe_user_id']);
         //Shows exercise header
         echo $objExercise->show_exercise_result_header($user_info, api_convert_and_format_date($exercise_stat_info['start_date'], DATE_TIME_FORMAT_LONG), $exercise_stat_info['duration'], $exercise_stat_info['user_ip']);
     }
     // Display text when test is finished #4074 and for LP #4227
     $end_of_message = $objExercise->selectTextWhenFinished();
     if (!empty($end_of_message)) {
         Display::display_normal_message($end_of_message, false);
         echo "<div class='clear'>&nbsp;</div>";
     }
     $question_list_answers = array();
     $media_list = array();
     $category_list = array();
     // Loop over all question to show results for each of them, one by one
     if (!empty($question_list)) {
         foreach ($question_list as $questionId) {
             // creates a temporary Question object
             $objQuestionTmp = Question::read($questionId);
             // This variable came from exercise_submit_modal.php
             ob_start();
             // We're inside *one* question. Go through each possible answer for this question
             $result = $objExercise->manage_answer($exercise_stat_info['exe_id'], $questionId, null, 'exercise_result', array(), $save_user_result, true, $show_results, $objExercise->selectPropagateNeg(), array());
             if (empty($result)) {
                 continue;
             }
             // In case of global score, make sure the calculated total score is integer
             /*if (!is_int($result['score'])) {
                   $result['score'] = round($result['score']);
               }*/
             $total_score += $result['score'];
             $total_weight += $result['weight'];
             $question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer'], 'answer_type' => $result['answer_type']);
             $my_total_score = $result['score'];
             $my_total_weight = $result['weight'];
             // Category report
             $category_was_added_for_this_test = false;
             if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
                 if (!isset($category_list[$objQuestionTmp->category]['score'])) {
                     $category_list[$objQuestionTmp->category]['score'] = 0;
                 }
                 if (!isset($category_list[$objQuestionTmp->category]['total'])) {
                     $category_list[$objQuestionTmp->category]['total'] = 0;
                 }
                 $category_list[$objQuestionTmp->category]['score'] += $my_total_score;
                 $category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
                 $category_was_added_for_this_test = true;
             }
             if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
                 foreach ($objQuestionTmp->category_list as $category_id) {
                     $category_list[$category_id]['score'] += $my_total_score;
                     $category_list[$category_id]['total'] += $my_total_weight;
                     $category_was_added_for_this_test = true;
                 }
             }
             // No category for this question!
             if ($category_was_added_for_this_test == false) {
                 if (!isset($category_list['none']['score'])) {
                     $category_list['none']['score'] = 0;
                 }
//.........这里部分代码省略.........
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:exercise.lib.php

示例2: array

				</tr>
				</table>';
            }
        }
    }
} else {
    Display::display_warning_message(get_lang('CantViewResults'));
    $show_results = false;
}
if ($origin == 'learnpath' && !isset($_GET['fb_type'])) {
    $show_results = false;
}
if ($show_results || $show_only_total_score) {
    $user_info = api_get_user_info($student_id);
    //Shows exercise header
    echo $objExercise->show_exercise_result_header($user_info, api_convert_and_format_date($exercise_date));
}
$i = $totalScore = $totalWeighting = 0;
if ($debug > 0) {
    error_log("ExerciseResult: " . print_r($exerciseResult, 1));
    error_log("QuestionList: " . print_r($questionList, 1));
}
$arrques = array();
$arrans = array();
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=" . intval($student_id) . " ";
$query = "SELECT attempts.question_id, answer FROM " . $TBL_TRACK_ATTEMPT . " as attempts\n\t\t\t\tINNER JOIN " . $TBL_TRACK_EXERCICES . " AS stats_exercices ON stats_exercices.exe_id=attempts.exe_id\n\t\t\t\tINNER JOIN " . $TBL_EXERCICE_QUESTION . " AS quizz_rel_questions\n\t\t\t\t    ON quizz_rel_questions.exercice_id=stats_exercices.exe_exo_id\n\t\t\t\t    AND quizz_rel_questions.question_id = attempts.question_id\n\t\t\t\t    AND quizz_rel_questions.c_id=" . api_get_course_int_id() . "\n\t\t\t\tINNER JOIN " . $TBL_QUESTIONS . " AS questions\n\t\t\t\t    ON questions.id=quizz_rel_questions.question_id\n\t\t\t\t    AND questions.c_id = " . api_get_course_int_id() . "\n\t\t  WHERE attempts.exe_id='" . Database::escape_string($id) . "' {$user_restriction}\n\t\t  GROUP BY quizz_rel_questions.question_order, attempts.question_id";
$result = Database::query($query);
$question_list_from_database = array();
$exerciseResult = array();
while ($row = Database::fetch_array($result)) {
    $question_list_from_database[] = $row['question_id'];
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:exercise_show.php

示例3: array

                </tr>
                </table>';
            }
        }
    }
} else {
    Display::display_warning_message(get_lang('CantViewResults'));
    $show_results = false;
}
if ($origin == 'learnpath' && !isset($_GET['fb_type'])) {
    $show_results = false;
}
if ($show_results || $show_only_total_score) {
    $user_info = api_get_user_info($student_id);
    //Shows exercise header
    echo $objExercise->show_exercise_result_header($user_info, api_convert_and_format_date($exercise_date), null, $track_exercise_info['user_ip']);
}
$i = $totalScore = $totalWeighting = 0;
if ($debug > 0) {
    error_log("ExerciseResult: " . print_r($exerciseResult, 1));
    error_log("QuestionList: " . print_r($questionList, 1));
}
$arrques = array();
$arrans = array();
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=" . intval($student_id) . " ";
$sql = "SELECT attempts.question_id, answer\n        FROM {$TBL_TRACK_ATTEMPT} as attempts\n        INNER JOIN " . $TBL_TRACK_EXERCISES . " AS stats_exercises\n        ON stats_exercises.exe_id=attempts.exe_id\n        INNER JOIN {$TBL_EXERCISE_QUESTION} AS quizz_rel_questions\n        ON\n            quizz_rel_questions.exercice_id=stats_exercises.exe_exo_id AND\n            quizz_rel_questions.question_id = attempts.question_id AND\n            quizz_rel_questions.c_id=" . api_get_course_int_id() . "\n        INNER JOIN " . $TBL_QUESTIONS . " AS questions\n        ON\n            questions.id=quizz_rel_questions.question_id AND\n            questions.c_id = " . api_get_course_int_id() . "\n        WHERE\n            attempts.exe_id = " . intval($id) . " {$user_restriction}\n\t\tGROUP BY quizz_rel_questions.question_order, attempts.question_id";
$result = Database::query($sql);
$question_list_from_database = array();
$exerciseResult = array();
while ($row = Database::fetch_array($result)) {
    $question_list_from_database[] = $row['question_id'];
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_show.php

示例4: array

				</tr>
				</table>';
            }
        }
    }
} else {
    Display::display_warning_message(get_lang('CantViewResults'));
    $show_results = false;
}
if ($origin == 'learnpath' && !isset($_GET['fb_type'])) {
    $show_results = false;
}
if ($show_results || $show_only_total_score) {
    $user_info = api_get_user_info($student_id);
    // Shows exercise header.
    echo $objExercise->show_exercise_result_header(api_get_person_name($user_info['firstName'], $user_info['lastName']), api_convert_and_format_date($exercise_date));
}
$i = $totalScore = $totalWeighting = 0;
if ($debug > 0) {
    error_log("ExerciseResult: " . print_r($exerciseResult, 1));
    error_log("QuestionList: " . print_r($questionList, 1));
}
$arrques = array();
$arrans = array();
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=" . intval($student_id) . " ";
$query = "SELECT attempts.question_id, answer\n          FROM " . $TBL_TRACK_ATTEMPT . " as attempts\n            INNER JOIN " . $TBL_TRACK_EXERCICES . " AS stats_exercices\n                ON stats_exercices.exe_id=attempts.exe_id\n            INNER JOIN " . $TBL_EXERCICE_QUESTION . " AS quizz_rel_questions\n                ON quizz_rel_questions.exercice_id=stats_exercices.exe_exo_id AND\n                quizz_rel_questions.question_id = attempts.question_id AND\n                quizz_rel_questions.c_id=" . api_get_course_int_id() . "\n            INNER JOIN " . $TBL_QUESTIONS . " AS questions\n                ON questions.iid=quizz_rel_questions.question_id AND\n                questions.c_id = " . api_get_course_int_id() . "\n\t\t  WHERE attempts.exe_id='" . Database::escape_string($id) . "' {$user_restriction}\n\t\t  GROUP BY quizz_rel_questions.question_order, attempts.question_id";
$result = Database::query($query);
$question_list_from_database = array();
$exerciseResult = array();
while ($row = Database::fetch_array($result)) {
    $question_list_from_database[] = $row['question_id'];
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:exercise_show.php


注:本文中的Exercise::show_exercise_result_header方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。