function doInsert() { if (isset($_POST['save'])) { $NAME = $_POST['subjectname']; $DESCRIPTION = $_POST['description']; $SECTOR = $_POST['sector']; $DOMAIN = $_POST['domain']; $subject = new subject(); $subject->name = $NAME; $subject->description = $DESCRIPTION; $subject->sector_id = $SECTOR; $subject->domain_id = $DOMAIN; } if ($NAME == "") { message('Subject Name is required!', "error"); redirect('index.php?view=add'); } elseif ($DESCRIPTION == "") { message('Description is required!', "error"); redirect('index.php?view=add'); } elseif ($SECTOR == "") { message('Sector ID is required!', "error"); redirect('index.php?view=add'); } elseif ($DOMAIN == "") { message('Domain ID is required!', "error"); redirect('index.php?view=add'); } else { $subject->create(); message('New subject addedd successfully!', "success"); redirect('index.php?view=list'); } }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { $subject = new subject(); $subject->user_id = Auth::id(); $subject->code = $request->get('code'); $subject->name = $request->get('name'); $subject->description = $request->get('description'); $subject->save(); return redirect(route('subjects.index'))->with('flash_success', 'subject updated successfully.'); }
public function listAll() { $toReturn = array(); $teachers = User::where('role', 'teacher')->get()->toArray(); $toReturn['dormitory'] = dormitories::get()->toArray(); $toReturn['subject'] = array(); $subjects = subject::get(); foreach ($subjects as $value) { $toReturn['subject'][$value->id] = $value->subjectTitle; } $toReturn['classes'] = array(); $classes = \DB::table('classes')->leftJoin('dormitories', 'dormitories.id', '=', 'classes.dormitoryId')->select('classes.id as id', 'classes.className as className', 'classes.classTeacher as classTeacher', 'classes.classSubjects as classSubjects', 'dormitories.id as dormitory', 'dormitories.dormitory as dormitoryName')->where('classAcademicYear', $this->panelInit->selectAcYear)->get(); $toReturn['teachers'] = array(); while (list($teacherKey, $teacherValue) = each($teachers)) { $toReturn['teachers'][$teacherValue['id']] = $teacherValue; } while (list($key, $class) = each($classes)) { $toReturn['classes'][$key] = $class; $toReturn['classes'][$key]->classSubjects = json_decode($toReturn['classes'][$key]->classSubjects); if ($toReturn['classes'][$key]->classTeacher != "") { $toReturn['classes'][$key]->classTeacher = json_decode($toReturn['classes'][$key]->classTeacher, true); if (is_array($toReturn['classes'][$key]->classTeacher)) { while (list($teacherKey, $teacherID) = each($toReturn['classes'][$key]->classTeacher)) { if (isset($toReturn['teachers'][$teacherID]['fullName'])) { $toReturn['classes'][$key]->classTeacher[$teacherKey] = $toReturn['teachers'][$teacherID]['fullName']; } else { unset($toReturn['classes'][$key]->classTeacher[$teacherKey]); } } $toReturn['classes'][$key]->classTeacher = implode($toReturn['classes'][$key]->classTeacher, ", "); } } } return $toReturn; }
function edit($id) { $subject = subject::find($id); $subject->subjectTitle = Input::get('subjectTitle'); $subject->teacherId = Input::get('teacherId'); $subject->save(); $teacher = User::where('id', $subject->teacherId)->first(); $subject->teacherName = $teacher->fullName; return $this->panelInit->apiOutput(true, $this->panelInit->language['editSubject'], $this->panelInit->language['subjectEdited'], $subject->toArray()); }
public function listAll() { $toReturn = array(); $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray(); $classesArray = array(); while (list(, $class) = each($toReturn['classes'])) { $classesArray[$class['id']] = array("classTitle" => $class['className'], "subjects" => json_decode($class['classSubjects'])); } if ($this->data['users']->role == "teacher") { $subjects = subject::where('teacherId', $this->data['users']->id)->get()->toArray(); } else { $subjects = subject::get()->toArray(); } $subjectArray = array(); while (list(, $subject) = each($subjects)) { $subjectArray[$subject['id']] = $subject['subjectTitle']; } $toReturn['onlineExams'] = array(); $onlineExams = new onlineExams(); if ($this->data['users']->role == "teacher") { $onlineExams = $onlineExams->where('examTeacher', $this->data['users']->id); } if ($this->data['users']->role == "student") { $onlineExams = $onlineExams->where('examClass', 'LIKE', '%"' . $this->data['users']->studentClass . '"%'); } $onlineExams = $onlineExams->where('exAcYear', $this->panelInit->selectAcYear); $onlineExams = $onlineExams->get(); foreach ($onlineExams as $key => $onlineExam) { $classId = json_decode($onlineExam->examClass); if ($this->data['users']->role == "student" and !in_array($this->data['users']->studentClass, $classId)) { continue; } $toReturn['onlineExams'][$key]['id'] = $onlineExam->id; $toReturn['onlineExams'][$key]['examTitle'] = $onlineExam->examTitle; $toReturn['onlineExams'][$key]['examDescription'] = $onlineExam->examDescription; if (isset($subjectArray[$onlineExam->examSubject])) { $toReturn['onlineExams'][$key]['examSubject'] = $subjectArray[$onlineExam->examSubject]; } $toReturn['onlineExams'][$key]['ExamEndDate'] = date("F j, Y", $onlineExam->ExamEndDate); $toReturn['onlineExams'][$key]['ExamShowGrade'] = $onlineExam->ExamShowGrade; $toReturn['onlineExams'][$key]['classes'] = ""; while (list(, $value) = each($classId)) { if (isset($classesArray[$value])) { $toReturn['onlineExams'][$key]['classes'] .= $classesArray[$value]['classTitle'] . ", "; } } } $toReturn['userRole'] = $this->data['users']->role; return $toReturn; }
public function listAll() { $toReturn = array(); $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray(); $classesArray = array(); while (list(, $class) = each($toReturn['classes'])) { $classesArray[$class['id']] = $class['className']; } $toReturn['subject'] = subject::get()->toArray(); $subjectArray = array(); while (list(, $subject) = each($toReturn['subject'])) { $subjectArray[$subject['id']] = $subject['subjectTitle']; } $toReturn['materials'] = array(); $studyMaterial = new studyMaterial(); if ($this->data['users']->role == "student") { $studyMaterial = $studyMaterial->where('class_id', 'LIKE', '%"' . $this->data['users']->studentClass . '"%'); } if ($this->data['users']->role == "teacher") { $studyMaterial = $studyMaterial->where('teacher_id', $this->data['users']->id); } $studyMaterial = $studyMaterial->get(); foreach ($studyMaterial as $key => $material) { $classId = json_decode($material->class_id); if ($this->data['users']->role == "student" and !in_array($this->data['users']->studentClass, $classId)) { continue; } $toReturn['materials'][$key]['id'] = $material->id; $toReturn['materials'][$key]['subjectId'] = $material->subject_id; $toReturn['materials'][$key]['subject'] = $subjectArray[$material->subject_id]; $toReturn['materials'][$key]['material_title'] = $material->material_title; $toReturn['materials'][$key]['material_description'] = $material->material_description; $toReturn['materials'][$key]['material_file'] = $material->material_file; $toReturn['materials'][$key]['classes'] = ""; if (is_array($classId)) { while (list(, $value) = each($classId)) { if (isset($classesArray[$value])) { $toReturn['materials'][$key]['classes'] .= $classesArray[$value] . ", "; } } } } $toReturn['userRole'] = $this->data['users']->role; return $toReturn; exit; }
function lastCalls() { global $db; $query = $db->query("SELECT * FROM {$db->table['calls']} ORDER BY `id` DESC LIMIT 5"); //require_once('inc/classes/customer.php'); require_once 'inc/classes/web.php'; require_once 'inc/classes/subject.php'; //$customer = new customer; $web = new web(); $subject = new subject(); while ($row = $db->newRow($query)) { if ($row['type'] == 'Incoming') { $type = 'red'; } else { if ($row['type'] == 'Outgoing') { $type = 'green'; } else { if ($row['type'] == 'Outgoing') { $type = 'blue'; } } } echo '<li><a href="edit.php?id=' . $row['id'] . '"><font color="' . $type . '">[' . $web->idToName($row['web']) . '] ' . $subject->idToName($row['subject']) . '</font></a></li>'; } }
public function subjectList($classes = "") { $subjectList = array(); $classesCount = 1; if ($classes == "") { $classes = Input::get('classes'); if (!Input::has('classes')) { return $subjectList; } } if (is_array($classes)) { $classes = classes::whereIn('id', $classes)->get()->toArray(); $classesCount = count($classes); } else { $classes = classes::where('id', $classes)->get()->toArray(); } while (list(, $value) = each($classes)) { $value['classSubjects'] = json_decode($value['classSubjects'], true); if (is_array($value['classSubjects'])) { while (list(, $value2) = each($value['classSubjects'])) { $subjectList[] = $value2; } } } if ($classesCount == 1) { $finalClasses = $subjectList; } else { $subjectList = array_count_values($subjectList); $finalClasses = array(); while (list($key, $value) = each($subjectList)) { if ($value == $classesCount) { $finalClasses[] = $key; } } } if (count($finalClasses) > 0) { return subject::whereIn('id', $finalClasses)->get()->toArray(); } return array(); }
public function update(\subject $subject) { $this->sendNotification($subject->getData()); }
?> >Chat</option> </select><br><br> <label for="web">Web:</label><br><br> <select name="web"> <?php $web = new web(); $web->select($info['web']); ?> </select><br><br> <label for="subject">Subject:</label><br><br> <select name="subject"> <?php $subject = new subject(); $subject->select($info['subject']); ?> </select><br><br> <label for="duration">Duration:</label><br><br> <select name="minutes"> <?php $minutes = (int) ($info['duration'] / 60); printTime($minutes); ?> </select>: <select name="seconds"> <?php $seconds = (int) ($info['duration'] % 60);
} else { if ($_POST['type'] == 3) { User::updateUser($_POST['id'], $_POST['password'], $_POST['class']); } } } $app->redirect($app->urlFor('gestionUser')); }); $app->get('/gestionUser', function () use($app) { $alladmin = User::listAdmin(); $allteacher = User::listTeacher(); $i = 0; $size = sizeof($allteacher); $tab = []; while ($i < $size) { $tab[] = subject::getAllSubject(); $i++; } $subjectTeacher = array(); $i = 0; $j = 0; while ($i < $size) { $size2 = sizeof($tab[$i]); while ($j < $size2) { $subjectTeacher[$tab[$i][$j]['teacherId']] = $tab[$i][$j]['subjectName']; $j++; } $i++; } $alluser = User::listUser(); $allclass = StudentClass::getAllClass();
$current_admin = admin::find_admin_by_id($_GET["admin"]); ?> <?php if (!$current_admin) { $_SESSION["message"] = "Can't find this admin."; utility::redirect_to("manage_admins.php"); } ?> <?php $key = "admin_id"; $subject_set = subject::find_subjects_by_admin($current_admin["id"], false); if ($current_admin["id"] == $my_session->return_session_data($key)) { $_SESSION["message"] = "YOU CAN'T DELETE YOURSELF!!"; utility::redirect_to("manage_admins.php"); } if ($current_admin["id"] == admin::$super_user) { $_SESSION["message"] = "YOU DON'T HAVE PRIVILEGE TO DELETE SUPERUSER"; utility::redirect_to("manage_admins.php"); } if (subject::subjectset_not_empty($subject_set)) { $_SESSION["message"] = "DELETION FAILED, THIS USER STILL HAVE POSTED NOTES!"; utility::redirect_to("manage_admins.php"); } ?> <?php admin::delete_admin($current_admin["id"]); ob_end_flush();
public function __construct() { parent::__construct(); $this->subject = "bigBen"; }
<?php //Include necessary files include_once '../includes/core/init.inc.php'; $my_session->confirm_logged_in(); ?> <?php $current_subject = subject::find_subject_by_id($_GET["subject"], false); ?> <?php if (!$current_subject) { // subject ID was missing or invlid or // subject couldn't be found in database utility::redirect_to("manage_content.php"); } subject::delete_subject($current_subject["id"]); ob_end_flush();
public function proceed() { if (Input::get('nextStep') == "1") { if (filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) { if (!Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'role' => 'admin'))) { $loginError = false; $this->data['loginError'] = "loginError"; } } else { if (!Auth::attempt(array('username' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'role' => 'admin'))) { $loginError = false; $this->data['loginError'] = "loginError"; } } if (!isset($loginError)) { file_put_contents('app/storage/meta/lc', Input::get('cpc')); if ($this->sbApi() == "err") { @unlink('app/storage/meta/lc'); $this->data['installErrors'][] = "Purchase code is missing"; $loginError = false; $this->data['loginError'] = "loginError"; } } $this->data['currStep'] = "welcome"; if (!isset($loginError)) { $this->data['currStep'] = "1"; $this->data['nextStep'] = "2"; $testData = uniqid(); @file_put_contents("uploads/assignments/test", $testData); @file_put_contents("uploads/books/test", $testData); @file_put_contents("uploads/cache/test", $testData); @file_put_contents("uploads/media/test", $testData); @file_put_contents("uploads/profile/test", $testData); @file_put_contents("uploads/studyMaterial/test", $testData); @file_put_contents("uploads/assignmentsAnswers/test", $testData); @file_put_contents("app/storage/cache/test", $testData); @file_put_contents("app/storage/logs/test", $testData); @file_put_contents("app/storage/meta/test", $testData); @file_put_contents("app/storage/sessions/test", $testData); @file_put_contents("app/storage/views/test", $testData); if (@file_get_contents("uploads/assignments/test") != $testData) { $this->data['perrors'][] = "uploads/assignments"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/assignments"; } if (@file_get_contents("uploads/books/test") != $testData) { $this->data['perrors'][] = "uploads/books"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/books"; } if (@file_get_contents("uploads/cache/test") != $testData) { $this->data['perrors'][] = "uploads/cache"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/cache"; } if (@file_get_contents("uploads/media/test") != $testData) { $this->data['perrors'][] = "uploads/media"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/media"; } if (@file_get_contents("uploads/profile/test") != $testData) { $this->data['perrors'][] = "uploads/profile"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/profile"; } if (@file_get_contents("uploads/studyMaterial/test") != $testData) { $this->data['perrors'][] = "uploads/studyMaterial"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/studyMaterial"; } if (@file_get_contents("uploads/assignmentsAnswers/test") != $testData) { $this->data['perrors'][] = "uploads/assignmentsAnswers"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "uploads/assignmentsAnswers"; } if (@file_get_contents("app/storage/cache/test") != $testData) { $this->data['perrors'][] = "app/storage/cache"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "app/storage/cache"; } if (@file_get_contents("app/storage/logs/test") != $testData) { $this->data['perrors'][] = "app/storage/logs"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "app/storage/logs"; } if (@file_get_contents("app/storage/meta/test") != $testData) { $this->data['perrors'][] = "app/storage/meta"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "app/storage/meta"; } if (@file_get_contents("app/storage/sessions/test") != $testData) { $this->data['perrors'][] = "app/storage/sessions"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "app/storage/sessions"; } if (@file_get_contents("app/storage/views/test") != $testData) { $this->data['perrors'][] = "app/storage/views"; $this->data['nextStep'] = "1"; } else { $this->data['success'][] = "app/storage/views"; } } } if (Input::get('nextStep') == "2") { $this->data['currStep'] = "2"; $this->data['nextStep'] = "3"; $testInstalled = settings::where('fieldName', 'thisVersion')->first(); if ($testInstalled->fieldValue == "1.2" || $testInstalled->fieldValue == "1.3") { //Upgrade from first version to 1.4 DB::unprepared(file_get_contents('app/storage/dbsqlUp14')); $settings = settings::where('fieldName', 'thisVersion')->first(); $settings->fieldValue = '1.4'; $settings->save(); $testInstalled->fieldValue = "1.4"; } if ($testInstalled->fieldValue == "1.4") { //Upgrade from first version to 1.4 DB::unprepared(file_get_contents('app/storage/dbsqlUp20')); //Classes and relation with subjects $classes = classes::get(); foreach ($classes as $class) { $classesUpdateArray = array(); $subjects = subject::where('classId', $class->id)->get(); foreach ($subjects as $subject) { $classesUpdateArray[] = $subject->id; } $classesUpdateArray = json_encode($classesUpdateArray); classes::where('id', $class->id)->update(array('classSubjects' => $classesUpdateArray)); unset($classesUpdateArray); } //create academic years $users = User::where('role', 'student')->get(); foreach ($users as $user) { $studentAcademicYears = new studentAcademicYears(); $studentAcademicYears->studentId = $user->id; $studentAcademicYears->academicYearId = 1; $studentAcademicYears->classId = $user->studentClass; $studentAcademicYears->save(); } DB::unprepared('ALTER TABLE `subject` CHANGE `teacherId` `teacherId` int(250) NOT NULL after `subjectTitle` ,DROP COLUMN `classId` ;'); $settings = settings::where('fieldName', 'thisVersion')->first(); $settings->fieldValue = '2.0'; $settings->save(); } } if (Input::get('nextStep') == "3") { $this->data['currStep'] = "3"; $settings = settings::where('fieldName', 'thisVersion')->first(); $settings->fieldValue = '1.4'; $settings->save(); } return View::make('upgrade', $this->data); }
public function __construct() { parent::__construct(); }
public function loadSubject($timeTableId) { $pdo = $this->dbConnManager->connect(); $pdo = $this->dbConnManager->connect(); try { $statement = $pdo->query("SELECT `Time`,`name` from subject where timeTableId='" . $timeTableId . "' Order By `Time`"); $statement->setFetchMode(PDO::FETCH_ASSOC); $result = $statement->fetch(); print_r($result); $myBigArray = array(); foreach ($result as &$value) { $createSubject = new subject(); $createSubject->setExamTime($result['Time']); $createSubject->setSubjectName($result['name']); array_push($myBigArray, $createSubject); } return $myBigArray; } catch (Exception $ex) { //print_r($ex); } finally { $this->dbConnManager->closeConnection($pdo); } }
function editSub($id) { if ($this->data['users']->role != "admin") { exit; } $classSchedule = classSchedule::find($id); $classSchedule->subjectId = Input::get('subjectId'); $classSchedule->dayOfWeek = Input::get('dayOfWeek'); $startTime = ""; if (Input::get('startTimeHour') < 10) { $startTime .= "0"; } $startTime .= Input::get('startTimeHour'); if (Input::get('startTimeMin') < 10) { $startTime .= "0"; } $startTime .= Input::get('startTimeMin'); $classSchedule->startTime = $startTime; $endTime = ""; if (Input::get('endTimeHour') < 10) { $endTime .= "0"; } $endTime .= Input::get('endTimeHour'); if (Input::get('endTimeMin') < 10) { $endTime .= "0"; } $endTime .= Input::get('endTimeMin'); $classSchedule->endTime = $endTime; $classSchedule->save(); $classSchedule->startTime = wordwrap($classSchedule->startTime, 2, ':', true); $classSchedule->endTime = wordwrap($classSchedule->endTime, 2, ':', true); $classSchedule->subjectId = subject::where('id', Input::get('subjectId'))->first()->subjectTitle; return $this->panelInit->apiOutput(true, $this->panelInit->language['editSch'], $this->panelInit->language['schModSucc'], $classSchedule->toArray()); }
<?php $errors = session::errors(); ?> <?php echo utility::form_errors($errors); ?> <h2>Create Subject</h2> <form action="create_subject.php" method="post"> <p>Menu name: <input type="text" name="menu_name" value="" /></p> <p>Position: <select name="position"> <?php echo subject::find_subject_position(true); //param true means edit subject ?> </select> </p> <p>Visible: <input type="radio" name="visible" value="0" /> No <input type="radio" name="visible" value="1" /> Yes </p> <input type="submit" name="submit" value="Create Subject" /> </form> <br /> <a href="manage_content.php">Cancel</a>
/** * according to user active, to find current subject and current page user want to visit * @param boolean context @var */ public static function find_selected_content($public = false) { global $current_subject; global $current_page; if (isset($_GET["subject"])) { $current_subject = subject::find_subject_by_id($_GET["subject"], $public); if ($current_subject && $public) { $current_page = page::find_default_page_for_subject($current_subject["id"]); } else { $current_page = null; } } else { if (isset($_GET["page"])) { $current_page = page::find_page_by_id($_GET["page"], $public); $current_subject = null; } else { $current_subject = null; $current_page = null; } } }
public function search() { $sql = "select * from attendance where "; $sqlArray = array(); $toReturn = array(); $students = array(); $studentArray = User::where('role', 'student')->get(); foreach ($studentArray as $stOne) { $students[$stOne->id] = array('name' => $stOne->fullName, 'studentRollId' => $stOne->studentRollId, 'attendance' => ''); } $subjectsArray = subject::get(); $subjects = array(); foreach ($subjectsArray as $subject) { $subjects[$subject->id] = $subject->subjectTitle; } if (Input::get('classId') and Input::get('classId') != "") { $sqlArray[] = "classId='" . Input::get('classId') . "'"; } if (Input::get('subjectId') and Input::get('subjectId') != "") { $sqlArray[] = "subjectId='" . Input::get('subjectId') . "'"; } if (Input::get('status') and Input::get('status') != "All") { $sqlArray[] = "status='" . Input::get('status') . "'"; } if (Input::get('attendanceDay') and Input::get('attendanceDay') != "") { $sqlArray[] = "date='" . Input::get('attendanceDay') . "'"; } $sql = $sql . implode(" AND ", $sqlArray); $attendanceArray = DB::select(DB::raw($sql)); foreach ($attendanceArray as $stAttendance) { $toReturn[$stAttendance->id] = $stAttendance; if (isset($students[$stAttendance->studentId])) { $toReturn[$stAttendance->id]->studentName = $students[$stAttendance->studentId]['name']; if ($stAttendance->subjectId != "") { $toReturn[$stAttendance->id]->studentSubject = $subjects[$stAttendance->subjectId]; } $toReturn[$stAttendance->id]->studentRollId = $students[$stAttendance->studentId]['studentRollId']; } } return $toReturn; }
public function update(\subject $subject) { $this->sendInvitation($subject->getData()); }
/** * retrieve subject name for edit page, page can change to different subject * @return HTML */ public static function find_page_belong_subject() { global $dbo; global $current_page; $subject_set = subject::find_all_subjects(false); $output = ""; while ($subject = $dbo->fetch_assoc($subject_set)) { $output .= "<option value=\"{$subject["id"]}\""; if ($subject["id"] == $current_page["subject_id"]) { $output .= "selected"; } $output .= ">{$subject["menu_name"]}</option>"; } return $output; }
echo " "; echo " "; echo "<a href=logout.php>Log out</a>"; echo "<br />"; echo "<br />"; ?> <div class="subjects"> <?php //$subject_set = subject::find_all_subjects(false); // 2. Perform database query ?> <?php $admin_id = $my_session->return_session_data("admin_id"); ?> <?php $subject_set = subject::find_subjects_by_admin($admin_id, false); ?> <?php // 3. Use returned data (if any) while ($subject = $dbo->fetch_assoc($subject_set)) { ?> <!-- <?php echo "<li"; if ($current_subject && $current_subject["id"] == $subject["id"]) { echo " class=\"selected\""; } echo ">"; ?> --> <a href="manage_content.php?subject=<?php
function attendance($id) { $toReturn = array(); $toReturn['attendanceModel'] = $this->data['panelInit']->settingsArray['attendanceModel']; $toReturn['attendance'] = attendance::where('studentId', $id)->get()->toArray(); if ($this->data['panelInit']->settingsArray['attendanceModel'] == "subject") { $subjects = subject::get(); $toReturn['subjects'] = array(); foreach ($subjects as $subject) { $toReturn['subjects'][$subject->id] = $subject->subjectTitle; } } return $toReturn; }
echo " "; echo " "; echo "<a href=logout.php>Log out</a>"; echo "<br />"; echo "<br />"; } else { include "../includes/layouts/login_form.php"; } ?> </div> <div > <?php $subject_set = subject::find_all_subjects(); ?> <?php // 3. Use returned data (if any) while ($subject = $dbo->fetch_assoc($subject_set)) { ?> <a href="index.php?subject=<?php echo urlencode($subject["id"]); ?> "><?php echo htmlentities($subject["menu_name"]); ?> </a> <?php
<?php //required includes at start require_once 'inc/top.php'; //others required includes only here require_once 'inc/session.php'; require_once 'inc/classes/subject.php'; $subject = new subject(); if (isset($_POST['subject'])) { $subject->create($_POST['subject']); $msg = $subject->printNiceLog(false); } if (isset($_POST['delete'])) { $subject->deleteSelected(); $msg = $subject->printNiceLog(false); } if (isset($_POST['edit']) && isset($_POST['id'])) { $subject->edit($_POST['id'], $_POST['edit']); $msg = $subject->printNiceLog(false); } $html['title'] = 'Subjects'; //theme header include_once 'themes/' . THEME . '/header.php'; ?> <div class="title"> <h2>Subjects</h2> <p><small>Manage the subjects.</small></p> </div> <div class="entry"> <p><?php echo $msg;
function notifications($id) { if ($this->data['users']->role != "admin") { exit; } if ($this->panelInit->settingsArray['examDetailsNotif'] == "0") { return json_encode(array("jsTitle" => $this->panelInit->language['examDetailsNot'], "jsMessage" => $this->panelInit->language['adjustExamNot'])); } $examsList = examsList::where('id', $id)->first(); $subjectArray = array(); $subject = subject::get(); foreach ($subject as $value) { $subjectArray[$value->id] = $value->subjectTitle; } $usersArray = array(); if ($this->data['panelInit']->settingsArray['examDetailsNotifTo'] == "parent" || $this->data['panelInit']->settingsArray['examDetailsNotifTo'] == "both") { $users = User::where('role', 'student')->orWhere('role', 'parent')->get(); } else { $users = User::where('role', 'student')->get(); } foreach ($users as $value) { if ($value->parentOf == "" and $value->role == "parent") { continue; } if (!isset($usersArray[$value->id])) { $usersArray[$value->id] = array(); } if ($value->parentOf != "") { $value->parentOf = json_decode($value->parentOf); if (!is_array($value->parentOf)) { continue; } if (count($value->parentOf) > 0) { $usersArray[$value->id]['parents'] = array(); } foreach ($value->parentOf as $parentOf) { $usersArray[$parentOf->id]['parents'][$value->id] = array('username' => $value->username, "email" => $value->email, "fullName" => $value->fullName, "mobileNo" => $value->mobileNo); } } $usersArray[$value->id]['student'] = array('username' => $value->username, "studentRollId" => $value->studentRollId, "mobileNo" => $value->mobileNo, "email" => $value->email, "fullName" => $value->fullName); } $return['marks'] = array(); $examMarks = examMarks::where('examId', $id)->get(); foreach ($examMarks as $value) { if (!isset($return['marks'][$value->studentId])) { $return['marks'][$value->studentId] = array(); } if (isset($subjectArray[$value->subjectId])) { $return['marks'][$value->studentId][$subjectArray[$value->subjectId]] = array("examMark" => $value->examMark, "attendanceMark" => $value->attendanceMark, "markComments" => $value->markComments); } } $mailTemplate = mailsmsTemplates::where('templateTitle', 'Exam Details')->first(); if ($this->panelInit->settingsArray['examDetailsNotif'] == "mail" || $this->panelInit->settingsArray['examDetailsNotif'] == "mailsms") { $mail = true; } if ($this->panelInit->settingsArray['examDetailsNotif'] == "sms" || $this->panelInit->settingsArray['examDetailsNotif'] == "mailsms") { $sms = true; } $sms = true; $MailSmsHandler = new MailSmsHandler(); while (list($key, $value) = each($return['marks'])) { if (isset($mail)) { $studentTemplate = $mailTemplate->templateMail; $examGradesTable = ""; while (list($keyG, $valueG) = each($value)) { if ($valueG['examMark'] == "" and $valueG['attendanceMark'] == "") { continue; } $examGradesTable .= $keyG . " Grade : " . $valueG['examMark'] . " - Attendance : " . $valueG['attendanceMark'] . " - Comments : " . $valueG['markComments'] . "<br/>"; } if ($examGradesTable == "") { continue; } $searchArray = array("{studentName}", "{studentRoll}", "{studentEmail}", "{studentUsername}", "{examTitle}", "{examDescription}", "{examDate}", "{schoolTitle}", "{examGradesTable}"); $replaceArray = array($usersArray[$key]['student']['fullName'], $usersArray[$key]['student']['studentRollId'], $usersArray[$key]['student']['email'], $usersArray[$key]['student']['username'], $examsList->examTitle, $examsList->examDescription, $examsList->examDate, $this->panelInit->settingsArray['siteTitle'], $examGradesTable); $studentTemplate = str_replace($searchArray, $replaceArray, $studentTemplate); $MailSmsHandler->mail($usersArray[$key]['student']['email'], "Exam grade details", $studentTemplate, $usersArray[$key]['student']['fullName']); if (isset($usersArray[$key]['parents'])) { while (list($keyP, $valueP) = each($usersArray[$key]['parents'])) { // $MailSmsHandler->mail($valueP['email'],"Exam grade details",$studentTemplate,$usersArray[$key]['student']['fullName']); } } } if (isset($sms)) { $studentTemplate = $mailTemplate->templateSMS; $examGradesTable = ""; reset($value); while (list($keyG, $valueG) = each($value)) { if ($valueG['examMark'] == "" and $valueG['attendanceMark'] == "") { continue; } $examGradesTable .= $keyG . " Grade : " . $valueG['examMark'] . " - Attendance : " . $valueG['attendanceMark'] . " "; } if ($examGradesTable == "") { continue; } $searchArray = array("{studentName}", "{studentRoll}", "{studentEmail}", "{studentUsername}", "{examTitle}", "{examDescription}", "{examDate}", "{schoolTitle}", "{examGradesTable}"); $replaceArray = array($usersArray[$key]['student']['fullName'], $usersArray[$key]['student']['studentRollId'], $usersArray[$key]['student']['email'], $usersArray[$key]['student']['username'], $examsList->examTitle, $examsList->examDescription, $examsList->examDate, $this->panelInit->settingsArray['siteTitle'], $examGradesTable); $studentTemplate = str_replace($searchArray, $replaceArray, $studentTemplate); if ($usersArray[$key]['student']['mobileNo'] != "") { $MailSmsHandler->sms($usersArray[$key]['student']['mobileNo'], $studentTemplate); } if (isset($usersArray[$key]['parents'])) { reset($usersArray[$key]['parents']); while (list($keyP, $valueP) = each($usersArray[$key]['parents'])) { if (trim($valueP['mobileNo']) != "") { $MailSmsHandler->sms($valueP['mobileNo'], $studentTemplate); } } } } } return $this->panelInit->apiOutput(true, $this->panelInit->language['examDetailsNot'], $this->panelInit->language['examNotSent']); }
<option value="Outgoing">Outgoing</option> <option value="Chat">Chat</option> </select><br><br> <label for="web">Web:</label><br><br> <select name="web"> <?php $web = new web(); $web->select(); ?> </select><br><br> <label for="subject">Subject:</label><br><br> <select name="subject"> <?php $subject = new subject(); $subject->select(); ?> </select><br><br> <label for="duration">Duration:</label><br><br> <select name="minutes"> <?php printTime(); ?> </select>: <select name="seconds"> <?php printTime(); ?>
<p> <form action="edit_subject.php?subject=<?php echo urlencode($current_subject["id"]); ?> " method="post"> <p>Menu name: <input type="text" name="menu_name" value="<?php echo htmlentities($current_subject["menu_name"]); ?> " /> </p> <p>Position: <select name="position"> <?php echo subject::find_subject_position(false); // param false means edit subject ?> </select> </p> <p>Visible: <input type="radio" name="visible" value="0" <?php if ($current_subject["visible"] == 0) { echo "checked"; } ?> /> No <input type="radio" name="visible" value="1" <?php if ($current_subject["visible"] == 1) {