Bugfix: hidden select menu in starting type selection replaced by radio buttons

This commit is contained in:
marko
2023-12-03 19:49:59 +01:00
parent eb735d853e
commit c50ebba62c
8 changed files with 466 additions and 162 deletions

View File

@@ -2,12 +2,29 @@
require_once 'participoLib/dbConnector.php';
require_once 'participoLib/user.php';
require_once 'participoLib/event.php';
require_once 'participoLib/eventPage.php';
require_once 'participoLib/starter.php';
require_once 'participoLib/planer.php';
/**
* FrameWork for the participoApp
*/
class participo
{
/** a page describing an event */
private static $eventPage = null;
/** getter for the eventPage, creates a new one if not already created */
public static function eventPage()
{
if (!self::$eventPage) {
self::$eventPage = new EventPage();
}
self::$eventPage->init();
return self::$eventPage;
}
private static $db = null;
private static $message = ['error' => null, 'success' => null, 'notice' => null];
@@ -131,6 +148,64 @@ class participo
}
}
/** Initialize the participoApp
*
* - validate the login
* - init the db connection
*
* @param [type] $config
* @return void
*/
public static function init($config)
{
self::authentificate();
self::initDb(
$config['db']['host'],
$config['db']['name'],
$config['db']['user'],
$config['db']['password']
);
}
private static function initDb($host, $name, $user, $password)
{
dbConnector::connect($host, $name, $user, $password);
}
/** Framework to parse parameters get/post requests
*
* - Each param given in to this function is looked up in the request and put through the parsing function.
* - Params in the request that aren't in given a parsing function aren't parsed and hence not returned.
*
* @param [array(paramName => parseFunction)] $params array of the name of the param and a sanitizer/parsing/input function
* @return array(parsedParam=>paramValue) Associative array of the name of the param and its parsed value
*/
public static function parseParams($params)
{
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', substr(@$_SERVER['PATH_INFO'], 1));
$parsedParams = [];
foreach ($params as $paramName => $parseFunction) {
$parsedParams[$paramName] = null;
switch ($method) {
// case 'PUT':
// do_something_with_put($request);
// break;
case 'POST':
$parsedParams[$paramName] = $parseFunction($_POST[$paramName]);
break;
case 'GET':
$parsedParams[$paramName] = $parseFunction($_GET[$paramName]);
break;
default:
// handle_error($request);
break;
}
}
return $parsedParams;
}
public static function getMessages()
{
return self::$message;
@@ -209,8 +284,13 @@ class participo
$query =
'SELECT * FROM `wkParticipo_Users` '
. 'INNER JOIN `vormundschaft` ON `wkParticipo_Users`.`id` = `vormundschaft`.`kidId` '
. 'WHERE `vormundschaft`.`userId` = :userId;';
. 'INNER JOIN `vormundschaft` '
. 'ON `wkParticipo_Users`.`id` = `vormundschaft`.`kidId` '
. 'INNER JOIN `wkParticipo_user<=>userAttributes` '
. 'ON `wkParticipo_Users`.`id` = `wkParticipo_user<=>userAttributes`.`userId`'
. 'WHERE `vormundschaft`.`userId` = :userId '
. 'AND `vormundschaft`.`userId` = :userId '
. 'AND `wkParticipo_user<=>userAttributes`.`attributeId` = 4;';
$params = [':userId' => ['value' => $userId, 'data_type' => PDO::PARAM_INT]];
$response = dbConnector::query($query, $params);