Пример #1
0
    $result = $epsclass->db->query("SELECT h.name, m.* FROM " . TBL_K48MARK . " m LEFT JOIN " . TBL_K48HTD . " h ON h.s_id=m.s_id WHERE h.course='" . $epsclass->db->escape($course) . "'") or error('Unable to fetch mark', __FILE__, __LINE__, $epsclass->db->error());
    if (!$epsclass->db->num_rows($result)) {
        alert($eps_lang['Bad_request']);
        return;
    }
    $students = array();
    while ($cur_std = $epsclass->db->fetch_assoc($result)) {
        $tmp = array('id' => $cur_std['id'], 's_id' => $cur_std['s_id'], 'name' => $cur_std['name']);
        foreach ($eps_subjects as $k => $v) {
            $tmp[$k] = $cur_std[$k];
        }
        $students[] = $tmp;
    }
    $epsclass->db->free_result($result);
    $smarty->assign('tpl_jump', gen_course_jump_tpl('index.php?eps=mark&action=postmark', $course));
    $smarty->assign('error_show', !empty($errors) ? gen_alert($errors) : '');
    $smarty->assign('form_tag', auto_gen_form('index.php?eps=mark&action=' . $action . '&list=' . $course, 'mark', true));
    $smarty->assign('subjects', $eps_subjects);
    $smarty->assign('students', $students);
    $smarty->display('module/mark.tpl');
} else {
    $result = $epsclass->db->query("SELECT * FROM " . TBL_K48MARK . " WHERE s_id='" . $epsclass->db->escape($eps_user['s_id']) . "'") or error('Unable to fetch user mark', __FILE__, __LINE__, $epsclass->db->error());
    if ($epsclass->db->num_rows($result) != 1) {
        return;
    }
    $marks = array_slice($epsclass->db->fetch_assoc($result), 2);
    $epsclass->db->free_result($result);
    $mark_sum = $sum = null;
    foreach ($marks as $k => $v) {
        if ($v != null) {
            $mark_sum += $v * $eps_subjects[$k];
Пример #2
0
define('EPS_ROOT', './');
require EPS_ROOT . 'include/common.php';
// No Guest
if ($eps_user['is_guest']) {
    return;
}
$down = !empty($_GET['down']) ? $_GET['down'] : '';
$id = !empty($_GET['id']) && intval($_GET['id']) >= 1 ? intval($_GET['id']) : '';
if (empty($id)) {
    return;
}
if ($down == 'share') {
    $result = $epsclass->db->vselect(TBL_SHARE, array('url', 'size', 'mimetype'), $id);
    if (!$epsclass->db->num_rows($result)) {
        $smarty->assign('tpl_eps_title', $eps_lang['Error']);
        $smarty->assign('tpl_eps_main', gen_alert($eps_lang['Bad_request']));
        $smarty->display('main.tpl');
        return;
    } else {
        $this_share = $epsclass->db->fetch_assoc($result);
        $epsclass->db->free_result($result);
        $this_share['full_url'] = EPS_SHARE_DIR . $this_share['url'];
        if (!is_file($this_share['full_url'])) {
            alert($eps_lang['Bad_request']);
            return;
        } else {
            // Send Header
            //header('Content-Type: '.$this_share['mimetype']);
            header('Content-type: application/force-download');
            header('Content-Disposition: attachment; filename="' . basename($this_share['url']) . '"');
            if ($this_share['size'] != 0) {