add new properties to camp
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* tábor osztály
|
||||
*/
|
||||
* tábor osztály.
|
||||
*/
|
||||
class camp
|
||||
{
|
||||
private $camp_id;
|
||||
private $camp_name;
|
||||
private $camp_count;
|
||||
private $camp_price;
|
||||
private $camp_info;
|
||||
private $camp_city;
|
||||
private $camp_from;
|
||||
private $camp_to;
|
||||
@@ -13,14 +17,9 @@ class camp
|
||||
private $camp_helpers;
|
||||
private $camp_camp_type_ct_id; //ID
|
||||
private $camp_type; //OBJ
|
||||
private $camp_shuttle = array(); //array
|
||||
private $camp_sleep;
|
||||
private $camp_deleted;
|
||||
private $camp_is_open;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value of camp_id.
|
||||
*
|
||||
@@ -38,13 +37,109 @@ class camp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_camp_id($camp_id)
|
||||
public function set_camp_id($camp_id)
|
||||
{
|
||||
$this->camp_id = $camp_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of camp_name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_camp_name()
|
||||
{
|
||||
return $this->camp_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of camp_name.
|
||||
*
|
||||
* @param mixed $camp_name the camp name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_camp_name($camp_name)
|
||||
{
|
||||
$this->camp_name = $camp_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of camp_count.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_camp_count()
|
||||
{
|
||||
return $this->camp_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of camp_count.
|
||||
*
|
||||
* @param mixed $camp_count the camp count
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_camp_count($camp_count)
|
||||
{
|
||||
$this->camp_count = $camp_count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of camp_price.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_camp_price()
|
||||
{
|
||||
return $this->camp_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of camp_price.
|
||||
*
|
||||
* @param mixed $camp_price the camp price
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_camp_price($camp_price)
|
||||
{
|
||||
$this->camp_price = $camp_price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of camp_info.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_camp_info()
|
||||
{
|
||||
return $this->camp_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of camp_info.
|
||||
*
|
||||
* @param mixed $camp_info the camp info
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_camp_info($camp_info)
|
||||
{
|
||||
$this->camp_info = $camp_info;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of camp_city.
|
||||
*
|
||||
@@ -62,7 +157,7 @@ class camp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_camp_city($camp_city)
|
||||
public function set_camp_city($camp_city)
|
||||
{
|
||||
$this->camp_city = $camp_city;
|
||||
|
||||
@@ -79,18 +174,25 @@ class camp
|
||||
return $this->camp_from;
|
||||
}
|
||||
|
||||
public function get_camp_from_day() {
|
||||
$day = date("d", strtotime($this->camp_from));
|
||||
if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
|
||||
return date("d", strtotime($this->camp_from));
|
||||
public function get_camp_from_day()
|
||||
{
|
||||
$day = date('d', strtotime($this->camp_from));
|
||||
if ('0' == substr($day, 0, 1)) {
|
||||
return substr($day, 1, 1);
|
||||
}
|
||||
|
||||
public function get_camp_to_day() {
|
||||
$day = date("d", strtotime($this->camp_to));
|
||||
if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
|
||||
return date("d", strtotime($this->camp_to));
|
||||
return date('d', strtotime($this->camp_from));
|
||||
}
|
||||
|
||||
public function get_camp_to_day()
|
||||
{
|
||||
$day = date('d', strtotime($this->camp_to));
|
||||
if ('0' == substr($day, 0, 1)) {
|
||||
return substr($day, 1, 1);
|
||||
}
|
||||
|
||||
return date('d', strtotime($this->camp_to));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of camp_from.
|
||||
@@ -99,7 +201,7 @@ class camp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_camp_from($camp_from)
|
||||
public function set_camp_from($camp_from)
|
||||
{
|
||||
$this->camp_from = $camp_from;
|
||||
|
||||
@@ -123,7 +225,7 @@ class camp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_camp_to($camp_to)
|
||||
public function set_camp_to($camp_to)
|
||||
{
|
||||
$this->camp_to = $camp_to;
|
||||
|
||||
@@ -147,7 +249,7 @@ class camp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_camp_camp_type_ct_id($camp_camp_type_ct_id)
|
||||
public function set_camp_camp_type_ct_id($camp_camp_type_ct_id)
|
||||
{
|
||||
$this->camp_camp_type_ct_id = $camp_camp_type_ct_id;
|
||||
|
||||
@@ -171,85 +273,98 @@ class camp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_camp_type($camp_type)
|
||||
public function set_camp_type($camp_type)
|
||||
{
|
||||
$this->camp_type = $camp_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function get_camp_deleted() {
|
||||
public function get_camp_deleted()
|
||||
{
|
||||
return $this->camp_deleted;
|
||||
}
|
||||
|
||||
private function set_camp_deleted($_item) {
|
||||
public function set_camp_deleted($_item)
|
||||
{
|
||||
$this->camp_deleted = $_item;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function get_camp_is_open() {
|
||||
public function get_camp_is_open()
|
||||
{
|
||||
return $this->camp_is_open;
|
||||
}
|
||||
|
||||
private function set_camp_is_open($_item) {
|
||||
public function set_camp_is_open($_item)
|
||||
{
|
||||
$this->camp_is_open = $_item;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function get_camp_leader() {
|
||||
public function get_camp_leader()
|
||||
{
|
||||
return $this->camp_leader;
|
||||
}
|
||||
|
||||
private function set_camp_leader($_item) {
|
||||
public function set_camp_leader($_item)
|
||||
{
|
||||
$this->camp_leader = $_item;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function get_camp_helpers() {
|
||||
public function get_camp_helpers()
|
||||
{
|
||||
return $this->camp_helpers;
|
||||
}
|
||||
|
||||
private function set_camp_helpers($_item) {
|
||||
public function set_camp_helpers($_item)
|
||||
{
|
||||
$this->camp_helpers = $_item;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function has_pending_apply() {
|
||||
public function has_pending_apply()
|
||||
{
|
||||
global $sql;
|
||||
return $sql->num_of_rows("select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 2 AND camp_id = " . $this->get_camp_id());
|
||||
|
||||
return $sql->num_of_rows('select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 2 AND camp_id = '.$this->get_camp_id());
|
||||
}
|
||||
|
||||
public function has_deleted_apply() {
|
||||
public function has_deleted_apply()
|
||||
{
|
||||
global $sql;
|
||||
return $sql->num_of_rows("select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 5 AND camp_id = " . $this->get_camp_id());
|
||||
|
||||
return $sql->num_of_rows('select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 5 AND camp_id = '.$this->get_camp_id());
|
||||
}
|
||||
|
||||
public function get_camp_applies() {
|
||||
public function get_camp_applies()
|
||||
{
|
||||
//visszaadja az elfogadott jelentkezéseket ABC sorrendben
|
||||
global $sql;
|
||||
$apply_assoc_array = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid ON ck_id = capp_camp_kid_ck_id WHERE capp_status = 3 AND capp_camp_id = " . $this->get_camp_id() . " ORDER BY ck_name ASC;");
|
||||
$apply_array = array();
|
||||
$apply_assoc_array = $sql->assoc_array('SELECT * FROM camp_apply JOIN camp_kid ON ck_id = capp_camp_kid_ck_id WHERE capp_status = 3 AND capp_camp_id = '.$this->get_camp_id().' ORDER BY ck_name ASC;');
|
||||
$apply_array = [];
|
||||
foreach ($apply_assoc_array as $apply) {
|
||||
$new_apply = new camp_apply();
|
||||
$new_apply->set_capp_data_by_id($apply['capp_id']);
|
||||
$apply_array[] = $new_apply;
|
||||
}
|
||||
|
||||
return $apply_array;
|
||||
}
|
||||
|
||||
|
||||
public function set_camp_data_by_id($_camp_id) {
|
||||
public function set_camp_data_by_id($_camp_id)
|
||||
{
|
||||
global $sql;
|
||||
$camp_data_assoc_array = $sql->assoc_array("select * from camp where camp_id = " . $_camp_id);
|
||||
$camp_data_assoc_array = $sql->assoc_array('select * from camp where camp_id = '.$_camp_id);
|
||||
$camp_data_array = $camp_data_assoc_array[0];
|
||||
//alapadatok
|
||||
foreach ($camp_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$function_name = 'set_'.$field;
|
||||
$this->$function_name($value);
|
||||
if ('camp_camp_type_ct_id' == $field) {
|
||||
$new_ct = new camp_type();
|
||||
@@ -257,80 +372,79 @@ class camp
|
||||
$this->set_camp_type($new_ct);
|
||||
}
|
||||
}
|
||||
|
||||
//labdatípusok hozzáadása tömbbe
|
||||
$shuttle_assoc_array = $sql->assoc_array("SELECT cs_shuttle_id FROM camp_shuttle WHERE cs_camp_id = " . $_camp_id . ";");
|
||||
if (!empty($shuttle_assoc_array)) {
|
||||
foreach ($shuttle_assoc_array as $shuttle_array) {
|
||||
$this->camp_shuttle[] = $shuttle_array['cs_shuttle_id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function create_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_shuttles, $_accoms) {
|
||||
public static function create_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_name, $_count, $_price, $_info)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
$new_camp_id = $sql->insert_into('camp',array(
|
||||
if ("" === $_name) {
|
||||
$_name = 'null';
|
||||
}
|
||||
|
||||
if ("" === $_count) {
|
||||
$_count = 'null';
|
||||
}
|
||||
|
||||
if ("" === $_price) {
|
||||
$_price = 'null';
|
||||
}
|
||||
|
||||
if ("" === $_info) {
|
||||
$_info = 'null';
|
||||
}
|
||||
|
||||
$new_camp_id = $sql->insert_into('camp', [
|
||||
'camp_name' => $_name,
|
||||
'camp_count' => $_count,
|
||||
'camp_price' => $_price,
|
||||
'camp_info' => $_info,
|
||||
'camp_city' => $_city,
|
||||
'camp_from' => $_from,
|
||||
'camp_to' => $_to,
|
||||
'camp_leader' => $_leader,
|
||||
'camp_helpers' => $_helpers,
|
||||
'camp_is_open' => $_is_open,
|
||||
'camp_camp_type_ct_id' => $_ct_id
|
||||
));
|
||||
|
||||
if (!empty($_shuttles)) {
|
||||
foreach ($_shuttles as $_shuttle_id) {
|
||||
$sql->insert_into('camp_shuttle', array('cs_camp_id' => $new_camp_id, 'cs_shuttle_id' => $_shuttle_id));
|
||||
}
|
||||
'camp_camp_type_ct_id' => $_ct_id,
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($_accoms)) {
|
||||
foreach ($_accoms as $_accom_id) {
|
||||
$sql->insert_into('camp_accomodation', array('ca_camp_id' => $new_camp_id, 'ca_accomodation_id' => $_accom_id));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function update_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_shuttles, $_accoms, $_camp_id) {
|
||||
public static function update_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_name, $_count, $_price, $_info, $_camp_id)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
$new_camp_id = $sql->update_table('camp',array(
|
||||
if ("" === $_name) {
|
||||
$_name = 'null';
|
||||
}
|
||||
|
||||
if ("" === $_count) {
|
||||
$_count = 'null';
|
||||
}
|
||||
|
||||
if ("" === $_price) {
|
||||
$_price = 'null';
|
||||
}
|
||||
|
||||
if ("" === $_info) {
|
||||
$_info = 'null';
|
||||
}
|
||||
|
||||
$new_camp_id = $sql->update_table('camp', [
|
||||
'camp_name' => $_name,
|
||||
'camp_count' => $_count,
|
||||
'camp_price' => $_price,
|
||||
'camp_info' => $_info,
|
||||
'camp_city' => $_city,
|
||||
'camp_from' => $_from,
|
||||
'camp_to' => $_to,
|
||||
'camp_leader' => $_leader,
|
||||
'camp_helpers' => $_helpers,
|
||||
'camp_is_open' => $_is_open,
|
||||
'camp_camp_type_ct_id' => $_ct_id
|
||||
),
|
||||
array(
|
||||
'camp_id' => $_camp_id
|
||||
)
|
||||
'camp_camp_type_ct_id' => $_ct_id,
|
||||
],
|
||||
[
|
||||
'camp_id' => $_camp_id,
|
||||
]
|
||||
);
|
||||
|
||||
//kitöröljük a korábbi shuttle és accom sorokat
|
||||
$sql->execute_query('DELETE FROM camp_shuttle WHERE cs_camp_id = ' . $_camp_id);
|
||||
$sql->execute_query('DELETE FROM camp_accomodation WHERE ca_camp_id = ' . $_camp_id);
|
||||
|
||||
if (!empty($_shuttles)) {
|
||||
foreach ($_shuttles as $_shuttle_id) {
|
||||
$sql->insert_into('camp_shuttle', array('cs_camp_id' => $_camp_id, 'cs_shuttle_id' => $_shuttle_id));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_accoms)) {
|
||||
foreach ($_accoms as $_accom_id) {
|
||||
$sql->insert_into('camp_accomodation', array('ca_camp_id' => $_camp_id, 'ca_accomodation_id' => $_accom_id));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
if (isset($_POST['action'])) {
|
||||
|
||||
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
switch ($_POST['action']) {
|
||||
case 'user_register':
|
||||
# REGISZTRÁCIÓ
|
||||
$check_user_exists = $sql->num_of_rows("SELECT * FROM camp_user WHERE cu_email = '" . $_POST['user_email'] . "';");
|
||||
// REGISZTRÁCIÓ
|
||||
$check_user_exists = $sql->num_of_rows("SELECT * FROM camp_user WHERE cu_email = '".$_POST['user_email']."';");
|
||||
if ($check_user_exists) {
|
||||
//van már reg ezzel az email címmel
|
||||
setcookie('bc_reg_error', 1, 0, '/');
|
||||
header("Location: /tabor/regisztracio");
|
||||
}
|
||||
else {
|
||||
header('Location: /tabor/regisztracio');
|
||||
} else {
|
||||
//sikeres reg. visszairányítjuk a bejelentkező felületre
|
||||
$new_camp_user = camp_user::create_camp_user($_POST['user_email'], $_POST['user_password'], date("Y-m-d H:i:s"));
|
||||
log::register('new_camp_user', $new_camp_user, date("Y-m-d H:i:s"), $new_camp_user);
|
||||
$new_camp_user = camp_user::create_camp_user($_POST['user_email'], $_POST['user_password'], date('Y-m-d H:i:s'));
|
||||
log::register('new_camp_user', $new_camp_user, date('Y-m-d H:i:s'), $new_camp_user);
|
||||
setcookie('bc_reg_error', 2, 0, '/');
|
||||
header("Location: /tabor");
|
||||
header('Location: /tabor');
|
||||
}
|
||||
break;
|
||||
case 'login':
|
||||
//var_dump($_REQUEST['page']);
|
||||
# login
|
||||
// login
|
||||
/*
|
||||
USER TYPES: 1 - coach, 2 - kid, 3 - parent
|
||||
*/
|
||||
@@ -35,40 +32,47 @@ if (isset($_POST['action'])) {
|
||||
$user_camp_id = null;
|
||||
$user_camp_leader_id = null;
|
||||
|
||||
if ($_REQUEST['page'] == 'admin') $user_admin_id = $login->check_admin_login($_POST['user_name'], $_POST['user_password']);
|
||||
if ($_REQUEST['page'] == 'view') $user_kid_id = $login->check_kid_login($_POST['user_name'], $_POST['user_password']);
|
||||
if ($_REQUEST['page'] == 'coach') $user_coach_id = $login->check_coach_login($_POST['user_name'], $_POST['user_password']);
|
||||
if ($_REQUEST['page'] == 'tabor') $user_camp_id = $login->check_camp_login($_POST['user_name'], $_POST['user_password']);
|
||||
if ($_REQUEST['page'] == 'taborvezeto') $user_camp_leader_id = $login->check_camp_leader_login($_POST['user_name'], $_POST['user_password']);
|
||||
if ('admin' == $_REQUEST['page']) {
|
||||
$user_admin_id = $login->check_admin_login($_POST['user_name'], $_POST['user_password']);
|
||||
}
|
||||
if ('view' == $_REQUEST['page']) {
|
||||
$user_kid_id = $login->check_kid_login($_POST['user_name'], $_POST['user_password']);
|
||||
}
|
||||
if ('coach' == $_REQUEST['page']) {
|
||||
$user_coach_id = $login->check_coach_login($_POST['user_name'], $_POST['user_password']);
|
||||
}
|
||||
if ('tabor' == $_REQUEST['page']) {
|
||||
$user_camp_id = $login->check_camp_login($_POST['user_name'], $_POST['user_password']);
|
||||
}
|
||||
if ('taborvezeto' == $_REQUEST['page']) {
|
||||
$user_camp_leader_id = $login->check_camp_leader_login($_POST['user_name'], $_POST['user_password']);
|
||||
}
|
||||
|
||||
if ($user_admin_id) {
|
||||
//sikeres bejelentkezés adminként
|
||||
$login->login_user($user_admin_id, 'badminton_admin_user', 1);
|
||||
log::register('admin_login', $user_admin_id, null, $user_admin_id);
|
||||
header("Location: " . $actual_link);
|
||||
}
|
||||
elseif ($user_kid_id) {
|
||||
header('Location: '.$actual_link);
|
||||
} elseif ($user_kid_id) {
|
||||
//sikeres bejelentkezés szülőként
|
||||
$login->login_user($user_kid_id, 'badminton_parent_user', 2);
|
||||
log::register('kid_login', $user_kid_id, null, $user_kid_id);
|
||||
header("Location: " . $actual_link);
|
||||
}
|
||||
elseif ($user_coach_id) {
|
||||
header('Location: '.$actual_link);
|
||||
} elseif ($user_coach_id) {
|
||||
//sikeres bejelentkezés szülőként
|
||||
$login->login_user($user_coach_id, 'badminton_coach_user', 3);
|
||||
log::register('coach_login', $user_coach_id, null, $user_coach_id);
|
||||
header("Location: " . $actual_link);
|
||||
}
|
||||
elseif ($user_camp_id) {
|
||||
header('Location: '.$actual_link);
|
||||
} elseif ($user_camp_id) {
|
||||
//sikeres bejelentkezés táborózóként
|
||||
$login->login_user($user_camp_id, 'badminton_camp_user', 4);
|
||||
//log::register('camp_login', $user_coach_id, null, $user_coach_id);
|
||||
header("Location: " . $actual_link);
|
||||
header('Location: '.$actual_link);
|
||||
}
|
||||
else {
|
||||
|
||||
//die($user_coach_id);
|
||||
//sikertelen bejelentkezés
|
||||
}
|
||||
|
||||
/*
|
||||
$user_id = $login->check_login($_POST['user_name'], $_POST['user_password']);
|
||||
if ($user_id) {
|
||||
@@ -78,11 +82,10 @@ if (isset($_POST['action'])) {
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'user_data_edit':
|
||||
switch ($_POST['user_type']) {
|
||||
case '1':
|
||||
# KID
|
||||
// KID
|
||||
unset($_POST['user_type']);
|
||||
unset($_POST['action']);
|
||||
$uid = $_POST['uk_id'];
|
||||
@@ -91,90 +94,97 @@ if (isset($_POST['action'])) {
|
||||
log::register('update_member', $uid);
|
||||
header("Location: /admin/members/{$uid}");
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'user_data_create':
|
||||
# user létrehozása
|
||||
# nincs elágazás user_type szerint
|
||||
// user létrehozása
|
||||
// nincs elágazás user_type szerint
|
||||
unset($_POST['action']);
|
||||
//var_dump($_POST);
|
||||
//die("aaa");
|
||||
$new_user_id = user_kid::create_user($_POST);
|
||||
log::register('new_member', $new_user_id);
|
||||
header("Location: /admin/members");
|
||||
header('Location: /admin/members');
|
||||
//header("Location: /admin/edit_member/" . $new_user_id);
|
||||
break;
|
||||
|
||||
case 'parent_create':
|
||||
# parent létrehozása
|
||||
// parent létrehozása
|
||||
unset($_POST['action']);
|
||||
if (!isset($_POST['up_email'])) $_POST['up_email'] = null;
|
||||
if (!isset($_POST['up_phone'])) $_POST['up_phone'] = null;
|
||||
if (!isset($_POST['up_facebook'])) $_POST['up_facebook'] = null;
|
||||
if (!isset($_POST['up_email'])) {
|
||||
$_POST['up_email'] = null;
|
||||
}
|
||||
if (!isset($_POST['up_phone'])) {
|
||||
$_POST['up_phone'] = null;
|
||||
}
|
||||
if (!isset($_POST['up_facebook'])) {
|
||||
$_POST['up_facebook'] = null;
|
||||
}
|
||||
$new_parent_id = user_parent::create_parent($_POST['up_name'], $_POST['up_email'], $_POST['up_facebook'], $_POST['up_phone']);
|
||||
log::register('new_parent', $new_parent_id);
|
||||
header("Location: /admin/parents");
|
||||
header('Location: /admin/parents');
|
||||
break;
|
||||
|
||||
case 'parent_data_update':
|
||||
# parent updatelés
|
||||
// parent updatelés
|
||||
unset($_POST['action']);
|
||||
$up_id = $_POST['up_id'];
|
||||
unset($_POST['up_id']);
|
||||
if (!isset($_POST['up_email'])) $_POST['up_email'] = null;
|
||||
if (!isset($_POST['up_phone'])) $_POST['up_phone'] = null;
|
||||
if (!isset($_POST['up_facebook'])) $_POST['up_facebook'] = null;
|
||||
if (!isset($_POST['up_email'])) {
|
||||
$_POST['up_email'] = null;
|
||||
}
|
||||
if (!isset($_POST['up_phone'])) {
|
||||
$_POST['up_phone'] = null;
|
||||
}
|
||||
if (!isset($_POST['up_facebook'])) {
|
||||
$_POST['up_facebook'] = null;
|
||||
}
|
||||
user_parent::update_parent($_POST, $up_id);
|
||||
log::register('update_parent', $up_id);
|
||||
header("Location: /admin/parents/" . $up_id);
|
||||
header('Location: /admin/parents/'.$up_id);
|
||||
break;
|
||||
|
||||
case 'training_data_edit':
|
||||
#training edit
|
||||
//training edit
|
||||
$tr_id = $_POST['tr_id'];
|
||||
unset($_POST['tr_id']);
|
||||
unset($_POST['action']);
|
||||
//var_dump($_POST);
|
||||
training::update_training($_POST, $tr_id, true);
|
||||
log::register('update_training', $tr_id);
|
||||
header("Location: " . $actual_link);
|
||||
header('Location: '.$actual_link);
|
||||
break;
|
||||
|
||||
case 'training_data_create':
|
||||
# training create
|
||||
# a training_list-re ugrik vissza, mert lehet h többet is létrehoz
|
||||
// training create
|
||||
// a training_list-re ugrik vissza, mert lehet h többet is létrehoz
|
||||
unset($_POST['action']);
|
||||
unset($_POST['training_templates']);
|
||||
|
||||
$every_week = isset($_POST['every_week']);
|
||||
$jumpTo = $_POST['jumpTo'];
|
||||
unset($_POST['jumpTo']);
|
||||
if ($every_week) unset($_POST['every_week']);
|
||||
if ($every_week) {
|
||||
unset($_POST['every_week']);
|
||||
}
|
||||
$tr_id = training::create_training($_POST, $every_week);
|
||||
|
||||
if (!$jumpTo) {
|
||||
header("Location: /admin/trainings/");
|
||||
header('Location: /admin/trainings/');
|
||||
} else {
|
||||
header('Location: /admin/presence/'.$tr_id);
|
||||
}
|
||||
else {
|
||||
header("Location: /admin/presence/".$tr_id);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'training_type_create':
|
||||
# edzés típus létrehozása
|
||||
// edzés típus létrehozása
|
||||
unset($_POST['action']);
|
||||
$new_trt_id = training_type::create_training_type($_POST);
|
||||
log::register('new_training_type', $new_trt_id);
|
||||
header("Location: /admin/training_types");
|
||||
header('Location: /admin/training_types');
|
||||
|
||||
break;
|
||||
case 'training_type_update':
|
||||
# edzés típus lista updatelése ABí-ba
|
||||
// edzés típus lista updatelése ABí-ba
|
||||
unset($_POST['action']);
|
||||
// foreach ($_POST as $key => $value) {
|
||||
// $key_parts = explode('_', $key);
|
||||
@@ -183,210 +193,206 @@ if (isset($_POST['action'])) {
|
||||
// }
|
||||
training_type::update_training_type($_POST);
|
||||
log::register('update_training_type', 'update all');
|
||||
header("Location: " . $actual_link);
|
||||
header('Location: '.$actual_link);
|
||||
break;
|
||||
case 'coach_create':
|
||||
# edző létrehozása
|
||||
// edző létrehozása
|
||||
if (isset($_POST['ua_can_login']) && !empty($_POST['ua_can_login'])) {
|
||||
$psw = md5($_POST['ua_password']);
|
||||
}
|
||||
else {
|
||||
$psw = "null";
|
||||
} else {
|
||||
$psw = 'null';
|
||||
}
|
||||
|
||||
$authorities = isset($_POST['authorities']) ? $_POST['authorities'] : array();
|
||||
$authorities = isset($_POST['authorities']) ? $_POST['authorities'] : [];
|
||||
$new_coach_id = user::create_user($_POST['ua_name'], $psw, $authorities);
|
||||
log::register('new_coach', $new_coach_id);
|
||||
header("Location: /admin/coaches");
|
||||
header('Location: /admin/coaches');
|
||||
break;
|
||||
case 'coach_data_edit':
|
||||
# edző update
|
||||
// edző update
|
||||
if (!empty($_POST['ua_password'])) {
|
||||
$psw = md5($_POST['ua_password']);
|
||||
}
|
||||
else {
|
||||
$psw = "-1"; //ez jelzi h nem szabad updatelni
|
||||
} else {
|
||||
$psw = '-1'; //ez jelzi h nem szabad updatelni
|
||||
}
|
||||
|
||||
$authorities = isset($_POST['authorities']) ? $_POST['authorities'] : array();
|
||||
$authorities = isset($_POST['authorities']) ? $_POST['authorities'] : [];
|
||||
user::update_user($_POST['ua_name'], $psw, isset($_POST['ua_admin']), $_POST['ua_id'], $authorities);
|
||||
log::register('update_coach', $_POST['ua_id']);
|
||||
header("Location: /admin/coaches/".$_POST['ua_id']);
|
||||
header('Location: /admin/coaches/'.$_POST['ua_id']);
|
||||
break;
|
||||
case 'shirt_create':
|
||||
# póló létrehozása
|
||||
// póló létrehozása
|
||||
//todo: shirt object
|
||||
$new_shirt_id = $sql->insert_into('shirt', array(
|
||||
'shirt_name' => $_POST['shirt_name']
|
||||
)
|
||||
$new_shirt_id = $sql->insert_into('shirt', [
|
||||
'shirt_name' => $_POST['shirt_name'],
|
||||
]
|
||||
);
|
||||
log::register('new_shirt', $new_shirt_id);
|
||||
header("Location: /admin/shirts");
|
||||
header('Location: /admin/shirts');
|
||||
break;
|
||||
case 'shirt_data_edit':
|
||||
# shirt update
|
||||
// shirt update
|
||||
//todo: shirt object
|
||||
$sql->update_table('shirt', array(
|
||||
$sql->update_table('shirt', [
|
||||
'shirt_name' => $_POST['shirt_name'],
|
||||
),
|
||||
array(
|
||||
'shirt_id' => $_POST['shirt_id']
|
||||
)
|
||||
],
|
||||
[
|
||||
'shirt_id' => $_POST['shirt_id'],
|
||||
]
|
||||
);
|
||||
log::register('update_shirt', $_POST['shirt_id']);
|
||||
header("Location: /admin/shirts");
|
||||
header('Location: /admin/shirts');
|
||||
break;
|
||||
case 'city_create':
|
||||
# település létrehozása
|
||||
// település létrehozása
|
||||
$new_city_id = school_city::create_school_city($_POST['scc_city']);
|
||||
log::register('new_city', $new_city_id);
|
||||
header("Location: /admin/cities");
|
||||
header('Location: /admin/cities');
|
||||
break;
|
||||
case 'city_update':
|
||||
# city lista updatelése AB-ba
|
||||
// city lista updatelése AB-ba
|
||||
unset($_POST['action']);
|
||||
foreach ($_POST as $key => $value) {
|
||||
$key_parts = explode('_', $key);
|
||||
$scc_id = $key_parts[1];
|
||||
if ($key_parts[0] != "order") {
|
||||
$sql->update_table('school_city', array('scc_city' => $value), array('scc_id' => $scc_id));
|
||||
}
|
||||
else {
|
||||
$sql->update_table('school_city', array('scc_order' => ($value==0?'null':$value)), array('scc_id' => $scc_id));
|
||||
if ('order' != $key_parts[0]) {
|
||||
$sql->update_table('school_city', ['scc_city' => $value], ['scc_id' => $scc_id]);
|
||||
} else {
|
||||
$sql->update_table('school_city', ['scc_order' => (0 == $value ? 'null' : $value)], ['scc_id' => $scc_id]);
|
||||
}
|
||||
}
|
||||
log::register('update_city', 'update all');
|
||||
header("Location: /admin/cities");
|
||||
header('Location: /admin/cities');
|
||||
break;
|
||||
case 'region_create':
|
||||
# körzet létrehozása
|
||||
// körzet létrehozása
|
||||
//todo: körzet object
|
||||
$new_reg_id = $sql->insert_into('region', array(
|
||||
$new_reg_id = $sql->insert_into('region', [
|
||||
'reg_name' => $_POST['reg_name'],
|
||||
)
|
||||
]
|
||||
);
|
||||
log::register('new_region', $new_reg_id);
|
||||
header("Location: /admin/regions");
|
||||
header('Location: /admin/regions');
|
||||
break;
|
||||
case 'region_update':
|
||||
# region lista updatelése AB-ba
|
||||
// region lista updatelése AB-ba
|
||||
unset($_POST['action']);
|
||||
foreach ($_POST as $key => $value) {
|
||||
$key_parts = explode('_', $key);
|
||||
$reg_id = $key_parts[1];
|
||||
$sql->update_table('region', array('reg_name' => $value), array('reg_id' => $reg_id));
|
||||
$sql->update_table('region', ['reg_name' => $value], ['reg_id' => $reg_id]);
|
||||
}
|
||||
log::register('update_region', 'update all');
|
||||
header("Location: /admin/regions");
|
||||
header('Location: /admin/regions');
|
||||
break;
|
||||
case 'school_data_create':
|
||||
# iskola létrehozása
|
||||
// iskola létrehozása
|
||||
$new_school_id = school::create_school($_POST['sc_name'], $_POST['sc_school_city_scc_id']);
|
||||
log::register('new_school', $new_school_id);
|
||||
header("Location: /admin/schools");
|
||||
header('Location: /admin/schools');
|
||||
break;
|
||||
case 'school_data_edit':
|
||||
# iskola módosítása
|
||||
// iskola módosítása
|
||||
unset($_POST['action']);
|
||||
school::update_school($_POST['sc_id'], $_POST['sc_name'], $_POST['sc_school_city_scc_id']);
|
||||
log::register('update_school', $_POST['sc_id']);
|
||||
header("Location: /admin/schools");
|
||||
header('Location: /admin/schools');
|
||||
break;
|
||||
case 'money_deposit_create':
|
||||
# új befizetés létrehozása
|
||||
// új befizetés létrehozása
|
||||
$sets_date = (isset($_POST['mod_sets_expire_date']) && $_POST['mod_sets_expire_date']) ? $_POST['mod_sets_expire_date'] : false;
|
||||
|
||||
$new_mod_id = money_deposit::create_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_lease_l_id'], $_POST['mod_expire_date'], 1, $sets_date);
|
||||
$tmp_user = new user_kid();
|
||||
$tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']);
|
||||
log::register('new_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')');
|
||||
log::register('new_money_deposit', $tmp_user->get_uk_name().': '.$_POST['mod_sum'].' Ft ('.$_POST['mod_date'].')');
|
||||
|
||||
$tmp_user->update_balance();
|
||||
|
||||
//ha pozitiv az egyenleg, akkor lenullázhatjuk a hitelalkalmait (???)
|
||||
if (($tmp_user->get_uk_balance() + $_POST['mod_sum']) > 0) {
|
||||
$sql->update_table('user_kid', array('uk_credit' => '0'), array('uk_id' => $_POST['mod_user_kid_uk_id']));
|
||||
$sql->update_table('user_kid', ['uk_credit' => '0'], ['uk_id' => $_POST['mod_user_kid_uk_id']]);
|
||||
}
|
||||
header("Location: /admin/money_deposit");
|
||||
header('Location: /admin/money_deposit');
|
||||
break;
|
||||
case 'money_deposit_update':
|
||||
# befizetés módosítás
|
||||
// befizetés módosítás
|
||||
money_deposit::update_money_deposit($_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id'], 1, $_POST['mi_id']);
|
||||
$tmp_user = new user_kid();
|
||||
$tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']);
|
||||
$tmp_user->update_balance();
|
||||
log::register('update_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')');
|
||||
header("Location: /admin/money_deposit");
|
||||
log::register('update_money_deposit', $tmp_user->get_uk_name().': '.$_POST['mod_sum'].' Ft ('.$_POST['mod_date'].')');
|
||||
header('Location: /admin/money_deposit');
|
||||
break;
|
||||
case 'moxc_create':
|
||||
# kiadás kategória létrehozása
|
||||
// kiadás kategória létrehozása
|
||||
$new_moxc_id = money_expense_category::create_money_expense_category($_POST['moxc_name']);
|
||||
log::register('new_moxc', $new_moxc_id);
|
||||
header("Location: /admin/money_expense_category");
|
||||
header('Location: /admin/money_expense_category');
|
||||
break;
|
||||
case 'moxc_update':
|
||||
# kiadás kategória módosítása
|
||||
// kiadás kategória módosítása
|
||||
money_expense_category::update_money_expense_category($_POST['moxc_name'], $_POST['moxc_id']);
|
||||
log::register('update_moxc', $_POST['moxc_id']);
|
||||
header("Location: /admin/money_expense_category");
|
||||
header('Location: /admin/money_expense_category');
|
||||
break;
|
||||
case 'mox_create':
|
||||
# kiadás létrehozása
|
||||
// kiadás létrehozása
|
||||
$new_mox_id = money_expense::create_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_payment_type']);
|
||||
log::register('new_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft");
|
||||
header("Location: /admin/money_expense");
|
||||
log::register('new_mox', $_POST['mox_item'].': '.$_POST['mox_sum'].' Ft');
|
||||
header('Location: /admin/money_expense');
|
||||
break;
|
||||
case 'mox_update':
|
||||
# kiadás módosítása
|
||||
// kiadás módosítása
|
||||
money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id'], $_POST['mox_payment_type']);
|
||||
log::register('update_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft");
|
||||
header("Location: /admin/money_expense");
|
||||
log::register('update_mox', $_POST['mox_item'].': '.$_POST['mox_sum'].' Ft');
|
||||
header('Location: /admin/money_expense');
|
||||
break;
|
||||
case 'mic_create':
|
||||
# bevétel kategória létrehozása
|
||||
// bevétel kategória létrehozása
|
||||
$new_mic_id = money_income_category::create_money_income_category($_POST['mic_name']);
|
||||
log::register('new_mic', $new_mic_id);
|
||||
header("Location: /admin/money_income_category");
|
||||
header('Location: /admin/money_income_category');
|
||||
break;
|
||||
case 'mi_create':
|
||||
# bevétel létrehozása
|
||||
// bevétel létrehozása
|
||||
$new_mi_id = money_income::create_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_payment_type']);
|
||||
log::register('new_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft");
|
||||
header("Location: /admin/money_income");
|
||||
log::register('new_mi', $_POST['mi_item'].': '.$_POST['mi_sum'].' Ft');
|
||||
header('Location: /admin/money_income');
|
||||
break;
|
||||
case 'mic_update':
|
||||
# bevétel kategória módosítása
|
||||
// bevétel kategória módosítása
|
||||
money_income_category::update_money_income_category($_POST['mic_name'], $_POST['mic_id']);
|
||||
log::register('update_mic', $_POST['mic_id']);
|
||||
header("Location: /admin/money_income_category");
|
||||
header('Location: /admin/money_income_category');
|
||||
break;
|
||||
case 'mi_update':
|
||||
# bevétel módosítása
|
||||
// bevétel módosítása
|
||||
money_income::update_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_id'], $_POST['mi_payment_type']);
|
||||
log::register('update_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft");
|
||||
header("Location: /admin/money_income");
|
||||
log::register('update_mi', $_POST['mi_item'].': '.$_POST['mi_sum'].' Ft');
|
||||
header('Location: /admin/money_income');
|
||||
break;
|
||||
case 'settings_data_edit':
|
||||
$sql->update_table('setting_value',
|
||||
array(
|
||||
[
|
||||
'setv_'.$_POST['st_name'] => $_POST['set_val'],
|
||||
'setv_set_date' => date("Y-m-d H:i:s")
|
||||
),
|
||||
array(
|
||||
'setv_id' => $_POST['setv_id']
|
||||
)
|
||||
|
||||
'setv_set_date' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
[
|
||||
'setv_id' => $_POST['setv_id'],
|
||||
]
|
||||
);
|
||||
header("Location: /admin/settings/".$_POST['set_id']);
|
||||
header('Location: /admin/settings/'.$_POST['set_id']);
|
||||
break;
|
||||
case 'camp_type_create':
|
||||
# tábor típus létrehozása
|
||||
// tábor típus létrehozása
|
||||
$new_ct_id = camp_type::create_camp_type($_POST['ct_name']);
|
||||
log::register('new_ct', $new_ct_id);
|
||||
header("Location: /admin/camp_types");
|
||||
header('Location: /admin/camp_types');
|
||||
break;
|
||||
case 'camp_type_update':
|
||||
# tábor típus módosítása
|
||||
// tábor típus módosítása
|
||||
unset($_POST['action']);
|
||||
foreach ($_POST as $key => $value) {
|
||||
$key_parts = explode('_', $key);
|
||||
@@ -395,65 +401,46 @@ if (isset($_POST['action'])) {
|
||||
camp_type::update_camp_type($ct_id, $value);
|
||||
}
|
||||
log::register('update_ct', 'update all');
|
||||
header("Location: /admin/camp_types");
|
||||
header('Location: /admin/camp_types');
|
||||
break;
|
||||
case 'camp_create':
|
||||
# tábor létrehozása
|
||||
// tábor létrehozása
|
||||
unset($_POST['action']);
|
||||
//meg kell vizsgálni, hogy a checkboxos mezők léteznek-e
|
||||
$shuttles = array();
|
||||
if (!empty($_POST['shuttles'])) {
|
||||
$shuttles = $_POST['shuttles'];
|
||||
}
|
||||
|
||||
$accoms = array();
|
||||
if (!empty($_POST['accomodations'])) {
|
||||
$accoms = $_POST['accomodations'];
|
||||
}
|
||||
|
||||
camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms);
|
||||
log::register('new_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")");
|
||||
header("Location: /admin/camps");
|
||||
camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open']) ? 1 : 0), $_POST['camp_camp_type_ct_id'], $_POST['camp_name'], $_POST['camp_count'], $_POST['camp_price'], $_POST['camp_info']);
|
||||
log::register('new_camp', $_POST['camp_from'].' ('.$_POST['camp_city'].')');
|
||||
header('Location: /admin/camps');
|
||||
break;
|
||||
case 'camp_update':
|
||||
# tábor módosítás
|
||||
$shuttles = array();
|
||||
if (!empty($_POST['shuttles'])) {
|
||||
$shuttles = $_POST['shuttles'];
|
||||
}
|
||||
// tábor módosítás
|
||||
|
||||
$accoms = array();
|
||||
if (!empty($_POST['accomodations'])) {
|
||||
$accoms = $_POST['accomodations'];
|
||||
}
|
||||
|
||||
camp::update_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms, $_POST['camp_id']);
|
||||
log::register('update_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")");
|
||||
header('Location: /admin/camps/' . $_POST['camp_id']);
|
||||
camp::update_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open']) ? 1 : 0), $_POST['camp_camp_type_ct_id'], $_POST['camp_name'], $_POST['camp_count'], $_POST['camp_price'], $_POST['camp_info'], $_POST['camp_id']);
|
||||
log::register('update_camp', $_POST['camp_from'].' ('.$_POST['camp_city'].')');
|
||||
header('Location: /admin/camps/'.$_POST['camp_id']);
|
||||
|
||||
break;
|
||||
case 'camp_shirt_create':
|
||||
# tábori póló létrehozása
|
||||
// tábori póló létrehozása
|
||||
//todo: shirt object
|
||||
$new_shirt_id = $sql->insert_into('camp_shirt', array(
|
||||
'cshirt_name' => $_POST['shirt_name']
|
||||
)
|
||||
$new_shirt_id = $sql->insert_into('camp_shirt', [
|
||||
'cshirt_name' => $_POST['shirt_name'],
|
||||
]
|
||||
);
|
||||
log::register('new_camp_shirt', $new_shirt_id);
|
||||
header("Location: /admin/camp_shirt_type");
|
||||
header('Location: /admin/camp_shirt_type');
|
||||
break;
|
||||
case 'camp_shirt_data_edit':
|
||||
# camp shirt update
|
||||
// camp shirt update
|
||||
//todo: shirt object
|
||||
$sql->update_table('camp_shirt', array(
|
||||
$sql->update_table('camp_shirt', [
|
||||
'cshirt_name' => $_POST['shirt_name'],
|
||||
),
|
||||
array(
|
||||
'cshirt_id' => $_POST['shirt_id']
|
||||
)
|
||||
],
|
||||
[
|
||||
'cshirt_id' => $_POST['shirt_id'],
|
||||
]
|
||||
);
|
||||
log::register('update_camp_shirt', $_POST['shirt_id']);
|
||||
header("Location: /admin/camp_shirt_type");
|
||||
header('Location: /admin/camp_shirt_type');
|
||||
break;
|
||||
case 'apply_1':
|
||||
//jelentkezés 1. lépés - jelentkező adatai
|
||||
@@ -464,7 +451,7 @@ if (isset($_POST['action'])) {
|
||||
$_POST['ck_ss_number'],
|
||||
$_POST['ck_email'],
|
||||
$_POST['ck_mobile'],
|
||||
array(
|
||||
[
|
||||
'ck_sport_history' => $_POST['ck_sport_history'],
|
||||
'ck_badminton_history' => $_POST['ck_badminton_history'],
|
||||
'ck_food_info' => $_POST['ck_food_info'],
|
||||
@@ -472,21 +459,21 @@ if (isset($_POST['action'])) {
|
||||
'ck_health_info' => $_POST['ck_health_info'],
|
||||
'ck_pharma_info' => $_POST['ck_pharma_info'],
|
||||
'ck_other_info' => $_POST['ck_other_info'],
|
||||
),
|
||||
],
|
||||
$_POST['ck_list'],
|
||||
$_POST['ck_owner_id']
|
||||
);
|
||||
//létrehozzuk az apply objektumot és berakjuk cookieba az id-t, azzal azonosítjuk a sessiont
|
||||
$new_apply_id = camp_apply::create_camp_apply($new_camp_kid_id);
|
||||
setcookie('badminton_camp_session_id', $new_apply_id, time()+60*60, '/');
|
||||
setcookie('badminton_camp_session_id', $new_apply_id, time() + 60 * 60, '/');
|
||||
header('Location: /tabor/jelentkezes/2');
|
||||
break;
|
||||
case 'apply_2':
|
||||
# jelentkezés 2. lépés - kapcsolattartó adatai
|
||||
// jelentkezés 2. lépés - kapcsolattartó adatai
|
||||
|
||||
//leellenőrizzük, hogy új kapcsolat típust adott-e meg, ha igen, fetöltjük, és kivesszük az id-t
|
||||
if ($_POST['cc_camp_contact_type_cct_id'] == 'new') {
|
||||
$new_cct_id = $sql->insert_into('camp_contact_type', array('cct_name' => $_POST['cct_add_new'], 'cct_owner' => $_POST['cc_owner_id']));
|
||||
if ('new' == $_POST['cc_camp_contact_type_cct_id']) {
|
||||
$new_cct_id = $sql->insert_into('camp_contact_type', ['cct_name' => $_POST['cct_add_new'], 'cct_owner' => $_POST['cc_owner_id']]);
|
||||
$_POST['cc_camp_contact_type_cct_id'] = $new_cct_id;
|
||||
}
|
||||
|
||||
@@ -501,49 +488,46 @@ if (isset($_POST['action'])) {
|
||||
);
|
||||
|
||||
//hozzáadjuk a jelentkezéshez az új contact-ot
|
||||
$sql->insert_into('camp_apply_contact', array(
|
||||
$sql->insert_into('camp_apply_contact', [
|
||||
'cac_camp_apply_capp_id' => $_COOKIE['badminton_camp_session_id'],
|
||||
'cac_camp_contact_cc_id' => $new_cc_id,
|
||||
'cac_is_responsible' => (!empty($_POST['cc_is_responsible'])?1:0),
|
||||
)
|
||||
'cac_is_responsible' => (!empty($_POST['cc_is_responsible']) ? 1 : 0),
|
||||
]
|
||||
);
|
||||
|
||||
//megnézzük, hogy továbblépünk, vagy vissza a contact megadós oldalra
|
||||
if (1 == $_POST['add_more']) {
|
||||
header('Location: /tabor/jelentkezes/2');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//megnézzük, hogy adott-e meg felelős kapcsolattartót
|
||||
//ha nem, akkor a 3-as oldalon kilistázzuk a megadott kapcsolattartókat, és kattintással lehet választani
|
||||
//ha igen, akkor a negyedik oldalra megyünk
|
||||
if (camp_apply::has_responsible_contact($_COOKIE['badminton_camp_session_id'])) {
|
||||
header('Location: /tabor/jelentkezes/4');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
header('Location: /tabor/jelentkezes/3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case 'apply_3':
|
||||
# kiválasztott felelős kapcsolattartó beállítása
|
||||
// kiválasztott felelős kapcsolattartó beállítása
|
||||
camp_apply::make_contact_responsible($_COOKIE['badminton_camp_session_id'], $_POST['cc_is_responsible'], true);
|
||||
header("Location: /tabor/jelentkezes/4");
|
||||
header('Location: /tabor/jelentkezes/4');
|
||||
break;
|
||||
case 'apply_4':
|
||||
# jelentkezés lezárása
|
||||
// jelentkezés lezárása
|
||||
camp_apply::update_camp_apply($_POST['camp_apply_id'], 2, $_POST['camp_accomodation'], $_POST['camp_shuttle'], date('Y-m-d H:i:s'), 'null', $_POST['camp_id']);
|
||||
header('Location: /tabor/jelentkezes/5');
|
||||
break;
|
||||
case 'user_camp_leader_create':
|
||||
# táborvezető létrehozása
|
||||
// táborvezető létrehozása
|
||||
$new_ucl_id = user_camp_leader::create_camp_leader($_POST['ucl_name'], $_POST['ucl_password']);
|
||||
log::register('new_camp_leader', $new_ucl_id);
|
||||
header('Location: /admin/camp_user');
|
||||
break;
|
||||
case 'user_camp_leader_update':
|
||||
# táborvezető update
|
||||
// táborvezető update
|
||||
if (empty($_POST['ucl_password'])) {
|
||||
$_POST['ucl_password'] = null;
|
||||
}
|
||||
@@ -552,13 +536,13 @@ if (isset($_POST['action'])) {
|
||||
header('Location: /admin/camp_user');
|
||||
break;
|
||||
case 'user_group_create':
|
||||
# új csoport
|
||||
// új csoport
|
||||
$new_ug_id = user_group::create_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_is_automatic']);
|
||||
log::register('new_user_group', $new_ug_id);
|
||||
header('Location: /admin/user_groups');
|
||||
break;
|
||||
case 'user_group_update':
|
||||
# csoport update
|
||||
// csoport update
|
||||
user_group::update_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_id'], $_POST['ug_automatic']);
|
||||
log::register('update_user_group', $_POST['ug_id']);
|
||||
header('Location: /admin/user_groups/'.$_POST['ug_id']);
|
||||
@@ -567,25 +551,24 @@ if (isset($_POST['action'])) {
|
||||
$statusCode = milestone::upload_file($_FILES['fileToUpload']);
|
||||
if (0 !== $statusCode) {
|
||||
header('Location: /admin/milestones/'.$statusCode);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
header('Location: /admin/milestones/success');
|
||||
}
|
||||
break;
|
||||
case 'training_template_create':
|
||||
# új edzés salon
|
||||
// új edzés salon
|
||||
$new_tt_id = training_template::create_tt($_POST['tt_name'], $_POST['tt_time'], $_POST['tt_training_type'], $_POST['tt_duration']);
|
||||
log::register('new_training_template', $new_tt_id);
|
||||
header('Location: /admin/training_templates/'.$new_tt_id);
|
||||
break;
|
||||
case 'training_template_update':
|
||||
# edzés salon update
|
||||
// edzés salon update
|
||||
training_template::update_tt($_POST['tt_name'], $_POST['tt_time'], $_POST['tt_training_type'], $_POST['tt_duration'], $_POST['tt_id']);
|
||||
log::register('update_training_template', $_POST['tt_id']);
|
||||
header('Location: /admin/training_templates/'.$_POST['tt_id']);
|
||||
break;
|
||||
case 'news_create':
|
||||
# új hír
|
||||
// új hír
|
||||
unset($_POST['action']);
|
||||
$new_news_id = news::create_news($_POST);
|
||||
log::register('new_news', $new_news_id);
|
||||
@@ -600,7 +583,7 @@ if (isset($_POST['action'])) {
|
||||
header('Location: /admin/news/'.$n_id);
|
||||
break;
|
||||
case 'lease_create':
|
||||
# új bérlettípus
|
||||
// új bérlettípus
|
||||
unset($_POST['action']);
|
||||
$new_lease_id = lease::create_lease($_POST);
|
||||
log::register('new_lease', $new_lease_id);
|
||||
@@ -615,11 +598,7 @@ if (isset($_POST['action'])) {
|
||||
header('Location: /admin/lease/'.$l_id);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
17
index.php
17
index.php
@@ -7,6 +7,8 @@ ob_start();
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script src="/vendor/jQuery/jquery-3.1.1.min.js"></script>
|
||||
<script src="/vendor/ckeditor/ckeditor.js"></script>
|
||||
<script src="/vendor/jQuery/jquery-ui.js"></script>
|
||||
<link rel="stylesheet" href="/vendor/jQuery/jquery-ui.css">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/_image/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/_image/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/_image/apple-icon-72x72.png">
|
||||
@@ -90,6 +92,21 @@ ob_start();
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var inputIds = $('input').map(function() {
|
||||
return this.id;
|
||||
}).get().join(' '); // space separated ready for removeClass
|
||||
|
||||
$( function() {
|
||||
$(".datepicker").datepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
firstDay: 1,
|
||||
beforeShow: function(input, inst) {
|
||||
$('#ui-datepicker-div').removeClass(inputIds);
|
||||
$('#ui-datepicker-div').addClass(this.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onReady(callback) {
|
||||
var intervalID = window.setInterval(checkReady, 1000);
|
||||
function checkReady() {
|
||||
|
||||
@@ -3,3 +3,5 @@ ALTER TABLE `camp_kid` DROP INDEX `fk_camp_kid_1_idx`;
|
||||
ALTER TABLE `camp_kid` DROP `ck_shirt_size_id`;
|
||||
|
||||
DELETE FROM `subpage` WHERE `subpage`.`spage_id` = 29;
|
||||
|
||||
ALTER TABLE `camp` ADD `camp_name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci NOT NULL AFTER `camp_id`, ADD `camp_count` INT NULL DEFAULT NULL AFTER `camp_name`, ADD `camp_price` INT NULL DEFAULT NULL AFTER `camp_count`, ADD `camp_info` TEXT CHARACTER SET utf8 COLLATE utf8_hungarian_ci NULL DEFAULT NULL AFTER `camp_price`;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<div class="form_wrapper">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="camp_create">
|
||||
|
||||
<div>
|
||||
<label class="desc" for="camp_name">Tábor neve / típusa:</label>
|
||||
<div><input type="text" name="camp_name" id="camp_name" required></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="camp_city">Helyszín:</label>
|
||||
<div><input type="text" name="camp_city" id="camp_city" required></div>
|
||||
@@ -39,28 +42,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="shuttles">Labda típus:</label>
|
||||
<table>
|
||||
{foreach $shuttle_array as $shuttle}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="shuttles[]" value="{$shuttle->get_cst_id()}" class="coach_type"></td>
|
||||
<td class="coach">{$shuttle->get_cst_name()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<label class="desc" for="camp_count">Létszám:</label>
|
||||
<div><input type="number" name="camp_count" id="camp_count" min="1"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="shuttles">Bejárás típusa:</label>
|
||||
<table>
|
||||
{foreach $accomodation_array as $accomodation}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="accomodations[]" value="{$accomodation->get_cat_id()}" class="coach_type"></td>
|
||||
<td class="coach">{$accomodation->get_cat_name()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<label class="desc" for="camp_price">Ár:</label>
|
||||
<div><input type="number" name="camp_price" id="camp_price" min="0"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="camp_info">Tábor információk:</label>
|
||||
<div><textarea rows="7" name="camp_info" id="camp_info"></textarea></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Létrehozás">
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
<input type="hidden" name="action" value="camp_update">
|
||||
<input type="hidden" name="camp_id" value="{$camp->get_camp_id()}">
|
||||
|
||||
<div>
|
||||
<label class="desc" for="camp_name">Tábor neve / típusa:</label>
|
||||
<div><input type="text" name="camp_name" id="camp_name" value="{$camp->get_camp_name()}" required></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="camp_city">Helyszín:</label>
|
||||
<div><input type="text" name="camp_city" id="camp_city" value="{$camp->get_camp_city()}" required></div>
|
||||
@@ -43,28 +47,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="shuttles">Labda típus:</label>
|
||||
<table>
|
||||
{foreach $shuttle_array as $shuttle}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="shuttles[]" value="{$shuttle->get_cst_id()}" class="coach_type" {if in_array($shuttle->get_cst_id(), $shuttles)}checked{/if}></td>
|
||||
<td class="coach">{$shuttle->get_cst_name()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<label class="desc" for="camp_count">Létszám:</label>
|
||||
<div><input type="number" min="1" name="camp_count" id="camp_count" value="{$camp->get_camp_count()}"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" for="shuttles">Bejárás típusa:</label>
|
||||
<table>
|
||||
{foreach $accomodation_array as $accomodation}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="accomodations[]" value="{$accomodation->get_cat_id()}" class="coach_type" {if in_array($accomodation->get_cat_id(), $accomodations)}checked{/if}></td>
|
||||
<td class="coach">{$accomodation->get_cat_name()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<label class="desc" for="camp_price">Létszám:</label>
|
||||
<div><input type="number" min="0" name="camp_price" id="camp_price" value="{$camp->get_camp_price()}"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" id="title2" for="camp_info">Kapcsolat tartás:</label>
|
||||
<div><textarea rows="7" name="camp_info" id="camp_info">{$camp->get_camp_info()}</textarea></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Mentés">
|
||||
|
||||
Reference in New Issue
Block a user