summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
blob: 3f77d7b4d322f8bf915de377fb2237e828532d72 (plain) (blame)
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
<?php

class Page_Main extends Page
{

	protected function doPreprocess()
	{
		User::load();
	}

	protected function doRender()
	{
		Render::addTemplate('main/_page');
		if (User::isLoggedIn()) {
			// Logged in user --
			if (User::getOrganization() !== false) {
				// Organization is known, show signup form
				if (User::isShibbolethAuth() && !User::isInDatabase()) {
					// User comes via Shibboleth and is not known yet
					$data = User::getData();
					$data['organization'] = User::getOrganizationName();
					Render::addTemplate('main/deploy', $data);
				} else if (User::isInDatabase()) {
					// User is known from DB at least
					Render::addTemplate('main/logged-in');
				}
			} else if (User::getRemoteOrganizationId() !== false) {
				// Organization is not known, see if we at least have an idea
				Message::addWarning('Ihre Hochschule/Einrichtung {{0}} ist leider nicht bekannt. Bitte kontaktieren Sie den Support.', User::getRemoteOrganizationId());
			} else {
				// No idea where the user is coming from
				Message::addError('Ihr IdP sendet leider keine Informationen über Ihre Hochschul-/Einrichtungszugehörigkeit');
			}
		} else {
			// Guest
			Render::addTemplate('main/guest');
		}
	}

}