Guest User

Untitled

a guest
Sep 23rd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. class Controller_Register extends Controller
  2. {
  3.  
  4. function __construct()
  5. {
  6. $this->model = new Model_Register();
  7. $this->view = new View();
  8. }
  9.  
  10. function action_index()
  11. {
  12. $data = $this->model->Register('class');
  13. $this->view->generate('register_view.php', 'template_view.php', $data);
  14. }
  15.  
  16. function action_add()
  17. {
  18. $datas = $this->model->add();
  19. $this->view->generate('Register_added_view.php', 'template_view.php', $datas);
  20. }
  21. }
  22.  
  23. class Model_Register extends Model
  24. {
  25. public $id = '';
  26. public $name = '';
  27. public $username = '';
  28. public $password = '';
  29. public $email = '';
  30. public $class_id = '';
  31. public $team = '';
  32. public $contacts = '';
  33. public $ispl = '';
  34. public $ip = '';
  35.  
  36. public function __construct($id = null, $name = null,$username = null, $password = null, $email = null, $class_id = null, $team = null, $contacts = null, $ispl = null, $ip = null)
  37. {
  38. $this->id = $id;
  39. $this->name = $name;
  40. $this->username = $username;
  41. $this->password = $password;
  42. $this->email = $email;
  43. $this->class_id = $class_id;
  44. $this->team = $team;
  45. $this->contacts = $contacts;
  46. $this->ispl = $ispl;
  47. $this->ip = $ip;
  48. }
  49.  
  50. public function Register()
  51. {
  52. $list = [];
  53. $db = Db::getInstance();
  54. $req = $db->query('SELECT * FROM teams order by name');
  55.  
  56. foreach($req->fetchAll() as $teams)
  57. {
  58. $list[] = new Model_Register($teams['name']);
  59. }
  60.  
  61. return $list;
  62. }
  63. }
Add Comment
Please, Sign In to add comment