function JQ_ListQuestions($option, $page, $id, $gqp = false) { global $JLMS_DB, $JLMS_SESSION, $my, $Itemid, $JLMS_CONFIG; $JLMS_ACL =& JLMSFactory::getACL(); $usertype_simple = $JLMS_ACL->_role_type; // $usertype_simple = JLMS_GetUserType_simple($my->id, false, true); //------------------------------------------------------------------- $filt_quest = mosGetParam($_REQUEST, 'quest_filter', $JLMS_SESSION->get('LQ_quest_filter', '')); $JLMS_SESSION->set('LQ_quest_filter', $filt_quest); //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=\'setup_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, _JLMS_SB_QUIZ_SELECT_QCATS); //' ' ); 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, _JLMS_SB_QUIZ_SELECT_QCATS); //' ' ); 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 = false; $quiz_id = intval(mosGetParam($_REQUEST, 'quiz_id', $JLMS_SESSION->get('quiz_id', 0))); if ($quiz_id == -1) { $is_pool = true; } $JLMS_ACL =& JLMSFactory::getACL(); if (!$JLMS_ACL->CheckPermissions('quizzes', 'manage')) { if ($JLMS_ACL->CheckPermissions('quizzes', 'manage_pool')) { $quiz_id = -1; $is_pool = true; } } $JLMS_SESSION->set('quiz_id', $quiz_id); $qtype_id = intval(mosGetParam($_REQUEST, 'qtype_id', $JLMS_SESSION->get('qtype_id', 0))); $JLMS_SESSION->set('qtype_id', $qtype_id); $qcats_id = intval(mosGetParam($_REQUEST, 'qcats_id', $JLMS_SESSION->get('qcats_id', 0))); $JLMS_SESSION->set('qcats_id', $qcats_id); $new_qtype_id = intval(mosGetParam($_REQUEST, 'new_qtype_id', $JLMS_SESSION->get('new_qtype_id', 0))); $JLMS_SESSION->set('new_qtype_id', $new_qtype_id); $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)); if (!$gqp) { $query = "SELECT COUNT(*)" . "\n FROM #__lms_quiz_t_question as a" . "\n LEFT JOIN #__lms_quiz_t_question AS k ON k.c_id = a.c_pool_gqp" . "\n LEFT JOIN #__lms_quiz_t_question AS m ON m.c_id = a.c_pool" . "\n WHERE a.course_id = '" . $id . "'" . ($quiz_id ? "\n AND a.c_quiz_id = " . ($is_pool ? 0 : $quiz_id) : '') . ($qtype_id ? "\n AND a.c_type = {$qtype_id}" : '') . ($qcats_id ? "\n AND a.c_qcat = {$qcats_id}" : '') . ($filt_quest ? "\n AND (" . "\n ( CASE" . "\n WHEN a.c_type = 21 THEN k.c_id" . "\n WHEN a.c_type = 20 THEN m.c_id" . "\n WHEN a.c_type < 20 THEN a.c_id" . "\n END )" . " \n LIKE '{$filt_quest}' OR " . "\n ( CASE" . "\n WHEN a.c_type = 21 THEN k.c_question" . "\n WHEN a.c_type = 20 THEN m.c_question" . "\n WHEN a.c_type < 20 THEN a.c_question" . "\n END )" . "\n LIKE '%{$filt_quest}%' OR a.c_id LIKE '{$filt_quest}')" : ''); $JLMS_DB->setQuery($query); $total = $JLMS_DB->loadResult(); } else { $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 /*old kosmosa 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]." AND d.level = $i"; break; } } */ $query = "SELECT COUNT(*)" . "\n FROM #__lms_quiz_t_question a " . "\n WHERE a.course_id = 0" . ($qtype_id ? "\n AND a.c_type = {$qtype_id}" : '') . ($qcats_id ? "\n AND a.c_qcat = {$qcats_id}" : '') . ($filt_quest ? "\n AND (a.c_id LIKE '{$filt_quest}' OR a.c_question LIKE '%{$filt_quest}%')" : '') . ($str ? $str : ' '); $JLMS_DB->setQuery($query); $total = $JLMS_DB->loadResult(); } require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php"; $pageNav = new JLMSPageNav($total, $limitstart, $limit); if (!$gqp) { $query = "SELECT a.*," . "\n 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 LEFT JOIN #__lms_quiz_t_question AS k ON k.c_id = a.c_pool_gqp" . "\n LEFT JOIN #__lms_quiz_t_question AS m ON m.c_id = a.c_pool" . "\n WHERE a.course_id = '" . $id . "'" . ($quiz_id ? "\n AND a.c_quiz_id = " . ($is_pool ? 0 : $quiz_id) : '') . ($qtype_id ? "\n AND a.c_type = {$qtype_id}" : '') . ($qcats_id ? "\n AND a.c_qcat = {$qcats_id}" : '') . ($filt_quest ? "\n AND (" . "\n ( CASE" . "\n WHEN a.c_type = 21 THEN k.c_id" . "\n WHEN a.c_type = 20 THEN m.c_id" . "\n WHEN a.c_type < 20 THEN a.c_id" . "\n END )" . " \n LIKE '{$filt_quest}' OR " . "\n ( CASE" . "\n WHEN a.c_type = 21 THEN k.c_question" . "\n WHEN a.c_type = 20 THEN m.c_question" . "\n WHEN a.c_type < 20 THEN a.c_question" . "\n END )" . "\n LIKE '%{$filt_quest}%' OR a.c_id LIKE '{$filt_quest}')" : '') . "\n ORDER BY a.ordering, a.c_id" . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}"; $JLMS_DB->setQuery($query); $rows = $JLMS_DB->loadObjectList(); } else { $query = "SELECT a.*," . "\n b.c_qtype as qtype_full, '' 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" . "\n LEFT JOIN #__lms_gqp_cats AS qc ON a.c_qcat = qc.id" . "\n WHERE a.course_id = 0" . ($qtype_id ? "\n AND a.c_type = {$qtype_id}" : '') . ($qcats_id ? "\n AND a.c_qcat = {$qcats_id}" : '') . ($filt_quest ? "\n AND (a.c_id LIKE '{$filt_quest}' OR a.c_question LIKE '%{$filt_quest}%')" : '') . ($str ? $str : ' ') . "\n ORDER BY a.ordering, a.c_qcat"; $JLMS_DB->setQuery($query, $pageNav->limitstart, $pageNav->limit); $rows = $JLMS_DB->loadObjectList(); /*if (count($rows)) { $diff_ids = array(); foreach ($rows as $one_qrow) { $diff_ids[] = $one_qrow->c_id; } if (count($diff_ids)) { $diff_ids_str = implode(',',$diff_ids); $query = "SELECT a.quest_id, max(a.level) as level FROM #__lms_gqp_levels as a, #__lms_gqp_cats AS b" . "\n WHERE a.quest_id IN ($diff_ids_str) AND a.cat_id = b.id GROUP BY quest_id"; $JLMS_DB->setQuery( $query ); $rows_levels = $JLMS_DB->loadObjectList(); var_dump($rows_levels); if (count($rows_levels)) { for ($ir = 0, $nr = count($rows); $ir < $nr; $ir ++) { foreach ($rows_levels as $row_level) { if ($row_level->quest_id == $rows[$ir]->c_id) { $rows[$ir]->level = $row_level->level; break; } } } } } }*/ } for ($i = 0; $i < count($rows); $i++) { $str = '_JLMS_QUIZ_QTYPE_' . $rows[$i]->c_type; if (defined($str)) { $rows[$i]->qtype_full = constant($str); } } if ($gqp) { /* $tmp_level = 0; $tmp_level2 = 0; if(mosGetParam($_REQUEST,'filter_id_0') || (isset($_SESSION['GQP_filter_id_0']) && $_SESSION['GQP_filter_id_0'] > 0)) { if (count($rows)) { $tmp_level = isset($rows[0]->level) ? $rows[0]->level : 0; $tmp_level2 = $tmp_level + 1; } } $diff_ids = array(); foreach ($rows as $one_qrow) { $diff_ids[] = $one_qrow->c_id; } if (count($diff_ids)) { $diff_ids_str = implode(',',$diff_ids); $query = "SELECT a.quest_id, b.c_category FROM #__lms_gqp_levels as a, #__lms_gqp_cats AS b" . "\n WHERE a.quest_id IN ($diff_ids_str) AND a.cat_id = b.id AND a.level = $tmp_level"; $JLMS_DB->setQuery( $query ); $rows_level_cats = $JLMS_DB->loadObjectList(); if (count($rows_level_cats)) { for ($ir = 0, $nr = count($rows); $ir < $nr; $ir ++) { foreach ($rows_level_cats as $row_level_cat) { if ($row_level_cat->quest_id == $rows[$ir]->c_id) { if ($row_level_cat->c_category) { $rows[$ir]->c_category = $row_level_cat->c_category; } break; } } } } if ($tmp_level2) { $query = "SELECT a.quest_id, b.c_category FROM #__lms_gqp_levels as a, #__lms_gqp_cats AS b" . "\n WHERE a.quest_id IN ($diff_ids_str) AND a.cat_id = b.id AND a.level = $tmp_level2"; $JLMS_DB->setQuery( $query ); $rows_level_cats = $JLMS_DB->loadObjectList(); if (count($rows_level_cats)) { for ($ir = 0, $nr = count($rows); $ir < $nr; $ir ++) { foreach ($rows_level_cats as $row_level_cat) { if ($row_level_cat->quest_id == $rows[$ir]->c_id) { if ($row_level_cat->c_category) { $rows[$ir]->c_category = $row_level_cat->c_category; } break; } } } } } } */ /*for($i=0;$i<count($rows);$i++) { $new_level = $rows[$i]->level+1; $query = "SELECT b.c_category FROM #__lms_gqp_levels AS a, #__lms_gqp_cats AS b WHERE a.quest_id = '".$rows[$i]->c_id."' AND a.cat_id = b.id AND a.level = '".$new_level."'"; $JLMS_DB->SetQuery($query); $cat_name = $JLMS_DB->LoadResult(); if($cat_name) { $rows[$i]->c_category = $cat_name; } }*/ /*} else { for($i=0;$i<count($rows);$i++) { $query = "SELECT b.c_category FROM #__lms_gqp_levels AS a, #__lms_gqp_cats AS b WHERE a.quest_id = '".$rows[$i]->c_id."' AND a.cat_id = b.id AND a.level = 0"; $JLMS_DB->SetQuery($query); $cat_name = $JLMS_DB->LoadResult(); if($cat_name) { $rows[$i]->c_category = $cat_name; $rows[$i]->level = 0; } } }*/ } $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]->qtype_full = _JLMS_QUIZ_QUEST_POOL_SHORT . ' - ' . $rows2[$j]->qtype_full; break; } } } } } //----------------GQP $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]->qtype_full = _JLMS_QUIZ_QUEST_POOL_GQP_SHORT . ' - ' . $rows2[$j]->qtype_full; break; } } } } } //-------------------- //Tooltip Right Answer (Max - 15.04.2011) for ($i = 0; $i < count($rows); $i++) { if (in_array($rows[$i]->c_type, array(1, 2, 3))) { $right_answer = ''; $query = "SELECT c_choice" . "\n FROM" . "\n #__lms_quiz_t_choice" . "\n WHERE 1" . "\n AND c_right = 1" . "\n AND c_question_id = '" . $rows[$i]->c_id . "'"; $JLMS_DB->setQuery($query); $right_answer = $JLMS_DB->loadResult(); if (strlen($right_answer)) { $rows[$i]->right_answer = $right_answer; } } else { if (in_array($rows[$i]->c_type, array(20, 21))) { if ($rows[$i]->c_type == 20) { $select_field = "c_pool"; } else { if ($rows[$i]->c_type == 21) { $select_field = "c_pool_gqp"; } } $query = "SELECT " . $select_field . "\n FROM" . "\n #__lms_quiz_t_question" . "\n WHERE 1" . "\n AND c_id = '" . $rows[$i]->c_id . "'"; $JLMS_DB->setQuery($query); $question_id = $JLMS_DB->loadResult(); $right_answer = ''; if (intval($question_id)) { $query = "SELECT b.c_choice" . "\n FROM" . "\n #__lms_quiz_t_question as a" . "\n, #__lms_quiz_t_choice as b" . "\n WHERE 1" . "\n AND a.c_id = '" . $question_id . "'" . "\n AND b.c_question_id = '" . $question_id . "'" . "\n AND a.c_type IN (" . implode(',', array(1, 2, 3)) . ")" . "\n AND b.c_right = 1"; $JLMS_DB->setQuery($query); $right_answer = $JLMS_DB->loadResult(); } if (strlen($right_answer)) { $rows[$i]->right_answer = $right_answer; } } } } //Tooltip Right Answer (Max - 15.04.2011) $javascript = 'onchange="document.adminFormQ.submit();"'; $quizzes = array(); $quizzes[] = mosHTML::makeOption('0', _JLMS_SB_SELECT_QUIZ); $quizzes[] = mosHTML::makeOption('-1', _JLMS_QUIZ_QUEST_POOL); if ($JLMS_ACL->CheckPermissions('quizzes', 'manage')) { $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_merge($quizzes, $JLMS_DB->loadObjectList()); } $quiz = mosHTML::selectList($quizzes, 'quiz_id', 'class="inputbox" style="width:200px" size="1" ' . $javascript, 'value', 'text', $is_pool ? -1 : $quiz_id); $lists['quiz'] = $quiz; $lists['filtered_quiz'] = $is_pool ? -1 : $quiz_id; //test if ($gqp) { $where = "\n WHERE c_id NOT IN (" . implode(',', JLMS_quiz_admin_class::skippedQuestionIds()) . ")"; } else { $where = ''; } $query = "SELECT c_id AS value, c_qtype AS text" . "\n FROM #__lms_quiz_t_qtypes" . $where . "\n ORDER BY c_id"; $JLMS_DB->setQuery($query); $qtypes_lang = $JLMS_DB->loadObjectList(); for ($i = 0; $i < count($qtypes_lang); $i++) { $j = $i + 1; $str = '_JLMS_QUIZ_QTYPE_' . $j; if (defined($str)) { $qtypes_lang[$i]->value = $j; $qtypes_lang[$i]->text = constant($str); } } // // $query = "SELECT c_id AS value, c_qtype AS text" // . "\n FROM #__lms_quiz_t_qtypes" // . "\n ORDER BY c_id" // ; // $JLMS_DB->setQuery( $query ); $qtypes[] = mosHTML::makeOption('0', _JLMS_SB_QUIZ_SELECT_QTYPE); // $qtypes = array_merge( $qtypes, $JLMS_DB->loadObjectList() ); $qtypes = array_merge($qtypes, $qtypes_lang); $qtype = mosHTML::selectList($qtypes, 'qtype_id', 'class="inputbox" style="width:200px" size="1" ' . $javascript, 'value', 'text', $qtype_id); $lists['qtype'] = $qtype; $query = "SELECT * FROM #__lms_quiz_t_category WHERE course_id = '" . $id . "' AND is_quiz_cat = '0'"; $JLMS_DB->setQuery($query); $qcats = array(); $qcats[] = mosHTML::makeOption('0', _JLMS_SB_QUIZ_SELECT_QCATS, 'c_id', 'c_category'); $qcats = array_merge($qcats, $JLMS_DB->loadObjectList()); $lists['qcats'] = mosHTML::selectList($qcats, 'qcats_id', 'class="inputbox" size="1" ' . $javascript, 'c_id', 'c_category', $qcats_id); $lists['filt_quest'] = $filt_quest; // $query = "SELECT c_id AS value, c_qtype AS text" // . "\n FROM #__lms_quiz_t_qtypes" // . "\n ORDER BY c_id" // ; // $JLMS_DB->setQuery( $query ); $qtypes = array(); $qtypes[] = mosHTML::makeOption('0', _JLMS_SB_QUIZ_SELECT_QTYPE); // $qtypes = array_merge( $qtypes, $JLMS_DB->loadObjectList() ); $qtypes = array_merge($qtypes, $qtypes_lang); if ($quiz_id && !$is_pool) { $qtypes[] = mosHTML::makeOption('20', _JLMS_QUIZ_ADD_QUEST_FROM_POOL); } if ($JLMS_CONFIG->get('global_quest_pool', 0) && $quiz_id && !$is_pool) { $qtypes[] = mosHTML::makeOption('21', _JLMS_QUIZ_ADD_QUEST_FROM_GQP_POOL); } $qtype = mosHTML::selectList($qtypes, 'new_qtype_id', 'class="inputbox" style="width:200px" size="1" ', 'value', 'text', $new_qtype_id); $lists['new_qtype'] = $qtype; for ($i = 0; $i < count($rows); $i++) { if (isset($rows[$i]->c_question)) { preg_match_all('#{\\w+}(.*){\\/\\w+}#', $rows[$i]->c_question, $out, PREG_PATTERN_ORDER); if (isset($out[0][0]) && isset($out[1][0])) { $rows[$i]->c_question = str_replace($out[0][0], $out[1][0], $rows[$i]->c_question); } } } JLMS_quiz_admin_html_class::JQ_showQuestsList($rows, $lists, $pageNav, $option, $page, $id, $is_pool, $gqp, $levels); }