groups
This commit is contained in:
@@ -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()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user