<?php


switch ($this->get_id()) {
    case 'member':
        #ÚJ TAG LÉTREHOZÁSA
        //pólóméret array
        $shirt_size_query = "SELECT * FROM shirt WHERE shirt_deleted = 0;";
        $shirt_size_assoc_array = $sql->assoc_array($shirt_size_query);
        //szülő array
        $parent_query = "SELECT * FROM user_parent WHERE up_deleted = 0 ORDER BY up_name ASC;";
        $parent_assoc_array = $sql->assoc_array($parent_query);
        //SCHOOL ARRAY
        $school_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC;";
        $school_assoc_array = $sql->assoc_array($school_query);
        $schools = array();
        foreach ($school_assoc_array as $key => $value) {
            $new_school = new school();
            $new_school->set_school_data_by_id($value['sc_id']);
            $schools[] = $new_school;
        }
        //SCHOOL CITY ARRAY
        $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;";
        $school_city_assoc_array = $sql->assoc_array($school_city_query);
        $school_cities = array();
        foreach ($school_city_assoc_array as $key => $value) {
            $new_scc = new school_city();
            $new_scc->set_school_city_data_by_id($value['scc_id']);
            $school_cities[] = $new_scc;
        }
        //REGION ARRAY
        $region_query = "SELECT * FROM region WHERE reg_deleted = 0 ORDER BY reg_name ASC;";
        $region_assoc_array = $sql->assoc_array($region_query);

        //training type array
        $tt_assoc_array = $sql->assoc_array("SELECT * FROM training_type WHERE trt_deleted = 0 ORDER by trt_name ASC;");

        $smarty->assign('region_assoc_array', $region_assoc_array);
        $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array);
        $smarty->assign('school_assoc_array', $schools);
        $smarty->assign('school_city_assoc_array', $school_cities);
        $smarty->assign('parent_assoc_array', $parent_assoc_array);
        $smarty->assign('tt_assoc_array', $tt_assoc_array);
        $smarty->assign('today', date("Y-m-d"));

        $smarty->display('user_data_create.tpl');
        break;

    case 'training':
        //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);
        $smarty->assign("training_type_assoc_array", $training_type_assoc_array);
        //TRAINING TEMPLATE ARRAY
        $training_template_query = "SELECT * FROM training_template WHERE tt_deleted = 0 ORDER BY tt_name ASC;";
        $training_templates = $sql->assoc_array($training_template_query);
        $smarty->assign("training_templates", $training_templates);
        //COACH ARRAY
        $coach_data_query = "SELECT * FROM user_coach WHERE ua_deleted = 0 AND ua_name != 'Tóth Richárd';";
        $coach_data_assoc_array = $sql->assoc_array($coach_data_query);


        $coach_array = array();
        foreach ($coach_data_assoc_array as $coach_data) {
            $new_coach = new user();
            $new_coach->set_user_data_by_id($coach_data['ua_id']);
            $coach_array[] = $new_coach;
        }
        $smarty->assign("coach_data_assoc_array", $coach_data_assoc_array);
        $smarty->assign("coach_array", $coach_array);
        $smarty->display('training_data_create.tpl');
        break;

    case 'training_type':
        # TRAINING TYPE létrehozása
        $smarty->display('training_type_create.tpl');
        break;
    case 'parent':
        # PARENT LÉTREHOZÁSA
        $smarty->display('parent_create.tpl');
        break;
    case 'coach':
        # COACH létrehozása
        $a_assoc_array = $sql->assoc_array('SELECT * FROM authority');

        $a_array = array();
        foreach ($a_assoc_array as $key => $a) {
            $new_a = new authority();
            $new_a->set_a_data_by_id($a['a_id']);
            $a_array[] = $new_a;
        }

        $smarty->assign('a_array', $a_array);
        $smarty->display('coach_create.tpl');
        break;
    case 'shirt':
        # SHIRT létrehozása
        $smarty->display('shirt_create.tpl');
        break;
    case 'city':
        # CITY létrehozása
        $smarty->display('city_create.tpl');
        break;
    case 'region':
        # REGION létrehozása
        $smarty->display('region_create.tpl');
        break;
    case 'school':
        # SCHOOL létrehozása
        //SCHOOL CITY ARRAY
        $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;";
        $school_city_assoc_array = $sql->assoc_array($school_city_query);
        $school_cities = array();
        foreach ($school_city_assoc_array as $key => $value) {
            $new_scc = new school_city();
            $new_scc->set_school_city_data_by_id($value['scc_id']);
            $school_cities[] = $new_scc;
        }
        $smarty->assign('school_cities',$school_cities);
        $smarty->display('school_create.tpl');
        break;
    case 'money_deposit':
        # ÚJ BEFIZETÉS
        $user_kid_query = "SELECT * FROM user_kid WHERE uk_is_active = 1 AND uk_deleted = 0 order by uk_name ASC;";
        $user_kid_assoc_array = $sql->assoc_array($user_kid_query);
        $user_kids = array();
        foreach ($user_kid_assoc_array as $key => $value) {
            $new_kid = new user_kid();
            $new_kid->set_user_data_by_id($value['uk_id']);
            $user_kids[] = $new_kid;
        }

        if (isset($_POST['mod_user_kid_uk_id'])) {
            $smarty->assign('user_kid_id', $_POST['mod_user_kid_uk_id']);
        }

        $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');

        //bérlettípusok
        $l_assoc_array = $sql->assoc_array('SELECT * FROM lease WHERE l_deleted = 0 ORDER BY l_name ASC;');
        $l_array = array();

        foreach ($l_assoc_array as $key => $lease) {
            $new_lease = new lease();
            $new_lease->set_l_data_by_id($lease['l_id']);
            $l_array[] = $new_lease;
        }

        $smarty->assign('lease_array',$l_array);
        $smarty->assign('user_kids', $user_kids);
        $smarty->assign('pt_assoc_array', $pt_assoc_array);
        $smarty->display('money_deposit_create.tpl');

        break;
    case 'money_expense':
        # ÚJ KIADÁS
        $moxc_assoc_array = $sql->assoc_array('SELECT * FROM money_expense_category WHERE moxc_deleted = 0 ORDER BY moxc_name ASC;');
        $moxc_array = array();
        foreach ($moxc_assoc_array as $key => $moxc) {
            $new_moxc = new money_expense_category();
            $new_moxc->set_moxc_data_by_id($moxc['moxc_id']);
            $moxc_array[] = $new_moxc;
        }

        $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');

        $smarty->assign('pt_assoc_array', $pt_assoc_array);
        $smarty->assign('moxc_array', $moxc_array);
        $smarty->display('money_expense_create.tpl');
        break;
    case 'money_expense_category':
        # ÚJ KIADÁS KATEGÓRIA
        $smarty->display('money_expense_category_create.tpl');
        break;
    case 'money_income_category':
        # ÚJ BEVÉTEL KATEGÓRIA
        $smarty->display('money_income_category_create.tpl');
        break;
    case 'money_income':
        # ÚJ KIADÁS
        $mic_assoc_array = $sql->assoc_array('SELECT * FROM money_income_category WHERE mic_deleted = 0 AND mic_id != 4 ORDER BY mic_name ASC;');
        $mic_array = array();
        foreach ($mic_assoc_array as $key => $mic) {
            $new_mic = new money_income_category();
            $new_mic->set_mic_data_by_id($mic['mic_id']);
            $mic_array[] = $new_mic;
        }

        $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');

        $smarty->assign('pt_assoc_array', $pt_assoc_array);
        $smarty->assign('mic_array', $mic_array);
        $smarty->display('money_income_create.tpl');
        break;
    case 'training_template':
        # edzés sablon létrehozása
        //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);
        $smarty->assign("training_type_assoc_array", $training_type_assoc_array);

        $smarty->display('training_template_create.tpl');
        break;
    case 'news':
        # hír létrehozása
        $smarty->display('news_create.tpl');
        break;
    case 'lease':
        # bérlettípus létrehozása
        $training_type_query = "SELECT * FROM training_type WHERE trt_deleted = 0 ORDER BY trt_name ASC;";
        $training_type_assoc_array = $sql->assoc_array($training_type_query);
        $smarty->assign("training_type_assoc_array", $training_type_assoc_array);

        $smarty->display('lease_create.tpl');
        break;
    default:
        # code...
        break;
}


?>
