templates
This commit is contained in:
@@ -102,6 +102,14 @@ class page {
|
||||
$tpl = "edit";
|
||||
include('include_trainings.php');
|
||||
break;
|
||||
case 'training_templates':
|
||||
# EDZÉS SABLONOK
|
||||
include('include_training_templates.php');
|
||||
break;
|
||||
case 'delete_training_template':
|
||||
# EDZÉS SABLON TÖRLÉS
|
||||
include('include_delete_training_template.php');
|
||||
break;
|
||||
case 'shirts':
|
||||
# PÓLÓK
|
||||
include('include_shirts.php');
|
||||
|
||||
118
_class/class_training_template.php
Normal file
118
_class/class_training_template.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
class training_template {
|
||||
private $tt_id;
|
||||
private $tt_name;
|
||||
private $tt_time;
|
||||
private $tt_duration;
|
||||
private $tt_training_type; //object
|
||||
private $tt_deleted;
|
||||
|
||||
|
||||
public function set_tt_id($_item) {
|
||||
$this->tt_id = $_item;
|
||||
}
|
||||
|
||||
public function set_tt_name($_item) {
|
||||
$this->tt_name = $_item;
|
||||
}
|
||||
|
||||
public function set_tt_time($_item) {
|
||||
$this->tt_time = $_item;
|
||||
}
|
||||
|
||||
public function set_tt_duration($_item) {
|
||||
$this->tt_duration = $_item;
|
||||
}
|
||||
|
||||
public function set_tt_training_type($_item) {
|
||||
$this->tt_training_type = $_item;
|
||||
}
|
||||
|
||||
public function set_tt_deleted($_item) {
|
||||
$this->tt_deleted = $_item;
|
||||
}
|
||||
|
||||
public function get_tt_id() {
|
||||
return $this->tt_id;
|
||||
}
|
||||
|
||||
public function get_tt_name() {
|
||||
return $this->tt_name;
|
||||
}
|
||||
|
||||
public function get_tt_time() {
|
||||
return $this->tt_time;
|
||||
}
|
||||
|
||||
public function get_tt_duration() {
|
||||
return $this->tt_duration;
|
||||
}
|
||||
|
||||
public function get_tt_training_type() {
|
||||
return $this->tt_training_type;
|
||||
}
|
||||
|
||||
public function get_tt_deleted() {
|
||||
return $this->tt_deleted;
|
||||
}
|
||||
|
||||
public function set_tt_data_by_id($_id) {
|
||||
global $sql;
|
||||
$tt_data_assoc_array = $sql->assoc_array("select * from training_template where tt_id = " . $_id);
|
||||
$tt_data_array = $tt_data_assoc_array[0];
|
||||
foreach ($tt_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
|
||||
if ($field == 'tt_training_type' && $value != null) {
|
||||
$new_trt = new training_type();
|
||||
$new_trt->set_trt_data_by_id($value);
|
||||
$this->set_tt_training_type($new_trt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function create_tt($_name, $_time, $_type, $_duration) {
|
||||
global $sql;
|
||||
|
||||
if ($_time == '') {
|
||||
$_time = 'null';
|
||||
}
|
||||
|
||||
if ($_duration == '') {
|
||||
$_duration = 'null';
|
||||
}
|
||||
|
||||
return $sql->insert_into('training_template', array(
|
||||
'tt_name' => $_name,
|
||||
'tt_time' => $_time,
|
||||
'tt_training_type' => $_type,
|
||||
'tt_duration' => $_duration,
|
||||
));
|
||||
}
|
||||
|
||||
public static function update_tt($_name, $_time, $_type, $_duration, $_id) {
|
||||
global $sql;
|
||||
|
||||
if ($_time == '') {
|
||||
$_time = 'null';
|
||||
}
|
||||
|
||||
if ($_duration == '') {
|
||||
$_duration = 'null';
|
||||
}
|
||||
|
||||
$sql->update_table('training_template', array(
|
||||
'tt_name' => $_name,
|
||||
'tt_time' => $_time,
|
||||
'tt_training_type' => $_type,
|
||||
'tt_duration' => $_duration,
|
||||
), array('tt_id' => $_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -6,6 +6,7 @@
|
||||
class training_type {
|
||||
private $trt_id;
|
||||
private $trt_name;
|
||||
private $trt_deleted;
|
||||
|
||||
public function set_trt_id($_id) {
|
||||
$this->trt_id = $_id;
|
||||
@@ -15,6 +16,10 @@ class training_type {
|
||||
$this->trt_name = $_name;
|
||||
}
|
||||
|
||||
public function set_trt_deleted($_deleted) {
|
||||
$this->trt_deleted = $_deleted;
|
||||
}
|
||||
|
||||
public function get_trt_id() {
|
||||
return $this->trt_id;
|
||||
}
|
||||
@@ -23,11 +28,26 @@ class training_type {
|
||||
return $this->trt_name;
|
||||
}
|
||||
|
||||
public function get_trt_deleted() {
|
||||
return $this->trt_deleted;
|
||||
}
|
||||
|
||||
public function create_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
return $sql->insert_into('training_type', $_trt_value_array);
|
||||
}
|
||||
|
||||
public function set_trt_data_by_id($_id) {
|
||||
global $sql;
|
||||
$trt_data_assoc_array = $sql->assoc_array("select * from training_type where trt_id = " . $_id);
|
||||
$trt_data_array = $trt_data_assoc_array[0];
|
||||
foreach ($trt_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user