本文整理汇总了PHP中Display::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::input方法的具体用法?PHP Display::input怎么用?PHP Display::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::input方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFillTheBlankHtml
/**
* @param $separatorStartRegexp
* @param $separatorEndRegexp
* @param $correctItemRegexp
* @param $questionId
* @param $correctItem
* @param $attributes
* @param $answer
* @param $listAnswersInfo
* @param $displayForStudent
* @return string
*/
public static function getFillTheBlankHtml($separatorStartRegexp, $separatorEndRegexp, $correctItemRegexp, $questionId, $correctItem, $attributes, $answer, $listAnswersInfo, $displayForStudent, $inBlankNumber)
{
$result = "";
$inTabTeacherSolution = $listAnswersInfo['tabwords'];
$inTeacherSolution = $inTabTeacherSolution[$inBlankNumber];
switch (self::getFillTheBlankAnswerType($inTeacherSolution)) {
case self::FILL_THE_BLANK_MENU:
$selected = "";
// the blank menu
$optionMenu = "";
// display a menu from answer separated with |
// if display for student, shuffle the correct answer menu
$listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent);
$result .= '<select name="choice[' . $questionId . '][]">';
for ($k = 0; $k < count($listMenu); $k++) {
$selected = "";
if ($correctItem == $listMenu[$k]) {
$selected = " selected=selected ";
}
// if in teacher view, display the first item by default, which is the right answer
if ($k == 0 && !$displayForStudent) {
$selected = " selected=selected ";
}
$optionMenu .= '<option ' . $selected . ' value="' . $listMenu[$k] . '">' . $listMenu[$k] . '</option>';
}
if ($selected == "") {
// no good answer have been found...
$selected = " selected=selected ";
}
$result .= "<option {$selected} value=''>--</option>";
$result .= $optionMenu;
$result .= '</select>';
break;
case self::FILL_THE_BLANK_SEVERAL_ANSWER:
//no break
//no break
case self::FILL_THE_BLANK_STANDARD:
default:
$result = Display::input('text', "choice[{$questionId}][]", $correctItem, $attributes);
break;
}
return $result;
}
示例2: intval
exit;
}
}
}
$actions = null;
if ($is_allowedToEdit && $origin != 'learnpath') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$actions .= '<a href="admin.php?exerciseId=' . intval($_GET['exerciseId']) . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
$actions .= '<a href="live_stats.php?' . api_get_cidreq() . '&exerciseId=' . $exercise_id . '">' . Display::return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM) . '</a>';
$actions .= '<a href="stats.php?' . api_get_cidreq() . '&exerciseId=' . $exercise_id . '">' . Display::return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM) . '</a>';
$actions .= '<a id="export_opener" href="' . api_get_self() . '?export_report=1&exerciseId=' . intval($_GET['exerciseId']) . '" >' . Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM) . '</a>';
// clean result before a selected date icon
$actions .= Display::url(Display::return_icon('clean_before_date.png', get_lang('CleanStudentsResultsBeforeDate'), '', ICON_SIZE_MEDIUM), '#', array('onclick' => "javascript:display_date_picker()"));
// clean result before a selected date datepicker popup
$actions .= Display::span(Display::input('input', 'datepicker_start', get_lang('SelectADateOnTheCalendar'), array('onmouseover' => 'datepicker_input_mouseover()', 'id' => 'datepicker_start', 'onchange' => 'datepicker_input_changed()', 'readonly' => 'readonly')) . Display::button('delete', get_lang('Delete'), array('onclick' => 'submit_datepicker()')), array('style' => 'display:none', 'id' => 'datepicker_span'));
}
} else {
$actions .= '<a href="exercise.php">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
//Deleting an attempt
if (($is_allowedToEdit || $is_tutor || api_is_coach()) && isset($_GET['delete']) && $_GET['delete'] == 'delete' && !empty($_GET['did']) && $locked == false) {
$exe_id = intval($_GET['did']);
if (!empty($exe_id)) {
$sql = 'DELETE FROM ' . $TBL_TRACK_EXERCISES . ' WHERE exe_id = ' . $exe_id;
Database::query($sql);
$sql = 'DELETE FROM ' . $TBL_TRACK_ATTEMPT . ' WHERE exe_id = ' . $exe_id;
Database::query($sql);
header('Location: exercise_report.php?' . api_get_cidreq() . '&exerciseId=' . $exercise_id);
exit;
}
示例3: showQuestion
//.........这里部分代码省略.........
}
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
$attributes = array();
// Unique answer
if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
if ($show_comment) {
$s .= '<tr><td>';
}
if ($answerType == UNIQUE_ANSWER_IMAGE) {
if ($show_comment) {
if (empty($comment)) {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image" style="text-align: center">';
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
}
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
}
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = null;
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$attributes['style'] = 'display: none;';
$answer = '<div class="thumbnail">' . $answer . '</div>';
}
示例4: get_lang
if (!empty($_GET['add'])) {
echo '&add=true';
}
?>
" style="margin:0px;" <?php
if ($ajax_search) {
echo ' onsubmit="valide();"';
}
?>
>
<?php
echo '<legend>' . $data['name'] . ': ' . $tool_name . '</legend>';
echo Display::input('hidden', 'id', $id);
echo Display::input('hidden', 'form_sent', '1');
echo Display::input('hidden', 'add_type', null);
if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg);
//main API
}
?>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td align="center"><b><?php
echo get_lang('CoursesInPlatform');
?>
:</b>
</td>
<td></td>
<td align="center"><b><?php
示例5: array
$session_list = SessionManager::get_sessions_list(array(), array('name'));
$sessionList = array();
foreach ($session_list as $session) {
$sessionList[$session['id']] = $session['name'];
}
Display::display_header($tool_name);
?>
<form name="formulaire" method="post" action="<?php
echo api_get_self();
?>
" style="margin:0px;" >
<?php
echo '<legend>' . $tool_name . ' </legend>';
echo $htmlResult;
echo Display::input('hidden', 'form_sent', '1');
?>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td align="center">
<b><?php
echo get_lang('Sessions');
?>
:</b>
</td>
<td></td>
<td align="center">
<b><?php
echo get_lang('Sessions');
?>
:</b>
示例6: showQuestion
//.........这里部分代码省略.........
}
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="table table-hover table-striped">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
$attributes = array();
// Unique answer
if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
if ($show_comment) {
$s .= '<tr><td>';
}
if ($answerType == UNIQUE_ANSWER_IMAGE) {
if ($show_comment) {
if (empty($comment)) {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image" style="text-align: center">';
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
}
} else {
$s .= '<div id="answer' . $questionId . $numAnswer . '" ' . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
}
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = null;
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$attributes['style'] = 'display: none;';
$answer = '<div class="thumbnail">' . $answer . '</div>';
}
示例7: showQuestion
//.........这里部分代码省略.........
}
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
$attributes = array();
// Unique answer
if ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
$answer = Security::remove_XSS($answer, STUDENT);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = '<label class="radio">';
$answer_input .= Display::input('radio', 'choice[' . $questionId . ']', $numAnswer, $attributes);
$answer_input .= $answer;
$answer_input .= '</label>';
if ($show_comment) {
$s .= '<tr><td>';
$s .= $answer_input;
$s .= '</td>';
$s .= '<td>';
$s .= $comment;
$s .= '</td>';
$s .= '</tr>';
} else {
$s .= $answer_input;
}
} elseif ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE || $answerType == GLOBAL_MULTIPLE_ANSWER) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
$answer = Security::remove_XSS($answer, STUDENT);
if (in_array($numAnswer, $user_choice_array)) {
示例8: foreach
foreach ($question_list as $questionId) {
// destruction of the Question object
unset($objQuestionTmp);
// creates a temporary Question object
$objQuestionTmp = Question::read($questionId);
$quesId = $objQuestionTmp->selectId();
$check_id = 'remind_list[' . $questionId . ']';
$attributes = array('id' => $check_id, 'onclick' => "save_remind_item(this, '{$questionId}');");
if (in_array($questionId, $remind_list)) {
$attributes['checked'] = 1;
}
$label_attributes = array();
$label_attributes['class'] = 'checkbox';
$label_attributes['for'] = $check_id;
$label_attributes['class'] = "checkbox";
$checkbox = Display::input('checkbox', 'remind_list[' . $questionId . ']', '', $attributes);
$url = 'exercise_submit.php?exerciseId=' . $objExercise->id . '&num=' . $counter . '&reminder=1';
$counter++;
if ($objExercise->type == ONE_PER_PAGE) {
$question_title = Display::url($counter . '. ' . cut($objQuestionTmp->selectTitle(), 40), $url);
$question_title = $counter . '. ' . cut($objQuestionTmp->selectTitle(), 40);
} else {
$question_title = $counter . '. ' . cut($objQuestionTmp->selectTitle(), 40);
}
//Check if the question doesn't have an answer
if (!in_array($questionId, $exercise_result)) {
$question_title = Display::label($question_title, 'warning');
}
$question_title = Display::tag('label', $checkbox . $question_title, $label_attributes);
$table .= Display::div($question_title, array('class' => 'exercise_reminder_item'));
}
示例9: showQuestion
//.........这里部分代码省略.........
}
if ($show_comment) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
if ($show_comment) {
if (in_array($answerType, array(MULTIPLE_ANSWER, MULTIPLE_ANSWER_COMBINATION, UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, GLOBAL_MULTIPLE_ANSWER))) {
$header = Display::tag('th', get_lang('Options'));
if ($exercise_feedback == EXERCISE_FEEDBACK_TYPE_END) {
$header .= Display::tag('th', get_lang('Feedback'));
}
$s .= '<table class="data_table">';
$s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
}
}
$matching_correct_answer = 0;
$user_choice_array = array();
if (!empty($user_choice)) {
foreach ($user_choice as $item) {
$user_choice_array[] = $item['answer'];
}
}
foreach ($objAnswerTmp->answer as $answerId => $answer_item) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$comment = $objAnswerTmp->selectComment($answerId);
//$numAnswer = $objAnswerTmp->selectAutoId($answerId);
$numAnswer = $answerId;
$attributes = array();
// Unique answer
if (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION))) {
$input_id = 'choice-' . $questionId . '-' . $answerId;
if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
$attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
} else {
$attributes = array('id' => $input_id);
}
if ($debug_mark_answer) {
if ($answerCorrect) {
$attributes['checked'] = 1;
$attributes['selected'] = 1;
}
}
$answer = Security::remove_XSS($answer);
$s .= Display::input('hidden', 'choice2[' . $questionId . ']', '0');
$answer_input = null;
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$attributes['style'] = 'display:none';
$answer_input .= '<div id="answer' . $questionId . $numAnswer . '" style="float:left" class="highlight_image_default highlight_image">';
}
$answer_input .= '<label class="radio">';
$answer_input .= Display::input('radio', 'choice[' . $questionId . ']', $numAnswer, $attributes);
$answer_input .= $answer;
$answer_input .= '</label>';
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$answer_input .= "</div>";
}
if ($show_comment) {
$s .= '<tr><td>';
$s .= $answer_input;
$s .= '</td>';
$s .= '<td>';
$s .= $comment;
$s .= '</td>';
示例10: foreach
}
foreach ($result as $item) {
$column = 0;
$table->setCellContents($row, $column, $item['option_display_text']);
$column++;
$value = null;
foreach ($result as $itemCol) {
$id = 'extra_field_status_' . $item['id'] . '_' . $itemCol['id'];
$idForm = 'extra_field_status[' . $item['id'] . '][' . $itemCol['id'] . ']';
$attributes = array('onclick' => 'setHidden(this)');
$value = 0;
if (isset($includedFields[$itemCol['id']]) && in_array($item['id'], $includedFields[$itemCol['id']])) {
$value = 1;
$attributes['checked'] = 'checked';
}
$element = Display::input('checkbox', $id, null, $attributes);
$table->setCellContents($row, $column, $element);
$form->addElement('hidden', 'hidden_' . $idForm, $value, array('id' => 'hidden_' . $id));
$column++;
}
$row++;
}
if (!empty($roleId)) {
$form->addElement('html', $table->toHtml());
$group = array();
$group[] = $form->createElement('button', 'submit', get_lang('Save'));
$group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), array('class' => 'btn select_all'));
$group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), array('class' => 'btn unselect_all'));
$form->addGroup($group, '', null, ' ');
$form->setDefaults(array('status' => $roleId));
} else {
示例11: switch
// Shows the question and its answers
ExerciseLib::showQuestion($questionId, false, $origin, $i, true, false, $user_choice, false);
// Button save and continue
switch ($objExercise->type) {
case ONE_PER_PAGE:
$exercise_actions .= $objExercise->show_button($questionId, $current_question);
break;
case ALL_ON_ONE_PAGE:
$button = '<a href="javascript://" class="btn btn-info" onclick="save_now(\'' . $questionId . '\'); ">' . get_lang('SaveForNow') . '</a>';
$button .= '<span id="save_for_now_' . $questionId . '"></span> ';
$exercise_actions .= Display::div($button, array('class' => 'exercise_save_now_button'));
break;
}
// Checkbox review answers
if ($objExercise->review_answers) {
$remind_question_div = Display::tag('label', Display::input('checkbox', 'remind_list[' . $questionId . ']', '', $attributes) . get_lang('ReviewQuestionLater'), array('class' => 'checkbox', 'for' => 'remind_list[' . $questionId . ']'));
$exercise_actions .= Display::div($remind_question_div, array('class' => 'exercise_save_now_button'));
}
echo Display::div($exercise_actions, array('class' => 'form-actions'));
echo '</div>';
$i++;
// for sequential exercises
if ($objExercise->type == ONE_PER_PAGE) {
// quits the loop
break;
}
}
// end foreach()
if ($objExercise->type == ALL_ON_ONE_PAGE) {
$exercise_actions = $objExercise->show_button($questionId, $current_question);
echo Display::div($exercise_actions, array('class' => 'exercise_actions'));
示例12: 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());
}
示例13: get_lang
<div class="well">
<ul class="nav nav-list">
<li class="nav-header"><?php echo get_lang('Sessions'); ?></li>
<li>
<?php if ($action == 'display_sessions' && $_SERVER['REQUEST_METHOD'] != 'POST') { ?>
<strong><?php echo get_lang('Sessions'); ?></strong>
<?php } else { ?>
<a href="<?php echo getCourseCategoryUrl(1, $pageLength, null, 0, 'display_sessions'); ?>"><?php echo get_lang('SessionList'); ?></a>
<?php } ?>
</li>
<li class="nav-header"><?php echo get_lang('SearchActiveSessions') ?></li>
<form class="form-search" method="post" action="<?php echo getCourseCategoryUrl(1, $pageLength, null, 0, 'display_sessions'); ?>">
<div class="input-append">
<?php echo Display::input('date', 'date', $date, array(
'class' => 'span2',
'id' => 'date',
'readonly' => ''
)); ?>
<button class="btn" type="submit"><?php echo get_lang('Search'); ?></button>
</div>
</form>
</ul>
</div>
<?php } ?>
</div>
<div class="span9">
<div class="page-header">
<h2><?php echo get_lang('CourseCatalog')?></h2>
</div>
<?php if ($showCourses && $action != 'display_sessions') { ?>