Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support size ranges #155

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
10 changes: 8 additions & 2 deletions actions/monsters.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@
}
if (substr($value, 0,5) === "size_") {
$size = ltrim($value, 'size_');
if ( $size == -1 ) { $max_size = 5; } else { $max_size = $size;}
if ( $size == -1 ) { $max_size = 5; }
}
if (substr($value, 0,9) === "max_size_") {
$max_size = ltrim($value, 'max_size');
}
if (substr($value, 0, 4) == "cap_") {
$cap = ltrim($value, 'cap_');
Expand Down Expand Up @@ -174,7 +177,10 @@
}
if (substr($value, 0,5) === "size_") {
$size = ltrim($value, 'size_');
if ( $size == -1 ) { $max_size = 5; } else { $max_size = $size;}
if ( $size == -1 ) { $max_size = 5; }
}
if (substr($value, 0,9) === "max_size_") {
$max_size = ltrim($value, 'max_size');
}
if (substr($value, 0, 4) === "cap_") {
$cap = ltrim($value, 'cap_');
Expand Down
13 changes: 12 additions & 1 deletion include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,18 @@ function get_lure_name($id) {

}

function get_size_name($id) {

if ($id == '1') { $size_name = "XXS"; }
else if ($id == '2') { $size_name = "XS"; }
else if ($id == '3') { $size_name = "M"; }
else if ($id == '4') { $size_name = "XL"; }
else if ($id == '5') { $size_name = "XXL"; }

return $size_name;

}

function get_gym_name($id) {

if ( $id == "0") {
Expand Down Expand Up @@ -560,4 +572,3 @@ function default_distance($table) {
return $default_distance;

}

46 changes: 41 additions & 5 deletions modal/edit_pokemons_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,20 +424,21 @@ class="form-control text-center">
<input type="radio" name="gender" id="gender_2" value="gender_2" <?php echo $checked2; ?>> <?php echo i8ln("Female"); ?>
</label>
</div>
<hr>
<hr>
&nbsp;&nbsp;<?php echo i8ln("REMEMBER! Min. Size cannot be larger than Max. Size!"); ?></br></br>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><?php echo i8ln("Size"); ?></div>
<div class="input-group-text"><?php echo i8ln("Min. Size"); ?></div>
</div>
</div>
<?php
if ($row['size'] == -1) { $checked0 = 'checked'; } else { $checked0 = ''; }
if ($row['size'] == -1) { $checked0 = 'checked'; } else { $checked0 = ''; }
if ($row['size'] == 1) { $checked1 = 'checked'; } else { $checked1 = ''; }
if ($row['size'] == 2) { $checked2 = 'checked'; } else { $checked2 = ''; }
if ($row['size'] == 3) { $checked3 = 'checked'; } else { $checked3 = ''; }
if ($row['size'] == 4) { $checked4 = 'checked'; } else { $checked4 = ''; }
if ($row['size'] == 5) { $checked5 = 'checked'; } else { $checked5 = ''; }
if ($row['size'] == 5) { $checked5 = 'checked'; } else { $checked5 = ''; }
?>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_-1" value="size_-1" <?php echo $checked0; ?>> <?php echo i8ln("All"); ?>
Expand All @@ -447,7 +448,7 @@ class="form-control text-center">
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_2" value="size_2" <?php echo $checked2; ?>> <?php echo i8ln("XS"); ?>
</label>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_3" value="size_3" <?php echo $checked3; ?>> <?php echo i8ln("M"); ?>
</label>
Expand All @@ -458,6 +459,41 @@ class="form-control text-center">
<input type="radio" name="size" id="size_5" value="size_5" <?php echo $checked5; ?>> <?php echo i8ln("XXL"); ?>
</label>
</div>
</br>
</br>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><?php echo i8ln("Max. Size"); ?></div>
</div>
</div>
<?php
if ($row['size'] == -1 && $row['max_size'] == '5') { $checked0 = 'checked'; } else { $checked0 = ''; }
if ($row['max_size'] == 1) { $checked1 = 'checked'; } else { $checked1 = ''; }
if ($row['max_size'] == 2) { $checked2 = 'checked'; } else { $checked2 = ''; }
if ($row['max_size'] == 3) { $checked3 = 'checked'; } else { $checked3 = ''; }
if ($row['max_size'] == 4) { $checked4 = 'checked'; } else { $checked4 = ''; }
if ($row['size'] <> -1 && $row['max_size'] == 5) { $checked5 = 'checked'; } else { $checked5 = ''; }
?>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_5" value="max_size_5" <?php echo $checked0; ?>> <?php echo i8ln("All"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_1" value="max_size_1" <?php echo $checked1; ?>> <?php echo i8ln("XXS"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_2" value="max_size_2" <?php echo $checked2; ?>> <?php echo i8ln("XS"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_3" value="max_size_3" <?php echo $checked3; ?>> <?php echo i8ln("M"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_4" value="max_size_4" <?php echo $checked4; ?>> <?php echo i8ln("XL"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_5" value="max_size_5" <?php echo $checked5; ?>> <?php echo i8ln("XXL"); ?>
</label>
</div>
<hr>
<?php if (strpos($_SESSION['type'], ':user') === false) { ?>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
Expand Down
54 changes: 48 additions & 6 deletions pages/add/pokemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,24 @@ class="form-control text-center">
</label>
</div>
</div>
</div>
</div>

<hr>

<div class="row">
<div class="col">
<div class="alert alert-secondary text-center" role="alert">
<strong><?php echo i8ln("REMEMBER! Min. Size cannot be larger than Max. Size!"); ?></strong>
</div>
</div>
</div>

<div class="form-row align-items-center">
<div class="col-sm-12 my-1">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><?php echo i8ln("Size"); ?></div>
<div class="input-group-text"><?php echo i8ln("Min. Size"); ?></div>
</div>
</div>
<label class="btn btn-secondary">
Expand All @@ -340,20 +350,52 @@ class="form-control text-center">
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_2" value="size_2"><?php echo i8ln("XS"); ?>
</label>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_3" value="size_3"><?php echo i8ln("M"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_4" value="size_4"><?php echo i8ln("XL"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_5" value="size_5"><?php echo i8ln("XXL"); ?>
</label>
</div>
</div>
</div>

<div class="form-row align-items-center">
<div class="col-sm-12 my-1">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><?php echo i8ln("Max. Size"); ?></div>
</div>
</div>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_5" value="max_size_5" checked><?php echo i8ln("ALL"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_1" value="max_size_1"><?php echo i8ln("XXS"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_2" value="size_3"><?php echo i8ln("M"); ?>
<input type="radio" name="max_size" id="max_size_2" value="max_size_2"><?php echo i8ln("XS"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_2" value="size_4"><?php echo i8ln("XL"); ?>
<input type="radio" name="max_size" id="max_size_3" value="max_size_3"><?php echo i8ln("M"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="size" id="size_2" value="size_5"><?php echo i8ln("XXL"); ?>
<input type="radio" name="max_size" id="max_size_4" value="max_size_4"><?php echo i8ln("XL"); ?>
</label>
<label class="btn btn-secondary">
<input type="radio" name="max_size" id="max_size_5" value="max_size_5"><?php echo i8ln("XXL"); ?>
</label>
</div>
</div>
</div>

<hr>

<?php if (strpos($_SESSION['type'], ':user') === false) { ?>
<div class="form-row align-items-center">
<div class="col-sm-12 my-1">
Expand Down
13 changes: 7 additions & 6 deletions pages/display/pokemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,13 @@ class="list-group-item d-flex justify-content-between align-items-center">
<?php echo i8ln("SIZE"); ?>
<span class="badge badge-primary badge-pill">
<?php
if ($row['size'] == '1') { echo i8ln("XXS"); }
if ($row['size'] == '2') { echo i8ln("XS"); }
if ($row['size'] == '3') { echo i8ln("M"); }
if ($row['size'] == '4') { echo i8ln("XL"); }
if ($row['size'] == '5') { echo i8ln("XXL"); }
$size_name=get_size_name($row['size']);
echo $size_name;
if ( $row['max_size'] <> $row['size'] )
{
$max_size_name=get_size_name($row['max_size']);
echo "-".$max_size_name;
}
?>
</span>
</li>
Expand Down Expand Up @@ -600,4 +602,3 @@ class="badge badge-pill badge-info w-100"><?php echo i8ln("Cleaning Activated");
<?php
} // End of Mons Disable
?>

Loading