removed auth usage, php-cs-fixer

This commit is contained in:
marko
2022-06-26 19:24:14 +02:00
parent c5a6699caf
commit 269c680fe0
6 changed files with 400 additions and 387 deletions

View File

@@ -1,41 +1,42 @@
<?php <?php
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'); setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once("config/participo.php"); require_once 'config/participo.php';
require_once("./local/dbConf.php");
require_once("./local/cwsvJudo.php");
require_once("./lib/db.php"); require_once './local/dbConf.php';
require_once("./lib/api.php"); require_once './local/cwsvJudo.php';
require_once("./lib/participoLib/participo.php");
require_once("./auth.php"); require_once './lib/db.php';
require_once './lib/api.php';
require_once './lib/participoLib/participo.php';
require_once($config['basePath']."/config/cwsvJudo.config.php"); require_once $config['basePath'] . '/config/cwsvJudo.config.php';
require_once($config['basePath']."/config/phpcount.config.php"); require_once $config['basePath'] . '/config/phpcount.config.php';
dbConnector::connect( dbConnector::connect(
$cwsvJudoConfig["db"]["host"], $cwsvJudoConfig['db']['host'],
$cwsvJudoConfig["db"]["name"], $cwsvJudoConfig['db']['name'],
$cwsvJudoConfig["db"]["user"], $cwsvJudoConfig['db']['user'],
$cwsvJudoConfig["db"]["password"] $cwsvJudoConfig['db']['password']
); );
participo::authentificate();
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']); $userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
$usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']); $usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
abstract class AttendanceType { abstract class AttendanceType
{
const __default = null; const __default = null;
const Training = 1; const Training = 1;
const Excused = 2; const Excused = 2;
const Ill = 3; const Ill = 3;
const SpecialTraining = 4; const SpecialTraining = 4;
const Competition = 5; const Competition = 5;
} }
abstract class UserAttribute { abstract class UserAttribute
{
const __default = null; const __default = null;
const IsAdmin = 1; const IsAdmin = 1;
@@ -43,79 +44,86 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
const Passive = 3; const Passive = 3;
const InTraining = 4; const InTraining = 4;
} }
/** /**
* Datastructure and interface for an user * Datastructure and interface for an user
*/ */
class User{ class User
{
private $id = null; private $id = null;
private $familyName = null; private $familyName = null;
private $givenName = null; private $givenName = null;
private $attributes = null; private $attributes = null;
function __construct($id, $familyName, $givenName){ public function __construct($id, $familyName, $givenName)
{
$this->id = (int)$id; $this->id = (int)$id;
$this->familyName = $familyName; $this->familyName = $familyName;
$this->givenName = $givenName; $this->givenName = $givenName;
} }
static function fromArray($member){
public static function fromArray($member)
{
$id = $member['id']; $id = $member['id'];
$familyName = $member['familyName']; $familyName = $member['familyName'];
$givenName = $member['givenName']; $givenName = $member['givenName'];
return new User($id, $familyName, $givenName); return new User($id, $familyName, $givenName);
} }
static function getUsers($db, $options = []){
$attributeId = $options["attributeId"] ?? null; public static function getUsers($db, $options = [])
{
$attributeId = $options['attributeId'] ?? null;
$params = []; $params = [];
$query = "SELECT ". $query = 'SELECT ' .
"`cwsvjudo`.`wkParticipo_Users`.`id` AS `id`". '`cwsvjudo`.`wkParticipo_Users`.`id` AS `id`' .
", `cwsvjudo`.`wkParticipo_Users`.`vorname` AS `givenName`". ', `cwsvjudo`.`wkParticipo_Users`.`vorname` AS `givenName`' .
", `cwsvjudo`.`wkParticipo_Users`.`name` AS `familyName`". ', `cwsvjudo`.`wkParticipo_Users`.`name` AS `familyName`' .
", `cwsvjudo`.`wkParticipo_userAttributes`.`name` AS `attributeName`". ', `cwsvjudo`.`wkParticipo_userAttributes`.`name` AS `attributeName`' .
"FROM `cwsvjudo`.`wkParticipo_Users` ". 'FROM `cwsvjudo`.`wkParticipo_Users` ' .
"JOIN `cwsvjudo`.`wkParticipo_user<=>userAttributes` ". 'JOIN `cwsvjudo`.`wkParticipo_user<=>userAttributes` ' .
"ON `cwsvjudo`.`wkParticipo_Users`.`id` = `cwsvjudo`.`wkParticipo_user<=>userAttributes`.`userId`". 'ON `cwsvjudo`.`wkParticipo_Users`.`id` = `cwsvjudo`.`wkParticipo_user<=>userAttributes`.`userId`' .
"JOIN `cwsvjudo`.`wkParticipo_userAttributes` ". 'JOIN `cwsvjudo`.`wkParticipo_userAttributes` ' .
"ON `cwsvjudo`.`wkParticipo_user<=>userAttributes`.`attributeId` = `cwsvjudo`.`wkParticipo_userAttributes`.`id`"; 'ON `cwsvjudo`.`wkParticipo_user<=>userAttributes`.`attributeId` = `cwsvjudo`.`wkParticipo_userAttributes`.`id`';
if($attributeId != null){ if ($attributeId != null) {
$query .= " WHERE `cwsvjudo`.`wkParticipo_userAttributes`.`id` = :attributeId"; $query .= ' WHERE `cwsvjudo`.`wkParticipo_userAttributes`.`id` = :attributeId';
$params['attributeId'] = ['value'=>$attributeId, 'data_type'=>PDO::PARAM_INT]; $params['attributeId'] = ['value' => $attributeId, 'data_type' => PDO::PARAM_INT];
} }
$query .= ";"; $query .= ';';
$response = dbQuery($db, $query, $params); $response = dbQuery($db, $query, $params);
$users = []; $users = [];
foreach( $response as $r){ foreach ($response as $r) {
$users[] = User::fromArray($r); $users[] = User::fromArray($r);
} }
return $users; return $users;
} }
static function htmlTable($users){
echo("<table><tr><th>Id<th>Name</th><th>Vorname</th></tr>"); public static function htmlTable($users)
foreach( $users as $u){ {
echo("<tr><td>".$u->id."</td><td>".$u->familyName."</td><td>".$u->givenName."</td></tr>"); echo('<table><tr><th>Id<th>Name</th><th>Vorname</th></tr>');
foreach ($users as $u) {
echo('<tr><td>' . $u->id . '</td><td>' . $u->familyName . '</td><td>' . $u->givenName . '</td></tr>');
} }
echo("</table>"); echo('</table>');
} }
} }
/** /**
* Datastructure and interface for attendances * Datastructure and interface for attendances
*/ */
class Attendance{ class Attendance
{
private $id = null; //< id in the db private $id = null; //< id in the db
private $userId = null; //< user of the attendance private $userId = null; //< user of the attendance
private $date = null; //< date of the attendance private $date = null; //< date of the attendance
private $type = null; //< type of attendance private $type = null; //< type of attendance
static private $Types = [ private static $Types = [
AttendanceType::Training => "Training" AttendanceType::Training => 'Training', AttendanceType::Excused => 'Entschuldigt', AttendanceType::Ill => 'Krank', AttendanceType::SpecialTraining => 'SonderTraining', AttendanceType::Competition => 'Wettkampf'
, AttendanceType::Excused => "Entschuldigt"
, AttendanceType::Ill => "Krank"
, AttendanceType::SpecialTraining => "SonderTraining"
, AttendanceType::Competition => "Wettkampf"
]; ];
static private $NameOfMonth = [1=>"Januar", 2=>"Februar", 3=>"März", 4=>"April", 4=>"Mai", 6=>"Juni", 7=>"Juli", 8=>"August", 9=>"September", 10=>"Oktober", 11=>"November", 12=>"Dezember"]; private static $NameOfMonth = [1 => 'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 4 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember'];
/** /**
* constructor * constructor
* *
@@ -123,20 +131,24 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
* @param string/int $userId user of the attendance * @param string/int $userId user of the attendance
* @param string $date date of the attendance * @param string $date date of the attendance
*/ */
function __construct($id, $userId, $date){ public function __construct($id, $userId, $date)
{
$this->id = (int)$id; $this->id = (int)$id;
$this->userId = (int)$userId; $this->userId = (int)$userId;
$this->date = DateTime::createFromFormat("Y-m-d", $date); $this->date = DateTime::createFromFormat('Y-m-d', $date);
} }
/** /**
* create an Attendance from an assoziative array * create an Attendance from an assoziative array
* *
* @param array $member * @param array $member
* @return Attendance * @return Attendance
*/ */
static function constructFromArray($member){ public static function constructFromArray($member)
{
return new Attendance($member['id'], $member['userId'], $member['date']); return new Attendance($member['id'], $member['userId'], $member['date']);
} }
/** /**
* request a users attendances from the database * request a users attendances from the database
* *
@@ -144,16 +156,18 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
* @param int/string $userId * @param int/string $userId
* @return array with attendances * @return array with attendances
*/ */
static function getUsersAttendance($db, $userId){ public static function getUsersAttendance($db, $userId)
{
$userId = (int)$userId; $userId = (int)$userId;
$query = "SELECT `id`, `date` FROM `cwsvjudo`.`anwesenheit` WHERE `userId` = :userId"; $query = 'SELECT `id`, `date` FROM `cwsvjudo`.`anwesenheit` WHERE `userId` = :userId';
$response = dbQuery($db, $query, [':userId'=>['value'=>$userId, 'data_type'=>PDO::PARAM_INT]]); $response = dbQuery($db, $query, [':userId' => ['value' => $userId, 'data_type' => PDO::PARAM_INT]]);
$attendances = []; $attendances = [];
foreach($response as $r){ foreach ($response as $r) {
$attendances[] = new Attendance($r['id'], $userId, $r['date']); $attendances[] = new Attendance($r['id'], $userId, $r['date']);
} }
return $attendances; return $attendances;
} }
/** /**
* html table with users attendances * html table with users attendances
* *
@@ -161,56 +175,61 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
* @param string/int $userId * @param string/int $userId
* @return string with html code of the attendance table * @return string with html code of the attendance table
*/ */
static function userAttendanceHtmlTable($db, $userId){ public static function userAttendanceHtmlTable($db, $userId)
$htmlTableString = ""; {
$htmlTableString .= "<ul>"; $htmlTableString = '';
$userAttendances = Attendance::groupAttendances( $htmlTableString .= '<ul>';
Attendance::getUsersAttendance($db, $userId) $userAttendances = Attendance::groupAttendances(
Attendance::getUsersAttendance($db, $userId)
); );
krsort($userAttendances); krsort($userAttendances);
foreach( $userAttendances as $year=>$months ){ foreach ($userAttendances as $year => $months) {
$htmlTableString .= "<li>".$year."<dl>"; $htmlTableString .= '<li>' . $year . '<dl>';
// Counting the attendances per half year // Counting the attendances per half year
$attendanceCountH1 = 0; $attendanceCountH1 = 0;
$attendanceCountH2 = 0; $attendanceCountH2 = 0;
foreach($months as $month=>$days){ foreach ($months as $month => $days) {
if(1<=$month and $month<=6){ if (1 <= $month and $month <= 6) {
$attendanceCountH1 += count($days); $attendanceCountH1 += count($days);
} }
if(7<=$month and $month <= 12){ if (7 <= $month and $month <= 12) {
$attendanceCountH2 += count($days); $attendanceCountH2 += count($days);
} }
} }
$htmlTableString .= "<dt>Gesamt erstes Halbjahr:</dt><dd>".$attendanceCountH1."</dd>"; $htmlTableString .= '<dt>Gesamt erstes Halbjahr:</dt><dd>' . $attendanceCountH1 . '</dd>';
$htmlTableString .= "<dt>Gesamt zweites Halbjahr:</dt><dd>".$attendanceCountH2."</dd>"; $htmlTableString .= '<dt>Gesamt zweites Halbjahr:</dt><dd>' . $attendanceCountH2 . '</dd>';
krsort($months); krsort($months);
foreach($months as $month=>$days){ foreach ($months as $month => $days) {
$htmlTableString .= "<dt>".Attendance::$NameOfMonth[$month]."</dt>"; $htmlTableString .= '<dt>' . Attendance::$NameOfMonth[$month] . '</dt>';
$htmlTableString .= "<dd>".join(", ", $days)."</dd>"; $htmlTableString .= '<dd>' . join(', ', $days) . '</dd>';
} }
$htmlTableString .= "</dl></li>"; $htmlTableString .= '</dl></li>';
} }
$htmlTableString .= "</ul>"; $htmlTableString .= '</ul>';
return $htmlTableString; return $htmlTableString;
} }
/** /**
* group the attendances by year and month. * group the attendances by year and month.
* *
* @param list $attendances list of attendances * @param list $attendances list of attendances
* @return array[int][int](list of int) array with a list of days for every month in every year * @return array[int][int](list of int) array with a list of days for every month in every year
*/ */
static function groupAttendances($attendances){ public static function groupAttendances($attendances)
{
$groupedAttendances = []; $groupedAttendances = [];
foreach($attendances as $a){ foreach ($attendances as $a) {
$year =(int) $a->date->format("Y"); $year = (int) $a->date->format('Y');
if(!array_key_exists($year, $groupedAttendances)) if (!array_key_exists($year, $groupedAttendances)) {
$groupedAttendances[$year] = []; $groupedAttendances[$year] = [];
$month = (int) $a->date->format("m"); }
if(!array_key_exists($month, $groupedAttendances[$year])) $month = (int) $a->date->format('m');
if (!array_key_exists($month, $groupedAttendances[$year])) {
$groupedAttendances[$year][$month] = []; $groupedAttendances[$year][$month] = [];
$day = (int) $a->date->format("d"); }
$groupedAttendances[$year][$month][]=$day; $day = (int) $a->date->format('d');
$groupedAttendances[$year][$month][] = $day;
} }
return $groupedAttendances; return $groupedAttendances;
} }
@@ -223,7 +242,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php readfile("./shared/imports.php");?> <?php readfile('./shared/imports.php'); ?>
<!-- inits for the materializeCss --> <!-- inits for the materializeCss -->
<script> <script>
@@ -254,50 +273,53 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" /> <img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
</a> </a>
</li> </li>
<?php require_once("sidenav/loginStatus.php");?><!-- brings its own li --> <?php require_once 'sidenav/loginStatus.php'; ?><!-- brings its own li -->
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal right-align" href="#attendance-<?php echo($userData['id']);?>">Selber</a> <a class="waves-effect waves-teal right-align" href="#attendance-<?php echo($userData['id']); ?>">Selber</a>
</li> </li>
<?php <?php
foreach($usersKids as $k){ foreach ($usersKids as $k) {
if($userData['id']==$k['id']) continue; if ($userData['id'] == $k['id']) {
?> continue;
} ?>
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal right-align" href="#attendance-<?php echo($k['kidId']); ?>"><?php echo($k['vorname']." ".$k['name']);?></a> <a class="waves-effect waves-teal right-align" href="#attendance-<?php echo($k['kidId']); ?>"><?php echo($k['vorname'] . ' ' . $k['name']); ?></a>
</li> </li>
<?php }?> <?php
}?>
</ul> </ul>
</header> </header>
<?php <?php
if($_SESSION['login']){ if ($_SESSION['login']) {
?> ?>
<main> <main>
<?php //User::htmlTable( User::getUsers(dbConnector::getDbConnection(), ['attributeId' => UserAttribute::InTraining]));?> <?php //User::htmlTable( User::getUsers(dbConnector::getDbConnection(), ['attributeId' => UserAttribute::InTraining]));?>
<?php // show own ... <?php // show own ...
$ownAttendances = Attendance::getUsersAttendance(dbConnector::getDbConnection(), $_SESSION['user']['userId']); $ownAttendances = Attendance::getUsersAttendance(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
if (!empty($ownAttendances)){ if (!empty($ownAttendances)) {
echo( echo(
"<h2 id=\"attendance-".$userData['id']."\">Eigene Anwesenheiten</h2>". '<h2 id="attendance-' . $userData['id'] . '">Eigene Anwesenheiten</h2>' .
Attendance::userAttendanceHtmlTable(dbConnector::getDbConnection(), $userData['id']) Attendance::userAttendanceHtmlTable(dbConnector::getDbConnection(), $userData['id'])
); require_once("./lib/participoLib/participo.php"); );
require_once './lib/participoLib/participo.php';
}
// ... and kids attendances
if (!empty($usersKids)) {
echo('<h2>Anwesenheit der Kinder</h2>');
foreach ($usersKids as $k) {
if ($userData['id'] == $k['kidId']) {
continue;
} }
// ... and kids attendances echo(
if (!empty($usersKids)){ '<h3 id="attendance-' . $k['kidId'] . '">' . $k['vorname'] . ' ' . $k['name'] . '</h3>' .
echo("<h2>Anwesenheit der Kinder</h2>");
foreach($usersKids as $k){
if($userData['id']==$k['kidId']) continue;
echo(
"<h3 id=\"attendance-".$k['kidId']."\">".$k['vorname']." ".$k['name']."</h3>".
Attendance::userAttendanceHtmlTable(dbConnector::getDbConnection(), $k['kidId']) Attendance::userAttendanceHtmlTable(dbConnector::getDbConnection(), $k['kidId'])
); );
} }
} } ?>
?>
</main> </main>
<?php <?php
} }
?> ?>
</body> </body>
</html> </html>

View File

@@ -1,16 +0,0 @@
<?php
session_start();
// Falls der serverseitige LoginCookie nicht gesetzt ist,
// leite zur loginSeite weiter
if (empty($_SESSION['login'])) {
header("Location: login?returnTo=".urlencode($_SERVER['REQUEST_URI']), TRUE, 301);
exit;
} else {
$login_status =
"<div style=\"border: 1px solid black\">".
"Datum: ".date("Y-m-d")."<br />".
"Angemeldet als <strong>".htmlspecialchars($_SESSION['user']['username'])."</strong>.<br />".
"<a href=\"logout.php\">Sitzung beenden</a>".
"</div>";
}
?>

View File

@@ -1,21 +1,20 @@
<?php <?php
require_once("config/participo.php"); require_once 'config/participo.php';
require_once("./local/cwsvJudo.php"); require_once './local/cwsvJudo.php';
require_once("./lib/db.php");// should be replaced
require_once("./lib/api.php");// should be replaced
require_once("participoLib/participo.php");
require_once("participoLib/planer.php");
require_once './lib/db.php'; // should be replaced
require_once './lib/api.php'; // should be replaced
require_once 'participoLib/participo.php';
require_once 'participoLib/planer.php';
dbConnector::connect( dbConnector::connect(
$cwsvJudoConfig["db"]["host"], $cwsvJudoConfig['db']['host'],
$cwsvJudoConfig["db"]["name"], $cwsvJudoConfig['db']['name'],
$cwsvJudoConfig["db"]["user"], $cwsvJudoConfig['db']['user'],
$cwsvJudoConfig["db"]["password"] $cwsvJudoConfig['db']['password']
); );
eventPlaner::setDbConnection( dbConnector::getDbConnection() ); eventPlaner::setDbConnection(dbConnector::getDbConnection());
participo::authentificate(); participo::authentificate();
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']); $userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
@@ -26,7 +25,7 @@ require_once("config/participo.php");
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php readfile("./shared/imports.php");?> <?php readfile('./shared/imports.php'); ?>
<!-- inits for the materializeCss --> <!-- inits for the materializeCss -->
<script> <script>
@@ -61,7 +60,7 @@ require_once("config/participo.php");
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" /> <img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
</a> </a>
</li> </li>
<?php require_once("sidenav/loginStatus.php");?><!-- brings its own li --> <?php require_once 'sidenav/loginStatus.php'; ?><!-- brings its own li -->
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal right-align" href="#mitmachApps">Mitmachen<i class="material-icons">accessibility</i></a> <a class="waves-effect waves-teal right-align" href="#mitmachApps">Mitmachen<i class="material-icons">accessibility</i></a>
</li> </li>
@@ -74,7 +73,7 @@ require_once("config/participo.php");
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal right-align" href="#configApps">Einstellen<i class="material-icons">settings</i></a> <a class="waves-effect waves-teal right-align" href="#configApps">Einstellen<i class="material-icons">settings</i></a>
</li> </li>
<?php if( participo::isUserAdmin( $userData['id']) ){?> <?php if (participo::isUserAdmin($userData['id'])) {?>
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal right-align" href="#admiStuff">adminStuff</a> <a class="waves-effect waves-teal right-align" href="#admiStuff">adminStuff</a>
</li> </li>
@@ -83,30 +82,30 @@ require_once("config/participo.php");
</header> </header>
<?php <?php
if($_SESSION['login']){ if ($_SESSION['login']) {
?> ?>
<main> <main>
<!-- List of Mitmach-Apps --> <!-- List of Mitmach-Apps -->
<h2>Zum Mitmachen</h2> <h2>Zum Mitmachen</h2>
<div class="row" id="mitmachApps"> <div class="row" id="mitmachApps">
<?php <?php
echo( echo(
AppCard::fromArray([ AppCard::fromArray([
'link' => "/machs", 'link' => '/machs',
'title' => "<em>M</em>ein <em>Ach</em>ievement <em>S</em>ystem", 'title' => '<em>M</em>ein <em>Ach</em>ievement <em>S</em>ystem',
'description'=> "Ein kleines Achievementsystem für die tägliche Herausforderung", 'description' => 'Ein kleines Achievementsystem für die tägliche Herausforderung',
'imgUrl' => "images/mountain-climber.svg", 'imgUrl' => 'images/mountain-climber.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"MAchS", 'link'=>"/machs"]), AppCardAction::fromArray(['caption' => 'MAchS', 'link' => '/machs']),
], ],
])->htmlCode(). ])->htmlCode() .
AppCard::fromArray([ AppCard::fromArray([
'link' => "/pages/desktop/wkParticipo", 'link' => '/pages/desktop/wkParticipo',
'title' => "Event-Planer", 'title' => 'Event-Planer',
'description'=> "Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.</p>".eventPlaner::getHtmlEventTable(eventPlaner::getCommingWkEvents())."<p>", 'description' => 'Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.</p>' . eventPlaner::getHtmlEventTable(eventPlaner::getCommingWkEvents()) . '<p>',
'imgUrl' => "/ressourcen/graphiken/icons/terminKalender.svg", 'imgUrl' => '/ressourcen/graphiken/icons/terminKalender.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"Planer", 'link'=>"/pages/desktop/wkParticipo"]), AppCardAction::fromArray(['caption' => 'Planer', 'link' => '/pages/desktop/wkParticipo']),
], ],
])->htmlCode() ])->htmlCode()
) )
@@ -118,26 +117,25 @@ echo(
<?php <?php
echo( echo(
AppCard::fromArray([ AppCard::fromArray([
'link' => "infoZettel", 'link' => 'infoZettel',
'title' => "Infozettel", 'title' => 'Infozettel',
'description'=> "Online-Variante der Infozettel und Newsletter", 'description' => 'Online-Variante der Infozettel und Newsletter',
'imgUrl' => "images/info.svg", 'imgUrl' => 'images/info.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"Info", 'link'=>"infoZettel"]), AppCardAction::fromArray(['caption' => 'Info', 'link' => 'infoZettel']),
], ],
])->htmlCode(). ])->htmlCode() .
AppCard::fromArray([ AppCard::fromArray([
'link' => "attendance", 'link' => 'attendance',
'title' => "Teilnahme", 'title' => 'Teilnahme',
'description'=> "Eine kleine Übersicht, wie wie oft man beim Training war", 'description' => 'Eine kleine Übersicht, wie wie oft man beim Training war',
'imgUrl' => "http://cwsvjudo.bplaced.net/ressourcen/graphiken/icons/calendarIcon.svg", 'imgUrl' => 'http://cwsvjudo.bplaced.net/ressourcen/graphiken/icons/calendarIcon.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"Anwesenheit", 'link'=>"attendance"]), AppCardAction::fromArray(['caption' => 'Anwesenheit', 'link' => 'attendance']),
], ],
])->htmlCode() ])->htmlCode()
); );
// @todo attendanceApp // @todo attendanceApp?>
?>
</div> <!-- infoApps --> </div> <!-- infoApps -->
<h2>Zum Nachschlagen</h2> <h2>Zum Nachschlagen</h2>
@@ -145,26 +143,25 @@ echo(
<?php <?php
echo( echo(
AppCard::fromArray([ AppCard::fromArray([
'link' => "kyu", 'link' => 'kyu',
'title' => "Kyu", 'title' => 'Kyu',
'description'=> "Die Prüfungsprogamme der einzelnen Gürtelstufen in Bild, Ton und Text", 'description' => 'Die Prüfungsprogamme der einzelnen Gürtelstufen in Bild, Ton und Text',
'imgUrl' => "images/obi.svg", 'imgUrl' => 'images/obi.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"Kyu-Programme", 'link'=>"kyu"]), AppCardAction::fromArray(['caption' => 'Kyu-Programme', 'link' => 'kyu']),
], ],
])->htmlCode(). ])->htmlCode() .
AppCard::fromArray([ AppCard::fromArray([
'link' => "/JudoWiki", 'link' => '/JudoWiki',
'title' => "JudoWiki", 'title' => 'JudoWiki',
'description'=> "Ein Wiki zum Thema Judo", 'description' => 'Ein Wiki zum Thema Judo',
'imgUrl' => "http://cwsvjudo.bplaced.net/ressourcen/graphiken/icons/wikipediaW.svg", 'imgUrl' => 'http://cwsvjudo.bplaced.net/ressourcen/graphiken/icons/wikipediaW.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"JudoWiki", 'link'=>"/JudoWiki"]), AppCardAction::fromArray(['caption' => 'JudoWiki', 'link' => '/JudoWiki']),
], ],
])->htmlCode() ])->htmlCode()
); );
// @todo horstWolf // @todo horstWolf?>
?>
</div><!-- lexiApps --> </div><!-- lexiApps -->
<!-- List of ConfigStuff --> <!-- List of ConfigStuff -->
@@ -173,31 +170,29 @@ echo(
<?php <?php
echo( echo(
AppCard::fromArray([ AppCard::fromArray([
'link' => "user", 'link' => 'user',
'title' => "User-Config", 'title' => 'User-Config',
'description' => "Einstellungen zum aktuellen Benutzer dessen Kindern", 'description' => 'Einstellungen zum aktuellen Benutzer dessen Kindern',
'imgUrl' => "images/account.svg", 'imgUrl' => 'images/account.svg',
'actions' => [ 'actions' => [
AppCardAction::fromArray(['caption'=>"Config", 'link'=>"user"]), AppCardAction::fromArray(['caption' => 'Config', 'link' => 'user']),
], ],
])->htmlCode() ])->htmlCode()
); ); ?>
?>
</div> <!-- configApps --> </div> <!-- configApps -->
<?php <?php
// AdminStuff, thats only visible for Admins // AdminStuff, thats only visible for Admins
if( participo::isUserAdmin( $userData['id'] ) ){ if (participo::isUserAdmin($userData['id'])) {
echo( echo(
"<h2>AdminStuff</h2>". '<h2>AdminStuff</h2>' .
"<div id=\"admiStuff\" class=\"row\">". '<div id="admiStuff" class="row">' .
AppCard::fromArray([ AppCard::fromArray([
'title' =>"lastLogins", 'title' => 'lastLogins',
'description' => "</p>".lastLoginTable()."</p>" 'description' => '</p>' . lastLoginTable() . '</p>'
])->htmlCode(). ])->htmlCode() .
"</div>" '</div>'
); );
} } ?>
?>
</main> </main>
<?php <?php
} }

View File

@@ -1,31 +1,30 @@
<?php <?php
require_once("config/participo.php"); require_once 'config/participo.php';
require_once("participoLib/participo.php"); require_once 'participoLib/participo.php';
require_once("./local/dbConf.php");
require_once("./local/cwsvJudo.php");
require_once("./lib/db.php"); require_once './local/dbConf.php';
require_once("./lib/api.php"); require_once './local/cwsvJudo.php';
require_once("./auth.php"); require_once './lib/db.php';
require_once './lib/api.php';
$basePath = $config['basePath']; $basePath = $config['basePath'];
require_once($basePath."/config/cwsvJudo.config.php"); require_once $basePath . '/config/cwsvJudo.config.php';
require_once($basePath."/ressourcen/phpLib/parsedown/Parsedown.php"); require_once $basePath . '/ressourcen/phpLib/parsedown/Parsedown.php';
require_once($basePath."/ressourcen/phpLib/Spyc/Spyc.php"); require_once $basePath . '/ressourcen/phpLib/Spyc/Spyc.php';
participo::authentificate();
// get a list of all infoZettel // get a list of all infoZettel
$fileList = glob($basePath."/infoZettel/*.md"); $fileList = glob($basePath . '/infoZettel/*.md');
rsort($fileList); rsort($fileList);
$years = []; $years = [];
foreach($fileList as $file){ foreach ($fileList as $file) {
$years[] = (int)substr(basename($file), 0, 4); $years[] = (int)substr(basename($file), 0, 4);
} }
$years = array_unique($years); $years = array_unique($years);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -33,7 +32,7 @@ $years = array_unique($years);
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php readfile("./shared/imports.php");?> <?php readfile('./shared/imports.php'); ?>
<!-- adjustments to parsedowncards (smaller headings) --> <!-- adjustments to parsedowncards (smaller headings) -->
<link rel="stylesheet" href="css/parsedownCard.css"> <link rel="stylesheet" href="css/parsedownCard.css">
@@ -66,14 +65,14 @@ $years = array_unique($years);
<img style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" /> <img style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
</a> </a>
</li> </li>
<li><?php require_once("sidenav/loginStatus.php");?></li> <li><?php require_once 'sidenav/loginStatus.php'; ?></li>
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal left-align" href="/participo">zurück</a> <a class="waves-effect waves-teal left-align" href="/participo">zurück</a>
</li> </li>
<?php <?php
foreach($years as $year){?> foreach ($years as $year) {?>
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal right-align" href="#infoZettel-<?php echo($year);?>"><?php echo($year);?></a> <a class="waves-effect waves-teal right-align" href="#infoZettel-<?php echo($year); ?>"><?php echo($year); ?></a>
</li> </li>
<?php <?php
} }
@@ -84,37 +83,36 @@ foreach($years as $year){?>
<main> <main>
<!-- List of Infos --> <!-- List of Infos -->
<div class="row" id="infoList"> <div class="row" id="infoList">
<?php <?php
$currentYear = (int)substr(basename($fileList[0]), 0, 4); $currentYear = (int)substr(basename($fileList[0]), 0, 4);
echo("<h2 id=\"infoZettel-".$currentYear."\">".$currentYear."</h2>"); echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
foreach($fileList as $file){ foreach ($fileList as $file) {
$thisYear = (int)substr(basename($file), 0, 4); $thisYear = (int)substr(basename($file), 0, 4);
if($thisYear != $currentYear){ if ($thisYear != $currentYear) {
$currentYear=$thisYear; $currentYear = $thisYear;
echo("<h2 id=\"infoZettel-".$currentYear."\">".$currentYear."</h2>"); echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
} }
// get a list of all infoZettel // get a list of all infoZettel
$fileList = glob($basePath."/infoZettel/*.md"); $fileList = glob($basePath . '/infoZettel/*.md');
rsort($fileList); rsort($fileList);
foreach($fileList as $file){ foreach ($fileList as $file) {
$thisYear = (int)substr(basename($file), 0, 4); $thisYear = (int)substr(basename($file), 0, 4);
if($thisYear != $currentYear){ if ($thisYear != $currentYear) {
$currentYear=$thisYear; $currentYear = $thisYear;
echo("<h2 id=\"infoZettel-".$currentYear."\">".$currentYear."</h2>"); echo('<h2 id="infoZettel-' . $currentYear . '">' . $currentYear . '</h2>');
} }
$infoZettel = loadMarkdownFile($file); $infoZettel = loadMarkdownFile($file);
echo( echo(
AppCard::fromArray([ AppCard::fromArray([
'title' => $infoZettel['yaml']['title'], 'title' => $infoZettel['yaml']['title'],
'description'=> Parsedown::instance()->text( $infoZettel['mdText'] ), 'description' => Parsedown::instance()->text($infoZettel['mdText']),
])->htmlCode(['extraClass'=>"parsedownCard"]) ])->htmlCode(['extraClass' => 'parsedownCard'])
); );
} } ?>
?>
</div><!-- End of Infos --> </div><!-- End of Infos -->
</main> </main>
<?php <?php

View File

@@ -1,7 +1,7 @@
<?php <?php
class shiai
class shiai{ {
private $id = null; //< unique id private $id = null; //< unique id
private $date = null; //< date of the shiai private $date = null; //< date of the shiai
private $name = null; //< name of the shiai as string private $name = null; //< name of the shiai as string
@@ -12,10 +12,11 @@ class shiai{
private $galleryUrl = null; //< url of the gallery to a gallery of the shiai private $galleryUrl = null; //< url of the gallery to a gallery of the shiai
private $promoImgUrl = null; //< promotional image for the shiai (as url) private $promoImgUrl = null; //< promotional image for the shiai (as url)
function __construct($id, $date, $name, $ageclasses, $place, $announcementUrl, $routeUrl, $galleryUrl, $promoImgUrl){ public function __construct($id, $date, $name, $ageclasses, $place, $announcementUrl, $routeUrl, $galleryUrl, $promoImgUrl)
{
//! @todo input validation and sanitation //! @todo input validation and sanitation
$this->id = (int) $id; $this->id = (int) $id;
$this->date = DateTime::createFromFormat("Y-m-d", $date); $this->date = DateTime::createFromFormat('Y-m-d', $date);
$this->name = $name; $this->name = $name;
$this->ageclasses = $ageclasses; $this->ageclasses = $ageclasses;
$this->place = $place; $this->place = $place;
@@ -25,23 +26,29 @@ class shiai{
$this->promoImgUrl = $promoImgUrl; $this->promoImgUrl = $promoImgUrl;
} }
public function getName(){ public function getName()
{
return $this->name; return $this->name;
} }
public function getAgeClasses(){
return $this->ageclasses ? $this->ageclasses : "-"; public function getAgeClasses()
{
return $this->ageclasses ? $this->ageclasses : '-';
} }
public function getId(){
public function getId()
{
return $this->id; return $this->id;
} }
static public function fromArray($member){ public static function fromArray($member)
{
return new shiai( return new shiai(
$member['lfdeNr'] ?? null, $member['lfdeNr'] ?? null,
$member['Datum'] ?? null, $member['Datum'] ?? null,
$member['Veranstaltung'] ?? "<fehlender Name>", $member['Veranstaltung'] ?? '<fehlender Name>',
$member['Altersklassen'] ?? null, $member['Altersklassen'] ?? null,
$member['Ort'] ?? "<fehlender Ort>", $member['Ort'] ?? '<fehlender Ort>',
$member['Ausschreibung'] ?? null, $member['Ausschreibung'] ?? null,
$member['Routenplaner'] ?? null, $member['Routenplaner'] ?? null,
$member['galleryLink'] ?? null, $member['galleryLink'] ?? null,
@@ -50,7 +57,8 @@ class shiai{
} }
} // end class shiai } // end class shiai
class event{ class event
{
private $id = null; //< unique id of the event in the db private $id = null; //< unique id of the event in the db
private $date = null; //< date for the event (@todo ranges?) private $date = null; //< date for the event (@todo ranges?)
private $shiaiId = null; //< unique id of the shiai in the db (if appropriate) private $shiaiId = null; //< unique id of the shiai in the db (if appropriate)
@@ -59,54 +67,61 @@ class event{
private $shiai = null; private $shiai = null;
function __construct($id, $date, $shiaiId, $deadline, $remarks, $shiai){ public function __construct($id, $date, $shiaiId, $deadline, $remarks, $shiai)
{
//! @todo InputValidation //! @todo InputValidation
$this->id = (int) $id; $this->id = (int) $id;
$this->date = DateTime::createFromFormat("Y-m-d", $date); $this->date = DateTime::createFromFormat('Y-m-d', $date);
$this->shiaiId = (($shiaiId!=null)?((int)$shiaiId):(null)); $this->shiaiId = (($shiaiId != null) ? ((int)$shiaiId) : (null));
$this->deadline = DateTime::createFromFormat("Y-m-d", $deadline); $this->deadline = DateTime::createFromFormat('Y-m-d', $deadline);
$this->remarks = $remarks; $this->remarks = $remarks;
$this->shiai = $shiai; $this->shiai = $shiai;
} }
function asHtmlCard(){ public function asHtmlCard()
return {
"<div class=\"card blue-grey darken-1\">". return
"<div class=\"card-content white-text\">". '<div class="card blue-grey darken-1">' .
"<span class=\"card-title\">".$this->shiai->getName()."</span>". '<div class="card-content white-text">' .
"<dl>". '<span class="card-title">' . $this->shiai->getName() . '</span>' .
"<dt>Datum</dt>". '<dl>' .
"<dd>".$this->date->format("Y-m-d")."</dd>". '<dt>Datum</dt>' .
"<dt>Meldefrist</dt>". '<dd>' . $this->date->format('Y-m-d') . '</dd>' .
"<dd>".$this->deadline->format("Y-m-d")."</dd>". '<dt>Meldefrist</dt>' .
"<dt>Altersklassen</dt>". '<dd>' . $this->deadline->format('Y-m-d') . '</dd>' .
"<dd>".$this->shiai->getAgeClasses()."</dd>". '<dt>Altersklassen</dt>' .
"</div>". '<dd>' . $this->shiai->getAgeClasses() . '</dd>' .
"</div>"; '</div>' .
} '</div>';
public function htmlTableRow(){
return
"<tr>".
"<td>Datum ".$this->date->format("Y-m-d")."</td>".
"<td><a href=\"/pages/desktop/wkParticipo/showWkEvent.php?eventId=".$this->id."\" >".$this->shiai->getName()."</a></td>".
"<td><a class=\"waves-effect waves-light btn-floating modal-trigger\" href=\"#event-modal-".$this->id."\"><i class=\"material-icons\">add</i></a></td>".
"</tr>";
}
public function htmlModal(){
return
"<div id=\"event-modal-".$this->id."\" class=\"modal\">".
"<div class=\"modal-content\">".
"<h4>".$this->shiai->getName()."</h4>".
"<p>A bunch of text</p>".
"</div>". // end modal-content
"<div class=\"modal-footer\">".
"<a href=\"#!\" class=\"modal-close waves-effect waves-green btn-flat\">Agree</a>".
"</div>".
"</div>";
} }
static public function fromArray($member){ public function htmlTableRow()
{
return
'<tr>' .
'<td>' . $this->date->format('Y-m-d') . '</td>' .
'<td><a href="/pages/desktop/wkParticipo/showWkEvent.php?eventId=' . $this->id . '" >' . $this->shiai->getName() . '</a></td>' .
'<td><a class="waves-effect waves-light btn-floating modal-trigger" href="#event-modal-' . $this->id . '"><i class="material-icons">add</i></a></td>' .
'</tr>';
}
public function htmlModal()
{
return
'<div id="event-modal-' . $this->id . '" class="modal">' .
'<div class="modal-content">' .
'<h4>' . $this->shiai->getName() . '</h4>' .
'<p>A bunch of text</p>' .
'</div>' . // end modal-content
'<div class="modal-footer">' .
'<a href="#!" class="modal-close waves-effect waves-green btn-flat">Agree</a>' .
'</div>' .
'</div>';
}
public static function fromArray($member)
{
$shiai = json_decode($member['bemerkungen'], true); $shiai = json_decode($member['bemerkungen'], true);
return new event( return new event(
@@ -115,72 +130,75 @@ class event{
$member['wkId'] ?? null, $member['wkId'] ?? null,
$member['meldefrist'] ?? null, $member['meldefrist'] ?? null,
$member['bemerkungen'] ?? null, $member['bemerkungen'] ?? null,
shiai::fromArray( ($shiai != null) ? $shiai : $member ) shiai::fromArray(($shiai != null) ? $shiai : $member)
); );
} }
} // end class event } // end class event
class eventPlaner{ class eventPlaner
static private $db = null; {
private static $db = null;
// set the dbConnection (just setting, no establishing) // set the dbConnection (just setting, no establishing)
public static function setDbConnection($dbConnection){ public static function setDbConnection($dbConnection)
if($dbConnection instanceof PDO) {
if ($dbConnection instanceof PDO) {
self::$db = $dbConnection; self::$db = $dbConnection;
else } else {
self::$db = null; self::$db = null;
return; }
return;
} }
static public function getCommingWkEvents($someOptions=array() ){ public static function getCommingWkEvents($someOptions = [])
{
// wir befinden uns in der Übergangsphase: // wir befinden uns in der Übergangsphase:
// - als Standard wird das derzeitige Verhalten definiert (ISO-8859-1 // - als Standard wird das derzeitige Verhalten definiert (ISO-8859-1
// und die Konvertierung erfolgt ausserhalb) // und die Konvertierung erfolgt ausserhalb)
// - wenn einmal alle mbConvertEncoding weg sind, kann der Standard auf // - wenn einmal alle mbConvertEncoding weg sind, kann der Standard auf
// das gewünschte Verhalten umgestellt werden // das gewünschte Verhalten umgestellt werden
$dbCharset = $someOptions['dbCharset'] ?? "ISO-8859-1"; $dbCharset = $someOptions['dbCharset'] ?? 'ISO-8859-1';
// dbCharset = $someOptions['outCharset'] ?? "UTF-8";// das spätere, gewünschte Verhalten // dbCharset = $someOptions['outCharset'] ?? "UTF-8";// das spätere, gewünschte Verhalten
$outCharset = $someOptions['outCharset'] ?? "ISO-8859-1"; $outCharset = $someOptions['outCharset'] ?? 'ISO-8859-1';
$query = $query =
"SELECT ". 'SELECT ' .
"wkParticipo_Events.id, ". 'wkParticipo_Events.id, ' .
"wkParticipo_Events.date, ". 'wkParticipo_Events.date, ' .
"wkParticipo_Events.wkId, ". 'wkParticipo_Events.wkId, ' .
"wkParticipo_Events.meldefrist, ". 'wkParticipo_Events.meldefrist, ' .
"wkParticipo_Events.bemerkungen, ". 'wkParticipo_Events.bemerkungen, ' .
"wkParticipo_Events.kvOptions, ". 'wkParticipo_Events.kvOptions, ' .
"wettkampfkalender.Datum, ". 'wettkampfkalender.Datum, ' .
"wettkampfkalender.Veranstaltung, ". 'wettkampfkalender.Veranstaltung, ' .
"wettkampfkalender.Altersklassen, ". 'wettkampfkalender.Altersklassen, ' .
"wettkampfkalender.Ort, ". 'wettkampfkalender.Ort, ' .
"wettkampfkalender.Ausschreibung, ". 'wettkampfkalender.Ausschreibung, ' .
"wettkampfkalender.Routenplaner ". 'wettkampfkalender.Routenplaner ' .
"FROM wkParticipo_Events ". 'FROM wkParticipo_Events ' .
"LEFT JOIN wettkampfkalender ". 'LEFT JOIN wettkampfkalender ' .
"ON wettkampfkalender.lfdeNr = wkParticipo_Events.wkId ". 'ON wettkampfkalender.lfdeNr = wkParticipo_Events.wkId ' .
"WHERE wkParticipo_Events.date >= CURDATE() ". 'WHERE wkParticipo_Events.date >= CURDATE() ' .
"ORDER BY wkParticipo_Events.date;"; 'ORDER BY wkParticipo_Events.date;';
$ret = dbQuery(self::$db, $query); $ret = dbQuery(self::$db, $query);
$events = array(); $events = [];
foreach($ret as $event){ foreach ($ret as $event) {
array_push( $events, event::fromArray( $event ) ); array_push($events, event::fromArray($event));
} }
return $events; return $events;
} }
static public function getHtmlEventTable($eventList){ public static function getHtmlEventTable($eventList)
$ret = "<table>"; {
$ret .= "<!-- And now the table -->"; $ret = '<table>';
foreach($eventList as $event){ $ret .= '<!-- And now the table -->';
foreach ($eventList as $event) {
$ret .= $event->htmlTableRow(); $ret .= $event->htmlTableRow();
} }
$ret .= "</table>"; $ret .= '</table>';
foreach($eventList as $event){ foreach ($eventList as $event) {
$ret .= $event->htmlModal(); $ret .= $event->htmlModal();
} }
return $ret; return $ret;
} }
} }
?>

View File

@@ -1,26 +1,26 @@
<?php <?php
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'); setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once("config/participo.php"); require_once 'config/participo.php';
require_once("./local/dbConf.php");
require_once("./local/cwsvJudo.php");
require_once("./lib/participoLib/participo.php"); require_once './local/dbConf.php';
require_once("./lib/db.php"); require_once './local/cwsvJudo.php';
require_once("./lib/api.php");
require_once("./auth.php"); require_once './lib/participoLib/participo.php';
require_once './lib/db.php';
require_once './lib/api.php';
require_once $config['basePath'] . '/config/cwsvJudo.config.php';
require_once $config['basePath'] . '/config/phpcount.config.php';
require_once($config['basePath']."/config/cwsvJudo.config.php");
require_once($config['basePath']."/config/phpcount.config.php");
dbConnector::connect( dbConnector::connect(
$cwsvJudoConfig["db"]["host"], $cwsvJudoConfig['db']['host'],
$cwsvJudoConfig["db"]["name"], $cwsvJudoConfig['db']['name'],
$cwsvJudoConfig["db"]["user"], $cwsvJudoConfig['db']['user'],
$cwsvJudoConfig["db"]["password"] $cwsvJudoConfig['db']['password']
); );
participo::authentificate();
$userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']); $userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
$usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']); $usersKids = getUsersKids(dbConnector::getDbConnection(), $_SESSION['user']['userId']);
@@ -33,7 +33,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php readfile("./shared/imports.php");?> <?php readfile('./shared/imports.php'); ?>
<!-- inits for the materializeCss --> <!-- inits for the materializeCss -->
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
@@ -63,7 +63,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<img style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" /> <img style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
</a> </a>
</li> </li>
<li><?php require_once("sidenav/loginStatus.php");?></li> <li><?php require_once 'sidenav/loginStatus.php'; ?></li>
<li class="bold"> <li class="bold">
<a class="waves-effect waves-teal" href="/participo">zurück</a> <a class="waves-effect waves-teal" href="/participo">zurück</a>
</li> </li>
@@ -77,20 +77,19 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
</header> </header>
<?php <?php
if($_SESSION['login']){ if ($_SESSION['login']) {
?> ?>
<main> <main>
<h1>Benutzer-Einstellungen</h1> <h1>Benutzer-Einstellungen</h1>
<p> <p>
<?php <?php
if( array_key_exists('changePasswordSuccess', $_GET) ){ if (array_key_exists('changePasswordSuccess', $_GET)) {
if($_GET['changePasswordSuccess'] == "true"){ if ($_GET['changePasswordSuccess'] == 'true') {
echo("<div>Password geändert</div>"); echo('<div>Password geändert</div>');
}else{ } else {
echo("<div>Fehler während setzens des Passwortes.</div>"); echo('<div>Fehler während setzens des Passwortes.</div>');
} }
} } ?>
?>
</p> </p>
<h2>Benutzer-Info</h2> <h2>Benutzer-Info</h2>
<p>Informationen zum eigenen Benutzerkonto</p> <p>Informationen zum eigenen Benutzerkonto</p>
@@ -99,7 +98,7 @@ if($_SESSION['login']){
<div style="padding:1%;" class="col s12 m6"> <div style="padding:1%;" class="col s12 m6">
<div style="margin:1%;" class="card blue-grey darken-1"> <div style="margin:1%;" class="card blue-grey darken-1">
<div class="card-content white-text"> <div class="card-content white-text">
<span class="card-title"><?php echo($userData['name']);?>, <?php echo($userData['vorname']); ?></span> <span class="card-title"><?php echo($userData['name']); ?>, <?php echo($userData['vorname']); ?></span>
<img style="max-height:10vh;" class="responsive-img" src="images/account.svg" /> <img style="max-height:10vh;" class="responsive-img" src="images/account.svg" />
<dl> <dl>
<dt>Name</dt><dd><?php echo($userData['name']); ?></dd> <dt>Name</dt><dd><?php echo($userData['name']); ?></dd>
@@ -159,11 +158,11 @@ if($_SESSION['login']){
<p>Liste der User, für die man meldeberechtigt ist (bzw. Änderungen vornehmen darf). In der Regel ist das das eigene Kind (bei Eltern) oder man selber (bei Volljährigen).</p> <p>Liste der User, für die man meldeberechtigt ist (bzw. Änderungen vornehmen darf). In der Regel ist das das eigene Kind (bei Eltern) oder man selber (bei Volljährigen).</p>
<div class="row" id="kidsList"> <div class="row" id="kidsList">
<?php <?php
foreach($usersKids as $kid){ ?> foreach ($usersKids as $kid) { ?>
<div style="padding:1%;" class="col s12 m6"> <div style="padding:1%;" class="col s12 m6">
<div style="margin:1%;" class="card blue-grey darken-1"> <div style="margin:1%;" class="card blue-grey darken-1">
<div class="card-content white-text"> <div class="card-content white-text">
<span class="card-title"><?php echo($kid['name']);?>, <?php echo($kid['vorname']); ?></span> <span class="card-title"><?php echo($kid['name']); ?>, <?php echo($kid['vorname']); ?></span>
<img style="max-height:10vh;" class="responsive-img" src="images/account.svg" /> <img style="max-height:10vh;" class="responsive-img" src="images/account.svg" />
<dl> <dl>
<dt>Name</dt><dd><?php echo($kid['name']); ?></dd> <dt>Name</dt><dd><?php echo($kid['name']); ?></dd>
@@ -176,12 +175,10 @@ if($_SESSION['login']){
<p>Im folgenden Formular kann das Passwort des Kindes gesetzt werden. Das eigene Passwort muss dabei noch einmal zur Kontrolle eingegeben werden. Das neue Passwort muss zweimal blind eingegeben.</p> <p>Im folgenden Formular kann das Passwort des Kindes gesetzt werden. Das eigene Passwort muss dabei noch einmal zur Kontrolle eingegeben werden. Das neue Passwort muss zweimal blind eingegeben.</p>
<p> <p>
<?php <?php
if( ($kid['pwHash'] == "") || ($kid['pwHash']) == NULL ){ if (($kid['pwHash'] == '') || ($kid['pwHash']) == null) {
echo("<p>Derzeit ist kein Passwort gesetzt!</p>"); echo('<p>Derzeit ist kein Passwort gesetzt!</p>');
} } else {
else{ echo('<p>Es ist derzeit ein Passwort gesetzt!</p>'); ?>
echo("<p>Es ist derzeit ein Passwort gesetzt!</p>");
?>
<p>Es besteht auch die Möglickeit, das Passwort ganz zu entfernen. Man kann sich dann nicht mehr mit diesem Konto einloggen. Das eigene Passwort muss dabei noch einmal zur Kontrolle eingegeben werden.</p> <p>Es besteht auch die Möglickeit, das Passwort ganz zu entfernen. Man kann sich dann nicht mehr mit diesem Konto einloggen. Das eigene Passwort muss dabei noch einmal zur Kontrolle eingegeben werden.</p>
<form action="./user" method="post"> <form action="./user" method="post">
<input name="action" type="hidden" value="changePassword" /> <input name="action" type="hidden" value="changePassword" />
@@ -237,8 +234,7 @@ if($_SESSION['login']){
</div> </div>
</div> </div>
<?php <?php
} } ?>
?>
</main> </main>
<?php <?php
} }