<?php eventOnBeforeTestSubmit(); $G_SESSION['yt_state'] = TEST_STATE_TRESULTS; setCookieVar('pending_test_ids', ''); setCookieVar('pending_test_result_ids', ''); $i_now = time(); $i_timespent_total = $i_now - $G_SESSION['yt_teststart']; $i_timeexceeded = $G_SESSION['yt_teststop'] > 0 && $G_SESSION['yt_teststop'] < $i_now ? 1 : 0; $i_percents = $G_SESSION['yt_pointsmax'] != 0 ? round($G_SESSION['yt_got_points'] / $G_SESSION['yt_pointsmax'] * 100) : 100; $i_grade = calcResultGrade($G_SESSION['yt_gscaleid'], $i_percents); $G_SESSION['yt_gradeid'] = $i_grade['gradeid']; if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "results SET result_timespent={$i_timespent_total}, result_timeexceeded=" . $i_timeexceeded . ", result_points=" . $G_SESSION['yt_got_points'] . ", result_pointsmax=" . $G_SESSION['yt_pointsmax'] . ", gscaleid=" . $i_grade['gscaleid'] . ", gscale_gradeid=" . $i_grade['gradeid'] . " WHERE resultid=" . $G_SESSION['resultid']) === false) { showDBError(__FILE__, 2); } if ($G_SESSION['yt_attempts'] > 0) { $g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "tests_attempts (testid, id, test_attempt_count) VALUES (" . $G_SESSION['testid'] . ", " . $G_SESSION['id'] . ", 0);"); $g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests_attempts SET test_attempt_count=test_attempt_count+1 WHERE testid=" . $G_SESSION['testid'] . " AND id=" . $G_SESSION['id']); } if ($G_SESSION['yt_result_etemplateid'] > 0) { if (strlen($G_SESSION['yt_result_email']) > 0 || $G_SESSION['yt_result_emailtouser']) { $i_isok = true; $i_isok = $i_isok && ($i_rSet1 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "tests WHERE testid=" . $G_SESSION['testid'], 1)); if ($i_isok) { $i_isok = $i_isok && !$i_rSet1->EOF; } $i_isok = $i_isok && ($i_rSet2 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "users WHERE id=" . $G_SESSION['id'], 1)); if ($i_isok) { $i_isok = $i_isok && !$i_rSet2->EOF; } $i_email_tos_text = $G_SESSION['yt_result_email'];
} if ($i_questiontype == QUESTION_TYPE_ESSAY) { if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "results_answers SET result_answer_points=" . $f_points . ", result_answer_iscorrect=" . ($f_notdefined ? IGT_ANSWER_IS_UNDEFINED : ($f_points >= $i_questionpoints ? IGT_ANSWER_IS_CORRECT : ($f_points > 0 ? IGT_ANSWER_IS_PARTIALLYCORRECT : IGT_ANSWER_IS_INCORRECT))) . ", result_answer_feedback=" . $f_feedback . " WHERE resultid=" . $f_resultid . " AND result_answerid=" . $f_answerid) === false) { showDBError(__FILE__, 5); } $i_testpoints_max = 0; $i_rSet6 = $g_db->Execute("SELECT result_pointsmax FROM " . $srv_settings['table_prefix'] . "results WHERE resultid=" . $f_resultid); if (!$i_rSet6) { showDBError(__FILE__, 6); } else { if (!$i_rSet6->EOF) { $i_testpoints_max = $i_rSet6->fields["result_pointsmax"]; } $i_rSet6->Close(); } $i_rSet7 = $g_db->Execute("SELECT SUM(result_answer_points) as testpoints FROM " . $srv_settings['table_prefix'] . "results_answers WHERE resultid=" . $f_resultid); if (!$i_rSet7) { showDBError(__FILE__, 7); } else { if (!$i_rSet7->EOF) { $i_testpoints_new = $i_rSet7->fields['testpoints']; } $i_rSet7->Close(); } $i_percents = $i_testpoints_max != 0 ? round($i_testpoints_new / $i_testpoints_max * 100) : 100; $i_grade = calcResultGrade($i_gscaleid, $i_percents); if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "results SET result_points=" . $i_testpoints_new . ", gscaleid=" . $i_gscaleid . ", gscale_gradeid=" . $i_grade['gradeid'] . " WHERE resultid=" . $f_resultid) === false) { showDBError(__FILE__, 9); } } gotoLocation('reports-manager.php?resultid=' . $f_resultid . '&action=viewq');
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; }