function JQ_GetQuestData_review_nojs($q_data, $jq_language, $user_answer, $show_correct, $q_survey, $msg_cor, $correct = 0) { global $JLMS_DB, $JLMS_CONFIG, $option, $Itemid; $ret_str = ''; $cur_template = 'joomlaquiz_lms_template'; if ($cur_template) { require_once dirname(__FILE__) . '/templates/' . $cur_template . '/jq_template.php'; if ($msg_cor != '') { $ret_str .= "\t" . '<div style="text-align:center; font-size:14px; padding:5px 20px 5px 10px;">' . JoomlaQuiz_template_class::JQ_show_messagebox('', $msg_cor, $correct) . '</div>' . "\n"; } $ret_str .= "\t" . '<div style="text-align:center;">' . $q_data->c_question . '</div>' . "\n"; $ret_str .= "\t" . '<input type="hidden" name="quest_type" value="' . $q_data->c_type . '"/>' . "\n"; $ret_str .= "\t" . '<input type="hidden" name="quest_id" value="' . $q_data->old_c_id . '"/>' . "\n"; //$q_data->c_id $ret_str .= "\t" . '<input type="hidden" name="quest_score" value="' . $q_data->c_point . '"/>' . "\n"; switch ($q_data->c_type) { case 1: case 12: $sql_var = ''; $sql_table = ''; $sql_where = ''; if ($q_data->c_type == 12) { $sql_var .= ', b.imgs_name'; $sql_table = ', #__lms_quiz_images as b'; $sql_where .= ' AND a.c_choice = b.imgs_id'; } // $query = "SELECT a.c_id as value, a.c_choice as text, '0' as c_right, '0' as c_review".$sql_var." FROM #__lms_quiz_t_choice as a".$sql_table." WHERE a.c_question_id = '".$qu_id."'".$sql_where." ORDER BY a.ordering"; $query = "SELECT a.c_id as value, a.c_choice as text, a.c_right, '1' as c_review" . $sql_var . " FROM #__lms_quiz_t_choice as a" . $sql_table . " WHERE a.c_question_id = '" . $q_data->c_id . "'" . $sql_where . " ORDER BY a.ordering"; $JLMS_DB->SetQuery($query); $choice_data = $JLMS_DB->LoadObjectList(); $qhtml = JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type); $quhtml = ''; if ($show_correct || $q_survey) { for ($i = 0; $i < count($choice_data); $i++) { if ($choice_data[$i]->value == $user_answer) { $choice_data[$i]->c_right = 1; } else { $choice_data[$i]->c_right = 0; } } // print_r($choice_data); print_r($user_answer); $quhtml .= '<div><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>'; $quhtml .= JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type, '_answr'); $quhtml .= '</td></tr></table></div>'; } if ($q_survey) { $qhtml = ''; } $ret_str .= "\t" . '<div style="width:100%;"><table cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>' . $qhtml . '</td></tr></table></div>' . $quhtml . '' . "\n"; break; case 3: $query = "SELECT c_id as value, c_choice as text, c_right, '1' as c_review FROM #__lms_quiz_t_choice WHERE c_question_id = '" . $q_data->c_id . "' ORDER BY ordering"; $JLMS_DB->SetQuery($query); $choice_data = $JLMS_DB->LoadObjectList(); $i = 0; while ($i < count($choice_data)) { if ($choice_data[$i]->text == 'true' || $choice_data[$i]->text == 'True') { $choice_data[$i]->text = $jq_language['quiz_simple_true']; } elseif ($choice_data[$i]->text == 'false' || $choice_data[$i]->text == 'False') { $choice_data[$i]->text = $jq_language['quiz_simple_false']; } $i++; } $qhtml = JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type); $quhtml = ''; if ($show_correct) { for ($i = 0; $i < count($choice_data); $i++) { if ($choice_data[$i]->value == $user_answer) { $choice_data[$i]->c_right = 1; } else { $choice_data[$i]->c_right = 0; } } $quhtml .= '<div><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>'; $quhtml .= JoomlaQuiz_template_class::JQ_createMChoice($choice_data, $q_data->c_type, '_answr'); $quhtml .= '</td></tr></table></div>'; } $ret_str .= "\t" . '<div style="width:100%;"><table cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>' . $qhtml . '</td></tr></table></div>' . $quhtml . '' . "\n"; break; case 2: case 13: $sql_var = ''; $sql_table = ''; $sql_where = ''; if ($q_data->c_type == 13) { $sql_var .= ', b.imgs_name'; $sql_table = ', #__lms_quiz_images as b'; $sql_where .= ' AND a.c_choice = b.imgs_id'; } // $query = "SELECT a.c_id as value, a.c_choice as text, '0' as c_right, '0' as c_review".$sql_var." FROM #__lms_quiz_t_choice as a".$sql_table." WHERE a.c_question_id = '".$qu_id."'".$sql_where." ORDER BY a.ordering"; $query = "SELECT a.c_id as value, a.c_choice as text, a.c_right, '1' as c_review" . $sql_var . " FROM #__lms_quiz_t_choice as a" . $sql_table . " WHERE a.c_question_id = '" . $q_data->c_id . "'" . $sql_where . " ORDER BY a.ordering"; $JLMS_DB->SetQuery($query); $choice_data = $JLMS_DB->LoadObjectList(); $qhtml = JoomlaQuiz_template_class::JQ_createMResponse($choice_data, $q_data->c_type); $quhtml = ''; if ($show_correct || $q_survey) { for ($i = 0; $i < count($choice_data); $i++) { if (in_array($choice_data[$i]->value, $user_answer)) { $choice_data[$i]->c_right = 1; } else { $choice_data[$i]->c_right = 0; } } $quhtml .= '<div><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>'; $quhtml .= JoomlaQuiz_template_class::JQ_createMResponse($choice_data, $q_data->c_type, 0, '_r'); $quhtml .= '</td></tr></table></div>'; } if ($q_survey) { $qhtml = ''; } $ret_str .= "\t" . '<div style=\'width:100%;\'><table cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>' . $qhtml . '</td></tr></table></div>' . $quhtml . '' . "\n"; break; case 4: $query = "SELECT *, c_right_text as c_val FROM #__lms_quiz_t_matching WHERE c_question_id = '" . $q_data->c_id . "'" . "\n ORDER BY ordering"; $JLMS_DB->SetQuery($query); $match_data = $JLMS_DB->LoadObjectList(); $shuffle_match = $match_data; $ret_str .= "\t" . '<div>' . "\n" . '<div style=\'width:100%;text-align:center\'><table id=\'quest_table\' align="center" class="jlms_table_no_borders">'; for ($i = 0, $n = count($match_data); $i < $n; $i++) { $ret_str .= '<tr><td><div id=\'cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\'>' . $match_data[$i]->c_left_text . '</div></td><td><div id=\'ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\'>' . $shuffle_match[$i]->c_right_text . '</div></td></tr>'; } $ret_str .= '</table></div>' . "\n"; if ($show_correct) { $ret_str .= '<div style=\'width:100%;text-align:center\'><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table id=\'r_quest_table\' align="center" class="jlms_table_no_borders">'; for ($i = 0, $n = count($match_data); $i < $n; $i++) { $ret_str .= '<tr><td><div id=\'r_cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\'>' . $match_data[$i]->c_left_text . '</div></td><td><div id=\'r_ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\'>' . $user_answer[$i] . '</div></td></tr>'; } $ret_str .= '</table></div>' . "\n"; } $ret_str .= '</div>' . "\n"; break; case 5: $query = "SELECT *, c_right_text as c_val FROM #__lms_quiz_t_matching WHERE c_question_id = '" . $q_data->c_id . "'" . "\n ORDER BY ordering"; $JLMS_DB->SetQuery($query); $match_data = $JLMS_DB->LoadObjectList(); $shuffle_match = $match_data; $shuffle_match1 = array(); $shuffle_match1[0]->c_right_text = _JLMS_QUIZ_SHOW_SELECT_YOUR_ANSWER; $shuffle_match1[0]->c_val = '{0}'; $shuffle_match1 = array_merge($shuffle_match1, $shuffle_match); $qdata = array(); for ($i = 0, $n = count($match_data); $i < $n; $i++) { $qdata[$i]->c_left_text = $match_data[$i]->c_left_text; $qdata[$i]->c_right_text = mosHTML::selectList($shuffle_match1, 'quest_match', 'class="inputbox" size="1" disabled="disabled"', 'c_val', 'c_right_text', $shuffle_match1[$i + 1]->c_right_text); } $qhtml = JoomlaQuiz_template_class::JQ_createMDropDown($qdata); $quhtml = ''; if ($show_correct) { $quhtml .= '<div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table align="center" class="jlms_table_no_borders"><tr><td>'; for ($i = 0, $n = count($qdata); $i < $n; $i++) { $qdata[$i]->c_left_text = $match_data[$i]->c_left_text; $qdata[$i]->c_right_text = mosHTML::selectList($shuffle_match1, 'quest_match_u', 'class="inputbox" size="1" disabled="disabled"', 'c_val', 'c_right_text', $user_answer[$i]); } $quhtml .= JoomlaQuiz_template_class::JQ_createMDropDown($qdata); $quhtml .= '</td></tr></table>'; } $ret_str .= "\t" . '<div>' . $qhtml . $quhtml . '</div>' . "\n"; break; case 6: $query = "SELECT t.c_text FROM #__lms_quiz_t_blank as b, #__lms_quiz_t_text as t" . "\n WHERE b.c_question_id = '" . $q_data->c_id . "' AND t.c_blank_id = b.c_id" . "\n ORDER BY t.ordering"; $JLMS_DB->SetQuery($query); $blank_data = $JLMS_DB->LoadObjectList(); $ret_str .= "\t" . '<div style="text-align:center;">' . "\n"; $qhtml = ''; foreach ($blank_data as $bl_one) { $qhtml .= JoomlaQuiz_template_class::JQ_createBlank($bl_one->c_text) . "<br />"; } $quhtml = ''; if ($show_correct || $q_survey) { $quhtml .= '<div style="text-align:center;"><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table align="center" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"><tr><td>'; $quhtml .= JoomlaQuiz_template_class::JQ_createBlank($user_answer); $quhtml .= '</td></tr></table></div>'; } if ($q_survey) { $qhtml = ''; } $ret_str .= $qhtml . "\n" . "\t" . '' . $quhtml . '</div>' . "\n"; break; case 7: $query = "SELECT * FROM #__lms_quiz_t_hotspot WHERE c_question_id = '" . $q_data->c_id . "'"; $JLMS_DB->SetQuery($query); $hotspot_data = $JLMS_DB->LoadObjectList(); $hs_lefttop_x = 0; $hs_lefttop_y = 0; $hs_rightbottom_x = 0; $hs_rightbottom_y = 0; if (isset($hotspot_data[0])) { $hs_lefttop_x = $hotspot_data[0]->c_start_x; $hs_lefttop_y = $hotspot_data[0]->c_start_y; $hs_rightbottom_x = $hotspot_data[0]->c_width; $hs_rightbottom_y = $hotspot_data[0]->c_height; } $ret_str .= "\t" . '<center><table class="jlms_table_no_borders"><tr><td align="center"><div style="text-align:left; position:relative" >'; if ($show_correct) { $ret_str .= '<div id="div_hotspot_rec2" style="background:url(\'' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/images/hs_round.png\'); z-index:1002; width:12px; height:12px; position:absolute; left:' . ($user_answer[0] - 6) . 'px; top:' . ($user_answer[1] + 6) . 'px;"></div>'; } $ret_str .= '<div id="div_hotspot_rec" style="background-color:#FFFFFF; z-index:1001; ' . (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT']) ? "filter:alpha(opacity=50);" : '') . ' -moz-opacity:.50; opacity:.50; border:1px solid #000000; position:absolute; left:' . $hs_lefttop_x . 'px; top:' . $hs_lefttop_y . 'px; width:' . $hs_rightbottom_x . 'px; height:' . $hs_rightbottom_y . 'px; "><img src="' . $JLMS_CONFIG->get('live_site') . '/images/blank.png" border="0" width="1" height="1" alt="" /></div>' . '<img id=\'img_hotspot\' src=\'images/joomlaquiz/images/' . $q_data->c_image . '\' alt="" />' . '<input type=\'hidden\' name=\'hotspot_x\' value=\'0\' />' . '<input type=\'hidden\' name=\'hotspot_y\' value=\'0\' /></div></td></tr></table></center>' . "\n"; break; case 8: $ret_str .= "\t" . '' . "\n"; $qhtml = JoomlaQuiz_template_class::JQ_createSurvey(1, $user_answer); $ret_str .= $qhtml . "\n" . "\t" . '' . "\n"; break; case 9: $query = "SELECT * FROM #__lms_quiz_t_scale WHERE c_question_id = '" . $q_data->c_id . "'" . "\n ORDER BY ordering"; $JLMS_DB->SetQuery($query); $scale_data = $JLMS_DB->LoadObjectList(); for ($i = 0; $i < count($scale_data); $i++) { $scale_data[$i]->inchek = ''; foreach ($user_answer as $uansw) { if ($uansw[0] == $scale_data[$i]->c_id) { $scale_data[$i]->inchek = $uansw[1]; } } } $qhtml = JoomlaQuiz_template_class::JQ_createScale($scale_data, 1); $ret_str .= "\t" . '<div>' . $qhtml . '</div>' . "\n"; break; case 10: $ret_str .= "\t" . '' . "\n"; $ret_str .= "\n" . "\t" . '' . "\n"; break; case 11: $query = "SELECT a.*, a.c_right_text as c_val, b.imgs_name as left_name, c.imgs_name as right_name FROM #__lms_quiz_t_matching as a, #__lms_quiz_images as b, #__lms_quiz_images as c WHERE c_question_id = '" . $q_data->c_id . "' AND a.c_left_text = b.imgs_id AND a.c_right_text = c.imgs_id" . "\n ORDER BY a.ordering"; $JLMS_DB->SetQuery($query); $match_data = $JLMS_DB->LoadObjectList(); $shuffle_match = $match_data; // shuffle($shuffle_match); $ret_str .= "\t" . '<div>' . '<div style=\'width:100%;text-align:center\'><table id=\'quest_table\' align="center" class="jlms_table_no_borders">'; for ($i = 0, $n = count($match_data); $i < $n; $i++) { $ret_str .= '<tr><td><div id=\'cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'> <img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $match_data[$i]->c_left_text . '&Itemid=' . $Itemid . '&imgs_name=' . $match_data[$i]->left_name . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250) . '&bg_color=dddddd') . '" border="0" alt="' . $match_data[$i]->left_name . '"/></div></td><td><div id=\'ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'> <img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $shuffle_match[$i]->c_right_text . '&Itemid=' . $Itemid . '&imgs_name=' . $shuffle_match[$i]->right_name . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250)) . '" border="0" alt="' . $shuffle_match[$i]->right_name . '"/></div></td></tr>'; } $ret_str .= '</table></div>' . "\n"; if ($show_correct) { $ret_str .= '<div style=\'width:100%;text-align:center\'><div class="contentheading">' . _JLMS_QUIZ_REVIEW_YOUR_ANSWER . '</div><table id=\'r_quest_table\' align="center" class="jlms_table_no_borders">'; for ($i = 0, $n = count($match_data); $i < $n; $i++) { $ret_str .= '<tr><td><div id=\'r_cdiv_' . ($i + 1) . '\' class=\'jq_drop_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'> <img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $match_data[$i]->c_left_text . '&Itemid=' . $Itemid . '&imgs_name=' . $match_data[$i]->left_name . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250) . '&bg_color=dddddd') . '" border="0" alt="' . $match_data[$i]->left_name . '"/></div></td><td><div id=\'r_ddiv_' . ($i + 1) . '\' class=\'jq_drag_pre\' style=\'width: ' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . 'px; height: ' . $JLMS_CONFIG->get('quiz_match_max_height', 30) . 'px;\'> <img src="' . ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=' . $option . '&task=quizzes&page=imgs_v&id=' . $q_data->course_id . '&file_id=' . $user_answer[$i] . '&Itemid=' . $Itemid . '&pic_width=' . $JLMS_CONFIG->get('quiz_match_max_width', 250) . '&pic_height=' . $JLMS_CONFIG->get('quiz_match_max_height', 250)) . '" border="0" alt=""/></div></td></tr>'; } $ret_str .= '</table></div>' . "\n"; } $ret_str .= '</div>' . "\n"; break; } } return $ret_str; }