<?php

# HA NINCS ID, AKKOR EDZÉSTÍPUSLISTA

if ($this->is_id()) {

    # EDZÉS TÍPUS SZERKESZTÉSE
    $trt = new training_type();
    $trt->set_trt_data_by_id($this->get_id());

    $smarty->assign('trt', $trt);

    $smarty->display('training_type_edit.tpl');
}

else {

    # EDZÉS TÍPUS LISTA

    $tr_type_query = "SELECT * FROM training_type WHERE trt_deleted = 0 ORDER BY trt_name ASC";
    $tr_type_assoc_array = $sql->assoc_array($tr_type_query);

    $trt_array = array();
    foreach ($tr_type_assoc_array as $trt_data) {
        $new_trt = new training_type();
        $new_trt->set_trt_data_by_id($trt_data['trt_id']);
        $trt_array[] = $new_trt;
    }

    $smarty->assign('tr_type_assoc_array',$tr_type_assoc_array);
    $smarty->assign('trt_array',$trt_array);
    $smarty->display('training_type_list.tpl');

}
?>
