*      (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/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;
Esempio n. 2
0
</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<meta name="generator" content="Geany 0.16" />
	<link type="text/css" rel="stylesheet" href="<?php 
echo dgr_get_style('..');
?>
" />
</head>

<body>

<div id="main">


<?php 
dgr_require('/includes/db.php');
function sql_tables_from_file($filename, &$dblink, $stop_on_error = true)
{
    $sql = file($filename);
    foreach ($sql as $sqlline) {
        if (substr($sqlline, 0, 2) != "--") {
            $sql_cmd .= $sqlline;
        }
    }
    $sql_cmd = split(';', $sql_cmd);
    foreach ($sql_cmd as $query) {
        $query = trim($query);
        if (empty($query)) {
            continue;
        }
        if (!$dblink->query($query) && $stop_on_error) {
Esempio n. 3
0
 *      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($_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']);
Esempio n. 4
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']);
Esempio n. 5
0
 *      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('/config.php');
class DGradeDB
{
    private $conn = null;
    private function __construct()
    {
        $this->conn = @pg_connect('host=' . DGRADE_DB_SERV . ' dbname=' . DGRADE_DB_NAME . ' user='******' password='******'Cannot connect to database');
        }
    }
    public static function instance()
    {
        static $i = null;
        if (!isset($i)) {
            $i = new DGradeDB();