Ejemplo n.º 1
0
<?php

if (isset($_POST["box_grades"])) {
    foreach ($_POST["box_grades"] as $f_gscaleid) {
        deleteGrade((int) $f_gscaleid);
    }
} else {
    $f_gscaleid = (int) readGetVar('gscaleid');
    deleteGrade($f_gscaleid);
}
gotoLocation('grades.php' . getURLAddon('', array('action', 'confirmed', 'gscaleid')));
function deleteGrade($i_gscaleid)
{
    global $g_db, $srv_settings;
    if ($i_gscaleid > SYSTEM_GRADES_MAX_INDEX) {
        if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests SET gscaleid=1 WHERE gscaleid=" . $i_gscaleid) === false) {
            showDBError(__FILE__, 1);
        }
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "gscales_grades WHERE gscaleid={$i_gscaleid}") === false) {
            showDBError(__FILE__, 2);
        }
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "gscales WHERE gscaleid={$i_gscaleid}") === false) {
            showDBError(__FILE__, 3);
        }
    }
}
<?php

$f_groupid = (int) readGetVar('groupid');
$f_testids = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, readGetVar('testids'));
$i_sql_where_addon = '';
if ($_GET["set"]) {
    foreach ($f_testids as $i_testid) {
        //9917//9917
        $g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "groups_tests (groupid, testid) VALUES ({$f_groupid}, {$i_testid})");
    }
} else {
    reset($f_testids);
    if (list(, $val) = each($f_testids)) {
        $i_sql_where_addon .= "testid=" . (int) $val;
    }
    while (list(, $val) = each($f_testids)) {
        $i_sql_where_addon .= " OR testid=" . (int) $val;
    }
    if ($i_sql_where_addon) {
        $i_sql_where_addon = ' AND (' . $i_sql_where_addon . ')';
    }
    //9917//9917
    if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups_tests WHERE groupid={$f_groupid}" . $i_sql_where_addon) === false) {
        showDBError(__FILE__, 2);
    }
}
gotoLocation('test-manager.php' . getURLAddon('?action=groups', array('action', 'groupid', 'set')));
                    setCookieVar('filter_reportsmanager_result_date', 0);
                    setCookieVar('filter_reportsmanager_result_datestart', 0);
                    setCookieVar('filter_reportsmanager_result_dateend', 0);
                    setCookieVar('filter_reportsmanager_id', '');
                    setCookieVar('filter_reportsmanager_testid', '');
                    setCookieVar('filter_reportsmanager_user_lastname', '');
                    setCookieVar('filter_reportsmanager_user_department', '');
                    setCookieVar('filter_reportsmanager_subjectid', '');
                    gotoLocation('reports-manager.php' . getURLAddon('?action=', array('action', 'id', 'user_lastname', 'user_department', 'testid')));
                }
                break;
            case 'exportcsv':
                if ($G_SESSION['access_reportsmanager'] > 1) {
                    include_once $DOCUMENT_PAGES . 'reports-manager-exportcsv.inc.php';
                } else {
                    gotoLocation('reports-manager.php' . getURLAddon('?action=', array('action')));
                }
                break;
            case 'preview':
            case 'print':
                include_once $DOCUMENT_PAGES . 'reports-manager-report-1.inc.php';
                break;
            default:
                include_once $DOCUMENT_PAGES . 'reports-manager-1.inc.php';
        }
    } else {
        $g_vars['page']['notifications'] = $lngstr['inf_cant_view_results'];
        include_once $DOCUMENT_PAGES . 'home.inc.php';
    }
} else {
    $g_vars['page']['title'] = $lngstr['page_title_signin'];
            $i_strData = str_replace("\r", '', $i_strData);
            $i_strData = str_replace(' ', '', $i_strData);
            $i_nData = (int) $i_strData;
            if ($i_nData < 0) {
                $i_nData = 0;
            }
            $f_subjectid = $i_nData;
            break;
    }
    $i_nCurrNearest = $i_nNextNearest;
    $i_nCurrNearestPos = $i_nNextNearestPos;
}
if (!empty($f_question_text)) {
    insertQuestion();
}
gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action')));
function NewValueApply($i_nAnswerType, $i_strValue)
{
    global $f_answer_correct, $f_answer_percents;
    switch ($i_nAnswerType) {
        case QUESTION_TYPE_MULTIPLECHOICE:
        case QUESTION_TYPE_TRUEFALSE:
        case QUESTION_TYPE_MULTIPLEANSWER:
            if (!is_array($f_answer_correct)) {
                $f_answer_correct = array();
            }
            if (!is_array($f_answer_percents)) {
                $f_answer_percents = array();
            }
            $i_nValue = (int) $i_strValue;
            if ($i_nValue > 0 and $i_nValue <= MAX_ANSWER_COUNT) {
<?php

$f_testid = (int) readGetVar('testid');
$f_id = (int) readGetVar('id');
if ((int) readGetVar('set')) {
    $g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "tests_attempts (testid, id, test_attempt_count) VALUES (" . $f_testid . ", " . $f_id . ", 0)");
    $g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests_attempts SET test_attempt_count=999999 WHERE testid=" . $f_testid . " AND id=" . $f_id);
} else {
    $g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "tests_attempts WHERE testid=" . $f_testid . " AND id=" . $f_id);
}
gotoLocation('reports-manager.php' . getURLAddon('?action=', array('action', 'testid', 'id', 'set')));
<?php

$f_id = (int) readGetVar('id');
$f_set = isset($_GET["set"]) ? (int) $_GET["set"] : 0;
if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "users SET user_enabled=" . $f_set . " WHERE id=" . $f_id) === false) {
    showDBError(__FILE__, 1);
}
gotoLocation('users.php' . getURLAddon('', array('action', 'set')));
         if (isset($_POST['bsubmit']) || isset($_POST['bsubmit2'])) {
             if ($G_SESSION['access_questionbank'] > 1) {
                 include_once $DOCUMENT_PAGES . "edit_questions-3.inc.php";
             } else {
                 if (isset($_GET['testid'])) {
                     gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action', 'questionid')));
                 } else {
                     gotoLocation('question-bank.php' . getURLAddon('', array('action')));
                 }
             }
         } else {
             if (isset($_POST['bcancel'])) {
                 if (isset($_GET['testid'])) {
                     gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action', 'questionid')));
                 } else {
                     gotoLocation('question-bank.php' . getURLAddon('', array('action')));
                 }
             } else {
                 include_once $DOCUMENT_PAGES . "edit_questions-2.inc.php";
             }
         }
     }
     break;
 case 'statsq':
     $g_vars['page']['title'] = $lngstr['page_title_question_stats'] . $lngstr['item_separator'] . $g_vars['page']['title'];
     if (isset($_GET['questionid']) || isset($_POST["box_questions"])) {
         include_once $DOCUMENT_PAGES . "question-bank-2.inc.php";
     } else {
         gotoLocation('question-bank.php');
     }
     break;
Ejemplo n.º 8
0
<?php

require_once "../inc/init.inc.php";
$i_url = '/guide.php' . getURLAddon();
if (!empty($_GET['language'])) {
    $i_language = readGetVar('language');
} else {
    $i_language = $srv_settings['language'];
}
if ($i_language != 'en' && $i_language != 'de' && $i_language != 'es') {
    $i_language = 'en';
}
$i_url = $i_language . '' . $i_url;
gotoLocation($i_url);
<?php

$f_groupid = (int) readGetVar('groupid');
$f_ids = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, readGetVar('ids'));
if ($_GET["set"]) {
    foreach ($f_ids as $i_id) {
        //9917//9917
        $g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "groups_users (groupid, id) VALUES ({$f_groupid}, {$i_id})");
    }
} else {
    $i_sql_where_addon = '';
    reset($f_ids);
    if (list(, $val) = each($f_ids)) {
        $i_sql_where_addon .= "id=" . (int) $val;
    }
    while (list(, $val) = each($f_ids)) {
        $i_sql_where_addon .= " OR id=" . (int) $val;
    }
    if ($i_sql_where_addon) {
        $i_sql_where_addon = ' AND (' . $i_sql_where_addon . ')';
    }
    //9917//9917
    if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups_users WHERE groupid={$f_groupid}" . $i_sql_where_addon) === false) {
        showDBError(__FILE__, 2);
    }
}
gotoLocation('users.php' . getURLAddon('?action=groups', array('action')));
Ejemplo n.º 10
0
                         $i_confirm_url = 'groups.php?groupid=' . (int) $_GET['groupid'] . '&action=delete';
                         include_once $DOCUMENT_PAGES . "confirm.inc.php";
                     }
                 }
             } else {
                 gotoLocation('groups.php' . getURLAddon('', array('action')));
             }
             break;
         case 'edit':
             $g_vars['page']['title'] = $lngstr['page_title_groups_settings'] . $lngstr['item_separator'] . $g_vars['page']['title'];
             if (isset($_GET['groupid'])) {
                 if (isset($_POST['bsubmit'])) {
                     if ($G_SESSION['access_groups'] > 1) {
                         include_once $DOCUMENT_PAGES . "groups-3.inc.php";
                     } else {
                         gotoLocation('groups.php' . getURLAddon('', array('action')));
                     }
                 } else {
                     if (isset($_POST['bcancel'])) {
                         gotoLocation('groups.php');
                     } else {
                         include_once $DOCUMENT_PAGES . "groups-2.inc.php";
                     }
                 }
             }
             break;
         default:
             include_once $DOCUMENT_PAGES . "groups-1.inc.php";
     }
 } else {
     $g_vars['page']['notifications'] = $lngstr['inf_cant_access_groups'];
<?php

if (isset($_POST["box_rtemplates"])) {
    foreach ($_POST["box_rtemplates"] as $f_rtemplateid) {
        deleteRTemplate((int) $f_rtemplateid);
    }
} else {
    $f_rtemplateid = (int) readGetVar('rtemplateid');
    deleteRTemplate($f_rtemplateid);
}
gotoLocation('report-templates.php' . getURLAddon('', array('action', 'confirmed', 'rtemplateid')));
function deleteRTemplate($i_rtemplateid)
{
    global $g_db, $srv_settings;
    if ($i_rtemplateid > SYSTEM_RTEMPLATES_MAX_INDEX) {
        if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests SET rtemplateid=0 WHERE rtemplateid={$i_rtemplateid}") === false) {
            showDBError(__FILE__, 1);
        }
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "rtemplates WHERE rtemplateid={$i_rtemplateid}") === false) {
            showDBError(__FILE__, 2);
        }
    }
}
}
if ($i_pageno <= $i_pageno_count - floor($nPageWindow / 2) && $nStartPage + $nPageWindow - 1 <= $i_pageno_count) {
    $nEndPage = $nStartPage + $nPageWindow - 1;
} else {
    $nEndPage = $i_pageno_count;
    if ($nEndPage - $nPageWindow + 1 >= 1) {
        $nStartPage = $nEndPage - $nPageWindow + 1;
    }
}
$nRecordFrom = ($i_pageno - 1) * $i_limitcount + 1;
if ($i_pageno != $i_pageno_count) {
    $nRecordTo = $i_pageno * $i_limitcount;
} else {
    $nRecordTo = $i_recordcount;
}
$g_vars['page']['filter']['url_addon'] = getURLAddon('?action=filter', array('action'));
$g_vars['page']['filter']['result_date'] = $f_result_date;
$g_vars['page']['filter']['result_datestart_formatted'] = $f_result_datestart > 0 ? getDateLocal($lngstr['language']['calendar']['date_format'], $f_result_datestart) : '';
$g_vars['page']['filter']['result_dateend_formatted'] = $f_result_dateend > 0 ? getDateLocal($lngstr['language']['calendar']['date_format'], $f_result_dateend) : '';
if ($G_SESSION['access_reportsmanager'] > 1) {
    $i_users = array('' => $lngstr['label_none']);
    $i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "users");
    if (!$i_rSet2) {
        showDBError(__FILE__, 2);
    } else {
        while (!$i_rSet2->EOF) {
            $i_users[$i_rSet2->fields['id']] = $i_rSet2->fields['username'];
            $i_rSet2->MoveNext();
        }
        $i_rSet2->Close();
    }
Ejemplo n.º 13
0
                $g_vars['page']['title'] = $lngstr['page_title_users_memberof'] . $lngstr['item_separator'] . $g_vars['page']['title'];
                if (isset($_GET['id']) || isset($_POST['box_users']) || isset($_GET['ids'])) {
                    include_once $DOCUMENT_PAGES . 'manageusers-8.inc.php';
                } else {
                    gotoLocation('users.php');
                }
                break;
            case 'memberof':
                if ($G_SESSION['access_users'] > 1 && $G_SESSION['access_groups'] > 1) {
                    if (isset($_GET['groupid']) && isset($_GET['ids'])) {
                        include_once $DOCUMENT_PAGES . 'manageusers-9.inc.php';
                    }
                } else {
                    gotoLocation('users.php' . getURLAddon('?action=groups', array('action')));
                }
                break;
            default:
                if ($G_SESSION['access_users'] == 2 || $G_SESSION['access_users'] == 4) {
                    include_once $DOCUMENT_PAGES . 'manageusers-1.inc.php';
                } else {
                    gotoLocation('users.php' . getURLAddon('?action=edit&id=' . $G_SESSION['id'], array('action', 'id')));
                }
        }
    } else {
        $g_vars['page']['notifications'] = $lngstr['inf_cant_access_users'];
        include_once $DOCUMENT_PAGES . 'home.inc.php';
    }
} else {
    $g_vars['page']['title'] = $lngstr['page_title_signin'];
    include_once $DOCUMENT_PAGES . 'signin-1.inc.php';
}
<?php

if (isset($_POST["box_users"])) {
    foreach ($_POST["box_users"] as $f_id) {
        deleteUser((int) $f_id);
    }
} else {
    $f_id = (int) readGetVar('id');
    deleteUser($f_id);
}
gotoLocation('users.php' . getURLAddon('', array('action', 'confirmed')));
function deleteUser($i_id)
{
    global $g_db, $srv_settings;
    if ($i_id > SYSTEM_USER_MAX_INDEX) {
        $g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "tests_attempts WHERE id=" . $i_id);
        $i_rSet1 = $g_db->Execute("SELECT resultid FROM " . $srv_settings['table_prefix'] . "results WHERE id=" . $i_id);
        if (!$i_rSet1) {
            showDBError(__FILE__, 1);
        } else {
            while (!$i_rSet1->EOF) {
                deleteResultRecord($i_rSet1->fields["resultid"]);
                $i_rSet1->MoveNext();
            }
            $i_rSet1->Close();
        }
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "results WHERE id=" . $i_id) === false) {
            showDBError(__FILE__, 2);
        }
        //9917//9917
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups_users WHERE id=" . $i_id) === false) {
switch ($f_question_type) {
    case QUESTION_TYPE_FILLINTHEBLANK:
        $f_answer_feedback = array(1 => $g_db->qstr('', 0));
        $f_answer_correct = array(1 => 1);
        $f_answer_percents = array(1 => 100);
        break;
}
include_once $DOCUMENT_PAGES . 'edit_questions-3-int.inc.php';
$f_answercount = (int) readPostVar('answercount');
if (isset($_GET['resultid'])) {
    if (isset($_POST['bsubmit2'])) {
        gotoLocation('question-bank.php' . getURLAddon('?action=createq&question_type=' . $f_question_type . '&subjectid=' . $f_subjectid . '&answercount=' . $f_answercount, array('action', 'questionid', 'question_type', 'subjectid', 'answercount')));
    } else {
        gotoLocation('reports-manager.php' . getURLAddon('?action=viewq', array('action', 'questionid', 'question_type', 'subjectid', 'answercount')));
    }
} else {
    if (isset($_GET['testid'])) {
        $f_testid = (int) readGetVar('testid');
        if (isset($_POST['bsubmit2'])) {
            gotoLocation('question-bank.php' . getURLAddon('?action=createq&question_type=' . $f_question_type . '&subjectid=' . $f_subjectid . '&answercount=' . $f_answercount, array('action', 'questionid', 'question_type', 'subjectid', 'answercount')));
        } else {
            gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action', 'questionid', 'question_type', 'subjectid', 'answercount')));
        }
    } else {
        if (isset($_POST['bsubmit2'])) {
            gotoLocation('question-bank.php' . getURLAddon('?action=createq&question_type=' . $f_question_type . '&subjectid=' . $f_subjectid . '&answercount=' . $f_answercount, array('action', 'questionid', 'question_type', 'subjectid', 'answercount')));
        } else {
            gotoLocation('question-bank.php' . getURLAddon('', array('action', 'questionid', 'question_type', 'subjectid', 'answercount')));
        }
    }
}
<?php

$f_testid = (int) readGetVar('testid');
$f_set = isset($_GET['set']) ? (int) $_GET['set'] : 0;
if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests SET test_enabled={$f_set} WHERE testid={$f_testid}") === false) {
    showDBError(__FILE__, 1);
}
gotoLocation('test-manager.php' . getURLAddon('', array('action', 'testid', 'confirmed', 'set')));
<?php

if (isset($_POST["box_etemplates"])) {
    foreach ($_POST["box_etemplates"] as $f_etemplateid) {
        deleteETemplate((int) $f_etemplateid);
    }
} else {
    $f_etemplateid = (int) readGetVar('etemplateid');
    deleteETemplate($f_etemplateid);
}
gotoLocation('email-templates.php' . getURLAddon('', array('action', 'confirmed', 'etemplateid')));
function deleteETemplate($i_etemplateid)
{
    global $g_db, $srv_settings;
    if ($i_etemplateid > SYSTEM_ETEMPLATES_MAX_INDEX) {
        if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests SET result_etemplateid=0 WHERE result_etemplateid={$i_etemplateid}") === false) {
            showDBError(__FILE__, 1);
        }
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "etemplates WHERE etemplateid={$i_etemplateid}") === false) {
            showDBError(__FILE__, 2);
        }
    }
}
Ejemplo n.º 18
0
<?php

$f_gscaleid = (int) readGetVar('gscaleid');
$f_gscale_gradeid = (int) readGetVar('gscale_gradeid');
$i_gradecount = getRecordCount($srv_settings['table_prefix'] . 'gscales_grades', "gscaleid=" . $f_gscaleid);
if ($f_gscale_gradeid < $i_gradecount) {
    $g_db->Execute("LOCK TABLES " . $srv_settings['table_prefix'] . "gscales_grades WRITE");
    $g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "gscales_grades SET gscale_gradeid=0 WHERE gscale_gradeid=" . ($f_gscale_gradeid + 1) . " AND gscaleid=" . $f_gscaleid);
    $g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "gscales_grades SET gscale_gradeid=gscale_gradeid+1 WHERE gscale_gradeid=" . $f_gscale_gradeid . " AND gscaleid=" . $f_gscaleid);
    $g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "gscales_grades SET gscale_gradeid=" . $f_gscale_gradeid . " WHERE gscale_gradeid=0 AND gscaleid=" . $f_gscaleid);
    $g_db->Execute("UNLOCK TABLES");
}
gotoLocation('grades.php' . getURLAddon('?action=edit', array('action')));
Ejemplo n.º 19
0
setConfigItem(CONFIG_reg_values_userfield3, readPostVar('values_userfield3'));
setConfigItem(CONFIG_reg_userfield4, (int) readPostVar('userfield4'));
setConfigItem(CONFIG_reg_caption_userfield4, readPostVar('caption_userfield4'));
setConfigItem(CONFIG_reg_type_userfield4, readPostVar('type_userfield4'));
setConfigItem(CONFIG_reg_values_userfield4, readPostVar('values_userfield4'));
setConfigItem(CONFIG_reg_userfield5, (int) readPostVar('userfield5'));
setConfigItem(CONFIG_reg_caption_userfield5, readPostVar('caption_userfield5'));
setConfigItem(CONFIG_reg_type_userfield5, readPostVar('type_userfield5'));
setConfigItem(CONFIG_reg_values_userfield5, readPostVar('values_userfield5'));
setConfigItem(CONFIG_reg_userfield6, (int) readPostVar('userfield6'));
setConfigItem(CONFIG_reg_caption_userfield6, readPostVar('caption_userfield6'));
setConfigItem(CONFIG_reg_type_userfield6, readPostVar('type_userfield6'));
setConfigItem(CONFIG_reg_values_userfield6, readPostVar('values_userfield6'));
setConfigItem(CONFIG_reg_userfield7, (int) readPostVar('userfield7'));
setConfigItem(CONFIG_reg_caption_userfield7, readPostVar('caption_userfield7'));
setConfigItem(CONFIG_reg_type_userfield7, readPostVar('type_userfield7'));
setConfigItem(CONFIG_reg_values_userfield7, readPostVar('values_userfield7'));
setConfigItem(CONFIG_reg_userfield8, (int) readPostVar('userfield8'));
setConfigItem(CONFIG_reg_caption_userfield8, readPostVar('caption_userfield8'));
setConfigItem(CONFIG_reg_type_userfield8, readPostVar('type_userfield8'));
setConfigItem(CONFIG_reg_values_userfield8, readPostVar('values_userfield8'));
setConfigItem(CONFIG_reg_userfield9, (int) readPostVar('userfield9'));
setConfigItem(CONFIG_reg_caption_userfield9, readPostVar('caption_userfield9'));
setConfigItem(CONFIG_reg_type_userfield9, readPostVar('type_userfield9'));
setConfigItem(CONFIG_reg_values_userfield9, readPostVar('values_userfield9'));
setConfigItem(CONFIG_reg_userfield10, (int) readPostVar('userfield10'));
setConfigItem(CONFIG_reg_caption_userfield10, readPostVar('caption_userfield10'));
setConfigItem(CONFIG_reg_type_userfield10, readPostVar('type_userfield10'));
setConfigItem(CONFIG_reg_values_userfield10, readPostVar('values_userfield10'));
gotoLocation('config.php' . getURLAddon('', array('action')));
<?php

if (isset($_POST["box_questions"])) {
    foreach ($_POST["box_questions"] as $f_questionid) {
        deleteQuestion((int) $f_questionid);
    }
} else {
    $f_questionid = (int) readGetVar('questionid');
    deleteQuestion($f_questionid);
}
if (isset($_GET["testid"])) {
    gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action', 'confirmed', 'questionid')));
} else {
    gotoLocation('question-bank.php' . getURLAddon('', array('action', 'confirmed', 'questionid')));
}
function deleteQuestion($i_questionid)
{
    global $g_db, $srv_settings;
    $i_rSet1 = $g_db->Execute("SELECT test_questionid, testid FROM " . $srv_settings['table_prefix'] . "tests_questions WHERE questionid={$i_questionid} ORDER BY test_questionid DESC");
    if (!$i_rSet1) {
        showDBError(__FILE__, 1);
    } else {
        while (!$i_rSet1->EOF) {
            deleteQuestionLink($i_rSet1->fields["testid"], $i_rSet1->fields["test_questionid"]);
            $i_rSet1->MoveNext();
        }
        $i_rSet1->Close();
    }
    if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "answers WHERE questionid={$i_questionid}") === false) {
        showDBError(__FILE__, 2);
    }
<?php

$f_testid = (int) readGetVar('testid');
if (isset($_POST["box_qlinks"]) && is_array($_POST["box_qlinks"])) {
    $i_qlinks = $_POST["box_qlinks"];
    rsort($i_qlinks, SORT_NUMERIC);
    foreach ($i_qlinks as $f_test_questionid) {
        deleteQuestionLink($f_testid, (int) $f_test_questionid);
    }
} else {
    $f_test_questionid = (int) readGetVar('test_questionid');
    deleteQuestionLink($f_testid, $f_test_questionid);
}
gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action', 'confirmed', 'test_questionid')));
<?php

$f_testid = (int) readGetVar('testid');
if ($f_testid) {
    $i_subjectid = 0;
    $i_rSet1 = $g_db->Execute("SELECT subjectid FROM " . $srv_settings['table_prefix'] . "tests WHERE testid={$f_testid}");
    if (!$i_rSet1) {
        showDBError(__FILE__, 1);
    } else {
        if (!$i_rSet1->EOF) {
            $i_subjectid = (int) $i_rSet1->fields['subjectid'];
        }
        $i_rSet1->Close();
    }
    if ($g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "questions (subjectid, question_pre, question_post, question_text, question_solution) VALUES(" . $i_subjectid . ", '', '', '', '')") === false) {
        showDBError(__FILE__, 2);
    }
    $i_questionid = (int) $g_db->Insert_ID($srv_settings['table_prefix'] . 'questions', 'questionid');
    createQuestionLink($f_testid, $i_questionid);
    gotoLocation('question-bank.php' . getURLAddon('?action=editq&questionid=' . $i_questionid, array('action', 'questionid')));
} else {
    if ($g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "questions (question_pre, question_post, question_text, question_solution) VALUES('', '', '', '')") === false) {
        showDBError(__FILE__, 3);
    }
    $i_questionid = (int) $g_db->Insert_ID($srv_settings['table_prefix'] . 'questions', 'questionid');
    gotoLocation('question-bank.php' . getURLAddon('?action=editq&questionid=' . $i_questionid, array('action', 'questionid')));
}
Ejemplo n.º 23
0
         } else {
         }
     }
     break;
 case 'results':
     if (isset($G_SESSION['yt_state']) && $G_SESSION['yt_state'] == TEST_STATE_TRESULTS) {
         include_once $DOCUMENT_PAGES . 'test-showresults.inc.php';
     }
     break;
 default:
     if (!isset($G_SESSION['testid']) || isset($_GET['testid']) && $_GET['testid'] != $G_SESSION['testid'] || isset($G_SESSION['yt_state']) && ($G_SESSION['yt_state'] >= TEST_STATE_TRESULTS || $G_SESSION['yt_state'] == TEST_STATE_TESTINTRO)) {
         include_once $DOCUMENT_PAGES . 'test-3.inc.php';
     } else {
         if (isset($_POST['breview']) && !empty($_POST['review_questionno'])) {
             $i_questionno = (int) $_POST['review_questionno'];
             gotoLocation('test.php' . getURLAddon('?action=review&questionno=' . $i_questionno, array('action')));
         } else {
             if (isset($_POST['bsubmit']) || isset($_POST['bsubmit_prev']) || isset($_POST['bsubmit_next']) || isset($_POST['bsubmit_answer'])) {
                 if ($G_SESSION['yt_test_qsperpage'] != 1) {
                     include_once $DOCUMENT_PAGES . 'test-7.inc.php';
                 } else {
                     include_once $DOCUMENT_PAGES . 'test-2.inc.php';
                 }
             } else {
                 if ($G_SESSION['yt_test_qsperpage'] != 1) {
                     include_once $DOCUMENT_PAGES . 'test-6.inc.php';
                 } else {
                     include_once $DOCUMENT_PAGES . 'test-1.inc.php';
                 }
             }
         }
Ejemplo n.º 24
0
                         $i_confirm_url = 'subjects.php?subjectid=' . (int) $_GET['subjectid'] . '&action=delete';
                         include_once $DOCUMENT_PAGES . "confirm.inc.php";
                     }
                 }
             } else {
                 gotoLocation('subjects.php' . getURLAddon('', array('action', 'confirmed')));
             }
             break;
         case 'edit':
             $g_vars['page']['title'] = $lngstr['page_title_subjects_settings'] . $lngstr['item_separator'] . $g_vars['page']['title'];
             if (isset($_GET['subjectid'])) {
                 if (isset($_POST['bsubmit'])) {
                     if ($G_SESSION['access_subjects'] > 1) {
                         include_once $DOCUMENT_PAGES . "subjects-3.inc.php";
                     } else {
                         gotoLocation('subjects.php' . getURLAddon('', array('action')));
                     }
                 } else {
                     if (isset($_POST['bcancel'])) {
                         gotoLocation('subjects.php');
                     } else {
                         include_once $DOCUMENT_PAGES . "subjects-2.inc.php";
                     }
                 }
             }
             break;
         default:
             include_once $DOCUMENT_PAGES . "subjects-1.inc.php";
     }
 } else {
     $g_vars['page']['notifications'] = $lngstr['inf_cant_access_subjects'];
<?php

if (isset($_POST["box_subjects"])) {
    foreach ($_POST["box_subjects"] as $f_subjectid) {
        deletesubject((int) $f_subjectid);
    }
} else {
    $f_subjectid = (int) readGetVar('subjectid');
    deletesubject($f_subjectid);
}
gotoLocation('subjects.php' . getURLAddon('', array('action', 'confirmed')));
function deletesubject($i_subjectid)
{
    global $g_db, $srv_settings;
    if ($i_subjectid > SYSTEM_SUBJECTS_MAX_INDEX) {
        if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests SET subjectid=1 WHERE subjectid=" . $i_subjectid) === false) {
            showDBError(__FILE__, 1);
        }
        if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "questions SET subjectid=1 WHERE subjectid=" . $i_subjectid) === false) {
            showDBError(__FILE__, 2);
        }
        if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "subjects WHERE subjectid={$i_subjectid}") === false) {
            showDBError(__FILE__, 3);
        }
    }
}
<?php

if (isset($_POST["box_results"])) {
    foreach ($_POST["box_results"] as $f_resultid) {
        deleteResultRecord((int) $f_resultid);
    }
} else {
    $f_resultid = (int) readGetVar('resultid');
    deleteResultRecord($f_resultid);
}
gotoLocation('reports-manager.php' . getURLAddon('?action=', array('action', 'resultid', 'confirmed')));
                    break;
                case QUESTION_TYPE_ESSAY:
                    writeTR2($lngstr['page_editquestion_answer_count'], $lngstr['label_notapplicable']);
                    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']));
                    break;
                case QUESTION_TYPE_RANDOM:
                    writeTR2($lngstr['page_editquestion_question_name'], getInputElement('question_text', !empty($i_rSet1->fields['question_text']) ? $i_rSet1->fields['question_text'] : $lngstr['label_atype_random'] . ' (' . $i_subjects[$f_subjectid] . ')'));
                    break;
            }
            $i_rSet3->Close();
        }
        if ($f_question_type != QUESTION_TYPE_RANDOM) {
            writeTR2($lngstr['page_editquestion_points'], getInputElement('question_points', $i_rSet1->fields['question_points'], 3));
        }
        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_create_new_question'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
        echo '<script language=JavaScript type="text/javascript">
function updateQuestion() {
ctlQuestionType = document.getElementById("question_type");
nQuestionType = ctlQuestionType ? document.getElementById("question_type").options[document.getElementById("question_type").selectedIndex].value : "";
ctlSubjectID = document.getElementById("subjectid");
nSubjectID = ctlSubjectID ? ctlSubjectID.options[ctlSubjectID.selectedIndex].value : "";
ctlAnswerCount = document.getElementById("answercount");
nAnswerCount = ctlAnswerCount ? ctlAnswerCount.options[ctlAnswerCount.selectedIndex].value : "";
window.open("question-bank.php' . getURLAddon('', array('question_type', 'subjectid', 'answercount')) . '&question_type="+nQuestionType+"&subjectid="+nSubjectID+"&answercount="+nAnswerCount,"_top");
}
</script>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
if ($i_rSet2 = $g_db->Execute("SELECT subjectid FROM " . $srv_settings['table_prefix'] . "subjects WHERE subjectid={$f_subjectid}")) {
    $sql_subject_exists = $i_rSet2->RecordCount() > 0;
} else {
    $sql_subject_exists = false;
}
if (!$sql_subject_exists) {
    $g_vars['page']['errors'] .= $lngstr['err_subject_doesnotexist'];
}
$strQrySet = "test_type=" . $f_test_type . ", subjectid=" . $f_subjectid . ", gscaleid=" . $f_gscaleid . ", rtemplateid=" . $f_rtemplateid . ", test_reportgradecondition=" . $f_test_reportgradecondition . ", result_etemplateid=" . $f_result_etemplateid . ", test_name=" . $f_test_name . ", test_code=" . $f_test_code . ", test_description=" . $f_test_description . ", test_time=" . $nTestTime . ", test_timeforceout={$f_test_timeforceout}, test_attempts={$f_test_attempts}, test_contentprotection={$f_test_contentprotection}, test_shuffleq={$f_test_shuffleq}, test_shufflea={$f_test_shufflea}, test_qsperpage={$f_test_qsperpage}, test_canreview={$f_test_canreview}, test_showqfeedback={$f_test_showqfeedback}, test_result_showgrade={$f_test_result_showgrade}, test_result_showgradefeedback={$f_test_result_showgradefeedback}, test_result_showanswers={$f_test_result_showanswers}, test_result_showpoints={$f_test_result_showpoints}, test_result_rtemplateid={$f_test_result_rtemplateid}, test_result_showhtml={$f_test_result_showhtml}, test_result_showpdf={$f_test_result_showpdf}, test_result_email={$f_test_result_email}, test_result_emailtouser={$f_test_result_emailtouser}, test_datestart={$f_test_datestart}, test_dateend={$f_test_dateend}, test_instructions={$f_test_instructions}, test_prevtestid={$f_test_prevtestid}, test_nexttestid={$f_test_nexttestid}, test_price={$f_test_price}, test_other_repeatuntilcorrect={$f_test_other_repeatuntilcorrect}, test_notes={$f_test_notes}, test_forall={$f_test_forall}, test_enabled={$f_test_enabled}";
if ($g_vars['page']['errors']) {
    include_once $DOCUMENT_PAGES . "test-manager-2.inc.php";
} else {
    if ($g_db->Execute("UPDATE " . $srv_settings['table_prefix'] . "tests SET " . $strQrySet . " WHERE testid={$f_testid}") === false) {
        showDBError(__FILE__, 1);
    }
    //9917//9917
    if ($g_db->Execute("DELETE FROM " . $srv_settings['table_prefix'] . "groups_tests WHERE testid=" . $f_testid) === false) {
        showDBError(__FILE__, 2);
    }
    foreach ($f_group as $i_groupid => $i_ischecked) {
        if ($i_ischecked) {
            //9917//9917
            $g_db->Execute("INSERT INTO " . $srv_settings['table_prefix'] . "groups_tests (groupid, testid) VALUES (" . $i_groupid . ", " . $f_testid . ")");
        }
    }
    if (isset($_POST['bsubmit2'])) {
        gotoLocation('test-manager.php' . getURLAddon('?action=editt', array('action')));
    } else {
        gotoLocation('test-manager.php' . getURLAddon('', array('action', 'testid')));
    }
}
Ejemplo n.º 29
0
                    if ($f_confirmed == 1) {
                        if (isset($_GET['visitorid']) || isset($_POST['box_visitors'])) {
                            include_once $DOCUMENT_PAGES . 'visitors-4.inc.php';
                        } else {
                            gotoLocation('visitors.php' . getURLAddon('', array('action', 'visitorid')));
                        }
                    } else {
                        if ($f_confirmed == '0') {
                            gotoLocation('visitors.php' . getURLAddon('', array('action', 'visitorid')));
                        } else {
                            $i_confirm_header = $lngstr['page_visitors_delete_visitor'];
                            $i_confirm_request = $lngstr['qst_delete_visitor'];
                            $i_confirm_url = 'visitors.php' . getURLAddon();
                            include_once $DOCUMENT_PAGES . 'confirm.inc.php';
                        }
                    }
                } else {
                    gotoLocation('visitors.php' . getURLAddon('', array('action', 'visitorid')));
                }
                break;
            default:
                include_once $DOCUMENT_PAGES . 'visitors-1.inc.php';
        }
    } else {
        $g_vars['page']['notifications'] = $lngstr['inf_cant_access_visitors'];
        include_once $DOCUMENT_PAGES . 'home.inc.php';
    }
} else {
    $g_vars['page']['title'] = $lngstr['page_title_signin'];
    include_once $DOCUMENT_PAGES . 'signin-1.inc.php';
}