diff --git a/_ajax/add_category_to_kid.php b/_ajax/add_category_to_kid.php new file mode 100755 index 0000000..2552534 --- /dev/null +++ b/_ajax/add_category_to_kid.php @@ -0,0 +1,63 @@ +num_of_rows($ugk_query)) { + //update + //ha null, akkor megnézzük, hogy null-e a csoportja is + //ha igen, akkor töröljük + //ha nem, akkor updateljük null-ra + //egyébként update + $ugk_id = $sql->single_variable($ugk_query); + if ($_POST['category_id'] == 'null') { + $group_check_query = "SELECT ugk_user_group_ug_id FROM user_group_kid WHERE ugk_id = " . $ugk_id; + $group_id = $sql->single_variable($group_check_query); + + if ($group_id) { + $sql->update_table('user_group_kid', array('ugk_category_ugc_id' => $_POST['category_id']), array('ugk_id' => $ugk_id)); + } + else { + $sql->execute_query('DELETE FROM user_group_kid WHERE ugk_id = ' . $ugk_id); + } + } + else { + $sql->update_table('user_group_kid', array('ugk_category_ugc_id' => $_POST['category_id']), array('ugk_id' => $ugk_id)); + + } + +} +else { + //insert + //megnézzük, hogy null-e a csoport + //ha igen, insert + //ha nem, akkor update + $ugk_query = "SELECT ugk_id FROM user_group_kid WHERE ugk_user_kid_uk_id = " . $_POST['uk_id'] . " AND ugk_user_group_ug_id = " . $_POST['group_id']; + $ugk_id = $sql->single_variable($ugk_query); + + if ($ugk_id) { + $sql->update_table('user_group_kid', array('ugk_category_ugc_id' => $_POST['category_id']), array('ugk_id' => $ugk_id)); + } + else { + $sql->insert_into('user_group_kid', array( + 'ugk_user_kid_uk_id' => $_POST['uk_id'], + //'ugk_user_group_ug_id' => $_POST['group_id'], + 'ugk_category_ugc_id' => $_POST['category_id'], + )); + } +} + +?> \ No newline at end of file diff --git a/_ajax/apply_filters.php b/_ajax/apply_filters.php new file mode 100755 index 0000000..8873877 --- /dev/null +++ b/_ajax/apply_filters.php @@ -0,0 +1,47 @@ + $filter_value) { + //[0] => filter_value_id, [1] => value, [2] => filter_id + if ($filter_value[1] == 'null') { + $sql->execute_query('DELETE FROM user_group_filter_value WHERE ugfv_id = ' . $filter_value[0]); + } + else { + $sql->update_table('user_group_filter_value', array( + 'ugfv_filter_id' => $filter_value[2], + 'ugfv_group_id' => $_POST['user_group_id'], + 'ugfv_value' => $filter_value[1], + ), array( + 'ugfv_id' => $filter_value[0], + )); + + + + $ugfv_obj = new user_group_filter_value(); + $ugfv_obj->set_ugfv_data_by_id($filter_value[0]); + $ugfv_obj->apply($_POST['intersect']); + + } + + } + + +} + +?> \ No newline at end of file diff --git a/_ajax/create_category.php b/_ajax/create_category.php new file mode 100755 index 0000000..62680a7 --- /dev/null +++ b/_ajax/create_category.php @@ -0,0 +1,14 @@ +insert_into('user_group_category', array( + 'ugc_name' => $_POST['category_name'], + 'ugc_user_group_ug_id' => $_POST['group_id'] + ))); + +?> \ No newline at end of file diff --git a/_ajax/create_user_group_filter.php b/_ajax/create_user_group_filter.php new file mode 100755 index 0000000..03d1f00 --- /dev/null +++ b/_ajax/create_user_group_filter.php @@ -0,0 +1,11 @@ +insert_into('user_group_filter_value', array())); + +?> \ No newline at end of file diff --git a/_ajax/get_auto_group_members.php b/_ajax/get_auto_group_members.php new file mode 100755 index 0000000..9521b8c --- /dev/null +++ b/_ajax/get_auto_group_members.php @@ -0,0 +1,77 @@ +assoc_array($user_kid_query); + //var_dump($user_kid_query); + +//szívás, ne módosítsuk +foreach ($kid_array as $key => $kid_value) { + $tables = get_value_parts($kid_value['ugf_tables']); + $values_to_write = array(); + foreach ($tables as $index => $table_name) { + if ('null' != $table_name && $kid_value['ugc_names']) { + $values = get_value_parts($kid_value['ugf_values']); + $value_field = $values[$index]; + $labels = get_value_parts($kid_value['ugf_labels']); + $label_field = $labels[$index]; + $values_to_search = get_value_parts($kid_value['ugc_names']); + //var_dump($values_to_search); + $value_to_search = $values_to_search[$index]; + $values_to_write[] = $sql->single_variable('select '.$label_field.' from '.$table_name.' where '.$value_field.'='.$value_to_search); + $query = 'select '.$label_field.' from '.$table_name.' where '.$value_field.'='.$value_to_search; + } + else { + $names = get_value_parts($kid_value['ugc_names']); + $values_to_write[] = $names[$index]; + } + } + $final_string = implode(',', $values_to_write); + $kid_array[$key]['ugc_names'] = $final_string; +} + +echo json_encode($kid_array); + +?> \ No newline at end of file diff --git a/_ajax/get_category.php b/_ajax/get_category.php new file mode 100755 index 0000000..f7658f7 --- /dev/null +++ b/_ajax/get_category.php @@ -0,0 +1,12 @@ +assoc_array($category_query)); + +?> \ No newline at end of file diff --git a/_ajax/get_category_list.php b/_ajax/get_category_list.php new file mode 100755 index 0000000..773a5f0 --- /dev/null +++ b/_ajax/get_category_list.php @@ -0,0 +1,17 @@ +assoc_array($ugc_query); + +echo json_encode($ugc_assoc_array); + + + +?> \ No newline at end of file diff --git a/_ajax/get_filter_list.php b/_ajax/get_filter_list.php new file mode 100755 index 0000000..06ab269 --- /dev/null +++ b/_ajax/get_filter_list.php @@ -0,0 +1,17 @@ +assoc_array($ugc_query); + +echo json_encode($ugc_assoc_array); + + + +?> \ No newline at end of file diff --git a/_ajax/get_filter_value_list.php b/_ajax/get_filter_value_list.php new file mode 100755 index 0000000..5666abd --- /dev/null +++ b/_ajax/get_filter_value_list.php @@ -0,0 +1,17 @@ +assoc_array($ugfv_query); + +echo json_encode($ugfv_assoc_array); + + + +?> \ No newline at end of file diff --git a/_ajax/get_filter_values.php b/_ajax/get_filter_values.php new file mode 100755 index 0000000..3cd05b5 --- /dev/null +++ b/_ajax/get_filter_values.php @@ -0,0 +1,29 @@ +set_ugf_data_by_id($_POST['filter_id']); + + //megvizsgáljuk, hogy külön táblából kell-e szedni az adatokat + if ($ugf->get_ugf_table()) { + $ugf_query = "SELECT DISTINCT ".$ugf->get_ugf_value()." AS ugf_id, ".$ugf->get_ugf_label()." AS ugf_name FROM " . $ugf->get_ugf_table() . " WHERE " . $ugf->get_ugf_condition(); + } + else { + $ugf_query = "SELECT DISTINCT uk_" . $ugf->get_ugf_field() . " AS ugf_id, uk_".$ugf->get_ugf_field()." as ugf_name FROM user_kid WHERE uk_".$ugf->get_ugf_field()." IS NOT NULL ORDER BY uk_" . $ugf->get_ugf_field() . " ASC;"; + } + //var_dump($ugf_query); + $ugf_assoc_array = $sql->assoc_array($ugf_query); + + echo json_encode($ugf_assoc_array); +} + +?> \ No newline at end of file diff --git a/_ajax/get_group_members.php b/_ajax/get_group_members.php new file mode 100755 index 0000000..598e3bb --- /dev/null +++ b/_ajax/get_group_members.php @@ -0,0 +1,93 @@ +assoc_array($kid_query); + + +echo json_encode($kid_assoc_array); + +?> \ No newline at end of file diff --git a/_ajax/get_parent_data.php b/_ajax/get_parent_data.php old mode 100644 new mode 100755 diff --git a/_ajax/get_user_list.php b/_ajax/get_user_list.php old mode 100644 new mode 100755 diff --git a/_ajax/update_membership.php b/_ajax/update_membership.php new file mode 100755 index 0000000..487ac48 --- /dev/null +++ b/_ajax/update_membership.php @@ -0,0 +1,48 @@ +num_of_rows($ugk_query)) { + //ha nincs category-ja, akkor töröljük, egyébként csak nullra rakjuk a group_id-t + $ugk_id = $sql->single_variable($ugk_query); + + $check_query = "SELECT ugk_category_ugc_id FROM user_group_kid WHERE ugk_user_group_ug_id = " . $_POST['group_id']. " AND ugk_user_kid_uk_id = " . $_POST['uk_id'] . ";"; + $category_id = $sql->single_variable($check_query); + if ($category_id) { + //update to null + $sql->update_table('user_group_kid', array('ugk_user_group_ug_id' => 'null'), array('ugk_id' => $ugk_id)); + } + else { + $sql->execute_query("DELETE FROM user_group_kid WHERE ugk_id = " . $ugk_id); + } + + +} +else { + //ha még nincs benne null-lal, akkor insert, egyébként update + $check_query = "SELECT ugk_id FROM user_group_kid WHERE ugk_user_group_ug_id IS NULL AND ugk_user_kid_uk_id = " . $_POST['uk_id'] . ";"; + $ugk_id = $sql->single_variable($check_query); + if ($ugk_id) { + //update + $sql->update_table('user_group_kid', array( + 'ugk_user_group_ug_id' => $_POST['group_id'] + ), array('ugk_id' => $ugk_id)); + } + else { + $sql->insert_into('user_group_kid', array( + 'ugk_user_kid_uk_id' => $_POST['uk_id'], + 'ugk_user_group_ug_id' => $_POST['group_id'] + )); + } + +} + +?> \ No newline at end of file diff --git a/_ajax/update_presence.php b/_ajax/update_presence.php old mode 100644 new mode 100755 diff --git a/_class/class_log.php b/_class/class_log.php index 2c1b41e..09db371 100644 --- a/_class/class_log.php +++ b/_class/class_log.php @@ -17,9 +17,9 @@ class log { if (is_object($user)) { //ha a user változó objektum, akkor megvizsgáljuk, hogy coach vagy parent if (get_class($user) == 'user') $function_name = 'get_ua_id'; - elseif(get_class($user) == 'user_kid') $function_name = 'get_uk_id'; - elseif(get_class($user) == 'camp_user') $function_name = 'get_cu_id'; - elseif(get_class($user) == 'user_camp_leader') $function_name = 'get_ucl_id'; + elseif(get_class($user) == 'user_kid') $function_name = 'get_uk_id'; + elseif(get_class($user) == 'camp_user') $function_name = 'get_cu_id'; + elseif(get_class($user) == 'user_camp_leader') $function_name = 'get_ucl_id'; } $sql->insert_into('log', array( @@ -115,11 +115,11 @@ class log { } public function get_log_img() { - if (strstr($this->get_log_category()->get_logc_name(), 'new')) return 'tick'; - elseif (strstr($this->get_log_category()->get_logc_name(), 'delete')) return 'delete'; - elseif (strstr($this->get_log_category()->get_logc_name(), 'update')) return 'edit'; - elseif (in_array($this->get_log_category()->get_logc_name(), array('training_close', 'training_open'))) return 'lock'; - elseif (in_array($this->get_log_category()->get_logc_name(), array('admin_login', 'admin_logout', 'kid_login', 'kid_logout', 'coach_login', 'coach_logout', 'camp_user_login', 'camp_user_logout'))) return 'login'; + if (strstr($this->get_log_category()->get_logc_name(), 'new')) return 'tick'; + elseif (strstr($this->get_log_category()->get_logc_name(), 'delete')) return 'delete'; + elseif (strstr($this->get_log_category()->get_logc_name(), 'update')) return 'edit'; + elseif (in_array($this->get_log_category()->get_logc_name(), array('training_close', 'training_open'))) return 'lock'; + elseif (in_array($this->get_log_category()->get_logc_name(), array('admin_login', 'admin_logout', 'kid_login', 'kid_logout', 'coach_login', 'coach_logout', 'camp_user_login', 'camp_user_logout', 'camp_leader_login', 'camp_leader_logout'))) return 'login'; } public function set_log_data_by_id($_log_id) { @@ -141,6 +141,7 @@ class log { if ($this->get_log_category()->get_logc_type() == 1) $new_user = new user(); elseif($this->get_log_category()->get_logc_type() == 2) $new_user = new user_kid(); elseif($this->get_log_category()->get_logc_type() == 3) $new_user = new camp_user(); + elseif($this->get_log_category()->get_logc_type() == 4) $new_user = new user_camp_leader(); $new_user->set_user_data_by_id($value); $this->set_log_user($new_user); } @@ -150,4 +151,4 @@ class log { } -?> \ No newline at end of file +?> diff --git a/_class/class_page.php b/_class/class_page.php index 0c18425..f8e9c66 100755 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -219,6 +219,10 @@ class page { # turnusok include('include_camp_details.php'); break; + case 'user_groups': + # csoportok + include('include_user_groups.php'); + break; case 'delete_training_type': # EDZÉS TÍPUS TÖRLÉS include('include_delete_training_type.php'); @@ -275,6 +279,10 @@ class page { # TÁBORVEZETŐ TÖRLÉS include('include_delete_camp_leader.php'); break; + case 'delete_user_group': + # CSOPORT TÖRLÉS + include('include_delete_user_group.php'); + break; case 'logout': # kijelentkezés $from = "admin"; diff --git a/_class/class_user_group.php b/_class/class_user_group.php new file mode 100644 index 0000000..d18cc88 --- /dev/null +++ b/_class/class_user_group.php @@ -0,0 +1,194 @@ +ug_id; + } + + /** + * @param mixed $ug_id + * + * @return self + */ + public function set_ug_id($ug_id) + { + $this->ug_id = $ug_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_ug_name() + { + return $this->ug_name; + } + + /** + * @param mixed $ug_name + * + * @return self + */ + public function set_ug_name($ug_name) + { + $this->ug_name = $ug_name; + + return $this; + } + + /** + * @return mixed + */ + public function get_ug_description() + { + return $this->ug_description; + } + + /** + * @param mixed $ug_description + * + * @return self + */ + public function set_ug_description($ug_description) + { + $this->ug_description = $ug_description; + + return $this; + } + + /** + * @return mixed + */ + public function get_ug_is_automatic() + { + return $this->ug_is_automatic; + } + + /** + * @param mixed $ug_is_automatic + * + * @return self + */ + public function set_ug_is_automatic($ug_is_automatic) + { + $this->ug_is_automatic = $ug_is_automatic; + + return $this; + } + + /** + * @return mixed + */ + public function get_ug_deleted() + { + return $this->ug_deleted; + } + + /** + * @param mixed $ug_deleted + * + * @return self + */ + public function set_ug_deleted($ug_deleted) + { + $this->ug_deleted = $ug_deleted; + + return $this; + } + + /** + * @return mixed + */ + public function get_ug_filter() + { + return $this->ug_filter; + } + + /** + * @param mixed $ug_filter + * + * @return self + */ + public function set_ug_filter($ug_filter) + { + $this->ug_filter = $ug_filter; + + return $this; + } + + + + public function set_ug_data_by_id($_id) { + global $sql; + $set_data_assoc_array = $sql->assoc_array("select * from user_group where ug_id = " . $_id); + $set_data_array = $set_data_assoc_array[0]; + foreach ($set_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); //alapadatok beállítása + } + } + + public static function create_user_group($_name, $_description, $_is_automatic = 0) { + global $sql; + + return $sql->insert_into('user_group', array( + 'ug_name' => $_name, + 'ug_description' => $_description, + 'ug_is_automatic' => $_is_automatic, + ) + ); + } + + public static function update_user_group($_name, $_description, $_id, $_is_automatic = 0) { + global $sql; + + $sql->update_table('user_group', array( + 'ug_name' => $_name, + 'ug_description' => $_description, + 'ug_is_automatic' => $_is_automatic, + ), + array( + 'ug_id' => $_id, + ) + ); + } + + public static function empty_group($_group_id) { + //kitörli a usereket a groupból; categoryra szűrhető + global $sql; + $sql->execute_query("DELETE FROM user_group_kid WHERE ugk_user_group_ug_id = " . $_group_id); + $sql->execute_query("DELETE FROM user_group_category WHERE ugc_user_group_ug_id = " . $_group_id); + + } + + public function get_user_group_filter_values() { + global $sql; + + $ugfv_array = array(); + + $ugfv_assoc_array = $sql->assoc_array("SELECT * FROM user_group_filter_value WHERE ugfv_group_id = " . $this->get_ug_id()); + + foreach ($ugfv_assoc_array as $u) { + $ugfv = new user_group_filter_value(); + $ugfv->set_ugfv_data_by_id($u['ugfv_id']); + $ugfv_array[] = $ugfv; + } + + return $ugfv_array; + } +} + + +?> \ No newline at end of file diff --git a/_class/class_user_group_category.php b/_class/class_user_group_category.php new file mode 100644 index 0000000..cc521d6 --- /dev/null +++ b/_class/class_user_group_category.php @@ -0,0 +1,86 @@ +ugc_id; + } + + /** + * @param mixed $ugc_id + * + * @return self + */ + public function set_ugc_id($ugc_id) + { + $this->ugc_id = $ugc_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugc_name() + { + return $this->ugc_name; + } + + /** + * @param mixed $ugc_name + * + * @return self + */ + public function set_ugc_name($ugc_name) + { + $this->ugc_name = $ugc_name; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugc_user_group_ug_id() + { + return $this->ugc_user_group_ug_id; + } + + /** + * @param mixed $ugc_user_group_ug_id + * + * @return self + */ + public function set_ugc_user_group_ug_id($ugc_user_group_ug_id) + { + $this->ugc_user_group_ug_id = $ugc_user_group_ug_id; + + return $this; + } + + public function set_ugc_data_by_id($_id) { + global $sql; + $set_data_assoc_array = $sql->assoc_array("select * from user_group_category where ugc_id = " . $_id); + $set_data_array = $set_data_assoc_array[0]; + foreach ($set_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); //alapadatok beállítása + } + + } + + public static function get_ugc_by_name($_name, $_group_id) { + global $sql; + return $sql->single_varible("select ugc_id from user_group_category where ugc_user_group_ug_id = " . $_group_id . " AND ugc_name = '".$_name."';"); + } +} + + +?> \ No newline at end of file diff --git a/_class/class_user_group_filter.php b/_class/class_user_group_filter.php new file mode 100644 index 0000000..dff76bd --- /dev/null +++ b/_class/class_user_group_filter.php @@ -0,0 +1,167 @@ +ugf_id; + } + + /** + * @param mixed $ugf_id + * + * @return self + */ + public function set_ugf_id($ugf_id) + { + $this->ugf_id = $ugf_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugf_name() + { + return $this->ugf_name; + } + + /** + * @param mixed $ugf_name + * + * @return self + */ + public function set_ugf_name($ugf_name) + { + $this->ugf_name = $ugf_name; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugf_field() + { + return $this->ugf_field; + } + + /** + * @param mixed $ugf_field + * + * @return self + */ + public function set_ugf_field($ugf_field) + { + $this->ugf_field = $ugf_field; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugf_table() + { + return $this->ugf_table; + } + + /** + * @param mixed $ugf_table + * + * @return self + */ + public function set_ugf_table($ugf_table) + { + $this->ugf_table = $ugf_table; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugf_label() + { + return $this->ugf_label; + } + + /** + * @param mixed $ugf_label + * + * @return self + */ + public function set_ugf_label($ugf_label) + { + $this->ugf_label = $ugf_label; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugf_value() + { + return $this->ugf_value; + } + + /** + * @param mixed $ugf_value + * + * @return self + */ + public function set_ugf_value($ugf_value) + { + $this->ugf_value = $ugf_value; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugf_condition() + { + return $this->ugf_condition; + } + + /** + * @param mixed $ugf_condition + * + * @return self + */ + public function set_ugf_condition($ugf_condition) + { + $this->ugf_condition = $ugf_condition; + + return $this; + } + + public function set_ugf_data_by_id($_ugf_id) { + global $sql; + $ugf_assoc_array = $sql->assoc_array("select * from user_group_filter where ugf_id = " . $_ugf_id); + $ugf_array = $ugf_assoc_array[0]; + //alapadatok + foreach ($ugf_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + + } +} + + +?> \ No newline at end of file diff --git a/_class/class_user_group_filter_value.php b/_class/class_user_group_filter_value.php new file mode 100644 index 0000000..47fae66 --- /dev/null +++ b/_class/class_user_group_filter_value.php @@ -0,0 +1,232 @@ +ugfv_id; + } + + /** + * @param mixed $ugfv_id + * + * @return self + */ + public function set_ugfv_id($ugfv_id) + { + $this->ugfv_id = $ugfv_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugfv_filter_id() + { + return $this->ugfv_filter_id; + } + + /** + * @param mixed $ugfv_filter_id + * + * @return self + */ + public function set_ugfv_filter_id($ugfv_filter_id) + { + $this->ugfv_filter_id = $ugfv_filter_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugfv_group_id() + { + return $this->ugfv_group_id; + } + + /** + * @param mixed $ugfv_group_id + * + * @return self + */ + public function set_ugfv_group_id($ugfv_group_id) + { + $this->ugfv_group_id = $ugfv_group_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_ugfv_value() + { + return $this->ugfv_value; + } + + /** + * @param mixed $ugfv_value + * + * @return self + */ + public function set_ugfv_value($ugfv_value) + { + $this->ugfv_value = $ugfv_value; + + return $this; + } + + public function set_ugfv_data_by_id($_sc_id) { + global $sql; + $ugfv_data_assoc_array = $sql->assoc_array("select * from user_group_filter_value where ugfv_id = " . $_sc_id); + $ugfv_data_array = $ugfv_data_assoc_array[0]; + foreach ($ugfv_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); //alapadatok beállítása + if ($field == 'ugfv_filter_id' && !empty($value)) { + $filter = new user_group_filter(); + $filter->set_ugf_data_by_id($value); + $this->set_ugfv_filter_id($filter); + } + if ($field == 'ugfv_group_id' && !empty($value)) { + $group = new user_group(); + $group->set_ug_data_by_id($value); + $this->set_ugfv_group_id($group); + } + } + } + + public function apply($intersect = 0) { + global $sql; + //EZ CSAK BEILLESZT, A SZÜKSÉGES TÖRLÉSEKET ELŐTTE KELL MEGCSINÁLNI + //$this->get_ugfv_group_id()->empty_group($ugc_id); + //$this->get_ugfv_group_id()->empty_group($ugc_id); + //lekéri az usereket a megadott értékek alapján, és ha még nincs ilyen user a csoportban ezzel a category-val, akkor beilleszti + + if (!$intersect) { + $ugc_id = $sql->insert_into('user_group_category', array( + 'ugc_name' => $this->get_ugfv_value(), + 'ugc_user_group_ug_id' => $this->get_ugfv_group_id()->get_ug_id(), + 'ugc_ugfv_id' => $this->get_ugfv_id() + )); + } + + if ($this->get_ugfv_filter_id()->get_ugf_table()) { + //ha meg van adva table, akkor az alapján rakjuk össze a query-t + $table = $this->get_ugfv_filter_id()->get_ugf_table(); + $uk_field = 'uk_'.$this->get_ugfv_filter_id()->get_ugf_field(); + $value = $this->get_ugfv_filter_id()->get_ugf_value(); + $condition = $this->get_ugfv_filter_id()->get_ugf_condition(); + + $filter_query = " + SELECT + uk_id + FROM + user_kid + JOIN + ".$table." ON ".$value." = ".$uk_field." + WHERE ".($table!='user_kid_is_active'?"uk_is_active = 1 ":"")." AND uk_deleted = 0 AND + ".$uk_field." = ".$this->get_ugfv_value() . ($condition?" AND " . $condition:"") . + ";"; + + + } + + else { + $filter_query = " + SELECT uk_id FROM user_kid + WHERE uk_is_active = 1 AND uk_deleted = 0 AND uk_".$this->get_ugfv_filter_id()->get_ugf_field()." = '".$this->get_ugfv_value()."'; + "; + + } + //var_dump($filter_query); + + + $uk_assoc_array = $sql->assoc_array($filter_query); + + $uk_ids = []; + foreach ($uk_assoc_array as $uk_array) { + $uk_ids[] = $uk_array['uk_id']; + } + + $ugfv_list = $sql->assoc_array('SELECT * FROM user_group_kid WHERE ugk_ugfv_id in (SELECT ugfv_id FROM user_group_filter_value WHERE ugfv_group_id = ' . $this->get_ugfv_group_id()->get_ug_id(). ');'); + if ($intersect && count($ugfv_list)) { + //ha már van vmi a metszetben + //végigmegyünk a metszeten, és ha az aktuális elem nincs benne az uk_assoc_arrayben, akkor kivesszük a metszetből + foreach ($ugfv_list as $index => $ugfv_array) { + if (!in_array($ugfv_array['ugk_user_kid_uk_id'], $uk_ids)) { + $sql->execute_query('DELETE FROM user_group_kid WHERE ugk_id = ' . $ugfv_array['ugk_id']); + unset($ugfv_list[$index]); + } + } + } + + else { + foreach ($uk_assoc_array as $uk) { + $sql->insert_into('user_group_kid', array( + 'ugk_user_kid_uk_id' => $uk['uk_id'], + 'ugk_user_group_ug_id' => $this->get_ugfv_group_id()->get_ug_id(), + 'ugk_category_ugc_id' => ($intersect?'null':$ugc_id), + 'ugk_ugfv_id' => $this->get_ugfv_id(), + )); + } + } + } + + public function is_user_filterable($user) { + global $sql; + + if ($this->get_ugfv_filter_id()->get_ugf_table()) { + //ha meg van adva table, akkor az alapján rakjuk össze a query-t + $table = $this->get_ugfv_filter_id()->get_ugf_table(); + $uk_field = 'uk_'.$this->get_ugfv_filter_id()->get_ugf_field(); + $value = $this->get_ugfv_filter_id()->get_ugf_value(); + $condition = $this->get_ugfv_filter_id()->get_ugf_condition(); + + $filter_query = " + SELECT + uk_id + FROM + user_kid + JOIN + ".$table." ON ".$value." = ".$uk_field." + WHERE ".($table!='user_kid_is_active'?"uk_is_active = 1 ":"")." AND uk_id = ".$user->get_uk_id()." AND uk_deleted = 0 AND + ".$uk_field." = ".$this->get_ugfv_value() . ($condition?" AND " . $condition:"") . + ";"; + + + } + + else { + $filter_query = " + SELECT uk_id FROM user_kid + WHERE uk_is_active = 1 AND uk_deleted = 0 AND uk_id = ".$user->get_uk_id()." AND uk_".$this->get_ugfv_filter_id()->get_ugf_field()." = '".$this->get_ugfv_value()."'; + "; + + } + //var_dump($filter_query); + return $sql->num_of_rows($filter_query); + } + + public function is_intersect() { + global $sql; + return empty($sql->single_variable('SELECT ugk_category_ugc_id FROM user_group_kid WHERE ugk_user_group_ug_id = ' . $this->get_ugfv_group_id()->get_ug_id(). ' AND ugk_ugfv_id = ' . $this->get_ugfv_id())); + } +} + + +?> diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 6611a4a..a727a0d 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -21,6 +21,7 @@ class user_kid extends user_parent { private $user_first_training; private $user_beforehand; private $user_hand; + private $user_level; private $user_last_modified; private $logged_in; private $user_type; @@ -33,34 +34,35 @@ class user_kid extends user_parent { private $user_phone; private $user_facebook; private $user_region; - private $user_ago_category; + private $user_age_category; + private $user_official_age_category; private $user_contact; private $user_other; private $user_deleted; public function set_uk_id($_uid) { - $this->user_id = $_uid; + $this->user_id = $_uid; } public function set_uk_name($_uname) { - $this->user_name = $_uname; + $this->user_name = $_uname; } public function set_uk_is_active($_active) { - $this->user_is_active = $_active; + $this->user_is_active = $_active; } public function set_uk_password($_u_pass) { - $this->user_password = $_u_pass; + $this->user_password = $_u_pass; } public function set_uk_email($_u_email) { - $this->user_email = $_u_email; + $this->user_email = $_u_email; } public function set_uk_phone($_u_phone) { - $this->user_phone = $_u_phone; + $this->user_phone = $_u_phone; } public function set_uk_facebook($_facebook) { $this->user_facebook = $_facebook; } public function set_uk_last_login($_u_last_login) { - $this->user_last_login = $_u_last_login; + $this->user_last_login = $_u_last_login; } public function set_uk_shirt_size_ss_id($_shirt_size) { $this->user_shirt_size = $_shirt_size; @@ -178,73 +180,85 @@ class user_kid extends user_parent { } public function set_uk_gender($_gender) { - $this->user_gender = $_gender; + $this->user_gender = $_gender; } public function get_uk_gender() { return $this->user_gender; } public function set_uk_birth_date($_birth_date) { - $this->user_birth_date = $_birth_date; + $this->user_birth_date = $_birth_date; } public function get_uk_birth_date() { return $this->user_birth_date; } public function set_uk_birth_year($_birth_year) { - $this->user_birth_year = $_birth_year; + $this->user_birth_year = $_birth_year; } public function get_uk_birth_year() { return $this->user_birth_year; } public function set_uk_first_training($_first_training) { - $this->user_first_training = $_first_training; + $this->user_first_training = $_first_training; } public function get_uk_first_training() { return $this->user_first_training; } public function set_uk_hand($_hand) { - $this->user_hand = $_hand; + $this->user_hand = $_hand; } public function get_uk_hand() { return $this->user_hand; } + public function set_uk_level($_level) { + $this->user_level = $_level; + } + public function get_uk_level() { + return $this->user_level; + } public function set_uk_last_modified($_last_modified) { - $this->user_last_modified = $_last_modified; + $this->user_last_modified = $_last_modified; } public function get_uk_last_modified() { return $this->user_last_modified; } public function set_uk_address_scc_id($_address) { - $this->user_address_scc_id = $_address; + $this->user_address_scc_id = $_address; } public function get_uk_address_scc_id() { return $this->user_address_scc_id; } public function set_uk_address($_address) { - $this->user_address = $_address; + $this->user_address = $_address; } public function get_uk_address() { return $this->user_address; } public function set_uk_beforehand($_beforehand) { - $this->user_beforehand = $_beforehand; + $this->user_beforehand = $_beforehand; } public function get_uk_beforehand() { return $this->user_beforehand; } public function set_uk_age_category($_age_category) { - $this->user_age_category = $_age_category; + $this->user_age_category = $_age_category; } public function get_uk_age_category() { return $this->user_age_category; } + public function set_uk_official_age_category($_age_category) { + $this->user_official_age_category = $_age_category; + } + public function get_uk_official_age_category() { + return $this->user_official_age_category; + } public function set_uk_school($_school) { - $this->user_school = $_school; + $this->user_school = $_school; } public function get_uk_school() { return $this->user_school; } public function set_uk_balance($_balance) { - $this->user_balance = $_balance; + $this->user_balance = $_balance; } public function get_uk_balance() { return $this->user_balance; @@ -306,11 +320,11 @@ class user_kid extends user_parent { //beilleszti AB-ba //visszaadja az ID-t - if ($_email == '') $_email = 'null'; - if ($_facebook == '') $_facebook = 'null'; - if ($_phone == '') $_phone = 'null'; - - return $sql->insert_into('user_parent', + if ($_email == '') $_email = 'null'; + if ($_facebook == '') $_facebook = 'null'; + if ($_phone == '') $_phone = 'null'; + + return $sql->insert_into('user_parent', array( 'up_name' => $_parent_name, 'up_email' => $_email, @@ -324,7 +338,7 @@ class user_kid extends user_parent { //SCHOOL_HANDLER if (isset($_user_value_array['add_school']) && $_user_value_array['add_school'] != "") { //megnézzük adott-e az iskolához települést, ha nem, akkor null-ra állítjuk - //if (isset($_user_value_array['uk_school_city_scc_id']) && $_user_value_array['uk_school_city_scc_id'] == '') $_user_value_array['uk_school_city_scc_id'] = 'null'; + //if (isset($_user_value_array['uk_school_city_scc_id']) && $_user_value_array['uk_school_city_scc_id'] == '') $_user_value_array['uk_school_city_scc_id'] = 'null'; //$new_school_id = $sql->insert_into('school', array('sc_name' => $_user_value_array['add_school'], 'sc_school_city_scc_id' => $_user_value_array['uk_school_city_scc_id'])); $new_school_id = school::create_school($_user_value_array['add_school'], $_user_value_array['uk_school_city_scc_id']); log::register('new_school', $new_school_id); @@ -354,7 +368,7 @@ class user_kid extends user_parent { $_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'], $_user_value_array['parent_2_phone']); log::register('new_parent', $_user_value_array['uk_parent_2']); - } + } if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']); if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']); if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']); @@ -387,13 +401,13 @@ class user_kid extends user_parent { $_user_value_array['add_parent_1'], $_user_value_array['parent_1_email'], $_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']); - log::register('new_parent', $_user_value_array['uk_parent_1']); + log::register('new_parent', $_user_value_array['uk_parent_1']); } else { //meglévő szülő updatelése user_parent::update_parent(array( 'up_email' => $_user_value_array['parent_1_email'], - 'up_facebook' => $_user_value_array['parent_1_facebook'], + 'up_facebook' => $_user_value_array['parent_1_facebook'], 'up_phone' => $_user_value_array['parent_1_phone']), $_user_value_array['uk_parent_1']); } @@ -408,13 +422,13 @@ class user_kid extends user_parent { $_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'], $_user_value_array['parent_2_phone']); log::register('new_parent', $_user_value_array['uk_parent_2']); - } + } else { //meglévő szülő updatelése //var_dump($_user_value_array['uk_parent_2']); user_parent::update_parent(array( 'up_email' => $_user_value_array['parent_2_email'], - 'up_facebook' => $_user_value_array['parent_2_facebook'], + 'up_facebook' => $_user_value_array['parent_2_facebook'], 'up_phone' => $_user_value_array['parent_2_phone']), $_user_value_array['uk_parent_2']); } @@ -501,12 +515,110 @@ class user_kid extends user_parent { } } - + if (isset($_de)) $sql->update_table('user_kid', (array('uk_balance' => $_de->get_de_balance())), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false); else $sql->update_table('user_kid', (array('uk_balance' => 0)), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false); return $_de_obj_array; } + + public function get_groups() { + global $sql; + + $group_array = array(); + $g_assoc = $sql->assoc_array("select * from user_group_kid join user_group on ug_id = ugk_user_group_ug_id where ug_is_automatic = 1 and ugk_user_kid_uk_id = ".$this->get_uk_id().";"); + + foreach ($g_assoc as $g) { + $group = new user_group(); + $group->set_ug_data_by_id($g['ugk_user_group_ug_id']); + $group_array[] = $group; + } + + return $group_array; + } + + public function update_filters() { + global $sql; + + //azok a csoportokban, amikben az user benne van + $user_groups = $this->get_groups(); + + //az user csoportjainak ugfv-i; tömb[tömb] + $my_ugfv_array = array(); + foreach ($user_groups as $user_group) { + $ugfv = $user_group->get_user_group_filter_values(); + $no_falses = 0; + $index = 0; + foreach ($ugfv as $ugfv_obj) { + //var_dump($ugfv_obj->is_intersect()); + if(!$ugfv_obj->is_user_filterable($this) && $ugfv_obj->is_intersect()) { + //var_dump("DELETE FROM user_group_kid WHERE ugk_user_kid_uk_id = " . $this->get_uk_id() . " AND ugk_user_group_ug_id = " . $user_group->get_ug_id()); + $sql->execute_query("DELETE FROM user_group_kid WHERE ugk_user_kid_uk_id = " . $this->get_uk_id() . " AND ugk_user_group_ug_id = " . $user_group->get_ug_id()); + continue 2; + } + elseif (!$ugfv_obj->is_user_filterable($this) && !$ugfv_obj->is_intersect()) { + //var_dump("DELETE FROM user_group_kid WHERE ugk_user_kid_uk_id = " . $this->get_uk_id() . " AND ugk_user_group_ug_id = " . $user_group->get_ug_id() . " AND ugfv_id = " . $ugfv_obj->get_ugfv_id()); + $sql->execute_query("DELETE FROM user_group_kid WHERE ugk_user_kid_uk_id = " . $this->get_uk_id() . " AND ugk_user_group_ug_id = " . $user_group->get_ug_id() . " AND ugfv_id = " . $ugfv_obj->get_ugfv_id()); + $no_falses++; + } + $index ++; + } + if($no_falses == $index) { + //var_dump("DELETE FROM user_group_kid WHERE ugk_user_kid_uk_id = " . $this->get_uk_id() . " AND ugk_user_group_ug_id = " . $user_group->get_ug_id() . " AND ugfv_id = " . $this->get_ugfv_id()); + } + } + + //lekérni minden csoport (ami nem az előzőek egyike) minden filtervalue-ját, és megnézni, hogy beszűrné-e + + //minden csoport, ami nem az előzőek + $user_groups_assoc = $sql->assoc_array("select * from user_group where ug_id not in (select distinct ugk_user_group_ug_id from user_group_kid where ugk_user_kid_uk_id = ".$this->get_uk_id().") and ug_is_automatic = 1 and ug_deleted = 0;"); + + $user_groups = array(); + foreach ($user_groups_assoc as $ug) { + $new_ug = new user_group(); + $new_ug->set_ug_data_by_id($ug['ug_id']); + $user_groups[] = $new_ug; + } + + foreach ($user_groups as $user_group) { + $ugfv = $user_group->get_user_group_filter_values(); + $no_success = 0; + $index = 0; + foreach ($ugfv as $ugfv_obj) { + if($ugfv_obj->is_user_filterable($this) && !$ugfv_obj->is_intersect()) { + $category_id = $sql->single_variable("SELECT ugc_id FROM user_group_category WHERE ugc_ugfv_id =" . $ugfv_obj->get_ugfv_id()); + //var_dump("INSERT INTO user_group_kid (ugk_user_kid_uk_id, ugk_user_group_ug_id, ugk_category_ugc_id) VALUES (".$this->get_uk_id().", ".$user_group->get_ug_id().", " . $category_id . ");"); + $sql->insert_into( + 'user_group_kid', + array( + 'ugk_user_kid_uk_id' => $this->get_uk_id(), + 'ugk_user_group_ug_id' => $user_group->get_ug_id(), + 'ugk_category_ugc_id' => $category_id, + 'ugk_ugfv_id' => $ugfv_obj->get_ugfv_id() + ) + ); + } + elseif ($ugfv_obj->is_user_filterable($this) && $ugfv_obj->is_intersect()) { + $no_success++; + + //continue 2; + } + $index ++; + } + if($no_success == $index) { + //var_dump("INSERT INTO user_group_kid (ugk_user_kid_uk_id, ugk_user_group_ug_id) VALUES (".$this->get_uk_id().", ".$user_group->get_ug_id().");"); + //var_dump("INSERT INTO user_group_kid (ugk_user_kid_uk_id, ugk_user_group_ug_id) VALUES (".$this->get_uk_id().", ".$user_group->get_ug_id().");"); + $sql->insert_into( + 'user_group_kid', + array( + 'ugk_user_kid_uk_id' => $this->get_uk_id(), + 'ugk_user_group_ug_id' => $user_group->get_ug_id(), + 'ugk_ugfv_id' => $ugfv_obj->get_ugfv_id() + ) + ); + } + } + } } -?> \ No newline at end of file +?> diff --git a/_css/default.css b/_css/default.css index f188c85..c9a7e48 100644 --- a/_css/default.css +++ b/_css/default.css @@ -568,9 +568,161 @@ h1.apply { margin: 30px auto 50px auto; } +#footer_control { + position: fixed; + bottom: 0; + left: 0; + height: 50px; + background: #3d3d3d; + display: block; + width: 100%; + overflow: auto; +} + +.list .member { + background-color: #20b495; + border-left: 3px solid black; +} + +.list .member:hover { + background-color: #93e9ac; + border-left: 3px solid black; +} + +.toggle { + width: 50px; + height: 120px; + position: relative; + right: -5px; + top: -10px; + background-color: #edfc5a; + float: right; + border-right: 3px solid; + cursor: pointer; +} + +.list .list_item .toggle img { + position: relative; + left: 12px; + top: 45px; + width: 25px; + height: 25px; +} + +.nested { + position: relative; + right: 25px; + height: 28px; + border-radius: 0px 10px 7px 0px; + top: 1px; + width: 35px; +} + +#footer_toggle { + width: 60px; + height: 50px; + background: #e0e0e0; + float: right; + cursor: pointer; + position: fixed; + bottom: 0; + right: 0; +} + +#footer_toggle img { + width: 50px; +} + +.category_list { + width: 70%; + display: block; + margin: 5px 2% 5px 8%; +} + +.add_category { + width: 50%; + margin: 5px 2% 0px 15%; +} + +.name_span { + margin: 5px auto; + display: block; + text-align: center; +} + +.bigger_padding { + padding: 20px 0px 50px 0px; +} + +form#auto_filters > div > label { + padding-top: 0px; +} + +.category_tab { + padding: 3px; + border: 1px solid; + border-radius: 3px; + margin-right: 5px; +} + +.categories { + display: inline-block; + padding: 10px 45px 10px 45px; + margin: 0; + width: 100%; + text-align: center; +} + +#categories { + display: inline; +} @media (min-width: 680px) { +.categories { + width: unset; + text-align: left; + margin: 0px 0px 0px 45px; + padding: 0; +} + +.toggle { + width: 50px; + height: 50px; + position: relative; + right: -5px; + top: -10px; + background-color: #edfc5a; + float: right; + border-right: 3px solid; + cursor: pointer; +} + +.list .list_item .toggle img { + position: relative; + left: 12px; + top: 10px; + width: 25px; + height: 25px; +} + +.name_span { + min-width: 200px; + display: inline-block; + margin: 0; +} + +.category_list { + width: 25%; + margin: 0; + display: inline; +} + +.add_category { + width: 25%; + margin: 0; +} + .list .date_separator { width: 100%; diff --git a/_image/android-icon-144x144.png b/_image/android-icon-144x144.png new file mode 100644 index 0000000..78fd410 Binary files /dev/null and b/_image/android-icon-144x144.png differ diff --git a/_image/android-icon-192x192.png b/_image/android-icon-192x192.png new file mode 100644 index 0000000..6ff0ab2 Binary files /dev/null and b/_image/android-icon-192x192.png differ diff --git a/_image/android-icon-36x36.png b/_image/android-icon-36x36.png new file mode 100644 index 0000000..8549efe Binary files /dev/null and b/_image/android-icon-36x36.png differ diff --git a/_image/android-icon-48x48.png b/_image/android-icon-48x48.png new file mode 100644 index 0000000..5bc353e Binary files /dev/null and b/_image/android-icon-48x48.png differ diff --git a/_image/android-icon-72x72.png b/_image/android-icon-72x72.png new file mode 100644 index 0000000..1ba2fc3 Binary files /dev/null and b/_image/android-icon-72x72.png differ diff --git a/_image/android-icon-96x96.png b/_image/android-icon-96x96.png new file mode 100644 index 0000000..b6f0d8e Binary files /dev/null and b/_image/android-icon-96x96.png differ diff --git a/_image/apple-icon-114x114.png b/_image/apple-icon-114x114.png new file mode 100644 index 0000000..e98cf44 Binary files /dev/null and b/_image/apple-icon-114x114.png differ diff --git a/_image/apple-icon-120x120.png b/_image/apple-icon-120x120.png new file mode 100644 index 0000000..159a2f9 Binary files /dev/null and b/_image/apple-icon-120x120.png differ diff --git a/_image/apple-icon-144x144.png b/_image/apple-icon-144x144.png new file mode 100644 index 0000000..78fd410 Binary files /dev/null and b/_image/apple-icon-144x144.png differ diff --git a/_image/apple-icon-152x152.png b/_image/apple-icon-152x152.png new file mode 100644 index 0000000..8e3df2b Binary files /dev/null and b/_image/apple-icon-152x152.png differ diff --git a/_image/apple-icon-180x180.png b/_image/apple-icon-180x180.png new file mode 100644 index 0000000..c8657bd Binary files /dev/null and b/_image/apple-icon-180x180.png differ diff --git a/_image/apple-icon-57x57.png b/_image/apple-icon-57x57.png new file mode 100644 index 0000000..33f9975 Binary files /dev/null and b/_image/apple-icon-57x57.png differ diff --git a/_image/apple-icon-60x60.png b/_image/apple-icon-60x60.png new file mode 100644 index 0000000..804d474 Binary files /dev/null and b/_image/apple-icon-60x60.png differ diff --git a/_image/apple-icon-72x72.png b/_image/apple-icon-72x72.png new file mode 100644 index 0000000..1ba2fc3 Binary files /dev/null and b/_image/apple-icon-72x72.png differ diff --git a/_image/apple-icon-76x76.png b/_image/apple-icon-76x76.png new file mode 100644 index 0000000..ba30282 Binary files /dev/null and b/_image/apple-icon-76x76.png differ diff --git a/_image/apple-icon-precomposed.png b/_image/apple-icon-precomposed.png new file mode 100644 index 0000000..eb701fc Binary files /dev/null and b/_image/apple-icon-precomposed.png differ diff --git a/_image/apple-icon.png b/_image/apple-icon.png new file mode 100644 index 0000000..eb701fc Binary files /dev/null and b/_image/apple-icon.png differ diff --git a/_image/browserconfig.xml b/_image/browserconfig.xml new file mode 100644 index 0000000..c554148 --- /dev/null +++ b/_image/browserconfig.xml @@ -0,0 +1,2 @@ + +#ffffff \ No newline at end of file diff --git a/_image/collapse.png b/_image/collapse.png new file mode 100644 index 0000000..7a0645e Binary files /dev/null and b/_image/collapse.png differ diff --git a/_image/favicon-16x16.png b/_image/favicon-16x16.png new file mode 100644 index 0000000..8d0ef3f Binary files /dev/null and b/_image/favicon-16x16.png differ diff --git a/_image/favicon-32x32.png b/_image/favicon-32x32.png new file mode 100644 index 0000000..73732e7 Binary files /dev/null and b/_image/favicon-32x32.png differ diff --git a/_image/favicon-96x96.png b/_image/favicon-96x96.png new file mode 100644 index 0000000..b6f0d8e Binary files /dev/null and b/_image/favicon-96x96.png differ diff --git a/_image/manifest.json b/_image/manifest.json new file mode 100644 index 0000000..013d4a6 --- /dev/null +++ b/_image/manifest.json @@ -0,0 +1,41 @@ +{ + "name": "App", + "icons": [ + { + "src": "\/android-icon-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/android-icon-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/android-icon-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/android-icon-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/android-icon-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/android-icon-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] +} \ No newline at end of file diff --git a/_image/ms-icon-144x144.png b/_image/ms-icon-144x144.png new file mode 100644 index 0000000..78fd410 Binary files /dev/null and b/_image/ms-icon-144x144.png differ diff --git a/_image/ms-icon-150x150.png b/_image/ms-icon-150x150.png new file mode 100644 index 0000000..088278b Binary files /dev/null and b/_image/ms-icon-150x150.png differ diff --git a/_image/ms-icon-310x310.png b/_image/ms-icon-310x310.png new file mode 100644 index 0000000..0787aa9 Binary files /dev/null and b/_image/ms-icon-310x310.png differ diff --git a/_image/ms-icon-70x70.png b/_image/ms-icon-70x70.png new file mode 100644 index 0000000..7a9a40d Binary files /dev/null and b/_image/ms-icon-70x70.png differ diff --git a/_image/switch.png b/_image/switch.png new file mode 100644 index 0000000..4b263fd Binary files /dev/null and b/_image/switch.png differ diff --git a/_include/include_create.php b/_include/include_create.php index b103efb..be3edb5 100755 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -205,6 +205,10 @@ switch ($this->get_id()) { # táborvezető létrehozása $smarty->display('user_camp_leader_create.tpl'); break; + case 'user_group': + # táborvezető létrehozása + $smarty->display('user_group_create.tpl'); + break; default: # code... break; diff --git a/_include/include_delete_user_group.php b/_include/include_delete_user_group.php new file mode 100644 index 0000000..7035179 --- /dev/null +++ b/_include/include_delete_user_group.php @@ -0,0 +1,12 @@ +is_id()) { + //$delete_query = "DELETE FROM user_kid WHERE uk_id = " . $this->get_id() . ";"; + //$sql->execute_query($delete_query); + $sql->update_table('user_group', array('ug_deleted' => 1), array('ug_id' => $this->get_id())); + log::register('delete_user_group', $this->get_id()); + header("Location: /admin/user_groups"); +} + + +?> \ No newline at end of file diff --git a/_include/include_user_groups.php b/_include/include_user_groups.php new file mode 100644 index 0000000..7b6cd3b --- /dev/null +++ b/_include/include_user_groups.php @@ -0,0 +1,34 @@ +is_id()) { + + # CSOPORT SZERKESZTÉSE /TAGLISTA + + $group = new user_group(); + $group->set_ug_data_by_id($this->get_id()); + + $smarty->assign('user_group', $group); + $smarty->display('user_group_data_edit.tpl'); +} + +else { + + # CSOPORT LISTA + + $group_query = "SELECT * FROM user_group WHERE ug_deleted = 0 ORDER By ug_name ASC;"; + $group_assoc_array = $sql->assoc_array($group_query); + + $group_array = array(); + foreach ($group_assoc_array as $group) { + $new_ug = new user_group(); + $new_ug->set_ug_data_by_id($group['ug_id']); + $group_array[] = $new_ug; + } + + $smarty->assign('user_group_array',$group_array); + $smarty->display('user_group_list.tpl'); +} + +?> diff --git a/event_handler.php b/event_handler.php index a3642b3..cbec571 100644 --- a/event_handler.php +++ b/event_handler.php @@ -2,7 +2,7 @@ if (isset($_POST['action'])) { - + $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; switch ($_POST['action']) { case 'user_register': @@ -18,7 +18,7 @@ if (isset($_POST['action'])) { $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': @@ -32,7 +32,8 @@ if (isset($_POST['action'])) { $user_kid_id = null; $user_coach_id = null; $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']); @@ -92,10 +93,15 @@ if (isset($_POST['action'])) { $uid = $_POST['uk_id']; unset($_POST['uk_id']); user_kid::update_user($_POST, $uid); + //filter_update + $kid = new user_kid(); + $kid->set_user_data_by_id($uid); + $kid->update_filters(); + //filter update end log::register('update_member', $uid); - header("Location: " . $actual_link); + //header("Location: " . $actual_link); break; - + default: # code... break; @@ -156,7 +162,7 @@ if (isset($_POST['action'])) { if ($every_week) unset($_POST['every_week']); training::create_training($_POST, $every_week); header("Location: /admin/trainings/"); - + break; case 'training_type_create': @@ -218,7 +224,7 @@ if (isset($_POST['action'])) { # shirt update //todo: shirt object $sql->update_table('shirt', array( - 'shirt_name' => $_POST['shirt_name'], + 'shirt_name' => $_POST['shirt_name'], ), array( 'shirt_id' => $_POST['shirt_id'] @@ -253,7 +259,7 @@ if (isset($_POST['action'])) { # körzet létrehozása //todo: körzet object $new_reg_id = $sql->insert_into('region', array( - 'reg_name' => $_POST['reg_name'], + 'reg_name' => $_POST['reg_name'], ) ); log::register('new_region', $new_reg_id); @@ -324,7 +330,7 @@ if (isset($_POST['action'])) { header("Location: /admin/money_expense"); break; case 'settings_data_edit': - $sql->update_table('setting_value', + $sql->update_table('setting_value', array( 'setv_'.$_POST['st_name'] => $_POST['set_val'], 'setv_set_date' => date("Y-m-d H:i:s") @@ -401,7 +407,7 @@ if (isset($_POST['action'])) { # camp shirt update //todo: shirt object $sql->update_table('camp_shirt', array( - 'cshirt_name' => $_POST['shirt_name'], + 'cshirt_name' => $_POST['shirt_name'], ), array( 'cshirt_id' => $_POST['shirt_id'] @@ -507,6 +513,18 @@ if (isset($_POST['action'])) { log::register('update_camp_leader', $_POST['ucl_id']); header('Location: /admin/camp_user'); break; + case 'user_group_create': + # ú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 + user_group::update_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_id'], $_POST['ug_is_automatic']); + log::register('update_user_group', $_POST['ug_id']); + header('Location: /admin/user_groups'); + break; default: # code... break; @@ -515,4 +533,4 @@ if (isset($_POST['action'])) { } -?> \ No newline at end of file +?> diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..10fe61f Binary files /dev/null and b/favicon.ico differ diff --git a/index.php b/index.php index 6697619..1d9ea5b 100644 --- a/index.php +++ b/index.php @@ -11,11 +11,27 @@ setlocale(LC_ALL, 'hu_HU'); - + + + + + + + + + + + + + + + + + @@ -38,7 +54,7 @@ setlocale(LC_ALL, 'hu_HU'); } - if (in_array($page->get_page(), array('view','preview')) && $page->is_subpage() && $page->get_subpage() == "diary"|| $page->get_page() == "view" && !$page->is_subpage()) + if (in_array($page->get_page(), array('view','preview')) && $page->is_subpage() && $page->get_subpage() == "diary"|| $page->get_page() == "view" && !$page->is_subpage()) echo ''; if ($page->is_page() && ($page->get_page() == 'coach' || $page->get_page() == 'coach_preview')) { @@ -111,7 +127,7 @@ setlocale(LC_ALL, 'hu_HU'); if ($page->is_page() && ($page->get_page() == 'tabor' && !$dev)) { ?> - diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index ade04c3..1485d67 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -80,6 +80,11 @@ + +
+ +
+
@@ -152,6 +157,11 @@
+
+ +
+
+
diff --git a/template/templates/user_data_edit.tpl b/template/templates/user_data_edit.tpl index cd7ece6..a4f5ec8 100755 --- a/template/templates/user_data_edit.tpl +++ b/template/templates/user_data_edit.tpl @@ -85,6 +85,11 @@
+ +
+ +
+
@@ -177,6 +182,11 @@
+
+ +
+
+
diff --git a/template/templates/user_group_create.tpl b/template/templates/user_group_create.tpl new file mode 100644 index 0000000..9a7e419 --- /dev/null +++ b/template/templates/user_group_create.tpl @@ -0,0 +1,27 @@ +
+
+ + +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/template/templates/user_group_data_edit.tpl b/template/templates/user_group_data_edit.tpl new file mode 100644 index 0000000..fd25658 --- /dev/null +++ b/template/templates/user_group_data_edit.tpl @@ -0,0 +1,567 @@ +
+
+ + + + +
+ +
+
+ +
+ +
+
+ +
+ +
get_ug_is_automatic()}checked{/if}>
+
+ +
+
+ +
+
+ +
+ +{if $user_group->get_ug_is_automatic()} +


+
+
+ +
+ +
+
+
+ + +
+ +
+ + + + + + + +{else} + +
+ + +
+
+ + +
+ +
+ + +
+ + + + + + +{/if} + + diff --git a/template/templates/user_group_list.tpl b/template/templates/user_group_list.tpl new file mode 100644 index 0000000..46b5e55 --- /dev/null +++ b/template/templates/user_group_list.tpl @@ -0,0 +1,15 @@ + + +
+ {foreach $user_group_array as $user_group} + +
+ + {$user_group->get_ug_name()} +
+
+ {/foreach} + +
diff --git a/template/templates/user_list.tpl b/template/templates/user_list.tpl index 345068b..7f2570c 100755 --- a/template/templates/user_list.tpl +++ b/template/templates/user_list.tpl @@ -5,6 +5,7 @@ Települések Iskolák Diákolimpia körzetek + Csoportok