diff options
Diffstat (limited to 'mayor-orig/mayor-naplo/www/include/modules')
-rw-r--r-- | mayor-orig/mayor-naplo/www/include/modules/naplo/export/kretaOrarend.php | 70 | ||||
-rw-r--r-- | mayor-orig/mayor-naplo/www/include/modules/naplo/tanev/targyBontas.php | 2 |
2 files changed, 71 insertions, 1 deletions
diff --git a/mayor-orig/mayor-naplo/www/include/modules/naplo/export/kretaOrarend.php b/mayor-orig/mayor-naplo/www/include/modules/naplo/export/kretaOrarend.php new file mode 100644 index 00000000..48cf5f52 --- /dev/null +++ b/mayor-orig/mayor-naplo/www/include/modules/naplo/export/kretaOrarend.php @@ -0,0 +1,70 @@ +<?php + + function getOrarendAdat($ADAT) { + + global $aHetNapjai, $kretaHETIREND; + + $lr = db_connect('naplo'); + // orarendiOra - tankor + $q = "SELECT * from orarendiOra + LEFT JOIN orarendiOraTankor USING (tanarId, targyJel, osztalyJel) + LEFT JOIN ".__INTEZMENYDBNEV.".terem USING (teremId) + ORDER BY tanarId, het, nap, ora"; + $v = array(); + $ADAT['orak'] = db_query($q, array('fv' => 'getOrarendAdat', 'result'=>'indexed','value'=>$v), $lr); + $q = "SELECT tankorId, tankorNev, targyNev, kretaTargyNev, csoportNev FROM ".__INTEZMENYDBNEV.".tankor + LEFT JOIN ".__INTEZMENYDBNEV.".tankorSzemeszter USING (tankorId) + LEFT JOIN ".__INTEZMENYDBNEV.".targy USING (targyId) + LEFT JOIN tankorCsoport USING (tankorId) + LEFT JOIN csoport USING (csoportId) + WHERE tanev=".__TANEV." AND szemeszter=1"; + + $v = array(); + $ADAT['tankor'] = db_query($q, array('fv' => 'getOrarendAdat/tankor', 'result'=>'assoc','keyfield'=>'tankorId','value'=>$v), $lr); + foreach ($ADAT['tankor'] as $_tankorId => $T) { + $M = explode(' ', $T['csoportNev']); + + + if (strpos($T['csoportNev'],',') !== false) $ADAT['t2osztaly'][$_tankorId] = ''; + else $ADAT['t2osztaly'][$_tankorId] = $M[0]; + + if (strpos($T['csoportNev'],' ') === false && strpos($T['csoportNev'],'_') === false) $ADAT['t2csoport'][$_tankorId] = ''; + else $ADAT['t2csoport'][$_tankorId] = $T['csoportNev']; + } + + + db_close($lr); + $ADAT['export'][] = array( + 'Hetirend','Nap','Óra (adott napon belül)','Osztály','Csoport','Tantárgy','Tanár','Helyiség' + ); + foreach ($ADAT['orak'] as $index => $O) { + list($helyseg,$_nev) = explode(" - ",$O['leiras']); + $ADAT['export'][] = array( + $kretaHETIREND[ $O['het'] ], // Hetirend + $aHetNapjai[ $O['nap']-1 ], // Nap + $O['ora'], // Óra + $ADAT['t2osztaly'][ $O['tankorId'] ], // Osztály + $ADAT['t2csoport'][ $O['tankorId'] ], // Csoport + $ADAT['tankor'][ $O['tankorId'] ]['kretaTargyNev'], // Tantárgy + $ADAT['tanar'][ $O['tanarId'] ]['tanarNev'], // Tanár + $helyseg // Helyiség + ); + } + + return $ADAT['export']; + + } + + function exportKretaOrarend($file, $ADAT) { + + $T = $ADAT['export']; + + if ($ADAT['formatum'] == 'xml') return generateXLS("$file.${ADAT['formatum']}", $T, 'kreta_ETTF_simple'); + elseif ($ADAT['formatum'] == 'csv') return generateCSV("$file.${ADAT['formatum']}", $T, ''); + elseif ($ADAT['formatum'] == 'ods') return generateODS("$file.${ADAT['formatum']}", $T, 'kreta_ETTF_simple'); + else return false; + + } + + +?>
\ No newline at end of file diff --git a/mayor-orig/mayor-naplo/www/include/modules/naplo/tanev/targyBontas.php b/mayor-orig/mayor-naplo/www/include/modules/naplo/tanev/targyBontas.php index 5b31bdec..625e0482 100644 --- a/mayor-orig/mayor-naplo/www/include/modules/naplo/tanev/targyBontas.php +++ b/mayor-orig/mayor-naplo/www/include/modules/naplo/tanev/targyBontas.php @@ -74,7 +74,7 @@ $bontasId = db_query($q, array('fv'=>'addBontas/insert','modul'=>'naplo','result'=>'insert','values'=>array($osztalyId,$kepzesOratervId,$targyId)), $lr); // is_resource mysqli esetán nem jó (object) - if (!$olr) db_close(); + if (!$olr) db_close($lr); return array( 'targyId' => $targyId, |