예제 #1
0
 public function add()
 {
     LoadHelper::model("course");
     LoadHelper::repository("courserepository");
     $course_repository = new CourseRepository();
     if (isset($_POST['submit'])) {
         $student = $this->map_data();
         $this->studentrepository->insert($student);
         header("Location: index.php?page=student&action=success");
         exit;
     }
     include_once ROOT_PATH . "view/student/add.php";
 }
예제 #2
0
<?php

LoadHelper::model("course");
LoadHelper::repository("courserepository");
?>



<?php 
class CourseController
{
    private $courserepository;
    public function __construct()
    {
        $this->courserepository = new courserepository();
    }
    public function index()
    {
        if (isset($_POST['sort'])) {
            $order = $_POST['sort'];
        } else {
            $order = null;
        }
        include_once ROOT_PATH . "view/Course/index.php";
    }
    public function add()
    {
        if (isset($_POST['submit'])) {
            $Course = $this->map_data();
            $this->courserepository->insert($Course);
            header("Location: index.php?page=course&action=success");