Files
code-cegled/_include/include_schools.php
Ricsi 20781a0847 school and school_city class
user edit with parent edit included (ajax)
city and school connected
overview updated
2017-01-12 22:59:36 +01:00

55 lines
1.2 KiB
PHP

<?php
# HA NINCS ID, AKKOR ISKOLALISTA
if ($this->is_id()) {
# ISKOLA SZERKESZTÉSE
$new_school = new school();
$new_school->set_school_data_by_id($this->get_id());
//SCC LIST
$school_city_query = "SELECT scc_id 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;
}
//var_dump($school_cities);
$smarty->assign('school', $new_school);
$smarty->assign('school_cities', $school_cities);
$smarty->display('school_data_edit.tpl');
}
else {
# ISKOLA LISTA
$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 $school_array) {
$new_school = new school();
$new_school->set_school_data_by_id($school_array['sc_id']);
$schools[] = $new_school;
}
$smarty->assign('schools',$schools);
$smarty->display('school_list.tpl');
}
?>