summaryrefslogtreecommitdiff
path: root/src/web/_controller/people.php
blob: bb2db2c855ba17f1100be611f878c6006923c09f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php /* Copyright (c) 2024 Freya Murphy */
class People_controller extends XSS_Controller {

	// the people model
	private $people_model;

	function __construct() {
		parent::__construct();
		$this->people_model = $this->load_model('people');
		$this->load_lang('people');
	}

	public function index(): void {
		parent::index();
		$data = $this->people_model->get_data();
		$this->view('header', $data);
		$this->view('people/header', $data);
		$this->view('people/main', $data);
		$this->view('people/footer', $data);
		$this->view('footer', $data);
	}

	public function content(): void {
		$data = $this->people_model->get_data();
		$this->view('people/main', $data);
	}

	/**
	 * @return array<string,mixed>
	 */
	public function people(): array {
		$data = $this->people_model->get_people();

		$this->view('people/people', $data);

		$max = 0;
		foreach ($data['users'] as $user) {
			$max = max($max, $user['id']);
		}

		return $data;
	}
}

?>