From 5d31312b97c7f3fa3fb79ab71de7ab46dd50d57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 12 Jan 2018 16:30:16 +0100 Subject: [PATCH] =?UTF-8?q?PersonenLog=20Klasse=20f=C3=BCr=20nicht-CI=20Co?= =?UTF-8?q?de=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/functions.inc.php | 7 ++-- include/personlog.class.php | 68 +++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 include/personlog.class.php diff --git a/include/functions.inc.php b/include/functions.inc.php index 86e4da84f..eb49206f5 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -22,6 +22,7 @@ require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/authentication.class.php'); require_once(dirname(__FILE__).'/betriebsmittelperson.class.php'); +require_once(dirname(__FILE__).'/personlog.class.php'); // Auth: Benutzer des Webportals /** @@ -1081,9 +1082,9 @@ function cutString($string, $limit, $placeholderSign = '', $keepFileextension = } } -function PersonLog($ci, $person_id, $logtype_kurzbz, $logdata, $app, $oe_kurzbz = null, $user=null) +function PersonLog($person_id, $logtype_kurzbz, $logdata, $app, $oe_kurzbz = null, $user=null) { - $ci->load->library('PersonLogLib'); - $ci->personloglib->log($person_id, $logtype_kurzbz, $logdata, $app, $oe_kurzbz, $user); + $personlog = new personlog(); + $personlog->log($person_id, $logtype_kurzbz, $logdata, $app, $oe_kurzbz, $user); } ?> diff --git a/include/personlog.class.php b/include/personlog.class.php new file mode 100644 index 000000000..93a810a6c --- /dev/null +++ b/include/personlog.class.php @@ -0,0 +1,68 @@ + + */ +require_once(dirname(__FILE__).'/basis_db.class.php'); + +class personlog extends basis_db +{ + public $new; // boolean + public $logs = array(); // lehreinheit Objekt + + //Tabellenspalten + public $log_id; // Serial + public $person_id; + public $zeitpunkt; // timestamp + public $app; // varchar(32) + public $oe_kurzbz; // varchar(32) + public $logtype_kurzbz; // varchar(32) + public $logdata; + public $insertvon; + + /** + * Konstruktor + */ + public function __construct($log_id=null) + { + parent::__construct(); + } + + public function log($person_id, $logtype_kurzbz, $logdata, $app='core', $oe_kurzbz='null', $user=null) + { + $qry = "INSERT INTO system.tbl_log(person_id, zeitpunkt, app, oe_kurzbz, + logtype_kurzbz, logdata, insertvon) VALUES(". + $this->db_add_param($person_id).','. + $this->db_add_param(date('Y-m-d H:i:s')).','. + $this->db_add_param($app).','. + $this->db_add_param($oe_kurzbz).','. + $this->db_add_param($logtype_kurzbz).','. + $this->db_add_param(json_encode($logdata)).','. + $this->db_add_param($user).')'; + + if($this->db_query($qry)) + { + return true; + } + else + { + $this->errormsg = 'Fehler beim Speichern des Logeintrages'; + return false; + } + } +} +?>