*      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);
        }
    }
}
 *      (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);
 *      (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']);
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);
    }
}
?>
    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;
    $classes = dgr_get_classes();
    $ht = '<option value="0">' . gettext('new class') . '</option>';
    foreach ($classes as $c) {
        $ht .= '<option value="' . $c['class_id'] . '">' . $c['name'] . '</option>';
    }
}
Beispiel #6
0
</span>
<?php 
}
?>

<span class="doubleline">
	<a style="font-size:10pt" href="#" onclick="save_class()"><?php 
echo gettext('save');
?>
</a>
</span>

</div>

<span id="selecttutor" style="display:none"><?php 
echo $user->get_uid();
?>
</span>

</div>

<br />

<div id="maincontainer">

<div id="choosebox">
</div>

<div id="workarea">

<span id="inputdisabled" style="display:none">1</span>
}
$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;
    }
}
?>

{
 *      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']);
Beispiel #9
0
?>
	</span>
	<br />
	<span>
		<input id="view2" type="radio" name="view" value="subjects" onclick="set_view()" />
		<?php 
echo gettext('subjects');
?>
	</span>
</div>

<!-- from here in reverse order -->

<div class="menuitem right">
<span id="hrefvis" style="display:none"><?php 
echo $loadclass && $user->get_uid() == $class->get_tutorid() ? 1 : 0;
?>
</span>
<span id="lvl" style="display:none"><?php 
echo $user->get_level();
?>
</span>
<span id="managebox" style="font-size:10pt; text-align:center">
<a id="subjecthref" href="class_subjects.php?id=<?php 
echo $loadclass ? $class->get_id() : 0;
?>
">
	<?php 
echo gettext('subjects');
?>
</a>
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 
Beispiel #11
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');
Beispiel #12
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 :(');