*
 *      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/class.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
    $class = new DGradeClass($_GET['id']);
} catch (Exception $e) {
    exit;
}
if ($user->get_level() != 0 && $user->get_uid() != $class->get_tutorid()) {
    exit;
}
?>

<span id="chooseheader"><?php 
echo gettext('Students');
?>
</span>
<span id="choosesel" style="display:none">1</span>
<span id="chooseid" style="display:none">0</span>
dgr_require('/includes/student.php');
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);
    }
}
?>
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;
    $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>';
    }
 *
 *      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/class.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['view']) || !isset($_GET['semid']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
    $class = new DGradeClass($_GET['id']);
    $user->set_classid($_GET['id']);
} catch (Exception $e) {
    exit;
}
$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 {
    $classes = dgr_get_classes();
    if (isset($_GET['id']) && $_GET['id'] > 0) {
        $classid = $_GET['id'];
    } else {
        $classid = (int) $classes[0]['class_id'];
    }
} else {
    $classid = $user->get_tutored();
    if ($classid == 0) {
        die;
    }
}
$semesters = dgr_get_semesters();
if ($classid > 0 && count($semesters) > 0) {
    $semid = $semesters[0]['id'];
    $class = new DGradeClass($classid);
    $lc = true;
} else {
    $lc = false;
}
$subjects = dgr_get_subjects();
$teachers = dgr_get_users(true);
?>

<!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('subjects');
Exemple #6
0
 *      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/class.php');
dgr_startup();
$error = false;
$errmsg = '';
try {
    $user = new DGradeUser();
    $style = dgr_get_style('.', $user->get_styleid());
    $semesters = dgr_get_semesters();
    $classes = $user->get_classes($semesters[0]['id']);
    if (count($classes) > 0) {
        $class = new DGradeClass($classes[0]['class_id']);
        $classload = true;
    } else {
        $classload = false;
    }
} catch (Exception $e) {
    $error = true;
    $classload = false;
    $errmsg = $e->getMessage();
    $style = dgr_get_style('.');
}
?>

<!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">
<tr>
	<td id="mailmsg" class="msgbox" colspan="2">&nbsp;</td>
</tr>
</table>
<?php 
    } else {
        ?>
</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'];
 *
 *      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/class.php');
dgr_startup();
if (!isset($_GET['id']) || !isset($_GET['semid']) || !isset($_GET['qid'])) {
    exit;
}
try {
    $user = new DGradeUser();
    $class = new DGradeClass($_GET['id']);
} catch (Exception $e) {
    exit;
}
if ($user->get_level() != 0 && $user->get_uid() != $class->get_tutorid()) {
    exit;
}
?>

<span id="chooseheader"><?php 
echo gettext('Subjects');
?>
</span>
<span id="choosesel" style="display:none">1</span>
<span id="chooseid" style="display:none">0</span>