diff --git a/homepage/participo/events.js b/homepage/participo/events.js index 1e4e0b1..e5893f0 100644 --- a/homepage/participo/events.js +++ b/homepage/participo/events.js @@ -1,34 +1,3 @@ -function initSelects() { - var selectElements = document.querySelectorAll('select'); - var selectInstances = M.FormSelect.init(selectElements, {}); - -} - -function initSidenav() { - var sidenavElements = document.querySelectorAll('.sidenav'); - var sidenavInstances = M.Sidenav.init(sidenavElements, {}); -}; - -function initModals() { - var modalElements = document.querySelectorAll('.modal'); - var modalInstances = M.Modal.init(modalElements, { - 'onOpenEnd': initSelects - }); -}; - -function openEventModal(eventId) { - openModal(`#event-modal-${eventId}`); -} - -function openModal(modalId) { - var modalElement = document.querySelector(modalId); - if (modalElement === null) { - return; - } - var modalInstance = M.Modal.getInstance(modalElement); - modalInstance.open(); -} - // What to do when the document is loaded. document.addEventListener('DOMContentLoaded', function () { // init materialize elements @@ -42,3 +11,43 @@ document.addEventListener('DOMContentLoaded', function () { openEventModal(eventId); } }); + +// Inits for MaterializeCss (mCss) elements + +// Init select forms +function initSelects() { + var selectElements = document.querySelectorAll('select'); + // var selectInstances = + M.FormSelect.init(selectElements, {}); +} + +// Init SideNav menu +function initSidenav() { + var sidenavElements = document.querySelectorAll('.sidenav'); + // var sidenavInstances = + M.Sidenav.init(sidenavElements, {}); +}; + +// Init Modals +function initModals() { + var modalElements = document.querySelectorAll('.modal'); + // var modalInstances = + M.Modal.init(modalElements, { + 'onOpenEnd': initSelects + }); +}; + +// Open the modal of an event by event Id +function openEventModal(eventId) { + openModal(`#event-modal-${eventId}`); +} + +// Open a modal by html-Id +function openModal(modalId) { + var modalElement = document.querySelector(modalId); + if (modalElement === null) { + return; + } + var modalInstance = M.Modal.getInstance(modalElement); + modalInstance.open(); +} diff --git a/homepage/participo/events.php b/homepage/participo/events.php index 50ed4cc..c498160 100644 --- a/homepage/participo/events.php +++ b/homepage/participo/events.php @@ -12,42 +12,7 @@ include_once 'events.inc.php'; - + <?php echo($meta['title']); ?> @@ -73,10 +38,11 @@ include_once 'events.inc.php'; . 'DatumVeranstaltungStarter' . ''; foreach ($eventList as $event) { - $htmlTable .= '' . $event['eventDate'] . '' . $event['eventName'] . '' . $event['userName'] . ', ' . $event['userFirstname'] . ''; + $eventDate = DateTime::createFromFormat('Y-m-d', $event['eventDate']); + $htmlTable .= '' . getHtmlSquareDate($eventDate) . '' . $event['eventName'] . '' . $event['userName'] . ', ' . $event['userFirstname'] . ''; } $htmlTable .= ''; - echo('

Aktuelle Einschreibungen

'); + echo('

Aktuelle Einschreibungen

'); echo($htmlTable); } else { echo($eventList ? $htmlTable : '
Keine Meldungen zu bevorstehenden Events'); @@ -84,10 +50,10 @@ include_once 'events.inc.php'; ?>

Übersicht anstehender Events

- +

Detailansicht kommender Wettkämpfe

- asHtmlCard()); }?> diff --git a/homepage/participo/index.php b/homepage/participo/index.php index 084063d..859299d 100644 --- a/homepage/participo/index.php +++ b/homepage/participo/index.php @@ -21,7 +21,6 @@ dbConnector::connect( $cwsvJudoConfig['db']['password'] ); -eventPlaner::setDbConnection(dbConnector::getDbConnection()); participo::authentificate(); $userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userId']); ?> @@ -36,23 +35,34 @@ $userData = getUserData(dbConnector::getDbConnection(), $_SESSION['user']['userI @@ -120,7 +130,7 @@ echo( AppCard::fromArray([ 'link' => 'events', 'title' => 'Event-Planer', - 'description' => 'Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.' . eventPlaner::getHtmlEventTable(eventPlaner::getCommingWkEvents()), + 'description' => 'Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.' . eventPlaner::getHtmlEventTable(eventPlaner::getComingWkEvents()), 'imgUrl' => '/ressourcen/graphiken/icons/terminKalender.svg', 'actions' => [ AppCardAction::fromArray(['caption' => 'Planer', 'link' => 'events']), diff --git a/homepage/participo/lib/participoLib/event.php b/homepage/participo/lib/participoLib/event.php index 1c43e2b..b8ae51f 100644 --- a/homepage/participo/lib/participoLib/event.php +++ b/homepage/participo/lib/participoLib/event.php @@ -59,7 +59,7 @@ class Event '
' . '
Datum
' . '
' . $this->date->format('Y-m-d') . '
' . - '
Meldefrist
' . + '
Einschreibefrist
' . '
' . $this->deadline->format('Y-m-d') . '
' . '
Altersklassen
' . '
' . $this->shiai->getAgeClasses() . '
' . @@ -72,7 +72,7 @@ class Event return '' . '' . $this->date->format('Y-m-d') . '' . - '' . $this->shiai->getHtmlName() . '' . + '' . $this->shiai->getHtmlName() . '' . '' . $this->shiai->getAgeClasses() . '' . 'zoom_in' . ''; @@ -111,7 +111,7 @@ class Event $starterList .= 'Bereits eingetragen:
'; foreach ($listOfStarter as $s) { $u = $s->getUser(); - $starterList .= '
' . $u->getName() . ', ' . $u->getFirstname() . $this->getHtmlRemoveStarterForm($s->getEventId(), $s->getUserId()) . '
'; + $starterList .= '
' . $u->getName() . ', ' . $u->getFirstname() . $this->getHtmlRemoveStarterForm($s->getEventId(), $s->getUserId()) . '
'; } $starterList .= '
'; return $starterList; @@ -189,7 +189,7 @@ class Event { $key = isset($_SESSION['apiKey']) ? $_SESSION['apiKey'] : null; $form = - '
' + '' . '' . '' . '' diff --git a/homepage/participo/lib/participoLib/participo.php b/homepage/participo/lib/participoLib/participo.php index 9175a4c..f6db71e 100644 --- a/homepage/participo/lib/participoLib/participo.php +++ b/homepage/participo/lib/participoLib/participo.php @@ -43,7 +43,7 @@ class participo return '
' . 'Datum: ' . date('Y-m-d') . '
' . - 'Angemeldet als ' . htmlspecialchars($_SESSION['user']['username']) . '.
' . + 'Eingeloggt als ' . htmlspecialchars($_SESSION['user']['username']) . '.
' . 'Sitzung beenden' . '
'; } @@ -517,3 +517,27 @@ function getCurPagesUrl() } return $pageURL; } + +/** + * space saving way to put a date + * + * @param [DateTime] $date + * @return string html tag containing the date + */ +function getHtmlSquareDate($date = null) +{ + $date = $date ?? new DateTime; + + $year = $date->format('Y'); + $month = $date->format('M'); + $day = $date->format('d'); + + return + '
' + . '
' + . '' . $day . '' + . '' . $month . '' + . '
' + . '
' . $year . '
' + . '
'; +} diff --git a/homepage/participo/lib/participoLib/planer.php b/homepage/participo/lib/participoLib/planer.php index 4bb8cda..73aca47 100644 --- a/homepage/participo/lib/participoLib/planer.php +++ b/homepage/participo/lib/participoLib/planer.php @@ -1,5 +1,6 @@ '; foreach ($comingStarts as $s) { $eventDeadline = DateTime::createFromFormat('Y-m-d', $s['deadline']); + $eventDate = DateTime::createFromFormat('Y-m-d', $s['eventDate']); $today = new DateTime(); $htmlTable .= '' - . '' . $s['eventDate'] . '' + . '' . getHtmlSquareDate($eventDate) . '' . '' . $s['eventName'] . '' . '' . $s['userName'] . ', ' . $s['userFirstname'] . '' - . '' . ($eventDeadline <= $today ? Event::getHtmlRemoveStarterForm($s['eventId'], $s['userId']) : '') . '' + . '' . ($eventDeadline >= $today ? Event::getHtmlRemoveStarterForm($s['eventId'], $s['userId']) : '') . '' + // . '' . $eventDeadline->format('Y-m-d') . ' <= ' . $today->format('Y-m-d') . ': ' . ($eventDeadline <= $today ? 'true' : 'false') . '' . ''; } $htmlTable .= ''; diff --git a/homepage/participo/lib/participoLib/shiai.php b/homepage/participo/lib/participoLib/shiai.php index bd3bd8d..f6d7685 100644 --- a/homepage/participo/lib/participoLib/shiai.php +++ b/homepage/participo/lib/participoLib/shiai.php @@ -37,7 +37,7 @@ class Shiai { $name = ($this->name != null ? $this->name : 'Wettkampf ohne Namen'); foreach (['meisterschaft', 'turnier', 'randori'] as $fragment) { - str_replace($fragment, '­', $name); + $name = str_replace($fragment, '­' . $fragment, $name); } return $name; } diff --git a/homepage/participo/login.php b/homepage/participo/login.php index 291983e..ae962ec 100644 --- a/homepage/participo/login.php +++ b/homepage/participo/login.php @@ -82,7 +82,7 @@ else {
- +
Hinweise diff --git a/homepage/participo/sidenav/loginStatus.php b/homepage/participo/sidenav/loginStatus.php index 27e53ac..9313949 100644 --- a/homepage/participo/sidenav/loginStatus.php +++ b/homepage/participo/sidenav/loginStatus.php @@ -1,5 +1,5 @@
  • - Angemeldet als + Eingeloggt als
  • Logout diff --git a/homepage/participo/test.py b/homepage/participo/test.py index 9ab8329..18e09ce 100644 --- a/homepage/participo/test.py +++ b/homepage/participo/test.py @@ -47,7 +47,7 @@ except Exception as e: print(repr(e), file=sys.stderr) print(driver.page_source) -loginText = "Angemeldet als " + username +loginText = "Eingeloggt als " + username divList = driver.find_elements(By.TAG_NAME, 'li') if not any(loginText in d.text for d in divList): @@ -56,7 +56,7 @@ if not any(loginText in d.text for d in divList): driver.quit() exit(-1) -for pageName in ["events", "attendance", "kyu", "user"]: # missing: "infoZettel" +for pageName in ["events", "attendance", "kyu", "user"]: # missing: "infoZettel" driver.get("http://cwsvjudo.bplaced.net/participo/"+pageName) try: