remove shirt from camps

This commit is contained in:
2021-04-15 10:49:42 +02:00
parent a2c52318d3
commit 1df8f59e14
5 changed files with 61 additions and 127 deletions

View File

@@ -6,26 +6,24 @@
*/
class camp_kid
{
private $ck_id;
private $ck_owner_id; //camp_user_id
private $ck_owner; //camp_user ojektum
private $ck_original_id; //camp_kid ojektum
private $ck_original; //camp_kid ojektum
private $ck_name;
private $ck_birth_year;
private $ck_ss_number;
private $ck_email;
private $ck_mobile;
private $ck_badminton_history;
private $ck_sport_history;
private $ck_shirt_size_id;
private $ck_shirt;
private $ck_food_info;
private $ck_hygiene_info;
private $ck_health_info;
private $ck_pharma_info;
private $ck_other_info;
private $ck_deleted;
private $ck_id;
private $ck_owner_id; //camp_user_id
private $ck_owner; //camp_user ojektum
private $ck_original_id; //camp_kid ojektum
private $ck_original; //camp_kid ojektum
private $ck_name;
private $ck_birth_year;
private $ck_ss_number;
private $ck_email;
private $ck_mobile;
private $ck_badminton_history;
private $ck_sport_history;
private $ck_food_info;
private $ck_hygiene_info;
private $ck_health_info;
private $ck_pharma_info;
private $ck_other_info;
private $ck_deleted;
/**
@@ -220,54 +218,6 @@ class camp_kid
return $this;
}
/**
* Gets the value of ck_shirt_size_id.
*
* @return mixed
*/
public function get_ck_shirt_size_id()
{
return $this->ck_shirt_size_id;
}
/**
* Sets the value of ck_shirt_size_id.
*
* @param mixed $ck_shirt_size_id the ck shirt size id
*
* @return self
*/
private function set_ck_shirt_size_id($ck_shirt_size_id)
{
$this->ck_shirt_size_id = $ck_shirt_size_id;
return $this;
}
/**
* Gets the value of ck_shirt.
*
* @return mixed
*/
public function get_ck_shirt()
{
return $this->ck_shirt;
}
/**
* Sets the value of ck_shirt.
*
* @param mixed $ck_shirt the ck shirt
*
* @return self
*/
private function set_ck_shirt($ck_shirt)
{
$this->ck_shirt = $ck_shirt;
return $this;
}
/**
* Gets the value of ck_food_info.
*
@@ -461,54 +411,49 @@ class camp_kid
}
public function set_ck_data_by_id($_id) {
global $sql;
$ck_data_assoc_array = $sql->assoc_array("select * from camp_kid where ck_id = " . $_id);
$ck_data_array = $ck_data_assoc_array[0];
foreach ($ck_data_array as $field => $value) {
$function_name = "set_" . $field;
$this->$function_name($value);
if ($field == 'ck_shirt_size_id') {
$new_shirt = new camp_shirt();
$new_shirt->set_cshirt_data_by_id($value);
$this->set_ck_shirt($new_shirt);
}
if ($field == 'ck_owner_id') {
$new_camp_user = new camp_user();
$new_camp_user->set_user_data_by_id($value);
$this->set_ck_owner($new_camp_user);
}
if ($field == 'ck_original_id' && !empty($value)) {
$new_camp_kid = new camp_kid();
$new_camp_kid->set_ck_data_by_id($value);
$this->set_ck_original($new_camp_kid);
}
}
global $sql;
$ck_data_assoc_array = $sql->assoc_array("select * from camp_kid where ck_id = " . $_id);
$ck_data_array = $ck_data_assoc_array[0];
foreach ($ck_data_array as $field => $value) {
$function_name = "set_" . $field;
$this->$function_name($value);
if ($field == 'ck_owner_id') {
$new_camp_user = new camp_user();
$new_camp_user->set_user_data_by_id($value);
$this->set_ck_owner($new_camp_user);
}
if ($field == 'ck_original_id' && !empty($value)) {
$new_camp_kid = new camp_kid();
$new_camp_kid->set_ck_data_by_id($value);
$this->set_ck_original($new_camp_kid);
}
}
}
private static function empty_to_null($str) {
return ($str == ""?"null":$str);
return ($str == ""?"null":$str);
}
public static function create_camp_kid($_name, $_birth_year, $_ss_number, $_email, $_mobile, $_shirt_id, $_info, $_original_id, $_owner_id) {
global $sql;
return $sql->insert_into('camp_kid', array(
'ck_name' => $_name,
'ck_birth_year' => $_birth_year,
'ck_ss_number' => $_ss_number,
'ck_email' => $_email,
'ck_mobile' => $_mobile,
'ck_shirt_size_id' => $_shirt_id,
'ck_original_id' => $_original_id,
'ck_owner_id' => $_owner_id,
'ck_sport_history' => self::empty_to_null($_info['ck_sport_history']),
'ck_badminton_history' => self::empty_to_null($_info['ck_badminton_history']),
'ck_food_info' => self::empty_to_null($_info['ck_food_info']),
'ck_hygiene_info' => self::empty_to_null($_info['ck_hygiene_info']),
'ck_health_info' => self::empty_to_null($_info['ck_health_info']),
'ck_pharma_info' => self::empty_to_null($_info['ck_pharma_info']),
'ck_other_info' => self::empty_to_null($_info['ck_other_info']),
public static function create_camp_kid($_name, $_birth_year, $_ss_number, $_email, $_mobile, $_info, $_original_id, $_owner_id) {
global $sql;
return $sql->insert_into('camp_kid', array(
'ck_name' => $_name,
'ck_birth_year' => $_birth_year,
'ck_ss_number' => $_ss_number,
'ck_email' => $_email,
'ck_mobile' => $_mobile,
'ck_original_id' => $_original_id,
'ck_owner_id' => $_owner_id,
'ck_sport_history' => self::empty_to_null($_info['ck_sport_history']),
'ck_badminton_history' => self::empty_to_null($_info['ck_badminton_history']),
'ck_food_info' => self::empty_to_null($_info['ck_food_info']),
'ck_hygiene_info' => self::empty_to_null($_info['ck_hygiene_info']),
'ck_health_info' => self::empty_to_null($_info['ck_health_info']),
'ck_pharma_info' => self::empty_to_null($_info['ck_pharma_info']),
'ck_other_info' => self::empty_to_null($_info['ck_other_info']),
));
));
}
}

View File

@@ -464,7 +464,6 @@ if (isset($_POST['action'])) {
$_POST['ck_ss_number'],
$_POST['ck_email'],
$_POST['ck_mobile'],
$_POST['ck_shirt_size_id'],
array(
'ck_sport_history' => $_POST['ck_sport_history'],
'ck_badminton_history' => $_POST['ck_badminton_history'],

View File

@@ -0,0 +1,4 @@
ALTER TABLE badminton_coach.camp_kid DROP FOREIGN KEY fk_camp_kid_1`;`
ALTER TABLE `camp_kid` DROP INDEX `fk_camp_kid_1_idx`;
ALTER TABLE `camp_kid` DROP `ck_shirt_size_id`;

View File

@@ -48,19 +48,6 @@
<label class="desc" for="ck_sport_history">Sport múlt:</label>
<div><textarea rows="5" name="ck_sport_history" id="ck_sport_history"></textarea></div>
</div>
<div>
<label class="desc" for="ck_list">Pólóméret:</label>
<div>
<select required="required" name="ck_shirt_size_id" id="ck_shirt_size_id">
<option value="" disabled selected>Válasszon...</option>
{foreach $shirts as $shirt}
<option value="{$shirt->get_cshirt_id()}">
{$shirt->get_cshirt_name()}
</option>
{/foreach}
</select>
</div>
</div>
<div>
<label class="desc" for="ck_food_info">Étkezéssel kapcsolatos tudnivalók:</label>
<div><textarea rows="5" name="ck_food_info" id="ck_food_info"></textarea></div>

View File

@@ -2,7 +2,6 @@
<div class="buttons">
<a href="/admin/create/camp" class="addbutton add-big">Új tábor létrehozása</a>
<a href="/admin/camp_types" class="addbutton add-big">Tábor típusok</a>
<a href="/admin/camp_shirt_type" class="addbutton add-big">Pólók</a>
<a href="/admin/camp_details" class="addbutton add-big">Turnus lista</a>
</div>
</div>