diff --git a/.htaccess b/.htaccess
index 70a3610..5634439 100644
--- a/.htaccess
+++ b/.htaccess
@@ -3,7 +3,9 @@ Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
-# RewriteRule ^product/(([0-9]/[0-9a-zA-Z-\s]+)+)$ product.php?id=$1&string=$2
+
+RewriteRule ^\/?(_ajax\/)([a-zA-Z0-9_]+)\.php$ _ajax/$2.php [NC,L]
+
RewriteRule ^([a-z_]+)\/?([0-9a-z_]*)\/?([0-9a-z]*)$ index.php?page=$1&subpage=$2&id=$3 [NC,L]
diff --git a/_ajax/update_presence.php b/_ajax/update_presence.php
index 056e7d9..f1da2f5 100755
--- a/_ajax/update_presence.php
+++ b/_ajax/update_presence.php
@@ -1,11 +1,17 @@
insert_into('presence', array('pr_user_kid_uk_id' => $_GET['userid'], 'pr_training_tr_id' => '9'));
+ini_set('include_path', '/opt/lampp/htdocs/badminton_coach/_class');
+include('class_sql.php');
+$sql = new sql('localhost','root','','badminton_coach');
+/*
+foreach ($_POST as $key => $value) {
+ trigger_error($key . " : " . $value, E_USER_NOTICE);
+}
+*/
+if ($_POST['checked'] == "true") {
+ $sql->insert_into('presence', array('pr_user_kid_uk_id' => $_POST['user_id'], 'pr_training_tr_id' => $_POST['tr_id']));
+}
+else {
+ $sql->execute_query('delete from presence where pr_user_kid_uk_id = ' . $_POST['user_id'] . ' AND pr_training_tr_id = ' . $_POST['tr_id']);
}
?>
\ No newline at end of file
diff --git a/_class/class_page.php b/_class/class_page.php
index 0fc2dcf..643ddeb 100755
--- a/_class/class_page.php
+++ b/_class/class_page.php
@@ -29,8 +29,8 @@ class page {
public function get_page_content() {
global $sql, $user, $smarty;
//var_dump($user);
- //ini_set('include_path', '/opt/lampp/htdocs/badminton_coach/_include');
- ini_set('include_path', '/var/www/badminton_coach/_include');
+ ini_set('include_path', '/opt/lampp/htdocs/badminton_coach/_include');
+ //ini_set('include_path', '/var/www/badminton_coach/_include');
if (!empty($user) && $user->is_logged_in()) {
if ($this->is_page()) {
//TODO: mi van ha nincs page? átirányítás v 404?
@@ -66,6 +66,10 @@ class page {
$tpl = "edit";
include('include_trainings.php');
break;
+ case 'delete_training':
+ # EDZÉS TÖRLÉS
+ include('include_delete_training.php');
+ break;
case 'create':
# LÉTREHOZÓS OLDALAK
include('include_create.php');
diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php
index 69a7d3d..1aea1d1 100755
--- a/_class/class_user_kid.php
+++ b/_class/class_user_kid.php
@@ -194,8 +194,8 @@ class user_kid extends user_parent {
foreach ($user_data_array as $field => $value) {
$function_name = "set_" . $field;
$this->$function_name($value); //alapadatok beállítása
- $this->set_ua_type(2); //kid típus beállítása
- $this->set_login(true);
+ //$this->set_ua_type(2); //kid típus beállítása
+ //$this->set_login(true);
}
}
diff --git a/_class/class_user_parent.php b/_class/class_user_parent.php
index 6ca1918..01f2027 100755
--- a/_class/class_user_parent.php
+++ b/_class/class_user_parent.php
@@ -86,6 +86,26 @@ class user_parent {
}
}
+
+ public static function create_parent($_parent_name, $_email, $_facebook, $_phone) {
+ global $sql;
+ //beilleszti AB-ba
+ //visszaadja az ID-t
+
+ return $sql->insert_into('user_parent',
+ array(
+ 'up_name' => $_parent_name,
+ 'up_email' => $_email,
+ 'up_facebook' => $_facebook,
+ 'up_phone' => $_phone
+ )
+ );
+ }
+
+ public static function update_parent($_parent_value_array, $_up_id) {
+ global $sql;
+ $sql->update_table('user_parent', $_parent_value_array, array('up_id' => $_up_id));
+ }
}
diff --git a/_include/include_create.php b/_include/include_create.php
index f5c6271..90ef8dd 100755
--- a/_include/include_create.php
+++ b/_include/include_create.php
@@ -27,7 +27,6 @@ switch ($this->get_id()) {
break;
case 'training':
- # code...
//TRAINING TYPE ARRAY
$training_type_query = "SELECT * FROM training_type ORDER BY trt_name ASC;";
$training_type_assoc_array = $sql->assoc_array($training_type_query);
@@ -53,7 +52,11 @@ switch ($this->get_id()) {
$smarty->display('training_type_create.tpl');
break;
-
+ case 'parent':
+ # PARENT LÉTREHOZÁSA
+ $smarty->display('parent_create.tpl');
+
+ break;
default:
# code...
break;
diff --git a/_include/include_delete_training.php b/_include/include_delete_training.php
new file mode 100644
index 0000000..37d8393
--- /dev/null
+++ b/_include/include_delete_training.php
@@ -0,0 +1,10 @@
+is_id()) {
+ $delete_query = "DELETE FROM training WHERE tr_id = " . $this->get_id() . ";";
+ $sql->execute_query($delete_query);
+ header("Location: /admin/trainings");
+}
+
+
+?>
\ No newline at end of file
diff --git a/_include/include_parents.php b/_include/include_parents.php
index 06e4f4c..277f486 100644
--- a/_include/include_parents.php
+++ b/_include/include_parents.php
@@ -5,6 +5,12 @@
if ($this->is_id()) {
# ADOTT TAG ADATAINAK MEGJELENÍTÉSE
+
+ $parent = new user_parent();
+ $parent->set_user_data_by_id($this->get_id());
+
+ $smarty->assign('parent', $parent);
+ $smarty->display('parent_data_edit.tpl');
}
else {
diff --git a/_include/include_presence.php b/_include/include_presence.php
index ca1a914..a644d3c 100755
--- a/_include/include_presence.php
+++ b/_include/include_presence.php
@@ -8,7 +8,7 @@ if ($this->is_id()) {
# GYEREKEK BEJELÖLÉSE
# lekérjük, hogy az elmúlt 4 héten kik voltak ilyen típusú edzésen [egyeznie kell a dayofweeknek és a type-nak]
- $presence_query = "SELECT * FROM user_kid ORDER BY uk_last_name, uk_first_name;";
+ $presence_query = "SELECT * FROM user_kid ORDER BY uk_name;";
$presence_assoc_array = $sql->assoc_array($presence_query);
//végig kell menni rajta h legeneráljuk az usereket
@@ -31,9 +31,7 @@ if ($this->is_id()) {
}
else {
- $actual_month = date('m');
- $actual_month = 10;
- $traning_list_query = "SELECT * FROM training WHERE MONTH(tr_date) = " . $actual_month . ";";
+ $traning_list_query = "SELECT * FROM training ORDER BY tr_date DESC;";
$training_list_assoc_array = $sql->assoc_array($traning_list_query);
$training_array = array();
@@ -45,7 +43,7 @@ else {
//var_dump($training_array);
$smarty->assign('edit', $tpl);
$smarty->assign("training_array", $training_array);
- $smarty->display("training_list.tpl");
+ $smarty->display("presence_list.tpl");
}
diff --git a/_include/include_trainings.php b/_include/include_trainings.php
index 2ac42a3..1d66199 100755
--- a/_include/include_trainings.php
+++ b/_include/include_trainings.php
@@ -48,7 +48,7 @@ else {
$actual_month = date('m');
//$actual_month = 10;
- $traning_list_query = "SELECT * FROM training WHERE MONTH(tr_date) = " . $actual_month . ";";
+ $traning_list_query = "SELECT * FROM training ORDER BY tr_date DESC;";
$training_list_assoc_array = $sql->assoc_array($traning_list_query);
$training_array = array();
diff --git a/event_handler.php b/event_handler.php
index 7184621..2d48144 100755
--- a/event_handler.php
+++ b/event_handler.php
@@ -47,6 +47,28 @@ if (isset($_POST['action'])) {
header("Location: /admin/edit_member/" . $new_user_id);
break;
+ case 'parent_create':
+ # 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;
+ user_parent::create_parent($_POST['up_name'], $_POST['up_email'], $_POST['up_facebook'], $_POST['up_phone']);
+ header("Location: /admin/parents");
+ break;
+
+ case 'parent_data_update':
+ # 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;
+ user_parent::update_parent($_POST, $up_id);
+ header("Location: /admin/parents/" . $up_id);
+ break;
+
case 'training_data_edit':
#training edit
$tr_id = $_POST['tr_id'];
diff --git a/index.php b/index.php
index 179ff0f..fb2367f 100755
--- a/index.php
+++ b/index.php
@@ -29,6 +29,22 @@
line-height: 18px;
font-size: 18px;
}
+ .name_tag {
+ width: 200px;
+ text-align: left;
+ padding: 10px 0px 10px 10px;
+ margin: 5px;
+ background-color: #e2edff;
+ cursor: pointer;
+ }
+ .name_tag_checked {
+ width: 200px;
+ text-align: left;
+ padding: 10px 0px 10px 10px;
+ margin: 5px;
+ background-color: #1eea0b;
+ cursor: pointer;
+ }
diff --git a/template/templates/parent_create.tpl b/template/templates/parent_create.tpl
new file mode 100644
index 0000000..957a2b4
--- /dev/null
+++ b/template/templates/parent_create.tpl
@@ -0,0 +1,42 @@
+
\ No newline at end of file
diff --git a/template/templates/parent_data_edit.tpl b/template/templates/parent_data_edit.tpl
new file mode 100644
index 0000000..2ee64ea
--- /dev/null
+++ b/template/templates/parent_data_edit.tpl
@@ -0,0 +1,43 @@
+
\ No newline at end of file
diff --git a/template/templates/parent_list.tpl b/template/templates/parent_list.tpl
index f7427b7..7806f54 100644
--- a/template/templates/parent_list.tpl
+++ b/template/templates/parent_list.tpl
@@ -7,8 +7,8 @@
{foreach $parent_array as $parent}
|
-
- {$user->get_up_name()}
+
+ {$parent->get_up_name()}
|
diff --git a/template/templates/presence.tpl b/template/templates/presence.tpl
index f90b205..91ca020 100755
--- a/template/templates/presence.tpl
+++ b/template/templates/presence.tpl
@@ -1,28 +1,85 @@
-
-
\ No newline at end of file
diff --git a/template/templates/presence_list.tpl b/template/templates/presence_list.tpl
new file mode 100644
index 0000000..def31fa
--- /dev/null
+++ b/template/templates/presence_list.tpl
@@ -0,0 +1,18 @@
+Jelenlét
+
+
\ No newline at end of file
diff --git a/template/templates/training_data_view.tpl b/template/templates/training_data_view.tpl
index ad53cc0..ffc2afb 100755
--- a/template/templates/training_data_view.tpl
+++ b/template/templates/training_data_view.tpl
@@ -1,6 +1,7 @@
- | SZERKESZTÉS |
+ SZERKESZTÉS |
+ TÖRLÉS |
diff --git a/template/templates/training_type_create.tpl b/template/templates/training_type_create.tpl
index b9109b6..b93a250 100644
--- a/template/templates/training_type_create.tpl
+++ b/template/templates/training_type_create.tpl
@@ -1,9 +1,6 @@