school and school_city class

user edit with parent edit included (ajax)
city and school connected
overview updated
This commit is contained in:
Ricsi
2017-01-12 22:59:36 +01:00
parent 9c7f678e74
commit 20781a0847
20 changed files with 617 additions and 184 deletions

82
_class/class_school.php Normal file
View File

@@ -0,0 +1,82 @@
<?php
//ISKOLA OSZTÁLY
class school {
private $sc_id;
private $sc_name;
private $sc_school_city_scc_id; //ID
private $sc_school_city; //OBJ
private $sc_deleted;
public function set_sc_id($_id) {
$this->sc_id = $_id;
}
public function set_sc_name($_name) {
$this->sc_name = $_name;
}
public function set_sc_school_city_scc_id($_school_city_scc_id) {
$this->sc_school_city_scc_id = $_school_city_scc_id;
}
public function set_sc_school_city($_school_city) {
$this->sc_school_city = $_school_city;
}
public function set_sc_deleted($_deleted) {
$this->sc_deleted = $_deleted;
}
public function get_sc_id() {
return $this->sc_id;
}
public function get_sc_name() {
return $this->sc_name;
}
public function get_sc_school_city_scc_id() {
return $this->sc_school_city_scc_id;
}
public function get_sc_school_city() {
return $this->sc_school_city;
}
public function get_sc_deleted() {
return $this->sc_deleted;
}
public function set_school_data_by_id($_sc_id) {
global $sql, $school;
$school_data_assoc_array = $sql->assoc_array("select * from school where sc_id = " . $_sc_id);
$school_data_array = $school_data_assoc_array[0];
foreach ($school_data_array as $field => $value) {
$function_name = "set_" . $field;
$this->$function_name($value); //alapadatok beállítása
if ($field == 'sc_school_city_scc_id' && !empty($value)) {
$sc_city = new school_city();
$sc_city->set_school_city_data_by_id($value);
$this->set_sc_school_city($sc_city);
}
}
}
public static function create_school($_sc_name, $_scc_id) {
global $sql;
return $sql->insert_into('school', array('sc_name' => $_sc_name, 'sc_school_city_scc_id' => $_scc_id));
}
public static function update_school($_sc_id, $_sc_name, $_scc_id) {
global $sql;
$sql->update_table('school', array('sc_name' => $_sc_name, 'sc_school_city_scc_id' => $_scc_id), array('sc_id' => $_sc_id));
}
}
?>