Exemplo n.º 1
0
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
dgr_require('/includes/class.php');
if (!isset($_GET['id']) || !isset($_GET['classid']) || !isset($_GET['semid']) || !isset($_GET['subid']) || !isset($_GET['teachid']) || !isset($_GET['block']) || !isset($_GET['desc']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
    $class = new DGradeClass($_GET['classid']);
} catch (Exception $e) {
    die($e->getMessage());
}
if ($user->get_level() != 0 && $user->get_uid() != $class->get - tutorid()) {
    die;
}
$dblink = DGradeDB::instance();
$block = $_GET['block'] == 1;
$desc = $_GET['desc'] == 1;
if ($_GET['id'] > 0) {
    $dblink->set_csubject($_GET['id'], $_GET['subid'], $_GET['teachid'], $block, $desc);
} else {
    if ($_GET['id'] == 0) {
        $id = $dblink->add_csubject($_GET['classid'], $_GET['semid'], $_GET['subid'], $_GET['teachid'], $block, $desc);
        foreach ($class->students as $st) {
            $dblink->add_grade($id, $st);
        }
    }
}
Exemplo n.º 2
0
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
if (!isset($_POST['id']) || !isset($_POST['grades']) || !isset($_POST['notes']) || !isset($_POST['semestral']) || !isset($_POST['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
} catch (Exception $e) {
    exit;
}
$dblink = DGradeDB::instance();
if ($user->get_level() != 0 && !$dblink->can_modify_grade($_POST['id'], $user->get_uid())) {
    exit;
}
$grades = dgr_strip_whitespaces(stripslashes($_POST['grades']));
$notes = stripslashes($_POST['notes']);
$semestral = stripslashes($_POST['semestral']);
$dblink->set_grade($_POST['id'], $grades, $notes, $semestral);
Exemplo n.º 3
0
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
dgr_require('/includes/student.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $u = new DGradeUser();
} catch (Exception $e) {
    exit;
}
$student = new DGradeStudent($_GET['id']);
if ($u->get_level() != 0 && $student->get_tutorid() != $u->get_uid()) {
    exit;
}
$dblink = DGradeDB::instance();
$dblink->delete_student($_GET['id']);
Exemplo n.º 4
0
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
dgr_require('/includes/class.php');
dgr_startup();
if (!isset($_POST['id']) || !isset($_POST['name']) || !isset($_POST['startyear']) || !isset($_POST['tutorid']) || !isset($_POST['qid'])) {
    exit;
}
try {
    $u = new DGradeUser();
} catch (Exception $e) {
    exit;
}
$added = 0;
$ht = '';
if ($_POST['id'] == 0 && $u->get_level() == 0) {
    $dblink = DGradeDB::instance();
    $dblink->add_class(stripslashes($_POST['name']), stripslashes($_POST['startyear']), $_POST['tutorid']);
} else {
    if ($_POST['id'] > 0) {
        $class = new DGradeClass($_POST['id']);
        if ($u->get_level() == 0 || $u->get_uid() == $class->get_tutorid()) {
            $class->set_name(stripslashes($_POST['name']));
            $class->set_startyear(stripslashes($_POST['startyear']));
            $class->set_tutorid($_POST['tutorid']);
            $class->save();
        }
    }
}
if ($u->get_level() == 0) {
    $added = 1;
Exemplo n.º 5
0
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/common.php';
dgr_require('/includes/user.php');
dgr_startup();
try {
    $user = new DGradeUser();
    $style = dgr_get_style('.', $user->get_styleid());
} catch (Exception $e) {
    /* user not logged in */
    dgr_redirect('index.php');
}
if ($user->get_level() != 0) {
    die;
}
$users = dgr_get_users();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<title>DGrade - <?php 
echo gettext('users');
?>
</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
Exemplo n.º 6
0
}
$ht = '';
if ($_GET['view'] == 1) {
    $ht .= '<span id="chooseheader">' . gettext('Students') . '</span><span id="choosesel" style="display:none">1</span><span id="chooseid" style="display:none">0</span><div id="chooselist"><table cellpadding="0" cellspacing="0" width="100%">';
    $i = 0;
    foreach ($class->students as $st) {
        $stinfo = $class->get_student_brief($st);
        $tr = 'choose' . ++$i;
        $ht .= '<tr id="' . $tr . '" onmouseover="make_pointer(this)" onclick="change_selection(' . $i . ',' . $stinfo['id'] . ')">' . '<td style="width:15%" class="choosetd">' . $i . '</td>' . '<td class="choosetd">' . $stinfo['name'] . '</td>' . '<td class="choosetd">' . $stinfo['surname'] . '</td>' . '</tr>';
    }
    $ht .= '</table></div>';
} else {
    if ($_GET['view'] == 2) {
        $ht .= '<span id="chooseheader">' . gettext('Subjects') . '</span><span id="choosesel"  style="display:none">1</span><span id="chooseid" style="display:none">0</span><div id="chooselist"><table cellpadding="0" cellspacing="0" width="100%">';
        $i = 0;
        $accepted = $user->get_level() == 0 || $class->get_tutorid() == $user->get_uid();
        foreach ($class->get_subjects($_GET['semid']) as $sub) {
            if (!$accepted && $sub['uid'] != $user->get_uid()) {
                continue;
            }
            $tr = 'choose' . ++$i;
            $ht .= '<tr id="' . $tr . '" onmouseover="make_pointer(this)" onclick="change_selection(' . $i . ',' . $sub['id'] . ')">' . '<td class="choosetd" style="text-align:center">' . $sub['name'] . '</td></tr>';
        }
        $ht .= '</table></div>';
    } else {
        exit;
    }
}
?>

{
Exemplo n.º 7
0
if (!isset($_POST['id']) || !isset($_POST['classid']) || !isset($_POST['name']) || !isset($_POST['surname']) || !isset($_POST['email']) || !isset($_POST['paremail']) || !isset($_POST['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
    $student = new DGradeStudent($_POST['id']);
} catch (Exception $e) {
    exit;
}
$name = stripslashes($_POST['name']);
$surname = stripslashes($_POST['surname']);
$email = stripslashes($_POST['email']);
$paremail = stripslashes($_POST['paremail']);
if ($_POST['id'] == 0) {
    $class = new DGradeClass($_POST['classid']);
    if ($user->get_level() != 0 && $class->get_tutorid() != $user->get_uid()) {
        exit;
    }
    $dblink = DGradeDB::instance();
    $dblink->add_student($_POST['classid'], $name, $surname, $email, $paremail);
} else {
    if ($_POST['id'] > 0) {
        $student = new DGradeStudent($_POST['id']);
        if ($user->get_level() != 0 && $student->get_tutorid() != $user->get_uid()) {
            exit;
        }
        $student->save_info($name, $surname, $email, $paremail);
    }
}
?>
Exemplo n.º 8
0
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
if (!isset($_GET['id']) || !isset($_GET['absent']) || !isset($_GET['explained']) || !isset($_GET['late']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
} catch (Exception $e) {
    exit;
}
$dblink = DGradeDB::instance();
if ($user->get_level() != 0 && !$dblink->can_modify_attendance($_GET['id'], $user->get_uid())) {
    exit;
}
$dblink->set_attendance($_GET['id'], $_GET['absent'], $_GET['explained'], $_GET['late']);
Exemplo n.º 9
0
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
} catch (Exception $e) {
    exit;
}
if ($user->get_level() != 0 || $_GET['id'] == 0) {
    exit;
}
$dblink = DGradeDB::instance();
$dblink->delete_semester($_GET['id']);
$semesters = dgr_get_semesters();
?>

<option value="0"><?php 
echo gettext('new semester');
?>
</option>
<?php 
foreach ($semesters as $sem) {
    ?>
	<option value="<?php 
Exemplo n.º 10
0
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/db.php');
dgr_require('/includes/user.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $u = new DGradeUser();
} catch (Exception $e) {
    exit;
}
if ($u->get_level() != 0) {
    exit;
}
$dblink = DGradeDB::instance();
$dblink->delete_class($_GET['id']);
$classes = dgr_get_classes();
?>

<option value="0"><?php 
echo gettext('new class');
?>
</option>
<?php 
foreach ($classes as $c) {
    ?>
	<option value="<?php 
Exemplo n.º 11
0
<div class="left">
<span><?php 
echo gettext('Logged in as') . ': ' . $user->get_name() . ' ' . $user->get_surname();
?>
</span>
<br />
<span><a href="index.php?logout=1"><?php 
echo gettext('Logout');
?>
</a></span>
</div>

<div class="right">

<?php 
if ($user->get_level() == 0) {
    ?>
<span class="menuitem"><a href="classes.php"><?php 
    echo gettext('Classes');
    ?>
</a></span>
<span class="menuitem"><a href="subjects.php"><?php 
    echo gettext('Subjects & semesters');
    ?>
</a></span>
<span class="menuitem"><a href="class_subjects.php"><?php 
    echo gettext('Class subjects');
    ?>
</a></span>
<span class="menuitem"><a href="users.php"><?php 
    echo gettext('Users');
Exemplo n.º 12
0
if (!isset($_GET['id']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
} catch (Exception $e) {
    exit;
}
if ($_GET['id'] > 0) {
    try {
        $student = new DGradeStudent($_GET['id']);
        $tutorid = $student->get_tutorid();
    } catch (Exception $e) {
        die($e->getMessage());
    }
    if ($user->get_level() != 0 && $user->get_uid() != $tutorid) {
        exit;
    }
    $info = $student->get_info();
    ?>

{
"nameheader": "<?php 
    echo htmlspecialchars($info['name'] . ' ' . $info['surname']);
    ?>
",
"name": "<?php 
    echo htmlspecialchars($info['name']);
    ?>
",
"surname": "<?php 
Exemplo n.º 13
0
    $grades = $student->get_semester_grades($_GET['semid']);
    $longest = 0;
    foreach ($grades as &$g) {
        $g['grades'] = explode(',', $g['grades']);
        reset($g['grades']);
        /* foreach requires that */
        $cnt = count($g['grades']);
        if ($cnt > $longest) {
            $longest = $cnt;
        }
    }
    unset($g);
    /* break the reference to make $g usable later */
    $attendance = array();
    $total = $student->get_attendance($_GET['semid'], $attendance);
    $canwritebase = $user->get_level() == 0 || $student->get_tutorid() == $user->get_uid();
    $disabled = $canwritebase ? '' : 'disabled="disabled"';
    ?>

<table id="gradetable" cellpadding="2" cellspacing="0" width="100%" class="centered">
<thead>
<tr>
	<th class="rowheader showcell"><?php 
    echo gettext('Subjects');
    ?>
</th>
	<th class="showcell" colspan="<?php 
    echo $longest;
    ?>
"><?php 
    echo gettext('Grades');
Exemplo n.º 14
0
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/user.php');
dgr_require('/includes/student.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['semid']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
    $student = new DGradeStudent($_GET['id']);
} catch (Exception $e) {
    exit;
}
if ($user->get_level() != 0 && $user->get_uid() != $student->get_tutorid()) {
    exit;
}
$email = $user->get_email();
$err = 0;
$msg = '';
if (empty($email)) {
    $err = 1;
    $msg = gettext('E-mail not set');
} else {
    if ($student->send($_GET['semid'], $email)) {
        $err = 0;
        $msg = gettext('Message sent successfully');
    } else {
        $err = 1;
        $msg = gettext('Message not sent :(');