*      (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']);
    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);
    }
}
?>

Example #3
0
    $user = new DGradeUser();
    $class = new DGradeClass($_GET['id']);
} catch (Exception $e) {
    exit;
}
if ($user->get_level() != 0 && $user->get_uid() != $class->get_tutorid()) {
    exit;
}
$email = $user->get_email();
if (empty($email)) {
    $err = 1;
    $msg = gettext('E-mail not set');
} else {
    $ret = true;
    foreach ($class->students as $st) {
        $student = new DGradeStudent($st);
        $ret = $ret && $student->send($_GET['semid'], $email);
    }
    if ($ret) {
        $err = 0;
        $msg = gettext('All messages sent');
    } else {
        $err = 1;
        $msg = gettext('Not all messages were sent :(');
    }
}
?>

{
"status": "<?php 
echo $err;
 */
require_once dirname(__FILE__) . '/../common.php';
dgr_require('/includes/user.php');
dgr_require('/includes/student.php');
dgr_startup();
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']);
    ?>
",
Example #5
0
</table>
<?php 
    }
    ?>

<?php 
} else {
    if ($_GET['view'] == 2) {
        $class = new DGradeClass($user->get_classid());
        $data = array();
        $longest = 0;
        $userid = $user->get_uid();
        $canwritebase = $user->get_level() == 0 || $class->get_tutorid() == $user->get_uid();
        foreach ($class->students as $st) {
            $info = $class->get_student_brief($st);
            $student = new DGradeStudent($st);
            $rec = $student->get_subject_grades($_GET['id'], $_GET['semid']);
            $rec['grades'] = explode(',', $rec['grades']);
            $cnt = count($rec['grades']);
            if ($cnt > $longest) {
                $longest = $cnt;
            }
            $rec['student_id'] = $info['id'];
            $rec['info'] = $info['name'] . ' ' . $info['surname'];
            $data[] = $rec;
        }
        ?>

<table id="gradetable" cellpadding="2" cellspacing="0" width="100%" class="centered">
<thead>
<tr>
Example #6
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_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;