Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Controller_Register extends Controller
- {
- function __construct()
- {
- $this->model = new Model_Register();
- $this->view = new View();
- }
- function action_index()
- {
- $data = $this->model->Register('class');
- $this->view->generate('register_view.php', 'template_view.php', $data);
- }
- function action_add()
- {
- $datas = $this->model->add();
- $this->view->generate('Register_added_view.php', 'template_view.php', $datas);
- }
- }
- class Model_Register extends Model
- {
- public $id = '';
- public $name = '';
- public $username = '';
- public $password = '';
- public $email = '';
- public $class_id = '';
- public $team = '';
- public $contacts = '';
- public $ispl = '';
- public $ip = '';
- public function __construct($id = null, $name = null,$username = null, $password = null, $email = null, $class_id = null, $team = null, $contacts = null, $ispl = null, $ip = null)
- {
- $this->id = $id;
- $this->name = $name;
- $this->username = $username;
- $this->password = $password;
- $this->email = $email;
- $this->class_id = $class_id;
- $this->team = $team;
- $this->contacts = $contacts;
- $this->ispl = $ispl;
- $this->ip = $ip;
- }
- public function Register()
- {
- $list = [];
- $db = Db::getInstance();
- $req = $db->query('SELECT * FROM teams order by name');
- foreach($req->fetchAll() as $teams)
- {
- $list[] = new Model_Register($teams['name']);
- }
- return $list;
- }
- }
Add Comment
Please, Sign In to add comment