function addTransferredStudent(Student $student)
 {
     $connectionObject = Connection::getInstance();
     $connection = $connectionObject->get_connection();
     $number = $student->getNumber();
     $registered_date = $student->getRegisterdDate();
     $grade = $student->getGrade();
     $student_id = $student->getStudentId();
     $school_id = $_SESSION['school_id'];
     $is_old_boy = 0;
     $stmt = $connection->prepare("INSERT INTO student_school(student_id, school_id, registered_date,is_old_boy, starting_grade, registration_number) VALUES (?,?,?,?,?,?)");
     $stmt->bind_param("sssiss", $student_id, $school_id, $registered_date, $is_old_boy, $grade, $number);
     $result = $stmt->execute();
     $stmt->close();
     return $result;
 }
 /**
  * @param Request $request
  * @param Response $response
  */
 public function delete($request, $response)
 {
     try {
         Student::setRegistry($this->registry);
         $params = $request->getParams();
         $student = Student::find($params["id"]);
         $student->delete();
     } catch (ModelException $e) {
         $response->setParams(array("exception" => $e->getMessage()));
         $response->sendRedirect("error");
     }
     $response->sendRedirect("students");
 }
示例#3
0
     $name_in_full = $_POST['name_in_full'];
     $address = $_POST['address'];
     $registered_date = $_POST['date'];
     $grade = $_POST['registered_grade'];
     $student = new Student($address, $grade, $name_in_full, $number, $registered_date);
     $studentController->addStudent($student);
     include "add_student.php";
 } elseif (isset($_POST['add_transferred_student'])) {
     $studentController = new StudentController();
     $number = $_POST['registration_number'];
     $student_id = $_POST['studentsforschool'];
     $registered_date = $_POST['date'];
     $grade = $_POST['registered_grade'];
     $address = "";
     $name_in_full = "";
     $student = new Student($address, $grade, $name_in_full, $number, $registered_date);
     $student->setStudentId($student_id);
     $studentController->addTransferredStudent($student);
     include "add_transferred_student.php";
 } elseif (isset($_POST['add_teacher'])) {
     $name = $_POST['name'];
     $registered_date = $_POST['date'];
     $subject = $_POST['subject'];
     $address = $_POST['address'];
     $distance = $_POST['distance'];
     $contact_number = $_POST['contact_number'];
     $teacher = new Teacher($address, $distance, $name, $contact_number, $registered_date, $subject);
     $teacherController = new TeacherController();
     $teacherController->addTeacher($teacher);
     include "add_transferred_student.php";
 } elseif (isset($_POST['add_transferred_teacher'])) {