20161230
sql delete replaced by delete flag log list (simple), log categories minor bug fixes in css
This commit is contained in:
150
_class/class_log.php
Normal file
150
_class/class_log.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
class log {
|
||||
private $log_id;
|
||||
private $log_log_category_logc_id; //EZ CSAK AZ ID
|
||||
private $log_category; //EZ A LOG_CATEGORY OBJEKTUM
|
||||
private $log_date;
|
||||
private $log_user_id; //EZ CSAK AZ ID
|
||||
private $log_user; //EZ A USER OBJEKTUM
|
||||
private $log_text;
|
||||
|
||||
|
||||
public static function register($_category_name, $_text, $_date = null, $_user_id = null) {
|
||||
global $sql, $user;
|
||||
$category_id = $sql->single_variable("SELECT logc_id FROM log_category WHERE logc_name = '" . $_category_name . "';");
|
||||
|
||||
if (is_object($user)) {
|
||||
//ha a user változó objektum, akkor megvizsgáljuk, hogy coach vagy parent
|
||||
if (get_class($user) == 'user') $function_name = 'get_ua_id';
|
||||
elseif(get_class($user) == 'user_kid') $function_name = 'get_uk_id';
|
||||
}
|
||||
|
||||
$sql->insert_into('log', array(
|
||||
'log_log_category_logc_id' => $category_id,
|
||||
'log_user_id' => (!$_user_id?$user->$function_name():$_user_id),
|
||||
'log_date' => (!$_date?date("Y-m-d H:i:s"):$_date),
|
||||
'log_text' => $_text
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function set_log_id($_id) {
|
||||
$this->log_id = $_id;
|
||||
}
|
||||
|
||||
public function set_log_log_category_logc_id($_log_category_logc_id) {
|
||||
$this->log_log_category_logc_id = $_log_category_logc_id;
|
||||
}
|
||||
|
||||
public function set_log_category($_category) {
|
||||
$this->log_category = $_category;
|
||||
}
|
||||
|
||||
public function set_log_date($_date) {
|
||||
$this->log_date = $_date;
|
||||
}
|
||||
|
||||
public function set_log_user_id($_user_id) {
|
||||
$this->log_user_id = $_user_id;
|
||||
}
|
||||
|
||||
public function set_log_user($_user) {
|
||||
$this->log_user = $_user;
|
||||
}
|
||||
|
||||
public function set_log_text($_text) {
|
||||
$this->log_text = $_text;
|
||||
}
|
||||
|
||||
public function set_log_table($_table) {
|
||||
$this->log_table = $_table;
|
||||
}
|
||||
|
||||
public function set_log_field($_field) {
|
||||
$this->log_field = $_field;
|
||||
}
|
||||
|
||||
public function set_log_selector($_selector) {
|
||||
$this->log_selector = $_selector;
|
||||
}
|
||||
|
||||
public function get_log_id() {
|
||||
return $this->log_id;
|
||||
}
|
||||
|
||||
public function get_log_log_category_logc_id() {
|
||||
return $this->log_log_category_logc_id;
|
||||
}
|
||||
|
||||
public function get_log_category() {
|
||||
return $this->log_category;
|
||||
}
|
||||
|
||||
public function get_log_date() {
|
||||
return $this->log_date;
|
||||
}
|
||||
|
||||
public function get_log_user_id() {
|
||||
return $this->log_user_id;
|
||||
}
|
||||
|
||||
public function get_log_user() {
|
||||
return $this->log_user;
|
||||
}
|
||||
|
||||
public function get_log_text() {
|
||||
global $sql;
|
||||
//ha nincs TABLE beállítva, akkor visszaadja az üzenetet
|
||||
if (!$this->get_log_category()->get_logc_table()) return $this->log_text;
|
||||
else return $sql->single_variable("SELECT " . $this->get_log_category()->get_logc_field() . " FROM " . $this->get_log_category()->get_logc_table() . " WHERE " . $this->get_log_category()->get_logc_selector() . " = " . $this->log_text);
|
||||
}
|
||||
|
||||
public function get_log_table() {
|
||||
return $this->log_table;
|
||||
}
|
||||
|
||||
public function get_log_field() {
|
||||
return $this->log_field;
|
||||
}
|
||||
|
||||
public function get_log_selector() {
|
||||
return $this->log_selector;
|
||||
}
|
||||
|
||||
public function get_log_img() {
|
||||
if (strstr($this->get_log_category()->get_logc_name(), 'new')) return 'tick';
|
||||
elseif (strstr($this->get_log_category()->get_logc_name(), 'delete')) return 'delete';
|
||||
elseif (strstr($this->get_log_category()->get_logc_name(), 'update')) return 'edit';
|
||||
elseif (in_array($this->get_log_category()->get_logc_name(), array('training_close', 'training_open'))) return 'lock';
|
||||
elseif (in_array($this->get_log_category()->get_logc_name(), array('admin_login', 'admin_logout', 'kid_login', 'kid_logout'))) return 'login';
|
||||
}
|
||||
|
||||
public function set_log_data_by_id($_log_id) {
|
||||
global $sql, $user;
|
||||
$log_data_assoc_array = $sql->assoc_array("select * from log where log_id = " . $_log_id);
|
||||
$log_data_array = $log_data_assoc_array[0];
|
||||
foreach ($log_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value);
|
||||
if ($field == 'log_log_category_logc_id') {
|
||||
//beállítja a log_category objektumot
|
||||
$log_cat = new log_category();
|
||||
$log_cat->set_logc_data_by_id($value);
|
||||
$this->set_log_category($log_cat);
|
||||
}
|
||||
|
||||
if ($field == 'log_user_id') {
|
||||
//beállítja a log_user objektumot
|
||||
if ($this->get_log_category()->get_logc_type() == 1) $new_user = new user();
|
||||
elseif($this->get_log_category()->get_logc_type() == 2) $new_user = new user_kid();
|
||||
$new_user->set_user_data_by_id($value);
|
||||
$this->set_log_user($new_user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
79
_class/class_log_category.php
Normal file
79
_class/class_log_category.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
class log_category {
|
||||
private $logc_id;
|
||||
private $logc_name;
|
||||
private $logc_title;
|
||||
private $logc_type;
|
||||
private $logc_table;
|
||||
private $logc_field;
|
||||
private $logc_selector;
|
||||
|
||||
public function set_logc_id($_id) {
|
||||
$this->logc_id = $_id;
|
||||
}
|
||||
|
||||
public function set_logc_name($_name) {
|
||||
$this->logc_name = $_name;
|
||||
}
|
||||
|
||||
public function set_logc_title($_title) {
|
||||
$this->logc_title = $_title;
|
||||
}
|
||||
|
||||
public function set_logc_type($_type) {
|
||||
$this->logc_type = $_type;
|
||||
}
|
||||
|
||||
public function set_logc_table($_table) {
|
||||
$this->logc_table = $_table;
|
||||
}
|
||||
|
||||
public function set_logc_field($_field) {
|
||||
$this->logc_field = $_field;
|
||||
}
|
||||
|
||||
public function set_logc_selector($_selector) {
|
||||
$this->logc_selector = $_selector;
|
||||
}
|
||||
|
||||
public function get_logc_id() {
|
||||
return $this->logc_id;
|
||||
}
|
||||
|
||||
public function get_logc_name() {
|
||||
return $this->logc_name;
|
||||
}
|
||||
|
||||
public function get_logc_title() {
|
||||
return $this->logc_title;
|
||||
}
|
||||
|
||||
public function get_logc_type() {
|
||||
return $this->logc_type;
|
||||
}
|
||||
|
||||
public function get_logc_table() {
|
||||
return $this->logc_table;
|
||||
}
|
||||
|
||||
public function get_logc_field() {
|
||||
return $this->logc_field;
|
||||
}
|
||||
|
||||
public function get_logc_selector() {
|
||||
return $this->logc_selector;
|
||||
}
|
||||
|
||||
public function set_logc_data_by_id($_logc_id) {
|
||||
global $sql, $user;
|
||||
$logc_data_assoc_array = $sql->assoc_array("select * from log_category where logc_id = " . $_logc_id);
|
||||
$logc_data_array = $logc_data_assoc_array[0];
|
||||
foreach ($logc_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -125,6 +125,10 @@ class page {
|
||||
# DIÁKOLIMPIA KÖRZETEK
|
||||
include('include_regions.php');
|
||||
break;
|
||||
case 'log':
|
||||
# NAPLÓ
|
||||
include('include_log.php');
|
||||
break;
|
||||
case 'lock_training':
|
||||
# EDZÉS ZÁROLÁS, FELOLDÁS
|
||||
include('include_lock_training.php');
|
||||
|
||||
@@ -15,6 +15,7 @@ class training {
|
||||
private $tr_user_coach_uc_id;
|
||||
private $tr_duration;
|
||||
private $tr_locked;
|
||||
private $tr_deleted;
|
||||
private $coaches = array();
|
||||
|
||||
|
||||
@@ -38,6 +39,10 @@ class training {
|
||||
$this->tr_locked = $_tr_locked;
|
||||
}
|
||||
|
||||
public function set_tr_deleted($_tr_deleted) {
|
||||
$this->tr_deleted = $_tr_deleted;
|
||||
}
|
||||
|
||||
public function get_tr_id() {
|
||||
return $this->tr_id;
|
||||
}
|
||||
@@ -70,6 +75,10 @@ class training {
|
||||
return $this->tr_locked;
|
||||
}
|
||||
|
||||
public function get_tr_deleted() {
|
||||
return $this->tr_deleted;
|
||||
}
|
||||
|
||||
public function get_tr_type_name_by_id() {
|
||||
global $sql;
|
||||
return $sql->single_variable("SELECT trt_name FROM training_type WHERE trt_id = " . $this->get_tr_training_type_trt_id());
|
||||
@@ -79,7 +88,7 @@ class training {
|
||||
//beállítja a tr_coaches array-be a coach-okat
|
||||
//EZ CSAK AZ EDZŐKET ÁLLÍTJA BE, A SEGÉDEDZŐKET NEM
|
||||
global $sql;
|
||||
$coach_ids = $sql->assoc_array("SELECT trc_coach_uc_id FROM training_coach WHERE trc_helper = 0 AND trc_training_tr_id = " . $this->get_tr_id());
|
||||
$coach_ids = $sql->assoc_array("SELECT trc_coach_uc_id FROM training_coach JOIN user_coach ON ua_id = trc_coach_uc_id WHERE ua_deleted = 0 AND trc_helper = 0 AND trc_training_tr_id = " . $this->get_tr_id());
|
||||
$this->tr_coaches = array();
|
||||
foreach ($coach_ids as $trc) {
|
||||
$this->tr_coaches[] = $trc['trc_coach_uc_id'];
|
||||
@@ -131,6 +140,7 @@ class training {
|
||||
'tr_duration' => $_training_value_array['tr_duration']
|
||||
)
|
||||
);
|
||||
log::register('new_training', $new_tr_id);
|
||||
//itt rakjuk be a coach-okat
|
||||
if (isset($_training_value_array['coaches'])) {
|
||||
foreach ($_training_value_array['coaches'] as $coach_id) {
|
||||
@@ -163,7 +173,8 @@ class training {
|
||||
if (isset($coaches)) {
|
||||
foreach ($coaches as $coach_id) {
|
||||
# beilleszt minden edzőt ehhez az edzéshez
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id));
|
||||
$new_tr_id = $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id));
|
||||
log::register('new_training', $new_tr_id);
|
||||
}
|
||||
}
|
||||
if (isset($helpers)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ class user_kid extends user_parent {
|
||||
private $user_region;
|
||||
private $user_contact;
|
||||
private $user_other;
|
||||
private $user_deleted;
|
||||
|
||||
public function set_uk_id($_uid) {
|
||||
$this->user_id = $_uid;
|
||||
@@ -88,6 +89,9 @@ class user_kid extends user_parent {
|
||||
public function set_uk_other($_uk_other) {
|
||||
$this->user_other = $_uk_other;
|
||||
}
|
||||
public function set_uk_deleted($_uk_deleted) {
|
||||
$this->user_deleted = $_uk_deleted;
|
||||
}
|
||||
|
||||
public function get_uk_id() {
|
||||
return $this->user_id;
|
||||
@@ -164,6 +168,9 @@ class user_kid extends user_parent {
|
||||
public function get_uk_other() {
|
||||
return $this->user_other;
|
||||
}
|
||||
public function get_uk_deleted() {
|
||||
return $this->user_deleted;
|
||||
}
|
||||
|
||||
|
||||
public function get_uk_presence($_training_id) {
|
||||
|
||||
@@ -17,6 +17,7 @@ class user_parent {
|
||||
private $up_email;
|
||||
private $up_phone;
|
||||
private $up_facebook;
|
||||
private $up_deleted;
|
||||
private $logged_in;
|
||||
|
||||
|
||||
@@ -48,6 +49,10 @@ class user_parent {
|
||||
$this->up_facebook = $_facebook;
|
||||
}
|
||||
|
||||
public function set_up_deleted($_deleted) {
|
||||
$this->up_deleted = $_deleted;
|
||||
}
|
||||
|
||||
public function get_up_id() {
|
||||
return $this->up_id;
|
||||
}
|
||||
@@ -76,6 +81,12 @@ class user_parent {
|
||||
return $this->up_facebook;
|
||||
}
|
||||
|
||||
public function get_up_deleted() {
|
||||
return $this->up_deleted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function set_login($_login) {
|
||||
//bool-t kap paraméterül
|
||||
$this->logged_in = $_login;
|
||||
|
||||
Reference in New Issue
Block a user