aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-naplo/www
diff options
context:
space:
mode:
authorM.Gergo2020-03-24 15:53:18 +0100
committerM.Gergo2020-03-24 15:53:18 +0100
commit351ace3031cf063cef346027ae209d218225242a (patch)
tree11d7f1b7e30df558a54ed9f4a66598cf66de4a67 /mayor-orig/mayor-naplo/www
parent16626ba293babee3cd822e08021c7334282a8a6b (diff)
downloadmayor-351ace3031cf063cef346027ae209d218225242a.tar.gz
mayor-351ace3031cf063cef346027ae209d218225242a.zip
Rev: 4632rev4632
Diffstat (limited to 'mayor-orig/mayor-naplo/www')
-rw-r--r--mayor-orig/mayor-naplo/www/lang/hu_HU/module-naplo/haladasi/hazifeladat.php2
-rw-r--r--mayor-orig/mayor-naplo/www/policy/private/naplo/haladasi/hazifeladat-pre.php75
-rw-r--r--mayor-orig/mayor-naplo/www/skin/classic/module-naplo/css/haladasi/hazifeladat.css34
-rw-r--r--mayor-orig/mayor-naplo/www/skin/classic/module-naplo/html/haladasi/hazifeladat.phtml109
4 files changed, 193 insertions, 27 deletions
diff --git a/mayor-orig/mayor-naplo/www/lang/hu_HU/module-naplo/haladasi/hazifeladat.php b/mayor-orig/mayor-naplo/www/lang/hu_HU/module-naplo/haladasi/hazifeladat.php
index 6799d19e..c9767f65 100644
--- a/mayor-orig/mayor-naplo/www/lang/hu_HU/module-naplo/haladasi/hazifeladat.php
+++ b/mayor-orig/mayor-naplo/www/lang/hu_HU/module-naplo/haladasi/hazifeladat.php
@@ -37,5 +37,5 @@
define('_ALAPADATOK','Óra adatok');
define('_HAZIFELADAT','Házi feladat, Részletek, Referenciák, Hivatkozások');
-
+ define('_HAZIFELTOLTES','Házi feltöltés (max. 1 file)');
?>
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 28a02d5a..d0f4cb6b 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
@@ -18,12 +18,36 @@
require_once('include/modules/naplo/share/hetes.php');
require_once('include/modules/naplo/share/helyettesitesModifier.php');
require_once('include/modules/naplo/share/file.php');
+ require_once('include/share/net/upload.php');
require_once('include/share/date/names.php');
+// config
+ define('FILE_UPLOAD_DIR',_DOWNLOADDIR.'/private/naplo/haladasi/hazifeladat/');
+ $config['lowfreespacelimit'] = 335617790; // 330MB
+/*
+ dump(disk_free_space($config['dir']));
+ dump($file_uploads = ini_get('file_uploads')); // must be On
+ dump($post_max_size = ini_get('post_max_size')); // recommended: 64M
+ dump($upload_max_filesize = ini_get('upload_max_filesize')); // recommended: 60M
+ dump(human_filesize(file_upload_max_size()));
+*/
+
+ if (disk_free_space(FILE_UPLOAD_DIR)<$config['lowfreespacelimit']) {
+ $disableUpload = true;
+ if (__NAPLOADMIN === true) $_SESSION['alert'][] = 'info:nincs elég szabad hely, ezért nem tudsz filet feltölteni';
+ }
+ if (!ini_get('file_uploads')) {
+ $disableUpload = true;
+ if (__NAPLOADMIN === true) $_SESSION['alert'][] = 'info:feltöltés kikapcsolva (file_uploads)';
+ }
+ if ($disableUpload===true) define('FILE_UPLOAD_ENABLED',false);
+ else define('FILE_UPLOAD_ENABLED',true);
+// --
+
$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','hazifeladatKesz'));
+ $action = readVariable($_POST['action'],'strictstring',null,array('hazifeladatBeiras','hazifeladatKesz','hazifeladatFeltoltes','lattam'));
$q = "SELECT hazifeladatId FROM oraHazifeladat WHERE oraId=%u";
$values = array($ADAT['oraId']);
@@ -46,12 +70,24 @@
$leiras = readVariable($_POST['oraLeiras'],'string');
updateHaladasiNaploOra($oraId, $leiras);
}
+ } elseif (__TANAR===true && $action=='lattam') {
+ $lattamDiakIds = readVariable($_POST['lattam'],'id');
+ $q = "UPDATE oraHazifeladatDiak SET tanarLattamDt=null WHERE hazifeladatId=%u";
+ $values = array($ADAT['hazifeladatId'], $_diakId);
+ db_query($q, array('modul'=>'naplo','result'=>'update','values'=>$values));
+ for ($i=0; $i<count($lattamDiakIds); $i++) {
+ $_diakId = $lattamDiakIds[$i];
+ $q = "UPDATE oraHazifeladatDiak SET tanarLattamDt=NOW() WHERE hazifeladatId=%u AND diakId=%u";
+ $values = array($ADAT['hazifeladatId'], $_diakId);
+ db_query($q, array('modul'=>'naplo','result'=>'update','values'=>$values));
+ }
} 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);
@@ -64,6 +100,41 @@
db_query($q, array('modul'=>'naplo','result'=>'update','values'=>$values));
}
}
+
+ if (FILE_UPLOAD_ENABLED===true && $action=='hazifeladatFeltoltes') {
+ if (is_array($_FILES) && $_FILES['upfile']['name']!='') {
+ $FILEADAT['subdir'] = FILE_UPLOAD_DIR;
+ $ext = filename2ext($_FILES['upfile']['name']);
+ $ext2 = filemime2ext($_FILES['upfile']['type']);
+ if ($ext != $ext2) {
+ // $_SESSION['alert'][] = 'info:file_mime_type_extension_mismatch:'.$ext.':'.$ext2;
+ if ($ext2!='') $ext = $ext2;
+ }
+ $FILEADAT['filename'] = $hazifeladatId.'_'.$diakId.'_'.uniqid().'.'.$ext;
+ try {
+ $sikeresFeltoltes = mayorFileUpload($FILEADAT, false);
+ } catch (Exception $e) {
+ dump($e);
+ }
+
+ if ($sikeresFeltoltes===true) {
+ // --todo unlink existing?--
+
+ $q = "SELECT hazifeladatDiakFilename FROM oraHazifeladatDiak WHERE hazifeladatId=%u AND diakId=%u";
+ $values = array($ADAT['hazifeladatId'],$diakId);
+ $oldFilename = db_query($q, array('modul'=>'naplo','result'=>'value','values'=>$values));
+
+ if (file_exists(FILE_UPLOAD_DIR.$oldFilename)) unlink(FILE_UPLOAD_DIR.$oldFilename);
+
+ $origFilename = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $_FILES['upfile']['name']);
+ $origFilename = mb_ereg_replace("([\.]{2,})", '', $_FILES['upfile']['name']);
+ if ($origFilename=='') $origFilename = $FILEADAT['filename'];
+ $q = "UPDATE oraHazifeladatDiak SET hazifeladatDiakFilename='%s',hazifeladatDiakOrigFilename='%s' WHERE hazifeladatId=%u AND diakId=%u";
+ $values = array($FILEADAT['filename'],$origFilename,$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));
@@ -78,7 +149,7 @@
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['hazifeladatDiak'] = db_query($q, array('debug'=>false,'modul'=>'naplo','result'=>'indexed','values'=>$values));
}
$ADAT['oraAdat'] = getOraadatById($oraId);
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
index 1cce1e3e..1169d008 100644
--- 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
@@ -13,7 +13,6 @@
}
form button.btnHfStatusz span { color:#eee; }
form button.btnHfStatusz.kesz span { color: lightgreen; }
-
form button.btnHfStatusz:hover {
background-color:lightgreen;
color:black;
@@ -23,9 +22,38 @@
background-color: orange;
}
form button.btnHfStatusz:hover span { color: white; }
-
form button.btnHfStatusz.kesz:hover span { color: orange }
+
+
+
+/*---*/
+ form button.btnLattamStatusz {
+ background-color: #eee;
+ border-radius: 2px;
+ border: solid 1px #888;
+ color: #888;
+ padding:2px 18px 2px 4px;
+ }
+ form button.btnLattamStatusz:hover {
+ background-color:lightgreen;
+ color:black;
+ border-color:black;
+ }
+ form button.btnLattamStatusz span { color:#eee; }
+ form button.btnLattamStatusz:hover span { color: white; }
+
+ form button.btnLattamStatusz.lattam { background-color: lightgreen; color:white; }
+ form button.btnLattamStatusz.lattam span { color: white; }
+ form button.btnLattamStatusz.lattam:hover {background-color: orange;}
+ form button.btnLattamStatusz.lattam: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 thead tr th { background-color: #4caf50; color:white; font-weight:normal; padding: 2px 4px;}
table.hazifeladatDiak tbody tr td { background-color: white; font-weight:normal; padding: 2px 4px;}
+
+
+ table.hazifeladatDiak tr td a, fieldset.adatok a { color: black; }
+ table.hazifeladatDiak tr td a:hover, fieldset.adatok a:hover { text-decoration:underline; color: cornflowerblue; }
+
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 c5a26c13..a8540faa 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,25 +2,21 @@
function putHazifeladat($ADAT) {
-/* echo '<style type="text/css">';
- echo '
- 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; }
- ';
- echo '</style>';
-*/
echo '<fieldset class="adatok"><legend>'._ALAPADATOK.'</legend>'."\n";
- echo ($ADAT['oraAdat']['dt']).' ('.$ADAT['oraAdat']['dt'].'), '.$ADAT['oraAdat']['ora'].'. '._ORA.' – <span class="tankorNev" data-tankorid="'.$ADAT['oraId']['tankorId'].'">'.$ADAT['oraAdat']['tankorNev'].'</span> – '.$ADAT['oraAdat']['kiCn'];
+ echo '<span class="oraAdat" data-oraid="'.$ADAT['oraAdat']['oraId'].'">';
+ echo ($ADAT['oraAdat']['dt']).' ('.$ADAT['oraAdat']['dt'].'), '.$ADAT['oraAdat']['ora'].'. '._ORA;
+ echo '</span>';
+ echo ' – <span class="tankorNev tankorAdat" data-tankorid="'.$ADAT['oraAdat']['tankorId'].'">'.$ADAT['oraAdat']['tankorNev'].'</span>';
+ echo ' – <span class="tanarNev" data-tanarid="'.$ADAT['oraAdat']['ki'].'">'.$ADAT['oraAdat']['kiCn'].'</span>';
// echo '<p>'.$ADAT['oraAdat']['leiras'].'</p>';
echo '</fieldset>'."\n";
- if (__DIAK===true) {
+ if (__DIAK===true) { ////////////////////////////////////////////////////////////////////////////////////////////////
if ($ADAT['hazifeladatDiak']['hazifeladatDiakStatus']=='kész') $_class = "kesz";
- if ($skin != 'ajax') formBegin(array('class'=>'hazifeladat'));
echo '<fieldset class="adatok"><legend>'.ucfirst(_TANANYAG).'</legend>'."\n";
if ($ADAT['oraAdat']['leiras']=='')
{ echo '<p style="color:#aaa;">még nincs kitöltve</p>'; }
@@ -33,19 +29,64 @@
else
{ echo ($ADAT['hazifeladatAdat']['hazifeladatLeiras']); }
echo '</fieldset>'."\n";
- if ($ADAT['hazifeladatId']>0) {
- echo '<div style="text-align:center; margin-bottom: 140px;">';
- echo '<input type="hidden" name="action" value="hazifeladatKesz">';
- if ($ADAT['hazifeladatDiak']['hazifeladatDiakStatus']=='kész') {
- echo '<button type="submit" class="btnHfStatusz kesz"><span class="icon-ok-sign"></span> kész</button>';
+
+
+ if ($ADAT['hazifeladatDiak']['hazifeladatId']>0) {
+
+ echo '<fieldset class="adatok '.$_class.'"><legend>'._HAZIFELTOLTES.'</legend>'."\n";
+ echo formBegin(array('enctype'=>'multipart/form-data'));
+
+ if (FILE_UPLOAD_ENABLED===false || $ADAT['hazifeladatDiak']['tanarLattamDt']!='' || $ADAT['hazifeladatDiak']['hazifeladatDiakStatus']=='kész') {
+ if (FILE_UPLOAD_ENABLED===false) $mert = ', mert a feltöltés le van tiltva';
+ elseif ($ADAT['hazifeladatDiak']['tanarLattamDt']!='') $mert = ', mert már láttamozta a tanár';
+ elseif ($ADAT['hazifeladatDiak']['hazifeladatDiakStatus']=='kész') $mert = ', mert már késznek jelölted a feladatot';
+ echo '<p style="color:#888">nem tudsz új filet feltölteni'.$mert.'</p>';
} else {
- echo '<button type="submit" class="btnHfStatusz"><span class="icon-ok-sign"></span> késznek jelölöm</button>';
+ echo '<div style="width:100%; margin:auto; background-color: #eee; text-align:center; padding:20px 0px 20px 0px; border-radius: 2px;">';
+ echo '<input type="hidden" name="action" value="hazifeladatFeltoltes">';
+ echo '<input type="file" name="upfile" /> (maximum méret: '.human_filesize(file_upload_max_size()).')';
+ if ($ADAT['hazifeladatDiak']['hazifeladatDiakFilename']!='') {
+ $submitSzoveg = 'a korábbi feltöltés cseréje';
+ } else {
+ $submitSzoveg = 'feltöltés';
+ }
+ echo ' <input type="submit" value="'.$submitSzoveg.'">';
+ echo '</div>';
+ }
+
+ if ($ADAT['hazifeladatDiak']['hazifeladatDiakFilename']!='') {
+ $ADAT['dir'] = 'naplo/haladasi/hazifeladat';
+ $ADAT['file'] = $ADAT['hazifeladatDiak']['hazifeladatDiakFilename'];
+ $href = href('index.php?page=session&f=download&dir='.$ADAT['dir'].'&file='.$ADAT['file'].'&download=true');
+ echo '<h3>Feltöltve:</h3>';
+ echo '<ul><li>';
+ echo '<a href="'.$href.'" target="_blank">'.htmlspecialchars($ADAT['hazifeladatDiak']['hazifeladatDiakOrigFilename']).'</a> <span class="icon-paper-clip"></span>';
+ if ($ADAT['hazifeladatDiak']['tanarLattamDt']!='') {
+ echo ' <span class="icon-ok-sign" style="color: lightgreen"></span> '.$ADAT['hazifeladatDiak']['tanarLattamDt'];
+ }
+ echo '</li></ul>';
+ }
+
+ echo formEnd();
+ echo '</fieldset>';
+
+ formBegin(array('class'=>'hazifeladat'));
+ if ($ADAT['hazifeladatId']>0) {
+ echo '<div style="text-align:center; margin-bottom: 140px;">';
+ echo '<input type="hidden" name="action" value="hazifeladatKesz">';
+ if ($ADAT['hazifeladatDiak']['hazifeladatDiakStatus']=='kész') {
+ echo '<button type="submit" class="btnHfStatusz kesz"><span class="icon-ok-sign"></span> kész</button>';
+ } else {
+ echo '<button type="submit" class="btnHfStatusz"><span class="icon-ok-sign"></span> késznek jelölöm</button>';
+ }
+ echo '</div>';
}
- echo '</div>';
+ echo formEnd();
+
+
}
-
- echo formEnd();
- } else {
+
+ } else { ////////////////////////////////////////////////////////////////////////////////////
echo '<script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>';
if ($skin != 'ajax') formBegin(array('class'=>'hazifeladat'));
echo '<input type="hidden" name="action" value="hazifeladatBeiras"/>';
@@ -108,9 +149,12 @@
if (count($ADAT['hazifeladatDiak'])==0) return false;
+ echo formBegin();
+ echo '<input type="hidden" name="action" value="lattam" />';
+ echo '<input type="hidden" name="hazifeladatId" value="'.$ADAT['hazifeladatId'].'" />';
echo '<table class="hazifeladatDiak" cellpadding="1" cellspacing="1">';
echo '<thead>';
- echo '<tr><th>diák</th><th>látta</th><th>státusz</th><th></th></tr>';
+ echo '<tr><th>diák</th><th>látta</th><th colspan="2">státusz</th><th colspan="1">csatolmány</th><th>láttam</th></tr>';
echo '</thead>';
for ($i=0; $i<count($ADAT['hazifeladatDiak']); $i++) {
$D = $ADAT['hazifeladatDiak'][$i];
@@ -119,9 +163,32 @@
echo '<td>'.$D['diakLattamDt'].'</td>';
echo '<td>'.$D['hazifeladatDiakStatus'].'</td>';
echo '<td>'.$D['hazifeladatDiakMegjegyzes'].'</td>';
+
+ $ADAT['dir'] = 'naplo/haladasi/hazifeladat';
+ $ADAT['file'] = $D['hazifeladatDiakFilename'];
+ $href = href('index.php?page=session&f=download&dir='.$ADAT['dir'].'&file='.$ADAT['file'].'&download=true');
+ echo '<td>';
+ if ($D['hazifeladatDiakOrigFilename']!='') {
+ echo '<a href="'.$href.'" target="_blank">'.htmlspecialchars($D['hazifeladatDiakOrigFilename']).'</a> <span class="icon-paper-clip"></span>';
+ }
+ echo '</td>';
+ echo '<td style="text-align: center">';
+// if ($ADAT['hazifeladatDiak']['hazifeladatDiakStatus']=='kész') {
+ if (__TANAR===true) {
+ if ($D['tanarLattamDt']=='') {
+ echo '<button type="submit" name="lattam[]" value="'.$D['diakId'].'" class="btnLattamStatusz"><span class="icon-ok-sign"></span> láttam!</button>';
+ } else {
+ echo '<button type="submit" class="btnLattamStatusz lattam"><span class="icon-ok-sign"></span> láttam.</button>';
+ }
+ } else {
+ if ($D['tanarLattamDt']!='') {echo '<span class="icon-ok-sign" style="color:lightblue"></span>';}
+ }
+// }
+ echo '</td>';
echo '</tr>';
}
echo '</table>';
+ echo formEnd();
}
?>