mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 06:27:52 +00:00
feat: add birthday validation
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
// kein direkter Zugriff
|
// kein direkter Zugriff
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
require_once(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_tools.php');
|
require_once(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sportsmanager' . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_tools.php');
|
||||||
|
|
||||||
class HTML_sportsmanager_admin
|
class HTML_sportsmanager_admin
|
||||||
{
|
{
|
||||||
@@ -1194,7 +1194,7 @@ class HTML_sportsmanager_admin
|
|||||||
: <?php echo($row != null ? JText::_('COM_SPORTSMANAGER_CHANGING') : JText::_('COM_SPORTSMANAGER_ADD')); ?></div>
|
: <?php echo($row != null ? JText::_('COM_SPORTSMANAGER_CHANGING') : JText::_('COM_SPORTSMANAGER_ADD')); ?></div>
|
||||||
|
|
||||||
<form action="<?php echo SportsManagerURL($row != null ? ('#id' . $row->spieler_id) : ''); ?>" method="post"
|
<form action="<?php echo SportsManagerURL($row != null ? ('#id' . $row->spieler_id) : ''); ?>" method="post"
|
||||||
name="adminForm" id="adminForm" enctype="multipart/form-data">
|
name="adminForm" id="adminForm" enctype="multipart/form-data" onsubmit="return validate()">
|
||||||
<div class="uk-overflow-auto"><table class="uk-table" width="100%">
|
<div class="uk-overflow-auto"><table class="uk-table" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td nowrap width="60%" valign="top">
|
<td nowrap width="60%" valign="top">
|
||||||
@@ -1277,15 +1277,15 @@ class HTML_sportsmanager_admin
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td nowrap width="20%" align="right">
|
<td nowrap width="20%" align="right" id="birthDateLabel">
|
||||||
<?php echo JText::_('COM_SPORTSMANAGER_BIRTHDATE') ?>:
|
<?php echo JText::_('COM_SPORTSMANAGER_BIRTHDATE') . '*' ?>:
|
||||||
</td>
|
</td>
|
||||||
<td nowrap>
|
<td nowrap>
|
||||||
<?php
|
<?php
|
||||||
if (!$beschraenkter_zugriff)
|
if (!$beschraenkter_zugriff)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<select class="uk-select uk-form-width-medium" name="datum_tag" size="1">
|
<select id="birthDay" class="uk-select uk-form-width-medium" name="datum_tag" size="1">
|
||||||
<?php
|
<?php
|
||||||
$datum = "0000-00-00";
|
$datum = "0000-00-00";
|
||||||
if ($row != null)
|
if ($row != null)
|
||||||
@@ -1303,7 +1303,7 @@ class HTML_sportsmanager_admin
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<select class="uk-select uk-form-width-medium" name="datum_monat" size="1">
|
<select id="birthMonth" class="uk-select uk-form-width-medium" name="datum_monat" size="1">
|
||||||
<?php
|
<?php
|
||||||
$datum_monat = substr($datum, 5, 2);
|
$datum_monat = substr($datum, 5, 2);
|
||||||
echo "<option value=\"0\"></option>";
|
echo "<option value=\"0\"></option>";
|
||||||
@@ -1314,7 +1314,7 @@ class HTML_sportsmanager_admin
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<select class="uk-select uk-form-width-medium" name="datum_jahr" size="1">
|
<select id="birthYear" class="uk-select uk-form-width-medium" name="datum_jahr" size="1">
|
||||||
<?php
|
<?php
|
||||||
$datum_jahr = substr($datum, 0, 4);
|
$datum_jahr = substr($datum, 0, 4);
|
||||||
echo "<option value=\"0\"></option>";
|
echo "<option value=\"0\"></option>";
|
||||||
@@ -1324,6 +1324,7 @@ class HTML_sportsmanager_admin
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
<small id="birthDateError" style="color: red"></small>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
else if ($row != null && $row->geburtsdatum != null)
|
else if ($row != null && $row->geburtsdatum != null)
|
||||||
@@ -1623,6 +1624,27 @@ class HTML_sportsmanager_admin
|
|||||||
<input type="hidden" name="id" value="<?php echo($row != null ? $row->spieler_id : "0"); ?>"/>
|
<input type="hidden" name="id" value="<?php echo($row != null ? $row->spieler_id : "0"); ?>"/>
|
||||||
<input type="hidden" name="vereinsauswahl_anzahl" value="<?php echo $vereinsauswahl_anzahl; ?>"/>
|
<input type="hidden" name="vereinsauswahl_anzahl" value="<?php echo $vereinsauswahl_anzahl; ?>"/>
|
||||||
</form>
|
</form>
|
||||||
|
<script>
|
||||||
|
function validate() {
|
||||||
|
let isValid = true;
|
||||||
|
|
||||||
|
// Clear errors
|
||||||
|
document.getElementById("birthDateError").textContent = "";
|
||||||
|
document.getElementById("birthDateLabel").style.color = "";
|
||||||
|
|
||||||
|
const birthDay = document.getElementById("birthDay").value;
|
||||||
|
const birthMonth = document.getElementById("birthMonth").value;
|
||||||
|
const birthYear = document.getElementById("birthYear").value;
|
||||||
|
|
||||||
|
if(birthDay === '0' || birthMonth === '0' || birthYear === '0') {
|
||||||
|
document.getElementById("birthDateError").textContent = "<?php echo JText::_('COM_SPORTSMANAGER_ERROR_BIRTHDAY_REQUIRED'); ?>";
|
||||||
|
document.getElementById("birthDateLabel").style.color = "red";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -925,3 +925,5 @@ COM_SPORTSMANAGER_RANK="Rang"
|
|||||||
|
|
||||||
; SPIELER BEARBEITEN
|
; SPIELER BEARBEITEN
|
||||||
COM_SPORTSMANAGER_LIZENZ="Lizenz"
|
COM_SPORTSMANAGER_LIZENZ="Lizenz"
|
||||||
|
|
||||||
|
COM_SPORTSMANAGER_ERROR_BIRTHDAY_REQUIRED="Geburtstagsfelder dürfen nicht leer sein"
|
||||||
|
|||||||
@@ -921,3 +921,5 @@ COM_SPORTSMANAGER_NON_SMOKING_PROTECTION_MARK_NO=" (Kein Nichtraucherschutz)"
|
|||||||
COM_SPORTSMANAGER_POINTS_TABLE="Points table"
|
COM_SPORTSMANAGER_POINTS_TABLE="Points table"
|
||||||
COM_SPORTSMANAGER_EVALUATION="Auswertung"
|
COM_SPORTSMANAGER_EVALUATION="Auswertung"
|
||||||
COM_SPORTSMANAGER_FUNCTION_DESCRIPTION="Variables: n = number of participants, p = place, m = multiplier of rating and in doubles possibly additionally reduced rating<br />Functions: +, -, *, /, round(x), pow(x), if(a > b, x, y), min(x, y), max(x, y), log(x), ln(x), logn(b, x)<br />VerteilungR(r, p, n, m) := max(round((((m * r - 1) * (-log(p / n) * (1 - (p / n)))) / (-log(1 / n) * (1 - (1 / n)))) + 1), 1)<br />Verteilung(r, p, n, m) := max(round(m * round((((r - 1) * (-log(p / n) * (1 - (p / n)))) / (-log(1 / n) * (1 - (1 / n)))) + 1)), 1)<br /><br />The functions VerteilungR() and Verteilung() distribute points for place 1 (r) descending to the individual places (p) of the number of participants (n).<br />VerteilungR() applies the multiplier (m) to the points for 1st place and then distributes down to 1 point for the last place.<br />Verteilung() applies the multiplier (m) to the points after the calculation, i.e. the last place receives 1 * m points."
|
COM_SPORTSMANAGER_FUNCTION_DESCRIPTION="Variables: n = number of participants, p = place, m = multiplier of rating and in doubles possibly additionally reduced rating<br />Functions: +, -, *, /, round(x), pow(x), if(a > b, x, y), min(x, y), max(x, y), log(x), ln(x), logn(b, x)<br />VerteilungR(r, p, n, m) := max(round((((m * r - 1) * (-log(p / n) * (1 - (p / n)))) / (-log(1 / n) * (1 - (1 / n)))) + 1), 1)<br />Verteilung(r, p, n, m) := max(round(m * round((((r - 1) * (-log(p / n) * (1 - (p / n)))) / (-log(1 / n) * (1 - (1 / n)))) + 1)), 1)<br /><br />The functions VerteilungR() and Verteilung() distribute points for place 1 (r) descending to the individual places (p) of the number of participants (n).<br />VerteilungR() applies the multiplier (m) to the points for 1st place and then distributes down to 1 point for the last place.<br />Verteilung() applies the multiplier (m) to the points after the calculation, i.e. the last place receives 1 * m points."
|
||||||
|
COM_SPORTSMANAGER_LIZENZ="License"
|
||||||
|
COM_SPORTSMANAGER_ERROR_BIRTHDAY_REQUIRED="Birthday fields may not be empty"
|
||||||
|
|||||||
Reference in New Issue
Block a user