<?php
/**
 * User: David Camacho
 * Date: 31/03/2015
 * Time: 3:59
 */
include_once "./controllers/Core.php";
include_once "./classes/Module.php";

class StudentController extends Core {

    var $user;
    var $module;
    var $modules = array();

    public function StudentController()
    {

        parent::Core();
        //Only registered users can access here
        parent::isPrivateZone();

        //Student modules
        $this->module = new Module();
        $this->loadModules();

    }

    private function loadModules(){

       $module_names = $this->module->getStudentModulesNames();

        for($i=0; $i < count($module_names);$i++){

            include_once "./modules/student/". $module_names[$i] . "/" . $module_names[$i] . ".php";
            $class_name = ucfirst($module_names[$i])."Module";
            array_push($this->modules, new $class_name);

        }

    }
}