}
$f_subjectid = isset($_GET['subjectid']) ? (int) readGetVar('subjectid') : '';
writeTR2($lngstr['page_edittests_subjectid'], getSelectElement('subjectid', $f_subjectid, $i_subjects, ' onchange="document.location.href=\'test-manager.php?subjectid=\'+this.value+\'' . $i_testid_addon . $i_order_addon . $i_url_limitto_addon . '\';"'));
$i_tests = array('' => $lngstr['label_none']);
$i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "tests");
if (!$i_rSet2) {
    showDBError(__FILE__, 2);
} else {
    while (!$i_rSet2->EOF) {
        $i_tests[$i_rSet2->fields['testid']] = $i_rSet2->fields['test_name'];
        $i_rSet2->MoveNext();
    }
    $i_rSet2->Close();
}
$f_testid = isset($_GET['testid']) ? (int) readGetVar('testid') : '';
writeTR2($lngstr['page_edittests_testname'], getSelectElement('testid', $f_testid, $i_tests, ' onchange="document.location.href=\'test-manager.php?testid=\'+this.value+\'' . $i_subjectid_addon . $i_order_addon . $i_url_limitto_addon . '\';"'));
echo '</table>';
echo '</div></td></tr>';
echo '</table></p>';
echo '<p><form name=testsForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="test-manager.php?action=create"><img src="images/button-new-big.gif" width=32 height=32 border=0 title="' . $lngstr['label_action_create_test'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-groups-big.gif" border=0 title="' . $lngstr['label_action_groups'] . '" style="cursor: hand;" onclick="f=document.testsForm;f.action=\'test-manager.php?action=groups\';f.submit();"></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_tests_delete'] . '" style="cursor: hand;" onclick="f=document.testsForm;if (confirm(\'' . $lngstr['qst_delete_tests'] . '\')) { f.action=\'test-manager.php?action=delete&confirmed=1\';f.submit();}"></td>';
echo '<td width=3><img src="images/1x1.gif" width=3 height=1></td>';
echo '<td width="100%">&nbsp;</td>';
if ($i_limitcount > 0) {
    $i_url_pages_addon = $i_url_limitto_addon . $i_order_addon . $i_testid_addon . $i_subjectid_addon;
    echo '<td vAlign=middle width=32><nobr>&nbsp;' . sprintf($lngstr['label']['KtoLofN'], $nRecordFrom, $nRecordTo, $i_recordcount) . '&nbsp;</nobr></td>';
    echo '<td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td>';
    echo '<td vAlign=middle width=32><nobr>&nbsp;';
    for ($i = $nStartPage; $i <= $nEndPage; $i++) {
        if ($i != $i_pageno) {
            echo '&nbsp;<a href="test-manager.php?pageno=' . $i . $i_url_pages_addon . '">' . $i . '</a>&nbsp;';
     writeInstallDialogRow($lngstr['install_dirrootfull'], getInputElement('dir_root_full', @$_SESSION['INSTALL']['dir_root_full']));
     writeInstallDialogRow($lngstr['install_urlfiles'], getInputElement('url_files', @$_SESSION['INSTALL']['url_files']));
     writeInstallDialogRow($lngstr['install_dirfilesfull'], getInputElement('dir_files_full', @$_SESSION['INSTALL']['dir_files_full']));
     echo '</table>';
     break;
 case 4:
     echo '<h1>' . $lngstr['install_page3'] . '</h1>';
     echo $lngstr['install_page3_description'];
     if (isset($g_vars['page']['errors']) && $g_vars['page']['errors']) {
         echo '<p><b><font color="#cc0000">' . $g_vars['page']['errors'] . '</font></b>';
     }
     if (isset($g_vars['page']['notifications']) && $g_vars['page']['notifications']) {
         echo '<p><b><font color="#006000">' . $g_vars['page']['notifications'] . '</font></b>';
     }
     echo '<p><table cellpadding=5 cellspacing=1 border=0 width="100%">';
     writeInstallDialogRow($lngstr['install_dbdriver'], getSelectElement('db_driver', @$_SESSION['INSTALL']['db_driver'], $m_db_drivers));
     writeInstallDialogRow($lngstr['install_dbhost'], getInputElement('db_host', @$_SESSION['INSTALL']['db_host']));
     writeInstallDialogRow($lngstr['install_dbdb'], getInputElement('db_db', @$_SESSION['INSTALL']['db_db']));
     writeInstallDialogRow($lngstr['install_dbuser'], getInputElement('db_user', @$_SESSION['INSTALL']['db_user']));
     writeInstallDialogRow($lngstr['install_dbpassword'], getInputElement('db_password', @$_SESSION['INSTALL']['db_password']));
     writeInstallDialogRow($lngstr['install_dbtableprefix'], getInputElement('table_prefix', @$_SESSION['INSTALL']['table_prefix']));
     echo '</table>';
     break;
 case 5:
     echo '<h1>' . $lngstr['install_page4'] . '</h1>';
     if (isset($g_vars['page']['errors']) && $g_vars['page']['errors']) {
         echo '<p><b><font color="#cc0000">' . $g_vars['page']['errors'] . '</font></b>';
         echo $lngstr['install_downloadconfig'];
     } else {
         echo $lngstr['install_canwritetoconfig'];
     }
$g_vars['page']['userfield6_content'] = getSelectElement('userfield6', getConfigItem(CONFIG_reg_userfield6), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield6_type_label'] = sprintf($lngstr['label_userfield_type'], 6);
$g_vars['page']['userfield6_type_content'] = getSelectElement('type_userfield6', getConfigItem(CONFIG_reg_type_userfield6), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield6\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield6 style="display:' . (getConfigItem(CONFIG_reg_type_userfield6) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield6', getConfigItem(CONFIG_reg_values_userfield6)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield6_caption_label'] = sprintf($lngstr['label_userfield_caption'], 6);
$g_vars['page']['userfield6_caption_content'] = getInputElement('caption_userfield6', getConfigItem(CONFIG_reg_caption_userfield6));
$g_vars['page']['userfield7_label'] = sprintf($lngstr['label_userfield'], 7);
$g_vars['page']['userfield7_content'] = getSelectElement('userfield7', getConfigItem(CONFIG_reg_userfield7), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield7_type_label'] = sprintf($lngstr['label_userfield_type'], 7);
$g_vars['page']['userfield7_type_content'] = getSelectElement('type_userfield7', getConfigItem(CONFIG_reg_type_userfield7), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield7\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield7 style="display:' . (getConfigItem(CONFIG_reg_type_userfield7) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield7', getConfigItem(CONFIG_reg_values_userfield7)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield7_caption_label'] = sprintf($lngstr['label_userfield_caption'], 7);
$g_vars['page']['userfield7_caption_content'] = getInputElement('caption_userfield7', getConfigItem(CONFIG_reg_caption_userfield7));
$g_vars['page']['userfield8_label'] = sprintf($lngstr['label_userfield'], 8);
$g_vars['page']['userfield8_content'] = getSelectElement('userfield8', getConfigItem(CONFIG_reg_userfield8), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield8_type_label'] = sprintf($lngstr['label_userfield_type'], 8);
$g_vars['page']['userfield8_type_content'] = getSelectElement('type_userfield8', getConfigItem(CONFIG_reg_type_userfield8), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield8\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield8 style="display:' . (getConfigItem(CONFIG_reg_type_userfield8) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield8', getConfigItem(CONFIG_reg_values_userfield8)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield8_caption_label'] = sprintf($lngstr['label_userfield_caption'], 8);
$g_vars['page']['userfield8_caption_content'] = getInputElement('caption_userfield8', getConfigItem(CONFIG_reg_caption_userfield8));
$g_vars['page']['userfield9_label'] = sprintf($lngstr['label_userfield'], 9);
$g_vars['page']['userfield9_content'] = getSelectElement('userfield9', getConfigItem(CONFIG_reg_userfield9), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield9_type_label'] = sprintf($lngstr['label_userfield_type'], 9);
$g_vars['page']['userfield9_type_content'] = getSelectElement('type_userfield9', getConfigItem(CONFIG_reg_type_userfield9), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield9\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield9 style="display:' . (getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield9', getConfigItem(CONFIG_reg_values_userfield9)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield9_caption_label'] = sprintf($lngstr['label_userfield_caption'], 9);
$g_vars['page']['userfield9_caption_content'] = getInputElement('caption_userfield9', getConfigItem(CONFIG_reg_caption_userfield9));
$g_vars['page']['userfield10_label'] = sprintf($lngstr['label_userfield'], 10);
$g_vars['page']['userfield10_content'] = getSelectElement('userfield10', getConfigItem(CONFIG_reg_userfield10), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield10_type_label'] = sprintf($lngstr['label_userfield_type'], 10);
$g_vars['page']['userfield10_type_content'] = getSelectElement('type_userfield10', getConfigItem(CONFIG_reg_type_userfield10), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield10\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield10 style="display:' . (getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield10', getConfigItem(CONFIG_reg_values_userfield10)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield10_caption_label'] = sprintf($lngstr['label_userfield_caption'], 10);
$g_vars['page']['userfield10_caption_content'] = getInputElement('caption_userfield10', getConfigItem(CONFIG_reg_caption_userfield10));
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('config-main');
    $i_userfield9_items = array();
    $i_items = explode(',', getConfigItem(CONFIG_reg_values_userfield9));
    foreach ($i_items as $val) {
        $i_userfield9_items[$val] = $val;
    }
}
if (getConfigItem(CONFIG_reg_userfield9) > CONFIG_CONST_donotshow) {
    writeTR2Fixed(getConfigItem(CONFIG_reg_caption_userfield9) . ':', getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_singlelinetext ? getInputElement('user_ufield9', @$arrUserData['user_ufield9']) : (getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_multilinetext ? getTextArea('user_ufield9', @$arrUserData['user_ufield9']) : getSelectElement('user_ufield9', @$arrUserData['user_ufield9'], $i_userfield9_items)));
}
if (isset($lngstr['custom']['user_userfield10_items'])) {
    $i_userfield10_items = $lngstr['custom']['user_userfield10_items'];
} else {
    $i_userfield10_items = array();
    $i_items = explode(',', getConfigItem(CONFIG_reg_values_userfield10));
    foreach ($i_items as $val) {
        $i_userfield10_items[$val] = $val;
    }
}
if (getConfigItem(CONFIG_reg_userfield10) > CONFIG_CONST_donotshow) {
    writeTR2Fixed(getConfigItem(CONFIG_reg_caption_userfield10) . ':', getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_singlelinetext ? getInputElement('user_ufield10', @$arrUserData['user_ufield10']) : (getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_multilinetext ? getTextArea('user_ufield10', @$arrUserData['user_ufield10']) : getSelectElement('user_ufield10', @$arrUserData['user_ufield10'], $i_userfield10_items)));
}
echo '</table></div></td></tr>';
if ($G_SESSION['access_users'] != 1 && $G_SESSION['access_users'] != 3) {
    echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_users_notes\')">' . $lngstr['page_users']['section_notes'] . '</td></tr>';
    echo '<tr valign=top><td class=rowone colspan=2><div id=div_users_notes style="display:' . (isset($_COOKIE['div_users_notes']) && $_COOKIE['div_users_notes'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
    writeTR2Fixed($lngstr['page_users']['notes'], getTextArea('user_notes', @$arrUserData['user_notes']));
    echo '</table></div></td></tr>';
}
echo '</table>';
echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
displayTemplate('_footer');
     }
     writeTR2($lngstr['page_editquestion_question_text'], getTextEditor($G_SESSION['config_editortype'], 'question_text', !empty($i_rSet1->fields['question_text']) ? $i_rSet1->fields['question_text'] : $lngstr['page_editquestion_emptyquestion']));
     $i = 1;
     while (!$i_rSet3->EOF && $i <= $i_answercount_nonempty) {
         writeTR2(sprintf($lngstr['label_choice_no'], $i), '<table cellpadding=0 cellspacing=1 border=0 width="100%"><tr vAlign=top><td width="100%">' . getTextEditor($i_answers_editor, 'answer_text[' . $i . ']', $i_rSet3->fields['answer_text'], 3) . '</td><td vAlign=middle width=150><nobr>' . getCheckbox('answer_correct[' . $i . ']', $i_rSet3->fields['answer_correct'], $lngstr['label_accept_as_correct'], ' onclick="changeChoicePercents(this, ' . $i . ')"') . '</nobr><br><nobr>' . getInputElement('answer_percents[' . $i . ']', $i_rSet3->fields['answer_percents'], 3) . ' ' . $lngstr['label_answer_percents'] . '</nobr></td></tr></table>');
         $i_rowno++;
         writeTR2(sprintf($lngstr['label_answer_feedback_no'], $i), getTextEditor($i_feedback_editor, 'answer_feedback_' . $i, $i_rSet3->fields['answer_feedback'], 3));
         $i_rSet3->MoveNext();
         $i++;
     }
     for ($i = $i_answercount_nonempty + 1; $i <= $f_answercount; $i++) {
         writeTR2(sprintf($lngstr['label_choice_no'], $i), '<table cellpadding=0 cellspacing=1 border=0 width="100%"><tr vAlign=top><td width="100%">' . getTextEditor($i_answers_editor, 'answer_text[' . $i . ']', '', 3) . '</td><td vAlign=middle width=150><nobr>' . getCheckbox('answer_correct[' . $i . ']', 0, $lngstr['label_accept_as_correct'], ' onclick="changeChoicePercents(this, ' . $i . ')"') . '</nobr><br><nobr>' . getInputElement('answer_percents[' . $i . ']', '0', 3) . ' ' . $lngstr['label_answer_percents'] . '</nobr></td></tr></table>');
         $i_rowno++;
         writeTR2(sprintf($lngstr['label_answer_feedback_no'], $i), getTextEditor($i_feedback_editor, 'answer_feedback_' . $i, '', 3));
     }
     writeTR2($lngstr['page_editquestion']['shuffle_answers'], getSelectElement('question_shufflea', $i_rSet1->fields['question_shufflea'], $lngstr['page_editquestion']['shuffle_answers_items']));
     if ($f_question_type == QUESTION_TYPE_MULTIPLEANSWER) {
         writeTR2($lngstr['page_editquestion']['advanced_settings'], getCheckbox('question_type2', $i_rSet1->fields['question_type2'], $lngstr['page_editquestion']['allow_partial_answers']));
     }
     break;
 case QUESTION_TYPE_TRUEFALSE:
     writeTR2($lngstr['page_editquestion_answer_count'], '2');
     writeTR2($lngstr['page_editquestion_question_text'], getTextEditor($G_SESSION['config_editortype'], 'question_text', !empty($i_rSet1->fields['question_text']) ? $i_rSet1->fields['question_text'] : $lngstr['page_editquestion_emptyquestion']));
     $i = 1;
     $i_answer_text = $lngstr['label_atype_truefalse_true'];
     $i_answer_feedback = '';
     $i_answer_correct = false;
     $i_answer_percents = 0;
     if (!$i_rSet3->EOF) {
         $i_answer_text = $i_rSet3->fields['answer_text'];
         $i_answer_feedback = $i_rSet3->fields['answer_feedback'];
$f_subjectid = (int) readGetVar('subjectid', readCookieVar('filter_reportsmanager_subjectid'));
$g_vars['page']['subjectid_content'] = getSelectElement('subjectid', $f_subjectid, $i_subjects);
if ($G_SESSION['access_reportsmanager'] > 1) {
    $i_rtemplates = array('' => $lngstr['label_none']);
    $i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "rtemplates");
    if (!$i_rSet2) {
        showDBError(__FILE__, 2);
    } else {
        while (!$i_rSet2->EOF) {
            $i_rtemplates[$i_rSet2->fields['rtemplateid']] = $i_rSet2->fields['rtemplate_name'];
            $i_rSet2->MoveNext();
        }
        $i_rSet2->Close();
    }
    $f_rtemplateid = (int) readGetVar('rtemplateid');
    $g_vars['page']['rtemplateid_content'] = getSelectElement('rtemplateid', $f_rtemplateid, $i_rtemplates, ' onchange="document.location.href=\'reports-manager.php?rtemplateid=\'+this.value+\'' . $i_order_addon . $i_url_limitto_addon . '\';"');
    $g_vars['page']['addon_rtemplateid'] = '&rtemplateid=' . $f_rtemplateid;
}
$g_vars['page']['addon_order'] = $i_order_addon;
$g_vars['page']['addon_limit'] = $i_url_limit_addon;
$g_vars['page']['addon_limitto'] = $i_url_limitto_addon;
$g_vars['page']['navbar']['record_from'] = $nRecordFrom;
$g_vars['page']['navbar']['record_to'] = $nRecordTo;
$g_vars['page']['navbar']['record_count'] = $i_recordcount;
$g_vars['page']['navbar']['page_window_numbers'] = array();
for ($i = $nStartPage; $i <= $nEndPage; $i++) {
    $g_vars['page']['navbar']['page_window_numbers'][$i] = $i;
}
$g_vars['page']['limitcount'] = $i_limitcount;
$g_vars['page']['pageno_current'] = $i_pageno;
$g_vars['page']['page_count'] = $i_pageno_count;
//9917
$i_rSet1 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "groups WHERE groupid={$f_groupid}");
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        echo '<p><form method=post action="groups.php?groupid=' . $f_groupid . '&action=edit">';
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        $i_rowno = 0;
        writeTR2($lngstr['page_managegroups_groupid'], $i_rSet1->fields["groupid"]);
        writeTR2($lngstr['page_managegroups_groupname'], getInputElement('group_name', $i_rSet1->fields["group_name"]));
        writeTR2($lngstr['page_managegroups_groupdescription'], getTextArea('group_description', $i_rSet1->fields["group_description"]));
        echo '<tr valign=top><td class=rowhdr2 colspan=2>' . $lngstr['page_groups_access_rights'] . '</td></tr>';
        writeTR2($lngstr['page_groups_access_tests'], getSelectElement('access_tests', $i_rSet1->fields["access_tests"], $lngstr['page_groups_access_tests_select']));
        writeTR2($lngstr['page_groups_access_questionbank'], getSelectElement('access_questionbank', $i_rSet1->fields["access_questionbank"], $lngstr['page_groups_access_questionbank_select']));
        writeTR2($lngstr['page_groups_access_subjects'], getSelectElement('access_subjects', $i_rSet1->fields["access_subjects"], $lngstr['page_groups_access_subjects_select']));
        writeTR2($lngstr['page_groups_access_testmanager'], getSelectElement('access_testmanager', $i_rSet1->fields["access_testmanager"], $lngstr['page_groups_access_testmanager_select']));
        writeTR2($lngstr['page_groups_access_gradingsystems'], getSelectElement('access_gradingsystems', $i_rSet1->fields["access_gradingsystems"], $lngstr['page_groups_access_gradingsystems_select']));
        writeTR2($lngstr['page_groups_access_emailtemplates'], getSelectElement('access_emailtemplates', $i_rSet1->fields["access_emailtemplates"], $lngstr['page_groups_access_emailtemplates_select']));
        writeTR2($lngstr['page_groups_access_reporttemplates'], getSelectElement('access_reporttemplates', $i_rSet1->fields["access_reporttemplates"], $lngstr['page_groups_access_reporttemplates_select']));
        writeTR2($lngstr['page_groups_access_reportsmanager'], getSelectElement('access_reportsmanager', $i_rSet1->fields["access_reportsmanager"], $lngstr['page_groups_access_reportsmanager_select']));
        writeTR2($lngstr['page_groups_access_users'], getSelectElement('access_users', $i_rSet1->fields["access_users"], $lngstr['page_groups_access_users_select']));
        writeTR2($lngstr['page_groups_access_groups'], getSelectElement('access_groups', $i_rSet1->fields["access_groups"], $lngstr['page_groups_access_groups_select']));
        writeTR2($lngstr['page_groups_access_config'], getSelectElement('access_config', $i_rSet1->fields["access_config"], $lngstr['page_groups_access_config_select']));
        writeTR2($lngstr['page_groups_access_visitors'], getSelectElement('access_visitors', $i_rSet1->fields["access_visitors"], $lngstr['page_groups_access_visitors_select']));
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
if (isset($lngstr['custom']['user_userfield9_items'])) {
    $i_userfield9_items = $lngstr['custom']['user_userfield9_items'];
} else {
    $i_userfield9_items = array();
    $i_items = explode(',', getConfigItem(CONFIG_reg_values_userfield9));
    foreach ($i_items as $val) {
        $i_userfield9_items[$val] = $val;
    }
}
$g_vars['page']['items']['userfield9'] = @getInputField(getConfigItem(CONFIG_reg_userfield9), getConfigItem(CONFIG_reg_caption_userfield9) . ':', getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_singlelinetext ? getInputElement('userfield9', $f_userfield9) : (getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_multilinetext ? getTextArea('userfield9', $f_userfield9) : getSelectElement('userfield9', $f_userfield9, $i_userfield9_items)));
if (isset($lngstr['custom']['user_userfield10_items'])) {
    $i_userfield10_items = $lngstr['custom']['user_userfield10_items'];
} else {
    $i_userfield10_items = array();
    $i_items = explode(',', getConfigItem(CONFIG_reg_values_userfield10));
    foreach ($i_items as $val) {
        $i_userfield10_items[$val] = $val;
    }
}
$g_vars['page']['items']['userfield10'] = @getInputField(getConfigItem(CONFIG_reg_userfield10), getConfigItem(CONFIG_reg_caption_userfield10) . ':', getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_singlelinetext ? getInputElement('userfield10', $f_userfield10) : (getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_multilinetext ? getTextArea('userfield10', $f_userfield10) : getSelectElement('userfield10', $f_userfield10, $i_userfield10_items)));
function getInputField($i_showsettings, $i_caption, $i_value)
{
    if ($i_showsettings >= CONFIG_CONST_show_donotrequire) {
        return getTR(array($i_caption . ' ' . ($i_showsettings >= CONFIG_CONST_show_autogenerate ? REQUIRED_FIELD_MARK : ''), $i_value));
    }
    return '';
}
$g_vars['page']['items']['groupid_input'] = getInputElement('groupid', $f_groupid, 0, 0, '', $i_type = 'hidden');
$g_vars['page']['items']['testid_input'] = getInputElement('testid', $f_testid, 0, 0, '', $i_type = 'hidden');
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('register');
        echo '<tr valign=top><td class=rowone colspan=2><div id=div_testmanager_settings_groups style="display:' . (isset($_COOKIE['div_testmanager_settings_groups']) && $_COOKIE['div_testmanager_settings_groups'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        writeTR2Fixed($lngstr['page_edittests_assignedto'], '<p>' . $i_groups_text . '<p>' . getCheckbox('test_forall', $i_rSet1->fields['test_forall'], $lngstr['page_edittests_assignto_everybody']));
        $i_tests_items = array(0 => $lngstr['label_none']);
        $i_rSet3 = $g_db->Execute("SELECT " . $srv_settings['table_prefix'] . "tests.testid, " . $srv_settings['table_prefix'] . "tests.test_name FROM " . $srv_settings['table_prefix'] . "tests ORDER BY testid");
        if (!$i_rSet3) {
            showDBError(__FILE__, 3);
        } else {
            while (!$i_rSet3->EOF) {
                $i_tests_items[$i_rSet3->fields['testid']] = $i_rSet3->fields['test_name'];
                $i_rSet3->MoveNext();
            }
            $i_rSet3->Close();
        }
        echo '</table></div></td></tr>';
        echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_testmanager_settings_advanced\')">' . $lngstr['page_testmanager']['settings']['section_advanced'] . '</td></tr>';
        echo '<tr valign=top><td class=rowone colspan=2><div id=div_testmanager_settings_advanced style="display:' . (!isset($_COOKIE['div_testmanager_settings_advanced']) || $_COOKIE['div_testmanager_settings_advanced'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        writeTR2Fixed($lngstr['page_testmanager']['content_protection'], getSelectElement('test_contentprotection', $i_rSet1->fields['test_contentprotection'], $lngstr['page_testmanager']['content_protection_list']));
        writeTR2Fixed($lngstr['page-testmanager']['prevtest'], getSelectElement('test_prevtestid', $i_rSet1->fields['test_prevtestid'], $i_tests_items));
        writeTR2Fixed($lngstr['page-testmanager']['nexttest'], getSelectElement('test_nexttestid', $i_rSet1->fields['test_nexttestid'], $i_tests_items));
        writeTR2Fixed($lngstr['page_testmanager']['other_options'], getCheckbox('test_other_repeatuntilcorrect', $i_rSet1->fields['test_other_repeatuntilcorrect'], $lngstr['page_testmanager']['repeat_until_answered_correctly']));
        echo '</table></div></td></tr>';
        echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_testmanager_settings_notes\')">' . $lngstr['page_testmanager']['settings']['section_notes'] . '</td></tr>';
        echo '<tr valign=top><td class=rowone colspan=2><div id=div_testmanager_settings_notes style="display:' . (isset($_COOKIE['div_testmanager_settings_notes']) && $_COOKIE['div_testmanager_settings_notes'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        writeTR2Fixed($lngstr['page_edittests_testnotes'], getTextArea('test_notes', $i_rSet1->fields['test_notes']));
        echo '</table></div></td></tr>';
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bsubmit2 value=" ' . $lngstr['button_update_and_edit_questions'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
echo '<p><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="">';
echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_filter_questionbank\')">' . $lngstr['label_filter_header'] . '</td></tr>';
echo '<tr valign=top><td class=rowone colspan=2><div id=div_filter_questionbank style="display:' . (isset($_COOKIE['div_filter_questionbank']) && $_COOKIE['div_filter_questionbank'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
$i_subjects = array('' => $lngstr['label_none']);
$i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "subjects");
if (!$i_rSet2) {
    showDBError(__FILE__, 2);
} else {
    while (!$i_rSet2->EOF) {
        $i_subjects[$i_rSet2->fields['subjectid']] = $i_rSet2->fields['subject_name'];
        $i_rSet2->MoveNext();
    }
    $i_rSet2->Close();
}
$f_subjectid = isset($_GET['subjectid']) ? (int) readGetVar('subjectid') : '';
writeTR2($lngstr['page_editquestion_subjectid'], getSelectElement('subjectid', $f_subjectid, $i_subjects, ' onchange="document.location.href=\'question-bank.php?subjectid=\'+this.value+\'' . $i_order_addon . $i_url_limit_addon . '\';"'));
echo '</table>';
echo '</div></td></tr>';
echo '</table></p>';
echo '<p><form name=qbankForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="question-bank.php?action=createq"><img src="images/button-new-big.gif" border=0 title="' . $lngstr['label_action_create_question'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-stats-big.gif" border=0 title="' . $lngstr['label_action_questions_stats'] . '" style="cursor: hand;" onclick="f=document.qbankForm;f.action=\'question-bank.php?action=statsq\';f.submit();"></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_questions_delete'] . '" style="cursor: hand;" onclick="f=document.qbankForm;if (confirm(\'' . $lngstr['qst_delete_questions'] . '\')) { f.action=\'question-bank.php?action=deleteq&confirmed=1\';f.submit();}"></td>';
echo '<td width="100%">&nbsp;</td>';
if ($i_limitcount > 0) {
    $i_url_pages_addon = $i_url_limitto_addon . $i_order_addon . $i_subjectid_addon;
    echo '<td vAlign=middle width=32><nobr>&nbsp;' . sprintf($lngstr['label']['KtoLofN'], $nRecordFrom, $nRecordTo, $i_recordcount) . '&nbsp;</nobr></td>';
    echo '<td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td>';
    echo '<td vAlign=middle width=32><nobr>&nbsp;';
    for ($i = $nStartPage; $i <= $nEndPage; $i++) {
        if ($i != $i_pageno) {
            echo '&nbsp;<a href="question-bank.php?pageno=' . $i . $i_url_pages_addon . '">' . $i . '</a>&nbsp;';
        } else {