function JQ_FinishQuiz($quiz_id, $stu_quiz_id, $user_unique_id, $id) { global $JLMS_DB, $my, $Itemid, $JLMS_CONFIG; $ret_str = ''; require_once dirname(__FILE__) . '/ajax_quiz.class.php'; $query = "SELECT * FROM #__lms_quiz_t_quiz WHERE c_id = '" . $quiz_id . "'"; $JLMS_DB->SetQuery($query); $quiz = $JLMS_DB->LoadObjectList(); if (count($quiz)) { $quiz = $quiz[0]; } else { return $ret_str; } $quiz_params = new JLMSParameters($quiz->params); $inside_lp = intval(mosGetParam($_REQUEST, 'inside_lp', 0)); $QA = new JLMS_quiz_API($quiz_id, $inside_lp); if (!$QA->quiz_valid()) { return ''; } $toolbar_no_a = $QA->quiz_Get_NoAtToolbar(); $QA->set('stu_quiz_id', $stu_quiz_id); $QA->set('user_unique_id', $user_unique_id); $QA->quiz_ProcessStartData(); if ($QA->start_valid() && $quiz_id) { $query = "SELECT SUM(c_score) FROM #__lms_quiz_r_student_question WHERE c_stu_quiz_id = '" . $stu_quiz_id . "'"; $JLMS_DB->SetQuery($query); $user_score = $JLMS_DB->LoadResult(); if (!$user_score) { $user_score = 0; } $max_score = $QA->quiz_Get_MaxScore(); $nugno_score = $QA->get_qvar('c_passing_score', 0) * $max_score / 100; $user_passed = 0; if ($user_score >= $nugno_score) { $user_passed = 1; } $user_time = 0; $quiz_time1 = time() - date('Z'); $query = "SELECT c_date_time FROM #__lms_quiz_r_student_quiz WHERE c_id = '" . $stu_quiz_id . "'"; $JLMS_DB->SetQuery($query); $quiz_time2 = $JLMS_DB->LoadResult(); $quiz_time2a = strtotime($quiz_time2); $user_time = $quiz_time1 - $quiz_time2a; $query = "SELECT c_total_score, c_passed, c_total_time FROM #__lms_quiz_r_student_quiz WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'"; $JLMS_DB->SetQuery($query); $user_quiz_results_obj = $JLMS_DB->LoadObject(); if (is_object($user_quiz_results_obj)) { $user_score = $user_quiz_results_obj->c_total_score; $user_passed = $user_quiz_results_obj->c_passed; $user_time = $user_quiz_results_obj->c_total_time; } // update lms results $lms_course = $QA->get_qvar('course_id', 0); $lms_quiz = $quiz_id; $lms_user = $my->id; $lms_score = $user_score; $lms_time = $user_time; $lms_date = date('Y-m-d H:i:s', time() - date('Z')); //the same as gmdate $lms_passed = $user_passed; global $JLMS_CONFIG; if ($lms_course && $JLMS_CONFIG->get('course_id') == $lms_course) { $course_params = $JLMS_CONFIG->get('course_params'); $params = new JLMSParameters($course_params); $do_insert_new_res = false; if ($params->get('track_type', 0) == 1) { $query = "SELECT * FROM #__lms_quiz_results WHERE course_id = '" . $lms_course . "' AND quiz_id = '" . $lms_quiz . "' AND user_id = '" . $lms_user . "'"; $JLMS_DB->SetQuery($query); $old_user_results = $JLMS_DB->LoadObject(); if (is_object($old_user_results)) { if (!$lms_passed && !$old_user_results->user_passed && $lms_score > $old_user_results->user_score) { $do_insert_new_res = true; } elseif ($lms_passed && !$old_user_results->user_passed) { $do_insert_new_res = true; } elseif ($lms_passed && $old_user_results->user_passed && $lms_score > $old_user_results->user_score) { $do_insert_new_res = true; } elseif ($lms_passed && $old_user_results->user_passed && $lms_score == $old_user_results->user_score && $lms_time < $old_user_results->user_time) { $do_insert_new_res = true; } } else { $do_insert_new_res = true; } } else { $do_insert_new_res = true; } if ($do_insert_new_res) { $query = "DELETE FROM #__lms_quiz_results WHERE course_id = '" . $lms_course . "' AND quiz_id = '" . $lms_quiz . "' AND user_id = '" . $lms_user . "'"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $query = "INSERT INTO #__lms_quiz_results (course_id, quiz_id, user_id, user_score, quiz_max_score, user_time, quiz_date, user_passed)" . "\n VALUES ('" . $lms_course . "', '" . $lms_quiz . "', '" . $lms_user . "', '" . $lms_score . "', " . intval($max_score) . ", '" . $lms_time . "', '" . $lms_date . "', '" . $lms_passed . "')"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); } } // end of lms results section $cur_tmpl = 'joomlaquiz_lms_template'; if ($cur_tmpl) { require_once dirname(__FILE__) . '/templates/' . $cur_tmpl . '/jq_template.php'; global $JLMS_LANGUAGE, $JLMS_CONFIG; JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language')); require _JOOMLMS_FRONT_HOME . '/includes/quiz/quiz_language.php'; global $jq_language; #$ret_str .= "\t" . '<task>results</task>' . "\n"; $eee = $jq_language['quiz_header_fin_message']; #$ret_str .= "\t" . '<finish_msg><![CDATA['; if ($user_passed) { if ($QA->get_qvar('c_pass_message', '')) { $jq_language['quiz_user_passes'] = nl2br($QA->get_qvar('c_pass_message', '')); } } else { if ($QA->get_qvar('c_unpass_message', '')) { $jq_language['quiz_user_fails'] = nl2br($QA->get_qvar('c_unpass_message', '')); } } #$ret_str .= ']]></finish_msg>' . "\n"; $t_ar = array(); $t_ar[] = mosHTML::makeOption($user_score . " of " . $max_score, $jq_language['quiz_res_mes_score']); $t_ar[] = mosHTML::makeOption($nugno_score ? $nugno_score . " (" . $QA->get_qvar('c_passing_score', 0) . "%)" : '', $jq_language['quiz_res_mes_pas_score']); $tot_hour = floor($user_time / 3600); if ($tot_hour) { $tot_min = floor(($user_time - $tot_hour * 3600) / 60); $tot_sec = $user_time - $tot_hour * 3600 - $tot_min * 60; $tot_time = str_pad($tot_hour, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT); } else { $tot_min = floor($user_time / 60); $tot_sec = $user_time - $tot_min * 60; $tot_time = str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT); } $t_ar[] = mosHTML::makeOption($tot_time, $jq_language['quiz_res_mes_time']); if ($quiz_params->get('sh_final_page_text', 1) == 1) { $results_txt = JoomlaQuiz_template_class::JQ_show_results($jq_language['quiz_header_fin_results'], $t_ar); } else { $results_txt = ''; } $footer_ar = array(); $footer_ar[] = mosHTML::makeOption(0, $jq_language['quiz_fin_btn_review']); $footer_ar[] = mosHTML::makeOption(1, $jq_language['quiz_fin_btn_print']); $footer_ar[] = mosHTML::makeOption(2, $jq_language['quiz_fin_btn_certificate']); $footer_ar[] = mosHTML::makeOption(3, $jq_language['quiz_fin_btn_email']); $toolbar_fotter = array(); if ($QA->get_qvar('c_certificate', 0) && $user_passed) { $link_inside_1 = ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=com_joomla_lms&Itemid=' . $Itemid . '&no_html=1&task=print_quiz_cert&course_id=' . $lms_course . '&stu_quiz_id=' . $stu_quiz_id . '&user_unique_id=' . $user_unique_id); $btn_certificate = 'window.open(\'' . $link_inside_1 . '\',\'blank\');'; $footer_ar[2]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"window.open ('" . $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_cert&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=" . $user_unique_id . "','blank');\">" . $jq_language['quiz_fin_btn_certificate'] . "</a></div>"; $toolbar_footer[2] = array('btn_type' => 'certificate_fbar', 'btn_js' => $btn_certificate); } if ($QA->get_qvar('c_enable_print', 0)) { $link_inside_2 = ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=com_joomla_lms&Itemid=' . $Itemid . '&no_html=1&task=print_quiz_result&course_id=' . $lms_course . '&stu_quiz_id=' . $stu_quiz_id . '&user_unique_id='); $btn_print = 'window.open(\'' . $link_inside_2 . '\'+user_unique_id,\'blank\');'; $footer_ar[1]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"window.open ('" . $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_result&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=' + user_unique_id,'blank');\">" . $jq_language['quiz_fin_btn_print'] . "</a></div>"; $toolbar_footer[1] = array('btn_type' => 'print_fbar', 'btn_js' => $btn_print); } if ($QA->get_qvar('c_email_to', 0)) { $btn_email_to = 'jq_emailResults();'; $footer_ar[3]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"jq_emailResults();\">" . $jq_language['quiz_fin_btn_email'] . "</a></div>"; $toolbar_footer[3] = array('btn_type' => 'email_to_fbar', 'btn_js' => $btn_email_to); } if ($QA->get_qvar('c_enable_review', 0)) { $btn_review = 'jq_startReview();'; $query = "UPDATE #__lms_quiz_r_student_quiz SET allow_review = 1 WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $footer_ar[0]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"jq_startReview();\">" . $jq_language['quiz_fin_btn_review'] . "</a></div>"; $toolbar_footer[0] = array('btn_type' => 'review_fbar', 'btn_js' => $btn_review); } $footer_html_graf = ''; if ($quiz_params->get('sh_final_page_grafic', 0) == 1) { ////----barss----//// $is_pool = 0; if ($quiz_id == -1 || $quiz_id == 0) { $is_pool = 1; $quiz_id = 0; } $rows = $QA->quiz_Get_QuestionList(); // 18 August 2007 - changes (DEN) - added check for GD and FreeType support $generate_images = true; $msg = ''; if (!function_exists('imageftbbox') || !function_exists('imagecreatetruecolor')) { $generate_images = false; $sec = false; if (!function_exists('imagecreatetruecolor')) { $msg = 'This function requires GD 2.0.1 or later (2.0.28 or later is recommended).'; $sec = true; } if (!function_exists('imageftbbox')) { $msg .= ($sec ? '<br />' : '') . 'This function is only available if PHP is compiled with freetype support.'; } } // end of GD and FreeType support check if ($JLMS_CONFIG->get('temp_folder', '') && $generate_images) { // temp folder setup is ready. //--------- array of bar-images $img_arr = array(); $title_arr = array(); $count_graph = array(); global $option; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $quest_params = new JLMSParameters($row->params); $z = 1; if (isset($row->c_pool) && $row->c_pool) { $row->c_pool_id = $row->c_pool; } else { $row->c_pool_id = $row->c_id; } $show_case = true; // if($showtype_id && !$quest_params->get('survey_question')) if (false && !$quest_params->get('survey_question')) { $show_case = false; } if ($show_case) { require_once _JOOMLMS_FRONT_HOME . "/includes/libraries/lms.lib.graph.php"; $group_id = 0; $str_user_in_groups = ''; $c_question_id = $row->c_pool_id; $obj_GraphStat = JLMS_GraphStatistics($option, $id, $quiz_id, $i, $z, $row, $c_question_id, $group_id, $str_user_in_groups); foreach ($obj_GraphStat as $key => $item) { if (preg_match_all('#([a-z]+)_(\\w+)#', $key, $out, PREG_PATTERN_ORDER)) { if ($out[1][0] == 'img') { $img_arr[$i]->{$out}[2][0] = $item; } else { if ($out[1][0] == 'title') { $title_arr[$i]->{$out}[2][0] = $item; } else { if ($out[1][0] == 'count') { $count_graph[$i]->{$out}[2][0] = $item; } } } } } } } } $footer_html_graf = JoomlaQuiz_template_class::JQ_show_results_footer_content_bars($img_arr, $title_arr, $count_graph, $id); } $ret_str .= $results_txt; // this filed shouldn't be a null - null caused errors in Safari if ($quiz_params->get('sh_final_page_fdbck', 1) == 1) { $ret_str .= '<br />'; $ret_str .= JoomlaQuiz_template_class::JQ_show_results_msg($eee, $user_passed ? $jq_language['quiz_user_passes'] : $jq_language['quiz_user_fails'], $user_passed); $ret_str .= '<br />'; } else { $ret_str .= '<br />'; } if (isset($toolbar_footer) && count($toolbar_footer) > 0) { ksort($toolbar_footer); $footer_html = JLMS_ShowToolbar($toolbar_footer, false, 'center'); $footer_html = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms', $footer_html); } else { $footer_html = ''; } $entire_footer_data = $footer_html . ($footer_html_graf ? '<br />' . $footer_html_graf : ''); $ret_str .= $entire_footer_data ? $entire_footer_data : ' '; } } return $ret_str; }
function JQ_ViewCharts($quiz_id, $option, $id, $gqp = false) { global $JLMS_DB, $JLMS_CONFIG, $JLMS_SESSION, $my; $JLMS_ACL =& JLMSFactory::getACL(); $usertype_simple = $JLMS_ACL->_role_type; // $usertype_simple = JLMS_GetUserType_simple($my->id, false, true); //------------------------------------------------------------------- //FLMS multicat $levels = array(); if ($gqp) { /* $query = "SELECT * FROM #__lms_gqp_cats_config ORDER BY id"; $JLMS_DB->setQuery($query); $levels = $JLMS_DB->loadObjectList(); */ if (count($levels) == 0) { for ($i = 0; $i < 15; $i++) { $num = $i + 1; if ($i > 0) { // $levels[$i]->cat_name = _JLMS_COURSES_COURSES_GROUPS; $levels[$i]->cat_name = 'Level #' . $num; } else { // $levels[$i]->cat_name = _JLMS_COURSES_COURSES_GROUPS; $levels[$i]->cat_name = 'Level #' . $num; } } } $level_id = array(); for ($i = 0; $i < count($levels); $i++) { if ($i == 0) { $level_id[$i] = intval(mosGetParam($_REQUEST, 'filter_id_' . $i . '', $JLMS_SESSION->get('GQP_filter_id_' . $i . '', 0))); $JLMS_SESSION->set('GQP_filter_id_' . $i . '', $level_id[$i]); } else { $level_id[$i] = intval(mosGetParam($_REQUEST, 'filter_id_' . $i . '', $JLMS_SESSION->get('GQP_filter_id_' . $i . '', 0))); $JLMS_SESSION->set('GQP_filter_id_' . $i . '', $level_id[$i]); } if ($i == 0) { $parent_id[$i] = 0; } else { $parent_id[$i] = $level_id[$i - 1]; } if ($i == 0 || $parent_id[$i]) { //(Max): extra requests $query = "SELECT count(id) FROM `#__lms_gqp_cats` WHERE parent = '" . $parent_id[$i] . "' ORDER BY c_category"; $JLMS_DB->setQuery($query); $groups = $JLMS_DB->loadResult(); if ($groups == 0) { $level_id[$i] = 0; $JLMS_SESSION->set('GQP_filter_id_' . $i . '', $level_id[$i]); } } } for ($i = 0; $i < count($levels); $i++) { if ($i > 0 && $level_id[$i - 1] == 0) { $level_id[$i] = 0; $JLMS_SESSION->set('GQP_filter_id_' . $i . '', $level_id[$i]); $parent_id[$i] = 0; } elseif ($i == 0 && $level_id[$i] == 0) { $level_id[$i] = 0; $JLMS_SESSION->set('GQP_filter_id_' . $i . '', $level_id[$i]); $parent_id[$i] = 0; } } $javascript = 'onclick="javascript:read_filter();" onchange="javascript:write_filter();document.adminFormQ.page.value=\'quiz_bars_gqp\';document.adminFormQ.submit();"'; $query1 = "SELECT group_id FROM `#__lms_users_in_global_groups` WHERE user_id = '" . $my->id . "'"; $JLMS_DB->setQuery($query1); $user_group_ids = $JLMS_DB->loadResultArray(); for ($i = 0; $i < count($levels); $i++) { if ($i == 0 || $parent_id[$i]) { //(Max): extra requests if ($parent_id[$i] == 0 && $usertype_simple == 1) { //(Max): roletype_id $query = "SELECT * FROM `#__lms_gqp_cats` WHERE `parent` = '0'"; $query .= "\n ORDER BY `c_category`"; } else { $query = "SELECT * FROM `#__lms_gqp_cats` WHERE parent = '" . $parent_id[$i] . "' ORDER BY c_category"; } $JLMS_DB->setQuery($query); $groups = $JLMS_DB->loadObjectList(); if ($parent_id[$i] && $i > 0 && count($groups)) { $type_level[$i][] = mosHTML::makeOption(0, ' '); foreach ($groups as $group) { $type_level[$i][] = mosHTML::makeOption($group->id, $group->c_category); } $lists['filter_' . $i . ''] = mosHTML::selectList($type_level[$i], 'filter_id_' . $i . '', 'class="inputbox" style="width: 266px;" size="1" ' . $javascript, 'value', 'text', $level_id[$i]); //onchange="document.location.href=\''. $link_multi .'\';" } elseif ($i == 0) { $type_level[$i][] = mosHTML::makeOption(0, ' '); foreach ($groups as $group) { $type_level[$i][] = mosHTML::makeOption($group->id, $group->c_category); } $lists['filter_' . $i . ''] = mosHTML::selectList($type_level[$i], 'filter_id_' . $i . '', 'class="inputbox" style="width: 266px;" size="1" ' . $javascript, 'value', 'text', $level_id[$i]); //onchange="document.location.href=\''. $link_multi .'\';" } } } } //------------------------------------------------------------------- $is_pool = 0; $showtype_id = JRequest::getVar('showtype_id', 0, '', 'ALNUM'); if (!$quiz_id) { $quiz_id = intval(mosGetParam($_REQUEST, 'quiz_id', -1)); } if ($quiz_id == -1 || $quiz_id == 0) { $is_pool = 1; $quiz_id = 0; } $group_id = intval(mosGetParam($_REQUEST, 'group_id', 0)); $questCatId = 0; if (strpos($showtype_id, SL_CATPREF) !== false) { $questCatId = (int) ltrim($showtype_id, SL_CATPREF); $showtype_id = 0; } if ($group_id) { if (!$gqp) { $query = "SELECT b.user_id FROM #__lms_users_in_global_groups as b, #__lms_users_in_groups as c"; $query .= "\n WHERE b.user_id = c.user_id AND c.course_id = '" . $id . "'"; $query .= "\n AND b.group_id = '" . $group_id . "'"; } else { $query = "SELECT b.user_id FROM #__lms_users_in_global_groups as b"; $query .= "\n WHERE "; $query .= "\n b.group_id = '" . $group_id . "'"; } } else { $query = "SELECT c.user_id FROM #__lms_users_in_groups as c"; $query .= "\n WHERE c.course_id = '" . $id . "'"; } $JLMS_DB->setQuery($query); $user_in_groups = $JLMS_DB->loadResultArray(); $str_user_in_groups = '0'; if (count($user_in_groups)) { $str_user_in_groups = implode(",", $user_in_groups); } // echo '<pre>'; // print_r($user_in_groups); // echo '</pre>'; $pageNav = ''; if (!$gqp) { $AND = ''; if ($questCatId) { $AND = ' AND qc.c_id = ' . $questCatId; } $query = "SELECT a.*, b.c_qtype as qtype_full, c.c_title as quiz_name, qc.c_category" . "\n FROM #__lms_quiz_t_question a LEFT JOIN #__lms_quiz_t_qtypes b ON b.c_id = a.c_type LEFT JOIN #__lms_quiz_t_quiz c ON a.c_quiz_id = c.c_id AND c.course_id = '" . $id . "'" . "\n LEFT JOIN #__lms_quiz_t_category as qc ON a.c_qcat = qc.c_id AND qc.course_id = '" . $id . "' AND qc.is_quiz_cat = 0" . "\n WHERE a.course_id = '" . $id . "'" . "\n AND c_quiz_id = '" . $quiz_id . "'" . $AND . "\n ORDER BY a.ordering, a.c_id"; $JLMS_DB->setQuery($query); $total = count($JLMS_DB->loadObjectList()); $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->get('list_limit')))); $JLMS_SESSION->set('list_limit', $limit); $limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0)); require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php"; $pageNav = new JLMSPageNav($total, $limitstart, $limit); $query = "SELECT a.*, b.c_qtype as qtype_full, c.c_title as quiz_name, qc.c_category" . "\n FROM #__lms_quiz_t_question a LEFT JOIN #__lms_quiz_t_qtypes b ON b.c_id = a.c_type LEFT JOIN #__lms_quiz_t_quiz c ON a.c_quiz_id = c.c_id AND c.course_id = '" . $id . "'" . "\n LEFT JOIN #__lms_quiz_t_category as qc ON a.c_qcat = qc.c_id AND qc.course_id = '" . $id . "' AND qc.is_quiz_cat = 0" . "\n WHERE a.course_id = '" . $id . "'" . "\n AND c_quiz_id = '" . $quiz_id . "'" . $AND . "\n ORDER BY a.ordering, a.c_id" . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}"; } else { //echo "qqqq"; die; $str = ''; //NEW MUSLTICATS $tmp_level = array(); $last_catid = 0; $i = 0; foreach ($_REQUEST as $key => $item) { if (preg_match('#filter_id_(\\d+)#', $key, $result)) { if ($item) { $tmp_level[$i] = $result; $last_catid = $item; $i++; } } } if (!$i) { foreach ($_SESSION as $key => $item) { if (preg_match('#GQP_filter_id_(\\d+)#', $key, $result)) { if ($item) { $tmp_level[$i] = $result; $last_catid = $item; $i++; } } } } $query = "SELECT * FROM #__lms_gqp_cats" . "\n ORDER BY id"; $JLMS_DB->setQuery($query); $all_cats = $JLMS_DB->loadObjectList(); $tmp_cats_filter = array(); $children = array(); foreach ($all_cats as $cat) { $pt = $cat->parent; $list = @$children[$pt] ? $children[$pt] : array(); array_push($list, $cat->id); $children[$pt] = $list; } $tmp_cats_filter[0] = $last_catid; $i = 1; foreach ($children as $key => $childs) { if ($last_catid == $key) { foreach ($children[$key] as $v) { if (!in_array($v, $tmp_cats_filter)) { $tmp_cats_filter[$i] = $v; $i++; } } } } foreach ($children as $key => $childs) { if (in_array($key, $tmp_cats_filter)) { foreach ($children[$key] as $v) { if (!in_array($v, $tmp_cats_filter)) { $tmp_cats_filter[$i] = $v; $i++; } } } } $tmp_cats_filter = array_unique($tmp_cats_filter); $catids = implode(",", $tmp_cats_filter); if ($last_catid && count($tmp_cats_filter)) { $str .= "\n AND a.c_qcat IN (" . $catids . ")"; } //NEW MUSLTICATS /* for ($i=count($level_id);$i>-1;$i--) { if(isset($level_id[$i]) && $level_id[$i]) { $str = "\n AND d.cat_id = ".$level_id[$i].""; break; } } */ /*---------------navigation-------------------*/ $query = "SELECT a.*, b.c_qtype as qtype_full, qc.c_category" . "\n FROM" . "\n #__lms_quiz_t_question a," . "\n #__lms_quiz_t_qtypes b," . "\n #__lms_gqp_cats as qc" . "\n WHERE b.c_id = a.c_type" . "\n AND a.c_quiz_id = 0" . "\n AND a.course_id = 0" . $str . "\n GROUP BY a.c_id" . "\n ORDER BY a.ordering, a.c_id"; $JLMS_DB->setQuery($query); $total = count($JLMS_DB->loadObjectList()); $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->get('list_limit')))); $JLMS_SESSION->set('list_limit', $limit); $limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0)); require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php"; $pageNav = new JLMSPageNav($total, $limitstart, $limit); /*--------------------------------------------*/ $query = "SELECT a.*, b.c_qtype as qtype_full, qc.c_category" . "\n FROM" . "\n #__lms_quiz_t_question a," . "\n #__lms_quiz_t_qtypes b," . "\n #__lms_gqp_cats as qc" . "\n WHERE 1" . "\n AND b.c_id = a.c_type" . "\n AND a.c_quiz_id = 0" . "\n AND a.course_id = 0" . $str . "\n GROUP BY a.c_id" . "\n ORDER BY a.ordering, a.c_id" . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}"; } $JLMS_DB->setQuery($query); $rows = $JLMS_DB->loadObjectList(); for ($i = 0; $i < count($rows); $i++) { $str = '_JLMS_QUIZ_QTYPE_' . $rows[$i]->c_type; if (defined($str)) { $rows[$i]->qtype_full = constant($str); } } $q_from_pool = array(); foreach ($rows as $row) { if ($row->c_type == 20) { $q_from_pool[] = $row->c_pool; } } if (count($q_from_pool)) { $qp_ids = implode(',', $q_from_pool); $query = "SELECT a.*, b.c_qtype as qtype_full FROM #__lms_quiz_t_question as a LEFT JOIN #__lms_quiz_t_qtypes b ON b.c_id = a.c_type" . "\n WHERE a.course_id = '" . $id . "' AND a.c_id IN ({$qp_ids})"; $JLMS_DB->setQuery($query); $rows2 = $JLMS_DB->loadObjectList(); for ($i = 0; $i < count($rows2); $i++) { $str = '_JLMS_QUIZ_QTYPE_' . $rows2[$i]->c_type; if (defined($str)) { $rows2[$i]->qtype_full = constant($str); } } for ($i = 0, $n = count($rows); $i < $n; $i++) { if ($rows[$i]->c_type == 20) { for ($j = 0, $m = count($rows2); $j < $m; $j++) { if ($rows[$i]->c_pool == $rows2[$j]->c_id) { $rows[$i]->c_question = $rows2[$j]->c_question; $rows[$i]->c_type = $rows2[$j]->c_type; $rows[$i]->qtype_full = _JLMS_QUIZ_QUEST_POOL_SHORT . ' - ' . $rows2[$j]->qtype_full; break; } } } } } $q_from_pool_gqp = array(); foreach ($rows as $row) { if ($row->c_type == 21) { $q_from_pool_gqp[] = $row->c_pool_gqp; } } if (count($q_from_pool_gqp)) { $qp_ids_gqp = implode(',', $q_from_pool_gqp); $query = "SELECT a.*, b.c_qtype as qtype_full FROM #__lms_quiz_t_question as a LEFT JOIN #__lms_quiz_t_qtypes b ON b.c_id = a.c_type" . "\n WHERE a.course_id = 0 AND a.c_id IN ({$qp_ids_gqp})"; $JLMS_DB->setQuery($query); $rows2 = $JLMS_DB->loadObjectList(); for ($i = 0; $i < count($rows2); $i++) { $str = '_JLMS_QUIZ_QTYPE_' . $rows2[$i]->c_type; if (defined($str)) { $rows2[$i]->qtype_full = constant($str); } } for ($i = 0, $n = count($rows); $i < $n; $i++) { if ($rows[$i]->c_type == 21) { for ($j = 0, $m = count($rows2); $j < $m; $j++) { if ($rows[$i]->c_pool_gqp == $rows2[$j]->c_id) { $rows[$i]->c_question = $rows2[$j]->c_question; $rows[$i]->c_type = $rows2[$j]->c_type; $rows[$i]->qtype_full = _JLMS_QUIZ_QUEST_POOL_GQP_SHORT . ' - ' . $rows2[$j]->qtype_full; break; } } } } } // 18 August 2007 - changes (DEN) - added check for GD and FreeType support $generate_images = true; $msg = ''; if (!function_exists('imageftbbox') || !function_exists('imagecreatetruecolor')) { $generate_images = false; $sec = false; if (!function_exists('imagecreatetruecolor')) { $msg = 'This function requires GD 2.0.1 or later (2.0.28 or later is recommended).'; $sec = true; } if (!function_exists('imageftbbox')) { $msg .= ($sec ? '<br />' : '') . 'This function is only available if PHP is compiled with freetype support.'; } } // end of GD and FreeType support check if ($JLMS_CONFIG->get('temp_folder', '') && $generate_images) { // temp folder setup is ready. //--------- array of bar-images $rows_result = array(); $img_arr = array(); $title_arr = array(); $count_graph = array(); $img_correct = array(); $title_correct = array(); for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $quest_params = new JLMSParameters($row->params); $z = 1; $show_case = true; if ($showtype_id && !$quest_params->get('survey_question')) { $show_case = false; } if ($row->c_pool) { $c_question_id = $row->c_pool; } elseif ($row->c_pool_gqp) { $c_question_id = $row->c_pool_gqp; } else { $c_question_id = $row->c_id; } if ($gqp) { $query = "SELECT c_id FROM #__lms_quiz_t_question WHERE c_pool_gqp = '" . $row->c_id . "'"; $JLMS_DB->setQuery($query); $gqp_id = $JLMS_DB->loadResult(); if ($gqp_id) { $row->c_id = $gqp_id; } } if ($show_case) { require_once _JOOMLMS_FRONT_HOME . "/includes/libraries/lms.lib.graph.php"; $obj_GraphStat = JLMS_GraphStatistics($option, $id, $quiz_id, $i, $z, $row, $c_question_id, $group_id, $str_user_in_groups); foreach ($obj_GraphStat as $key => $item) { if (preg_match_all('#([a-z]+)_(\\w+)#', $key, $out, PREG_PATTERN_ORDER)) { if ($out[1][0] == 'img') { $img_arr[$i]->{$out}[2][0] = $item; $rows_result[$i]->images_array->{$out}[2][0] = $item; } else { if ($out[1][0] == 'title') { $title_arr[$i]->{$out}[2][0] = $item; $rows_result[$i]->title_array->{$out}[2][0] = $item; } else { if ($out[1][0] == 'count') { $count_graph[$i]->{$out}[2][0] = $item; $rows_result[$i]->count_array->{$out}[2][0] = $item; } } } } } /*if(isset($obj_GraphStat->img_graph)){ $img_arr[$i]->graph = $obj_GraphStat->img_graph; }*/ /*$img_arr[$i]->graph = $JLMS_CONFIG->get('temp_folder', '').'/'.$filename; $title_arr[$i]->graph = trim(strip_tags($row->c_question)); $count_graph[$i]->graph = 1; $img_arr[$i]->correct = $JLMS_CONFIG->get('temp_folder', '').'/'.$filename; $title_arr[$i]->correct = trim(strip_tags($row->c_question)); $count_graph[$i]->correct = 1;*/ } } } // echo '<pre>'; // print_r($rows_result); // echo '</pre>'; if (!$gqp) { $lists = array(); } $javascript = 'onchange="if(document.adminFormQ.quiz_id.value != 0){document.adminFormQ.submit();}"'; $query = "SELECT c_id AS value, c_title AS text" . "\n FROM #__lms_quiz_t_quiz" . "\n WHERE course_id = '" . $id . "'" . "\n ORDER BY c_title"; $JLMS_DB->setQuery($query); $quizzes = array(); $quizzes[] = mosHTML::makeOption('0', _JLMS_SB_SELECT_QUIZ); $quizzes[] = mosHTML::makeOption('-1', _JLMS_QUIZ_QUEST_POOL); $quizzes = array_merge($quizzes, $JLMS_DB->loadObjectList()); $quiz = mosHTML::selectList($quizzes, 'quiz_id', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', $is_pool ? -1 : $quiz_id); $lists['quiz'] = $quiz; if ($gqp) { $javascript = 'onchange="document.adminFormQ.page.value=\'quiz_bars_gqp\'; document.adminFormQ.submit();"'; } else { $javascript = 'onchange="document.adminFormQ.submit();"'; } $query = "SELECT CONCAT( '" . SL_CATPREF . "', c_id ) AS value, c_category AS text" . "\n FROM #__lms_quiz_t_category" . "\n WHERE is_quiz_cat = 0 AND course_id = " . $id . "\n ORDER BY c_category"; $JLMS_DB->setQuery($query); $showtype = array(); $showtype[] = mosHTML::makeOption('0', _JLMS_QUIZ_ALL_QUESTIONS); $showtype[] = mosHTML::makeOption('1', _JLMS_QUIZ_SURVEY_QUESTIONS); $showtype = array_merge($showtype, $JLMS_DB->loadObjectList()); if ($questCatId) { $showtype_id = SL_CATPREF . $questCatId; } $shtype = mosHTML::selectList($showtype, 'showtype_id', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', $showtype_id); $lists['showtype'] = $shtype; $query = "SELECT id as value, ug_name as text FROM #__lms_usergroups WHERE course_id = '0'"; $JLMS_DB->setQuery($query); $showgroups = array(); $showgroups[] = mosHTML::makeOption('0', _JLMS_ATT_FILTER_ALL_GROUPS); $showgroups = array_merge($showgroups, $JLMS_DB->loadObjectList()); $lists['showgroups'] = mosHTML::selectList($showgroups, 'group_id', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', $group_id); JLMS_quiz_admin_html_class::JQ_showBars($rows_result, $lists, $id, $option, $gqp, $levels, $pageNav); }
function JQ_ResultsQuiz_nojs() { global $JLMS_DB, $my, $Itemid, $option, $Itemid, $JLMS_CONFIG; $doc =& JFactory::getDocument(); $ret_str = ''; $quiz_id = intval(mosGetParam($_REQUEST, 'quiz', 0)); $id = intval(mosGetParam($_REQUEST, 'id', 0)); $query = "SELECT * FROM #__lms_quiz_t_quiz WHERE c_id = '" . $quiz_id . "'"; $JLMS_DB->SetQuery($query); $quiz = $JLMS_DB->LoadObjectList(); if (count($quiz)) { $quiz = $quiz[0]; } else { return $ret_str; } $quiz_params = new JLMSParameters($quiz->params); $inside_lp = intval(mosGetParam($_REQUEST, 'inside_lp', 0)); $QA = new JLMS_quiz_API($quiz_id, $inside_lp); if (!$QA->quiz_valid()) { return ''; } // $toolbar_no_a = $QA->quiz_Get_NoAtToolbar(); $stu_quiz_id = intval(mosGetParam($_REQUEST, 'stu_quiz_id', 0)); $user_unique_id = strval(mosGetParam($_REQUEST, 'user_unique_id', '')); $QA->set('stu_quiz_id', $stu_quiz_id); $QA->set('user_unique_id', $user_unique_id); $QA->quiz_ProcessStartData(); if ($QA->start_valid() && $quiz_id) { $query = "SELECT SUM(c_score) FROM #__lms_quiz_r_student_question WHERE c_stu_quiz_id = '" . $stu_quiz_id . "'"; $JLMS_DB->SetQuery($query); $user_score = $JLMS_DB->LoadResult(); if (!$user_score) { $user_score = 0; } $max_score = $QA->quiz_Get_MaxScore(); $nugno_score = $QA->get_qvar('c_passing_score', 0) * $max_score / 100; $user_passed = 0; if ($user_score >= $nugno_score) { $user_passed = 1; } $query = "SELECT c_total_score, c_passed, c_total_time FROM #__lms_quiz_r_student_quiz WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'"; $JLMS_DB->setQuery($query); $results_data = $JLMS_DB->LoadObjectList(); $lms_course = $QA->get_qvar('course_id', 0); $lms_quiz = $quiz_id; $lms_user = $my->id; $lms_score = $user_score; $lms_time = $user_time = $results_data[0]->c_total_time; $lms_date = date('Y-m-d H:i:s', time() - date('Z')); $lms_passed = $user_passed = $results_data[0]->c_passed; $cur_tmpl = 'joomlaquiz_lms_template'; if ($cur_tmpl) { require_once dirname(__FILE__) . '/templates/' . $cur_tmpl . '/jq_template.php'; global $JLMS_LANGUAGE, $JLMS_CONFIG; JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language')); require _JOOMLMS_FRONT_HOME . '/includes/quiz/quiz_language.php'; global $jq_language; // $ret_str .= "\t" . '<task>results</task>' . "\n"; $eee = $jq_language['quiz_header_fin_message']; $doc->addStyleSheet($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/jq_template.css'); if ($QA->lpath_stu_quiz_id == $stu_quiz_id) { $query = "SELECT lpath_id FROM #__lms_learn_path_steps WHERE id = '" . $QA->lpath_step_id . "'"; $JLMS_DB->setQuery($query); $lpath_id = $JLMS_DB->loadResult(); $link_pre = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=show_lpath_nojs&id={$lpath_id}&course_id={$id}&step_id=" . $QA->lpath_step_id . "&user_start_id=" . $QA->lpath_start_id . "&user_unique_id=" . $QA->lpath_unique_id . "&action=prev_lpathstep"); $link_next = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=show_lpath_nojs&id={$lpath_id}&course_id={$id}&step_id=" . $QA->lpath_step_id . "&user_start_id=" . $QA->lpath_start_id . "&user_unique_id=" . $QA->lpath_unique_id . "&action=next_lpathstep"); $link_contents = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=show_lpath_nojs&id={$lpath_id}&course_id={$id}&step_id=" . $QA->lpath_step_id . "&user_start_id=" . $QA->lpath_start_id . "&user_unique_id=" . $QA->lpath_unique_id . "&action=contents_lpath"); $ret_str .= "<table width='100%' cellpadding='0' cellspacing='3' border='0' class='jlms_table_no_borders'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width='150'>\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width='100%'>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width='150' align='right'>\n\t\t\t\t\t\t\t<table cellpadding='0' cellspacing='3' border='0' class='jlms_table_no_borders'>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_pre . "' title='" . _JLMS_PREV_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_back.png' border='0' alt='" . _JLMS_PREV_ALT_TITLE . "'/>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_pre . "' title='" . _JLMS_PREV_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t" . _JLMS_PREV_ALT_TITLE . "\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_next . "' title='" . _JLMS_NEXT_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_start.png' border='0' alt='" . _JLMS_NEXT_ALT_TITLE . "'/>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_next . "' title='" . _JLMS_NEXT_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t" . _JLMS_NEXT_ALT_TITLE . "\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_contents . "' title='" . _JLMS_CONTENTS_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_contents.png' border='0' alt='" . _JLMS_CONTENTS_ALT_TITLE . "'/>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_contents . "' title='" . _JLMS_CONTENTS_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t" . _JLMS_CONTENTS_ALT_TITLE . "\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>"; } if ($user_passed) { if ($QA->get_qvar('c_pass_message', '')) { $jq_language['quiz_user_passes'] = nl2br($QA->get_qvar('c_pass_message', '')); } } else { if ($QA->get_qvar('c_unpass_message', '')) { $jq_language['quiz_user_fails'] = nl2br($QA->get_qvar('c_unpass_message', '')); } } $t_ar = array(); $t_ar[] = mosHTML::makeOption($user_score . " of " . $max_score, $jq_language['quiz_res_mes_score']); $t_ar[] = mosHTML::makeOption($nugno_score ? $nugno_score . " (" . $QA->get_qvar('c_passing_score', 0) . "%)" : '', $jq_language['quiz_res_mes_pas_score']); $tot_hour = floor($user_time / 3600); if ($tot_hour) { $tot_min = floor(($user_time - $tot_hour * 3600) / 60); $tot_sec = $user_time - $tot_hour * 3600 - $tot_min * 60; $tot_time = str_pad($tot_hour, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT); } else { $tot_min = floor($user_time / 60); $tot_sec = $user_time - $tot_min * 60; $tot_time = str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT); } $t_ar[] = mosHTML::makeOption($tot_time, $jq_language['quiz_res_mes_time']); //21.03.08 Max if ($quiz_params->get('sh_final_page_text', 1) == 1) { $results_txt = JoomlaQuiz_template_class::JQ_show_results($jq_language['quiz_header_fin_results'], $t_ar); $ret_str .= "\t" . '<div>' . $results_txt . '</div>' . "\n"; } //21.03.08 Max if ($quiz_params->get('sh_final_page_fdbck', 1) == 1) { $ret_str .= JoomlaQuiz_template_class::JQ_show_results_msg($eee, $user_passed ? $jq_language['quiz_user_passes'] : $jq_language['quiz_user_fails'], $user_passed); $ret_str .= '<br />'; } else { $ret_str .= '<br />'; } $footer_ar = array(); $footer_ar[] = mosHTML::makeOption(0, $jq_language['quiz_fin_btn_review']); $footer_ar[] = mosHTML::makeOption(1, $jq_language['quiz_fin_btn_print']); $footer_ar[] = mosHTML::makeOption(2, $jq_language['quiz_fin_btn_certificate']); $footer_ar[] = mosHTML::makeOption(3, $jq_language['quiz_fin_btn_email']); $toolbar_footer = array(); if ($QA->get_qvar('c_certificate', 0) && $user_passed) { $link_certificate = sefRelToAbs("index.php?option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_cert&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=" . $user_unique_id . ""); $footer_ar[2]->text = "<div class='back_button'><a target='_blank' href='" . $link_certificate . "'\">" . $jq_language['quiz_fin_btn_certificate'] . "</a></div>"; $toolbar_footer[2] = array('btn_type' => 'certificate_fbar', 'btn_js' => $link_certificate); } if ($QA->get_qvar('c_enable_print', 0)) { $link_print = sefRelToAbs("index.php?option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_result&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=" . $user_unique_id . ""); $footer_ar[1]->text = "<div class='back_button'><a target='_blank' href='" . $link_print . "' \">" . $jq_language['quiz_fin_btn_print'] . "</a></div>"; $toolbar_footer[1] = array('btn_type' => 'print_fbar', 'btn_js' => $link_print); } if ($QA->get_qvar('c_email_to', 0)) { $link_to_mail = ampReplace($JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&task=quiz_action&id={$id}&user_unique_id={$user_unique_id}&atask=email_results&quiz={$quiz_id}&stu_quiz_id={$stu_quiz_id}"); $footer_ar[3]->text = "<div class='back_button'><a target='_blank' href='" . $link_to_mail . "' onclick=\"jq_emailResults();\">" . $jq_language['quiz_fin_btn_email'] . "</a></div>"; $toolbar_footer[3] = array('btn_type' => 'email_to_fbar', 'btn_js' => $link_to_mail); } if ($QA->get_qvar('c_enable_review', 0)) { $query = "UPDATE #__lms_quiz_r_student_quiz SET allow_review = 1 WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'"; $JLMS_DB->SetQuery($query); $JLMS_DB->query(); $link_review = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&id={$id}&task=quiz_action&quiz={$quiz_id}&stu_quiz_id={$stu_quiz_id}&user_unique_id={$user_unique_id}&atask=review_start"); $footer_ar[0]->text = "<div class='back_button'><a href='" . $link_review . "'>" . $jq_language['quiz_fin_btn_review'] . "</a></div>"; $toolbar_footer[0] = array('btn_type' => 'review_fbar', 'btn_js' => $link_review); } if ($quiz_params->get('sh_final_page_grafic', 0) == 1) { ////----barss----//// $is_pool = 0; if ($quiz_id == -1 || $quiz_id == 0) { $is_pool = 1; $quiz_id = 0; } $rows = $QA->quiz_Get_QuestionList(); // 18 August 2007 - changes (DEN) - added check for GD and FreeType support $generate_images = true; $msg = ''; if (!function_exists('imageftbbox') || !function_exists('imagecreatetruecolor')) { $generate_images = false; $sec = false; if (!function_exists('imagecreatetruecolor')) { $msg = 'This function requires GD 2.0.1 or later (2.0.28 or later is recommended).'; $sec = true; } if (!function_exists('imageftbbox')) { $msg .= ($sec ? '<br />' : '') . 'This function is only available if PHP is compiled with freetype support.'; } } // end of GD and FreeType support check if ($JLMS_CONFIG->get('temp_folder', '') && $generate_images) { // temp folder setup is ready. //--------- array of bar-images $img_arr = array(); $title_arr = array(); $count_graph = array(); for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $quest_params = new JLMSParameters($row->params); $z = 1; $show_case = true; // if($shotype_id && !$quest_params->get('survey_question')) if (false && !$quest_params->get('survey_question')) { $show_case = false; } if ($show_case) { require_once _JOOMLMS_FRONT_HOME . "/includes/libraries/lms.lib.graph.php"; $c_question_id = $row->c_id; $group_id = 0; $str_user_in_groups = ''; $obj_GraphStat = JLMS_GraphStatistics($option, $id, $quiz_id, $i, $z, $row, $c_question_id, $group_id, $str_user_in_groups, 1); foreach ($obj_GraphStat as $key => $item) { if (preg_match_all('#([a-z]+)_(\\w+)#', $key, $out, PREG_PATTERN_ORDER)) { if ($out[1][0] == 'img') { $img_arr[$i]->{$out}[2][0] = $item; } else { if ($out[1][0] == 'title') { $title_arr[$i]->{$out}[2][0] = $item; } else { if ($out[1][0] == 'count') { $count_graph[$i]->{$out}[2][0] = $item; } } } } } } } } $footer_html = JoomlaQuiz_template_class::JQ_show_results_footer_content_bars($img_arr, $title_arr, $count_graph, $id); $ret_str .= "\t" . $footer_html . "\n"; } // $footer_html = JoomlaQuiz_template_class::JQ_show_results_footer($footer_ar); if (isset($toolbar_footer) && count($toolbar_footer) > 0) { ksort($toolbar_footer); $footer_html = JLMS_ShowToolbar($toolbar_footer, true, 'center'); } else { $footer_html = ''; } $ret_str .= "\t" . $footer_html . "\n"; } } echo $ret_str; }