From 31bf036be3be01ef7b3bbc9dc08813f0740dab9a Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Mon, 23 Mar 2020 01:17:58 +0100 Subject: Rev: 4630 --- .../install/module-naplo/mysql/tanev.sql | 14 ++++++ mayor-orig/mayor-naplo/log/mayor-naplo.rev | 2 +- .../mayor-naplo/update/pre004627-1-naplo.sql | 29 +++++++++++++ .../include/modules/naplo/haladasi/haladasi.php | 1 + .../www/include/modules/naplo/share/ora.php | 18 +++++++- .../policy/private/naplo/haladasi/haladasi-pre.php | 3 ++ .../private/naplo/haladasi/hazifeladat-pre.php | 32 +++++++++++++- .../policy/private/naplo/orarend/orarend-pre.php | 2 +- .../module-naplo/css/haladasi/hazifeladat.css | 31 ++++++++++++++ .../module-naplo/html/haladasi/haladasi.phtml | 7 ++- .../module-naplo/html/haladasi/hazifeladat.phtml | 50 ++++++++++++++++++++-- .../module-naplo/html/orarend/orarend.phtml | 6 +-- 12 files changed, 182 insertions(+), 13 deletions(-) create mode 100644 mayor-orig/mayor-naplo/update/pre004627-1-naplo.sql create mode 100644 mayor-orig/mayor-naplo/www/skin/classic/module-naplo/css/haladasi/hazifeladat.css (limited to 'mayor-orig/mayor-naplo') diff --git a/mayor-orig/mayor-naplo/install/module-naplo/mysql/tanev.sql b/mayor-orig/mayor-naplo/install/module-naplo/mysql/tanev.sql index eeaca556..59ee0c39 100644 --- a/mayor-orig/mayor-naplo/install/module-naplo/mysql/tanev.sql +++ b/mayor-orig/mayor-naplo/install/module-naplo/mysql/tanev.sql @@ -152,6 +152,20 @@ CREATE TABLE `oraHazifeladat` ( CONSTRAINT `oraHazifeladat_ibfk_1` FOREIGN KEY (`oraId`) REFERENCES `ora` (`oraId`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci; +CREATE TABLE `oraHazifeladatDiak` ( + `hazifeladatId` int(10) unsigned NOT NULL DEFAULT '0', + `diakId` int(10) unsigned NOT NULL DEFAULT '0', + `diakLattamDt` datetime DEFAULT NULL, + `tanarLattamDt` datetime DEFAULT NULL, + `hazifeladatDiakStatus` enum('','kész') COLLATE utf8_hungarian_ci DEFAULT '', + `hazifeladatDiakMegjegyzes` varchar(255) COLLATE utf8_hungarian_ci NOT NULL, + PRIMARY KEY (`hazifeladatId`,`diakId`), + UNIQUE KEY `oraHazifeladatDiak_UK` (`hazifeladatId`,`diakId`), + KEY `oraHazifeladatDiak_ibfk_2` (`diakId`), + CONSTRAINT `oraHazifeladatDiak_ibfk_1` FOREIGN KEY (`hazifeladatId`) REFERENCES `oraHazifeladat` (`hazifeladatId`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `oraHazifeladatDiak_ibfk_2` FOREIGN KEY (`diakId`) REFERENCES `%DB%`.`diak` (`diakId`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci; + CREATE TABLE `orarendiOraTankor` ( `tanarId` int(10) unsigned NOT NULL, `osztalyJel` varchar(7) COLLATE utf8_bin NOT NULL, diff --git a/mayor-orig/mayor-naplo/log/mayor-naplo.rev b/mayor-orig/mayor-naplo/log/mayor-naplo.rev index cebe3996..686eea15 100644 --- a/mayor-orig/mayor-naplo/log/mayor-naplo.rev +++ b/mayor-orig/mayor-naplo/log/mayor-naplo.rev @@ -1 +1 @@ -4627 +4630 diff --git a/mayor-orig/mayor-naplo/update/pre004627-1-naplo.sql b/mayor-orig/mayor-naplo/update/pre004627-1-naplo.sql new file mode 100644 index 00000000..ba6686cd --- /dev/null +++ b/mayor-orig/mayor-naplo/update/pre004627-1-naplo.sql @@ -0,0 +1,29 @@ +DELIMITER $$ +DROP PROCEDURE IF EXISTS upgrade_database_4627 $$ + +CREATE PROCEDURE upgrade_database_4627() +BEGIN +SET NAMES utf8 COLLATE utf8_hungarian_ci; + +IF NOT EXISTS ( + SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() and TABLE_NAME='oraHazifeladatDiak' +) THEN + +CREATE TABLE `oraHazifeladatDiak` ( + `hazifeladatId` int(10) unsigned DEFAULT NULL, + `diakId` int(10) unsigned DEFAULT NULL, + `diakLattamDt` datetime DEFAULT NULL, + `tanarLattamDt` datetime DEFAULT NULL, + `hazifeladatDiakStatus` ENUM('','kész') DEFAULT '', + `hazifeladatDiakMegjegyzes` varchar(255) COLLATE utf8_hungarian_ci NOT NULL, + PRIMARY KEY (`hazifeladatId`,`diakId`), + UNIQUE KEY `oraHazifeladatDiak_UK` (`hazifeladatId`,`diakId`), + CONSTRAINT `oraHazifeladatDiak_ibfk_1` FOREIGN KEY (`hazifeladatId`) REFERENCES `oraHazifeladat` (`hazifeladatId`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `oraHazifeladatDiak_ibfk_2` FOREIGN KEY (`diakId`) REFERENCES %INTEZMENYDB%.`diak` (`diakId`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci; + +END IF; + +END $$ +DELIMITER ; +CALL upgrade_database_4627(); diff --git a/mayor-orig/mayor-naplo/www/include/modules/naplo/haladasi/haladasi.php b/mayor-orig/mayor-naplo/www/include/modules/naplo/haladasi/haladasi.php index 0be1c61a..92d07ee8 100644 --- a/mayor-orig/mayor-naplo/www/include/modules/naplo/haladasi/haladasi.php +++ b/mayor-orig/mayor-naplo/www/include/modules/naplo/haladasi/haladasi.php @@ -134,6 +134,7 @@ $v = array($sor['oraId']); $sor['cimke'] = db_query($q, array('fv' => 'getHaladasi/cimkek', 'modul' => 'naplo', 'result' => 'idonly', 'values' => $v), $lr); } + $ret[$sor['dt']][] = $sor; } // Nap információk lekérdezése diff --git a/mayor-orig/mayor-naplo/www/include/modules/naplo/share/ora.php b/mayor-orig/mayor-naplo/www/include/modules/naplo/share/ora.php index 7c4c4b4e..602f26e1 100644 --- a/mayor-orig/mayor-naplo/www/include/modules/naplo/share/ora.php +++ b/mayor-orig/mayor-naplo/www/include/modules/naplo/share/ora.php @@ -371,7 +371,7 @@ WHERE dt>='%s' and dt<='%s' AND (ki=%u OR kit=%u) $WHERE ORDER BY dt,ora"; return $RESULT; } - function getOrak($TANKORIDK, $SET=array('tolDt'=>'','igDt'=>'', 'result'=>'likeOrarend', 'elmaradokNelkul'=>false)) { + function getOrak($TANKORIDK, $SET=array('tolDt'=>'','igDt'=>'', 'result'=>'likeOrarend', 'elmaradokNelkul'=>false, 'diakId'=>null)) { /* FIGYELEM! A függvény feltételezi, hogy az átadott tankoridkben az adott intervallumon helyes adatok szerepelnek! -- problémát okozhat, ha hosszú intervallumot adunk meg!!! -- lásd FS#100 */ @@ -404,6 +404,12 @@ WHERE dt>='%s' and dt<='%s' AND tankorId IN (".implode(',', array_fill(0, count( $_put['oo'] = false; $RE['orak'][$R[$i]['dt']][$R[$i]['ora']][$R[$i]['tankorId']] = $_put; if (!in_array($R[$i]['tankorId'],$RE['tankorok'])) $RE['tankorok'][] = intval($R[$i]['tankorId']); + if ($R[$i]['hazifeladatId']>0) { + if ($SET['diakId']>0) { + $diakHazifeladat = getDiakHazifeladatByOraIds(array($R[$i]['oraId']) , $SET['diakId']); + $RE['orak'][$R[$i]['dt']][$R[$i]['ora']][$R[$i]['tankorId']]['diakHazifeladat'] = $diakHazifeladat[$R[$i]['oraId']]; + } + } } } return $RE; @@ -641,5 +647,15 @@ WHERE dt>='%s' and dt<='%s' AND tankorId IN (".implode(',', array_fill(0, count( } } + function getDiakHazifeladatByOraIds($oraIdk,$diakId,$olr='') { + $R = array(); + if (count($oraIdk)>0 && $diakId>0) { + $q = "SELECT * FROM oraHazifeladat LEFT JOIN oraHazifeladatDiak USING (hazifeladatId) WHERE diakId=%u AND oraId IN (".implode(',',$oraIdk).")"; + $v = array($diakId); + $R = db_query($q,array('debug'=>false,'fv'=>'getDiakhazifeladatByOraIds','modul'=>'naplo','values'=>$v,'result'=>'assoc','keyfield'=>'oraId'),$olr); + } + return $R; + } + ?> diff --git a/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/haladasi-pre.php b/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/haladasi-pre.php index 9b397670..a7c57b7f 100644 --- a/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/haladasi-pre.php +++ b/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/haladasi-pre.php @@ -361,6 +361,9 @@ if ( $skin == 'ajax' } } $ADAT['oraLatogatasok'] = getOralatogatasByOraIds($ADAT['ORAIDK']); + if (__DIAK===true && $diakId>0) { + $ADAT['diakHazifeladat'] = getDiakHazifeladatByOraIds($ADAT['ORAIDK'],$diakId); + } foreach ($ADAT['oraLatogatasok'] as $olId => $olAdat) foreach ($olAdat['tanarIds'] as $_tanarId) $ADAT['oraLatogatasok'][$olId]['tanarNevek'][] = getTanarNevById($_tanarId); // Kell a munkaterv!! Ahhoz kell(enek) az osztály(ok)! diff --git a/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/hazifeladat-pre.php b/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/hazifeladat-pre.php index ba0a27c4..28a02d5a 100644 --- a/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/hazifeladat-pre.php +++ b/mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/hazifeladat-pre.php @@ -23,7 +23,7 @@ $ADAT['oraId' ] = $oraId = readVariable($_POST['oraId'],'id',readVariable($_GET['oraId'],'id')); // $ADAT['hazifeladatId' ] = $hazifeladatId = readVariable($_POST['hazifeladatId'],'id', readVariable($_GET['hazifeladatId'],'id')); $ADAT['hazifeladatLeiras' ] = readVariable($_POST['hazifeladatLeiras'],'string'); - $action = readVariable($_POST['action'],'strictstring',null,array('hazifeladatBeiras')); + $action = readVariable($_POST['action'],'strictstring',null,array('hazifeladatBeiras','hazifeladatKesz')); $q = "SELECT hazifeladatId FROM oraHazifeladat WHERE oraId=%u"; $values = array($ADAT['oraId']); @@ -46,13 +46,41 @@ $leiras = readVariable($_POST['oraLeiras'],'string'); updateHaladasiNaploOra($oraId, $leiras); } + } elseif (__DIAK===true) { + if (defined('__USERDIAKID') && __USERDIAKID>0) { + $diakId=__USERDIAKID; + } elseif (defined('__SZULODIAKID') && __SZULODIAKID>0) { + $diakId=__SZULODIAKID; + } + if ($diakId>0) { + $q = "INSERT IGNORE INTO oraHazifeladatDiak (hazifeladatId,diakId,diakLattamDt) VALUES (%u,%u,NOW())"; + $values = array($ADAT['hazifeladatId'], $diakId); + db_query($q, array('modul'=>'naplo','result'=>'insert','values'=>$values)); + + if ($action=='hazifeladatKesz') { + if ($diakId>0 && $ADAT['hazifeladatId']>0) { + $q = "UPDATE oraHazifeladatDiak SET hazifeladatDiakStatus=IF(hazifeladatDiakStatus='','kész','') WHERE hazifeladatId=%u AND diakId=%u"; + $values = array($ADAT['hazifeladatId'], $diakId); + db_query($q, array('modul'=>'naplo','result'=>'update','values'=>$values)); + } + } + $q = "SELECT * FROM oraHazifeladatDiak WHERE hazifeladatId=%u AND diakId=%u"; + $values = array($ADAT['hazifeladatId'],$diakId); + $ADAT['hazifeladatDiak'] = db_query($q, array('modul'=>'naplo','result'=>'record','values'=>$values)); + } + } $q = "SELECT * FROM oraHazifeladat WHERE oraId=%u"; $values = array($ADAT['oraId']); $ADAT['hazifeladatAdat'] = db_query($q, array('modul'=>'naplo','result'=>'record','values'=>$values)); - $ADAT['oraAdat'] = getOraadatById($oraId); + if (__TANAR===true || __NAPLOADMIN===true || __VEZETOSEG===true) { + $q = "SELECT *,getNev(diakId,'diak') AS diakNev FROM oraHazifeladatDiak WHERE hazifeladatId=%u ORDER BY diakNev"; + $values = array($ADAT['hazifeladatId']); + $ADAT['hazifeladatDiak'] = db_query($q, array('debug'=>true,'modul'=>'naplo','result'=>'indexed','values'=>$values)); + } + $ADAT['oraAdat'] = getOraadatById($oraId); $TOOL['vissza'] = array('tipus'=>'vissza', 'paramName'=>'vissza', diff --git a/mayor-orig/mayor-naplo/www/policy/private/naplo/orarend/orarend-pre.php b/mayor-orig/mayor-naplo/www/policy/private/naplo/orarend/orarend-pre.php index 6421687a..c56b6d87 100644 --- a/mayor-orig/mayor-naplo/www/policy/private/naplo/orarend/orarend-pre.php +++ b/mayor-orig/mayor-naplo/www/policy/private/naplo/orarend/orarend-pre.php @@ -191,7 +191,7 @@ if ($teremId!='') $_D = getOrakByTeremId($teremId,array('tolDt'=>$_dt,'igDt'=>$_dt,'result'=>'likeOrarend')); else - $_D = getOrak($TANKOROK['haladasi'],array('tolDt'=>$_dt,'igDt'=>$_dt,'result'=>'likeOrarend')); + $_D = getOrak($TANKOROK['haladasi'],array('tolDt'=>$_dt,'igDt'=>$_dt,'result'=>'likeOrarend','diakId'=>$diakId)); $ADAT['haladasi']['orak'][$_dt] = $_D['orak'][$_dt]; if (is_array($_D['tankorok'])) $ADAT['haladasi']['tankorok'] = array_map('intval',array_unique(array_merge($_D['tankorok'],$ADAT['haladasi']['tankorok']))); } diff --git a/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/css/haladasi/hazifeladat.css b/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/css/haladasi/hazifeladat.css new file mode 100644 index 00000000..1cce1e3e --- /dev/null +++ b/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/css/haladasi/hazifeladat.css @@ -0,0 +1,31 @@ + + fieldset.adatok { margin-bottom:1em; width:80%; margin-left:auto; margin-right:auto; border-radius: 2px; border: solid 1px #ddd;} + fieldset.adatok legend { border-radius: 2px; background-color: #ff5722; color:white; padding: 2px 4px; } + + fieldset.adatok.kesz legend { background-color:lightgreen} + + form button.btnHfStatusz { + background-color: #eee; + border-radius: 2px; + border: solid 1px #888; + color: #888; + padding:2px 18px 2px 4px; + } + form button.btnHfStatusz span { color:#eee; } + form button.btnHfStatusz.kesz span { color: lightgreen; } + + form button.btnHfStatusz:hover { + background-color:lightgreen; + color:black; + border-color:black; + } + form button.btnHfStatusz.kesz:hover { + background-color: orange; + } + form button.btnHfStatusz:hover span { color: white; } + + form button.btnHfStatusz.kesz:hover span { color: orange } + + table.hazifeladatDiak { margin:auto; background-color: #eee;} + table.hazifeladatDiak thead tr th { background-color: #4caf50; color:white; font-weight:normal;} + table.hazifeladatDiak tbody tr td { background-color: white; font-weight:normal; padding: 2px 4px;} diff --git a/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/haladasi.phtml b/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/haladasi.phtml index 3c36e9f2..e267cf27 100644 --- a/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/haladasi.phtml +++ b/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/haladasi.phtml @@ -528,7 +528,12 @@ } echo ''; if ($dOra['hazifeladatId']>0) { - echo ''; + if ($ADAT['diakHazifeladat'][$dOra['oraId']]['hazifeladatDiakStatus'] =='kész') { + $hfColor = 'lightgreen'; + } else { + $hfColor = '#ff5722'; + } + echo ''; } else { echo ''; } diff --git a/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/hazifeladat.phtml b/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/hazifeladat.phtml index e2b6d3ef..c5a26c13 100644 --- a/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/hazifeladat.phtml +++ b/mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/hazifeladat.phtml @@ -2,13 +2,13 @@ function putHazifeladat($ADAT) { - echo ''; - +*/ echo '