public function send($semid, $from) { $dblink = DGradeDB::instance(); $info = $dblink->get_student_info($this->id); if (empty($info['email']) && empty($info['parent_email'])) { return false; } $semname = $dblink->get_semester_name($semid); $grades = $dblink->get_grades($this->id, $semid); $attjunk = array(); $attendance = $dblink->get_attendance($this->id, $semid, $attjunk); unset($attjunk); /* don't need this */ $msg = ''; $semestral = gettext('Semestral'); $notes = gettext('Notes'); foreach ($grades as $g) { $msg .= $g['name'] . ': ' . $g['grades'] . "\n"; if (!empty($g['semestral'])) { $msg .= $semestral . ': ' . $g['semestral'] . "\n"; } if (!empty($g['notes'])) { $msg .= $notes . ': ' . $g['notes'] . "\n"; } $msg .= "\n"; } $msg .= gettext('Attendance') . ":\n" . gettext('Absent') . ': ' . $attendance['absent'] . "\n" . gettext('Explained') . ': ' . $attendance['explained'] . "\n" . gettext('Late') . ': ' . $attendance['late'] . "\n"; $subject = "[dgrade] {$info['name']} {$info['surname']} - {$semname}"; $msg = wordwrap($msg); $headers = "From: {$from}\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=utf-8\r\n"; $headers .= "Content-Transfer-Encoding: quoted-printable\r\n"; $ret = true; if (!empty($info['email'])) { $ret = $ret && mail($info['email'], $subject, $msg, $headers); } if (!empty($info['parent_email'])) { $ret = $ret && mail($info['parent_email'], $subject, $msg, $headers); } return $ret; }
* 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); } } }
function dgr_get_subjects() { try { $dblink = DGradeDB::instance(); } catch (Exception $e) { return array(); } return $dblink->get_subjects(); }
public function get_student_brief($id) { $dblink = DGradeDB::instance(); return $dblink->get_student_info_brief($id); }
public function get_tutored() { $dblink = DGradeDB::instance(); return $dblink->get_tutored($this->get_uid()); }