$i_order_addon = "&order=" . $i_order_no . "&direction=" . $i_direction; $i_sql_order_addon = " ORDER BY " . $i_tablefields[$i_order_no][2] . " " . $i_direction; } echo '<p><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top>'; writeQryTableHeaders('reports-manager.php?action=viewq' . $i_resultid_addon, $i_tablefields, $i_order_no, $i_direction); echo '<td class=rowhdr1 colspan=2 width=22>' . $lngstr['label_hdr_action'] . '</td></tr>'; $i_rSet2 = $g_db->Execute("SELECT result_answerid, questionid, test_questionid, result_answer_text, result_answer_points, result_answer_iscorrect, result_answer_timespent, result_answer_timeexceeded FROM " . $srv_settings['table_prefix'] . "results_answers WHERE resultid=" . $f_resultid . $i_sql_order_addon); if (!$i_rSet2) { showDBError(__FILE__, 2); } else { $i_counter = 0; while (!$i_rSet2->EOF) { $rowname = $i_counter % 2 ? 'rowone' : 'rowtwo'; if (IGT_NUMBERING_STYLE_ANSWERS == IGT_NUMBERING_STYLES_LETTERS) { $nQuestionType = getRecordItem($srv_settings['table_prefix'] . 'questions', 'question_type', 'questionid=' . $i_rSet2->fields['questionid']); switch ($nQuestionType) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: case QUESTION_TYPE_MULTIPLEANSWER: $strAnswerText = $i_rSet2->fields['result_answer_text']; $arrAnswerText = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $strAnswerText); foreach ($arrAnswerText as $key => $val) { $arrAnswerText[$key] = convertNumberToLetter($val); } $strAnswerText = implode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $arrAnswerText); $i_rSet2->fields['result_answer_text'] = $strAnswerText; break; } } echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=right>' . $i_rSet2->fields['result_answerid'] . '</td><td align=right>' . $i_rSet2->fields['test_questionid'] . '</td><td>' . makeTime($i_rSet2->fields['result_answer_timespent']) . '</td><td>' . convertTextValue($i_rSet2->fields['result_answer_text']) . '</td><td align=right>' . $i_rSet2->fields['result_answer_points'] . '</td><td align=center>' . ($i_rSet2->fields['result_answer_timeexceeded'] ? '<img src="images/button-checkbox-2.gif" width=13 height=13 border=0 title="' . $lngstr['label_yes'] . '">' : '<img src="images/button-checkbox-0.gif" width=13 height=13 border=0 title="' . $lngstr['label_no'] . '">') . '</td><td align=center>' . ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? '<a href="reports-manager.php?answerid=' . $i_rSet2->fields['result_answerid'] . $i_resultid_addon . '&action=viewa"><img width=13 height=13 border=0 src="images/button-checkbox-3.gif" title="' . $lngstr['label_undefined'] . '"></a>' : ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? '<img width=13 height=13 border=0 src="images/button-checkbox-2.gif" title="' . $lngstr['label_yes'] . '">' : ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? '<img width=13 height=13 border=0 src="images/button-checkbox-1.gif" title="' . $lngstr['label_partially'] . '">' : '<img width=13 height=13 border=0 src="images/button-checkbox-0.gif" title="' . $lngstr['label_no'] . '">'))) . '</td>';
<?php $i_filename = 'test-results.csv'; $i_delimiter = $lngstr['language']['list_separator']; $i_filecontent = ''; function csvQuote($text) { return '"' . str_replace('"', '""', $text) . '"'; } $f_rtemplateid = (int) readGetVar('rtemplateid'); if ($f_rtemplateid > 0) { $i_columns_text = trim(getRecordItem($srv_settings['table_prefix'] . 'rtemplates', 'rtemplate_body', 'rtemplateid=' . $f_rtemplateid)); } else { $i_columns_text = 'resultid,result_datestart,result_datestart_formatted,id,username,user_firstname,user_lastname,testid,test_name,result_timeexceeded,result_points,result_pointsmax,result_score,grade_name'; } $i_columns = explode(',', $i_columns_text); $i_sql_where_addon = '1=0 AND '; if ($G_SESSION['access_reportsmanager'] > 1) { $f_id = readCookieVar('filter_reportsmanager_id', readGetVar('id')); if (!empty($f_id)) { $f_id = (int) $f_id; $i_sql_where_addon = $srv_settings['table_prefix'] . 'results.id=' . $f_id . ' AND '; } else { $i_sql_where_addon = ''; } } else { $i_sql_where_addon = $srv_settings['table_prefix'] . 'results.id=' . $G_SESSION['id'] . ' AND '; } $f_user_lastname = readCookieVar('filter_reportsmanager_user_lastname', readGetVar('user_lastname')); if (!empty($f_user_lastname)) { $i_user_lastname = $g_db->qstr($f_user_lastname, get_magic_quotes_gpc());
$g_vars['page']['questionindicator_hint'] = sprintf($lngstr['page_test']['questionindicator_hint'], $G_SESSION['yt_questionno_current'], $G_SESSION['yt_questioncount']); $g_vars['page']['questionindicator'] = sprintf($lngstr['page_test']['questionindicator'], $G_SESSION['yt_questionno_current'], $G_SESSION['yt_questioncount']); $g_vars['page']['testid'] = $G_SESSION['testid']; $g_vars['page']['test_name'] = convertTextValue($G_SESSION['yt_name']); $g_vars['page']['content_protection'] = $G_SESSION['yt_contentprotection']; if (!isset($G_SESSION['questionid'])) { $nQuestionNoReal = $G_SESSION['yt_questions'][$G_SESSION['yt_questionno_current'] - 1]; $G_SESSION['questionid'] = $G_SESSION['yt_questionids'][$nQuestionNoReal]; $G_SESSION['yt_questionstart'] = time(); } $g_vars['page']['has_feedback'] = $G_SESSION['yt_state'] == TEST_STATE_QFEEDBACK; readTestQuestion($G_SESSION['yt_questionno_current'], $G_SESSION['questionid']); $G_SESSION['yt_page_hasfeedback'] = $g_vars['page']['has_feedback']; if ($g_vars['page']['errors_fatal'] && $G_SESSION['yt_state'] != TEST_STATE_QFEEDBACK) { unregisterTestData(); } $g_vars['page']['variables']['yt_questionno'] = $G_SESSION['yt_questionno']; $g_vars['page']['variables']['yt_questionno_current'] = $G_SESSION['yt_questionno_current']; $g_vars['page']['variables']['yt_questioncount'] = $G_SESSION['yt_questioncount']; $g_vars['page']['variables']['yt_state'] = $G_SESSION['yt_state']; $g_vars['page']['review']['mode'] = $G_SESSION['yt_canreview']; if ($G_SESSION['yt_canreview'] == IGT_TEST_REVIEW_ALLOWED) { for ($nQuestionNo = 1; $nQuestionNo <= min($G_SESSION['yt_questionno'], $G_SESSION['yt_questioncount']); $nQuestionNo++) { $nQuestionNoReal = $G_SESSION['yt_questions'][$nQuestionNo - 1]; $nQuestionID = $G_SESSION['yt_questionids'][$nQuestionNoReal]; $g_vars['page']['review']['question'][$nQuestionNo]['text_truncated'] = getTruncatedHTML(getRecordItem($srv_settings['table_prefix'] . 'questions', 'question_text', 'questionid=' . $nQuestionID)); } } $g_smarty->assign('g_questionno', $G_SESSION['yt_questionno_current']); $g_smarty->assign('g_vars', $g_vars); displayTemplate('test-question');
} else { $G_SESSION['yt_questionno_current']++; if ($G_SESSION['yt_questionno_current'] < $G_SESSION['yt_questionno']) { $G_SESSION['yt_state'] = TEST_STATE_QREVIEW; } } } $bFinishThisTest = $G_SESSION['yt_questionno'] > $G_SESSION['yt_questioncount']; if ($bFinishThisTest) { $G_SESSION['yt_state'] = TEST_STATE_QREVIEW; } $bButtonSubmit = isset($_POST['bsubmit']); $bFinishThisTest = $bFinishThisTest && $bButtonSubmit; } else { if ($G_SESSION['yt_other_repeatuntilcorrect']) { $bIsAnswerCorrect = getRecordItem($srv_settings['table_prefix'] . 'results_answers', 'result_answer_iscorrect', 'result_answerid=' . $G_SESSION['yt_questionno_current'] . ' AND resultid=' . $G_SESSION['resultid'] . ' AND questionid=' . $G_SESSION['questionid']); } if ($G_SESSION['yt_other_repeatuntilcorrect'] && ($bIsAnswerCorrect == IGT_ANSWER_IS_INCORRECT || $bIsAnswerCorrect == IGT_ANSWER_IS_PARTIALLYCORRECT)) { $G_SESSION['yt_questionno_current'] = $G_SESSION['yt_questionno']; $G_SESSION['yt_state'] = TEST_STATE_QREVIEW; } else { $G_SESSION['yt_questionno']++; $bFinishThisTest = $G_SESSION['yt_questionno'] > $G_SESSION['yt_questioncount']; } } unset($G_SESSION['questionid']); unset($G_SESSION['yt_questionstart']); if ($bFinishThisTest) { include_once $DOCUMENT_PAGES . 'test-saveresults.inc.php'; gotoLocation('test.php?action=results'); } else {
function processTemplate($i_parameters = array()) { global $g_db, $srv_settings, $DOCUMENT_PAGES; $arrResult = array(); $i_template_body = isset($i_parameters['template_body']) ? $i_parameters['template_body'] : ''; $i_content_type = isset($i_parameters['content_type']) ? $i_parameters['content_type'] : ''; $i_id = isset($i_parameters['id']) ? $i_parameters['id'] : ''; $i_username = isset($i_parameters['username']) ? $i_parameters['username'] : ''; $i_password = isset($i_parameters['password']) ? $i_parameters['password'] : ''; $i_checkword = isset($i_parameters['checkword']) ? $i_parameters['checkword'] : ''; $i_email = isset($i_parameters['email']) ? $i_parameters['email'] : ''; $i_title = isset($i_parameters['title']) ? $i_parameters['title'] : ''; $i_firstname = isset($i_parameters['firstname']) ? $i_parameters['firstname'] : ''; $i_lastname = isset($i_parameters['lastname']) ? $i_parameters['lastname'] : ''; $i_middlename = isset($i_parameters['middlename']) ? $i_parameters['middlename'] : ''; $i_address = isset($i_parameters['address']) ? $i_parameters['address'] : ''; $i_city = isset($i_parameters['city']) ? $i_parameters['city'] : ''; $i_state = isset($i_parameters['state']) ? $i_parameters['state'] : ''; $i_zip = isset($i_parameters['zip']) ? $i_parameters['zip'] : ''; $i_country = isset($i_parameters['country']) ? $i_parameters['country'] : ''; $i_phone = isset($i_parameters['phone']) ? $i_parameters['phone'] : ''; $i_fax = isset($i_parameters['fax']) ? $i_parameters['fax'] : ''; $i_mobile = isset($i_parameters['mobile']) ? $i_parameters['mobile'] : ''; $i_pager = isset($i_parameters['pager']) ? $i_parameters['pager'] : ''; $i_ipphone = isset($i_parameters['ipphone']) ? $i_parameters['ipphone'] : ''; $i_webpage = isset($i_parameters['webpage']) ? $i_parameters['webpage'] : ''; $i_icq = isset($i_parameters['icq']) ? $i_parameters['icq'] : ''; $i_msn = isset($i_parameters['msn']) ? $i_parameters['msn'] : ''; $i_aol = isset($i_parameters['aol']) ? $i_parameters['aol'] : ''; $i_gender = isset($i_parameters['gender']) ? $i_parameters['gender'] : ''; $i_birthday = isset($i_parameters['birthday']) ? $i_parameters['birthday'] : ''; $i_husbandwife = isset($i_parameters['husbandwife']) ? $i_parameters['husbandwife'] : ''; $i_children = isset($i_parameters['children']) ? $i_parameters['children'] : ''; $i_trainer = isset($i_parameters['trainer']) ? $i_parameters['trainer'] : ''; $i_photo = isset($i_parameters['photo']) ? $i_parameters['photo'] : ''; $i_company = isset($i_parameters['company']) ? $i_parameters['company'] : ''; $i_cposition = isset($i_parameters['cposition']) ? $i_parameters['cposition'] : ''; $i_department = isset($i_parameters['department']) ? $i_parameters['department'] : ''; $i_coffice = isset($i_parameters['coffice']) ? $i_parameters['coffice'] : ''; $i_caddress = isset($i_parameters['caddress']) ? $i_parameters['caddress'] : ''; $i_ccity = isset($i_parameters['ccity']) ? $i_parameters['ccity'] : ''; $i_cstate = isset($i_parameters['cstate']) ? $i_parameters['cstate'] : ''; $i_czip = isset($i_parameters['czip']) ? $i_parameters['czip'] : ''; $i_ccountry = isset($i_parameters['ccountry']) ? $i_parameters['ccountry'] : ''; $i_cphone = isset($i_parameters['cphone']) ? $i_parameters['cphone'] : ''; $i_cfax = isset($i_parameters['cfax']) ? $i_parameters['cfax'] : ''; $i_cmobile = isset($i_parameters['cmobile']) ? $i_parameters['cmobile'] : ''; $i_cpager = isset($i_parameters['cpager']) ? $i_parameters['cpager'] : ''; $i_cipphone = isset($i_parameters['cipphone']) ? $i_parameters['cipphone'] : ''; $i_cwebpage = isset($i_parameters['cwebpage']) ? $i_parameters['cwebpage'] : ''; $i_cphoto = isset($i_parameters['cphoto']) ? $i_parameters['cphoto'] : ''; $i_ufield1 = isset($i_parameters['ufield1']) ? $i_parameters['ufield1'] : ''; $i_ufield2 = isset($i_parameters['ufield2']) ? $i_parameters['ufield2'] : ''; $i_ufield3 = isset($i_parameters['ufield3']) ? $i_parameters['ufield3'] : ''; $i_ufield4 = isset($i_parameters['ufield4']) ? $i_parameters['ufield4'] : ''; $i_ufield5 = isset($i_parameters['ufield5']) ? $i_parameters['ufield5'] : ''; $i_ufield6 = isset($i_parameters['ufield6']) ? $i_parameters['ufield6'] : ''; $i_ufield7 = isset($i_parameters['ufield7']) ? $i_parameters['ufield7'] : ''; $i_ufield8 = isset($i_parameters['ufield8']) ? $i_parameters['ufield8'] : ''; $i_ufield9 = isset($i_parameters['ufield9']) ? $i_parameters['ufield9'] : ''; $i_ufield10 = isset($i_parameters['ufield10']) ? $i_parameters['ufield10'] : ''; $i_test_name = isset($i_parameters['test_name']) ? $i_parameters['test_name'] : ''; $i_result_id = isset($i_parameters['result_id']) ? $i_parameters['result_id'] : ''; $i_result_date = isset($i_parameters['result_date']) ? $i_parameters['result_date'] : ''; $i_result_time_spent = isset($i_parameters['result_time_spent']) ? $i_parameters['result_time_spent'] : ''; $i_result_time_exceeded = isset($i_parameters['result_time_exceeded']) ? $i_parameters['result_time_exceeded'] : ''; $i_result_points_scored = isset($i_parameters['result_points_scored']) ? $i_parameters['result_points_scored'] : ''; $i_result_points_possible = isset($i_parameters['result_points_possible']) ? $i_parameters['result_points_possible'] : ''; $i_result_percents = isset($i_parameters['result_percents']) ? $i_parameters['result_percents'] : ''; $i_result_grade = isset($i_parameters['result_grade']) ? $i_parameters['result_grade'] : ''; $i_result_grade_feedback = isset($i_parameters['result_grade_feedback']) ? $i_parameters['result_grade_feedback'] : ''; $i_result_subjects = isset($i_parameters['result_subjects']) ? $i_parameters['result_subjects'] : array(); $i_result_detailed_1 = isset($i_parameters['result_detailed_1']) ? $i_parameters['result_detailed_1'] : ''; $i_result_detailed_2 = isset($i_parameters['result_detailed_2']) ? $i_parameters['result_detailed_2'] : ''; $i_result_detailed_3 = isset($i_parameters['result_detailed_3']) ? $i_parameters['result_detailed_3'] : ''; $i_result_detailed_4 = isset($i_parameters['result_detailed_4']) ? $i_parameters['result_detailed_4'] : ''; $i_result_detailed_5 = isset($i_parameters['result_detailed_5']) ? $i_parameters['result_detailed_5'] : ''; $i_result_detailed_6 = isset($i_parameters['result_detailed_6']) ? $i_parameters['result_detailed_6'] : ''; $i_custom_tag_1 = isset($i_parameters['custom_tag_1']) ? $i_parameters['custom_tag_1'] : ''; $i_custom_tag_2 = isset($i_parameters['custom_tag_2']) ? $i_parameters['custom_tag_2'] : ''; $i_custom_tag_3 = isset($i_parameters['custom_tag_3']) ? $i_parameters['custom_tag_3'] : ''; $i_custom_tag_4 = isset($i_parameters['custom_tag_4']) ? $i_parameters['custom_tag_4'] : ''; $i_custom_tag_5 = isset($i_parameters['custom_tag_5']) ? $i_parameters['custom_tag_5'] : ''; $i_result_subjects_detailed = ''; if (strpos($i_template_body, ETEMPLATE_TAG_RESULT_SUBJECTS_DETAILED) !== false) { foreach ($i_result_subjects as $nSubjectID => $arrSubjectInfo) { $strSubjectName = getRecordItem($srv_settings['table_prefix'] . 'subjects', 'subject_name', 'subjectid=' . $nSubjectID); $rScore = $arrSubjectInfo['total_points'] != 0 ? $arrSubjectInfo['got_points'] / $arrSubjectInfo['total_points'] * 100 : 100; $i_result_subjects_detailed .= $strSubjectName . ' - ' . $arrSubjectInfo['got_points'] . '/' . $arrSubjectInfo['total_points'] . ', ' . sprintf("%.1f", $rScore) . '%<br />'; } } $nPos1 = 0; $nPos2 = 0; while ($nPos1 !== false && $nPos2 !== false) { $nPos1 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_NAME); $nPos2 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_NAME_CLOSE); if ($nPos1 !== false && $nPos2 !== false) { $nStartPos = $nPos1 + strlen(IGT_TAG_RESULT_SUBJECT_NAME); $nSubjectID = (int) trim(substr($i_template_body, $nStartPos, $nPos2 - $nStartPos)); if ($nSubjectID > 0) { $strSubjectName = getRecordItem($srv_settings['table_prefix'] . 'subjects', 'subject_name', 'subjectid=' . $nSubjectID); $i_template_body = substr_replace($i_template_body, $strSubjectName, $nPos1, $nPos2 + strlen(IGT_TAG_RESULT_SUBJECT_NAME_CLOSE) - $nPos1); } } } $nPos1 = 0; $nPos2 = 0; while ($nPos1 !== false && $nPos2 !== false) { $nPos1 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_POINTS_SCORED); $nPos2 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_POINTS_SCORED_CLOSE); if ($nPos1 !== false && $nPos2 !== false) { $nStartPos = $nPos1 + strlen(IGT_TAG_RESULT_SUBJECT_POINTS_SCORED); $nSubjectID = (int) trim(substr($i_template_body, $nStartPos, $nPos2 - $nStartPos)); if ($nSubjectID > 0) { $i_template_body = substr_replace($i_template_body, $i_result_subjects[$nSubjectID]['got_points'], $nPos1, $nPos2 + strlen(IGT_TAG_RESULT_SUBJECT_POINTS_SCORED_CLOSE) - $nPos1); } } } $nPos1 = 0; $nPos2 = 0; while ($nPos1 !== false && $nPos2 !== false) { $nPos1 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_POINTS_POSSIBLE); $nPos2 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_POINTS_POSSIBLE_CLOSE); if ($nPos1 !== false && $nPos2 !== false) { $nStartPos = $nPos1 + strlen(IGT_TAG_RESULT_SUBJECT_POINTS_POSSIBLE); $nSubjectID = (int) trim(substr($i_template_body, $nStartPos, $nPos2 - $nStartPos)); if ($nSubjectID > 0) { $i_template_body = substr_replace($i_template_body, $i_result_subjects[$nSubjectID]['total_points'], $nPos1, $nPos2 + strlen(IGT_TAG_RESULT_SUBJECT_POINTS_POSSIBLE_CLOSE) - $nPos1); } } } $nPos1 = 0; $nPos2 = 0; while ($nPos1 !== false && $nPos2 !== false) { $nPos1 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_SCORE); $nPos2 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_SCORE_CLOSE); if ($nPos1 !== false && $nPos2 !== false) { $nStartPos = $nPos1 + strlen(IGT_TAG_RESULT_SUBJECT_SCORE); $nSubjectID = (int) trim(substr($i_template_body, $nStartPos, $nPos2 - $nStartPos)); if ($nSubjectID > 0) { $rScore = $i_result_subjects[$nSubjectID]['total_points'] != 0 ? $i_result_subjects[$nSubjectID]['got_points'] / $i_result_subjects[$nSubjectID]['total_points'] * 100 : 100; $i_template_body = substr_replace($i_template_body, sprintf("%.1f", $rScore), $nPos1, $nPos2 + strlen(IGT_TAG_RESULT_SUBJECT_SCORE_CLOSE) - $nPos1); } } } $nPos1 = 0; $nPos2 = 0; while ($nPos1 !== false && $nPos2 !== false) { $nPos1 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_GRADE); $nPos2 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_GRADE_CLOSE); if ($nPos1 !== false && $nPos2 !== false) { $nStartPos = $nPos1 + strlen(IGT_TAG_RESULT_SUBJECT_GRADE); $arrValues = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, trim(substr($i_template_body, $nStartPos, $nPos2 - $nStartPos))); $nSubjectID = (int) trim($arrValues[0]); $nGScaleID = (int) trim($arrValues[1]); if ($nSubjectID > 0) { $rScore = $i_result_subjects[$nSubjectID]['total_points'] != 0 ? $i_result_subjects[$nSubjectID]['got_points'] / $i_result_subjects[$nSubjectID]['total_points'] * 100 : 100; $arrGrade = calcResultGrade($nGScaleID, $rScore); $i_template_body = substr_replace($i_template_body, $arrGrade['name'], $nPos1, $nPos2 + strlen(IGT_TAG_RESULT_SUBJECT_GRADE_CLOSE) - $nPos1); } } } $nPos1 = 0; $nPos2 = 0; while ($nPos1 !== false && $nPos2 !== false) { $nPos1 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_GRADE_FEEDBACK); $nPos2 = strpos($i_template_body, IGT_TAG_RESULT_SUBJECT_GRADE_FEEDBACK_CLOSE); if ($nPos1 !== false && $nPos2 !== false) { $nStartPos = $nPos1 + strlen(IGT_TAG_RESULT_SUBJECT_GRADE_FEEDBACK); $arrValues = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, trim(substr($i_template_body, $nStartPos, $nPos2 - $nStartPos))); $nSubjectID = (int) trim($arrValues[0]); $nGScaleID = (int) trim($arrValues[1]); if ($nSubjectID > 0) { $rScore = $i_result_subjects[$nSubjectID]['total_points'] != 0 ? $i_result_subjects[$nSubjectID]['got_points'] / $i_result_subjects[$nSubjectID]['total_points'] * 100 : 100; $arrGrade = calcResultGrade($nGScaleID, $rScore); $i_template_body = substr_replace($i_template_body, $arrGrade['feedback'], $nPos1, $nPos2 + strlen(IGT_TAG_RESULT_SUBJECT_GRADE_FEEDBACK_CLOSE) - $nPos1); } } } if ($i_content_type == 'text/plain') { $i_result_grade_feedback = strip_tags(convertTextAreaHTML(false, str_replace("\r", '', str_replace("\n", '', $i_result_grade_feedback)))); $i_result_subjects_detailed = strip_tags(convertTextAreaHTML(false, str_replace("\r", '', str_replace("\n", '', $i_result_subjects_detailed)))); } if ($i_template_body) { $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_GRADE_FEEDBACK, $i_result_grade_feedback, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_IGIVETEST_URL, $srv_settings['url_root_full'], $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_id, $i_id, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USERNAME, $i_username, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_PASSWORD, $i_password, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CHECKWORD, $i_checkword, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_TITLE, $i_title, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_FIRST_NAME, $i_firstname, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_LAST_NAME, $i_lastname, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_MIDDLE_NAME, $i_middlename, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_email, $i_email, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_ADDRESS, $i_address, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CITY, $i_city, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_STATE, $i_state, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_ZIP, $i_zip, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_COUNTRY, $i_country, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_PHONE, $i_phone, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_FAX, $i_fax, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_MOBILE, $i_mobile, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_PAGER, $i_pager, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_IPPHONE, $i_ipphone, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_WEBPAGE, $i_webpage, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_ICQ, $i_icq, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_MSN, $i_msn, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_AOL, $i_aol, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_GENDER, $i_gender, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_BIRTHDAY, $i_birthday, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_HUSBANDWIFE, $i_husbandwife, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CHILDREN, $i_children, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_TRAINER, $i_trainer, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_PHOTO, $i_photo, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_COMPANY, $i_company, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CPOSITION, $i_cposition, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_DEPARTMENT, $i_department, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_COFFICE, $i_coffice, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CADDRESS, $i_caddress, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CCITY, $i_ccity, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CSTATE, $i_cstate, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CZIP, $i_czip, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CCOUNTRY, $i_ccountry, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CPHONE, $i_cphone, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CFAX, $i_cfax, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CMOBILE, $i_cmobile, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CPAGER, $i_cpager, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CIPPHONE, $i_cipphone, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CWEBPAGE, $i_cwebpage, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_CPHOTO, $i_cphoto, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD1, $i_ufield1, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD2, $i_ufield2, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD3, $i_ufield3, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD4, $i_ufield4, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD5, $i_ufield5, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD6, $i_ufield6, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD7, $i_ufield7, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD8, $i_ufield8, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD9, $i_ufield9, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_USER_USERFIELD10, $i_ufield10, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_TEST_NAME, $i_test_name, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_ID, $i_result_id, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DATE, $i_result_date, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_TIME_SPENT, $i_result_time_spent, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_TIME_EXCEEDED, $i_result_time_exceeded, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_POINTS_SCORED, $i_result_points_scored, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_POINTS_POSSIBLE, $i_result_points_possible, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_PERCENTS, $i_result_percents, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_GRADE, $i_result_grade, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_SUBJECTS_DETAILED, $i_result_subjects_detailed, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DETAILED_1, $i_result_detailed_1, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DETAILED_2, $i_result_detailed_2, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DETAILED_3, $i_result_detailed_3, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DETAILED_4, $i_result_detailed_4, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DETAILED_5, $i_result_detailed_5, $i_template_body); $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_DETAILED_6, $i_result_detailed_6, $i_template_body); $i_template_body = str_replace(IGT_TAG_CUSTOM_1, $i_custom_tag_1, $i_template_body); $i_template_body = str_replace(IGT_TAG_CUSTOM_2, $i_custom_tag_2, $i_template_body); $i_template_body = str_replace(IGT_TAG_CUSTOM_3, $i_custom_tag_3, $i_template_body); $i_template_body = str_replace(IGT_TAG_CUSTOM_4, $i_custom_tag_4, $i_template_body); $i_template_body = str_replace(IGT_TAG_CUSTOM_5, $i_custom_tag_5, $i_template_body); $arrResult['attachments'] = array(); if (strpos($i_template_body, ETEMPLATE_TAG_RESULT_ATTACHMENT_REPORT_PDF) !== false) { if (isset($i_parameters['result_id'])) { include $DOCUMENT_PAGES . 'getfile-1.inc.php'; $i_pdf = getAdvancedReportPDF($i_parameters['result_id']); if (!empty($i_pdf)) { $i_pdfreport_binary = $i_pdf->Output('report.pdf', 'S'); } } if (!empty($i_pdfreport_binary)) { array_push($arrResult['attachments'], array('format' => 'string', 'content' => $i_pdfreport_binary, 'filename' => 'report.pdf', 'encoding' => 'base64', 'type' => 'application/pdf')); } $i_template_body = str_replace(ETEMPLATE_TAG_RESULT_ATTACHMENT_REPORT_PDF, '', $i_template_body); } } $arrResult['body'] = $i_template_body; return $arrResult; }
case CONFIG_CONST_upon_registration_signinautomatically: activateUserByID($i_id, true); signinUser($f_username, $f_password, false); if ($f_testid > 0) { gotoLocation('test.php?testid=' . $f_testid); } else { gotoLocation('index.php'); } break; case CONFIG_CONST_upon_registration_sendactivationemailtouser: sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_ACTIVATE_INDEX, 'emailto' => array($f_email), 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword)); $g_vars['page']['notifications'] = $lngstr['page-register']['check_activation_email']; include_once $DOCUMENT_PAGES . "signin-1.inc.php"; break; case CONFIG_CONST_upon_registration_sendactivationemailtoadmin: $i_admin_emails = getRecordItem($srv_settings['table_prefix'] . 'etemplates', 'etemplate_from', 'etemplateid=' . SYSTEM_ETEMPLATES_ACTIVATE_INDEX); $i_admin_emails = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, $i_admin_emails); sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_ACTIVATE_INDEX, 'emailto' => $i_admin_emails, 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword)); $g_vars['page']['notifications'] = $lngstr['page-register']['wait_for_approval']; include_once $DOCUMENT_PAGES . "signin-1.inc.php"; break; case CONFIG_CONST_upon_registration_custom: gotoLocation('register.php?action=step2&id=' . $i_id); break; default: activateUserByID($i_id, true); $g_vars['page']['notifications'] = sprintf($lngstr['page-register']['successful'], $f_username); include_once $DOCUMENT_PAGES . "signin-1.inc.php"; } } }