Stunden ende, einiges fertig, fehlt nicht mehr viel
Took 2 hours 31 minutes
This commit is contained in:
66
controller/DefaultController.class.inc.php
Normal file → Executable file
66
controller/DefaultController.class.inc.php
Normal file → Executable file
@ -13,17 +13,71 @@ class DefaultController
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$view = new Template( 'test' );
|
||||
|
||||
$DefaultModel = new DefaultModel();
|
||||
$value = $DefaultModel->getTestMessage();
|
||||
|
||||
$view->set_placeholder( 'test', $value );
|
||||
$view = new Template( 'start' );
|
||||
|
||||
// Return the HTML Code to the index.php
|
||||
return $view->getHtml();
|
||||
|
||||
} # function indexAction()
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function joinFAQAction()
|
||||
{
|
||||
$view = new Template( 'start' );
|
||||
$DefaultModel = new DefaultModel();
|
||||
|
||||
$Request = new Request();
|
||||
|
||||
$room_code = $Request->getVar( 'code', null, 'GET' );
|
||||
|
||||
if( empty( $room_code ) && !isset( $room_code ) )
|
||||
{
|
||||
$view->set_placeholder( 'error', 'Room-Code is invalid!' );
|
||||
return $view->getHtml();
|
||||
}
|
||||
|
||||
if( ( $room_id = $DefaultModel->checkCode( $room_code ) ) === false )
|
||||
{
|
||||
$view->set_placeholder( 'error', 'Room-Code is invalid!' );
|
||||
return $view->getHtml();
|
||||
}
|
||||
|
||||
if( !$DefaultModel->joinRoom( $room_id ) )
|
||||
{
|
||||
$view->set_placeholder( 'error', 'An error occured, please try again later!' );
|
||||
return $view->getHtml();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $view->getHtml();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createFAQAction()
|
||||
{
|
||||
$view = new Template( 'start' );
|
||||
$DefaultModel = new DefaultModel();
|
||||
|
||||
$Request = new Request();
|
||||
$room_name = $Request->getVar( 'room-name' );
|
||||
|
||||
if( !$DefaultModel->createRoom( $room_name ) )
|
||||
{
|
||||
$view->set_placeholder( 'error', 'An error occured, please try again later!' );
|
||||
return $view->getHtml();
|
||||
}
|
||||
|
||||
return $view->getHtml();
|
||||
}
|
||||
|
||||
|
||||
} # class
|
||||
|
Reference in New Issue
Block a user