aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/www/policy/private/naplo/hirnok
diff options
context:
space:
mode:
Diffstat (limited to 'mayor-orig/www/policy/private/naplo/hirnok')
-rw-r--r--mayor-orig/www/policy/private/naplo/hirnok/cronFutar-pre.php32
-rw-r--r--mayor-orig/www/policy/private/naplo/hirnok/cronFutar.php45
-rw-r--r--mayor-orig/www/policy/private/naplo/hirnok/hirnok-pre.php53
-rw-r--r--mayor-orig/www/policy/private/naplo/hirnok/hirnok.php6
-rw-r--r--mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas-pre.php47
-rw-r--r--mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas.php7
6 files changed, 190 insertions, 0 deletions
diff --git a/mayor-orig/www/policy/private/naplo/hirnok/cronFutar-pre.php b/mayor-orig/www/policy/private/naplo/hirnok/cronFutar-pre.php
new file mode 100644
index 00000000..5691de0f
--- /dev/null
+++ b/mayor-orig/www/policy/private/naplo/hirnok/cronFutar-pre.php
@@ -0,0 +1,32 @@
+<?php
+
+ if (_RUNLEVEL!=='cron') die('not valid RUNLEVEL! Exiting.');
+ if (__EMAIL_ENABLED!==true) die('EMAIL_ENABLED is false! Exiting.');
+
+ require_once('include/modules/naplo/share/hirnok.php');
+ require_once('include/share/net/phpmailer.php');
+
+ global $_TANEV;
+
+ $refDt = date('Y-m-d H:i:s');
+ $q = "SELECT naploId,naploTipus,utolsoEmailDt,userAccount,policy,email FROM hirnokFeliratkozas WHERE utolsoEmailDt IS NULL or utolsoEmailDt<'%s'";
+ $v = array($refDt);
+ $r = db_query($q,array('fv'=>'cron','modul'=>'naplo_intezmeny','result'=>'indexed','values'=>$v));
+
+ for ($i=0; $i<count($r); $i++) {
+ $d = $r[$i];
+ $TOLDTBYUSER[$d['naploTipus']][$d['naploId']] = ($d['utolsoEmailDt']=='') ? $_TANEV['kezdesDt'] : $d['utolsoEmailDt']; // setDt
+ if (!in_array($d['naploId'],$USER[$d['naploTipus']])) $USER[$d['naploTipus']][] = $d['naploId'];
+ $ADAT['feliratkozas'][$d['naploTipus']][$d['naploId']][] = array('userAccount'=>$d['userAccount'], 'policy'=>$d['policy'], 'email'=>$d['email'], 'setDt'=> $refDt);
+ }
+
+ // Megszorítás: egy naplóbeli entitás utolsoEmailDt-je együtt kell, hogy mozogjon ebben a feldolgozási rendszerben.
+ // Javítható: hirnokWrapper() függvény sokszoros használatával
+ $ADAT['hirnokFolyam'] = hirnokWrapper(array('tolDt'=>$tolDt,
+ 'diakId'=>$USER['diak'],
+ 'tanarId'=>$USER['tanar'],
+ 'tolDtByUser'=>$TOLDTBYUSER
+ ));
+
+
+?> \ No newline at end of file
diff --git a/mayor-orig/www/policy/private/naplo/hirnok/cronFutar.php b/mayor-orig/www/policy/private/naplo/hirnok/cronFutar.php
new file mode 100644
index 00000000..605e8eaa
--- /dev/null
+++ b/mayor-orig/www/policy/private/naplo/hirnok/cronFutar.php
@@ -0,0 +1,45 @@
+<?php
+
+ global $ADAT;
+ require_once('skin/classic/module-naplo/html/hirnok/hirnok.phtml');
+ require_once('skin/classic/module-naplo/html/share/email.phtml');
+
+ for ($i=0; $i<count($ADAT['hirnokFolyam']); $i++) {
+ $D = $ADAT['hirnokFolyam'][$i];
+ $_data = $D['hirnokFolyamAdatok'];
+ $cn = $_data['cn'];
+
+ for ($j=0; $j<count($ADAT['feliratkozas'][$_data['tipus']][$_data['id']]); $j++) {
+ $_toUser = $ADAT['feliratkozas'][$_data['tipus']][$_data['id']][$j];
+ $_toEmail = $_toUser['email'];
+ // if ($_toEmail=='') continue;;
+
+ $body = generateFutarEmailTorzs(array('hirnokFolyam'=>array($D)));
+ if ($body !='') {
+ echo "Email cím: ".$_toEmail."\n";
+ $mail = new PHPMailer();
+ $mail->CharSet = 'UTF-8';
+ $mail->SetFrom(__SUPPORT_EMAIL_ADDRESS, ''._SITE.'');
+ $mail->AddReplyTo(__SUPPORT_EMAIL_ADDRESS,'MaYoR Support');
+ $mail->AddAddress($_toEmail, $cn);
+ $mail->Subject = "[MaYoR] Értesítés – ".$cn;
+ $mail->MsgHTML(emailHead(array(
+ 'skin/classic/module-naplo/css/hirnok/hirnok.css',
+ 'skin/classic/module-naplo/css/hirnok/cronFutar.css'
+ )).$body.emailFoot());
+ if(!$mail->Send()) {
+ echo "PHP Mailer Error: " . $mail->ErrorInfo . "\n";
+ } else {
+ $q = "UPDATE hirnokFeliratkozas SET utolsoEmailDt ='%s' WHERE naploId=%u AND naploTipus='%s' AND userAccount='%s' AND policy='%s'";
+ $v = array($_toUser['setDt'],$_data['id'],$_data['tipus'],$_toUser['userAccount'],$_toUser['policy']);
+ db_query($q,array('modul'=>'naplo_intezmeny','fv'=>'cron','values'=>$v,'result'=>'update'));
+ echo "Email elküldve: ".$_toEmail." - ".$cn." - ".date('Y-m-d H:i:s')."\n";
+ }
+
+ } else {
+ // echo "Nincs mit küldeni.\n";
+ }
+ }
+
+ }
+?> \ No newline at end of file
diff --git a/mayor-orig/www/policy/private/naplo/hirnok/hirnok-pre.php b/mayor-orig/www/policy/private/naplo/hirnok/hirnok-pre.php
new file mode 100644
index 00000000..adc18ddc
--- /dev/null
+++ b/mayor-orig/www/policy/private/naplo/hirnok/hirnok-pre.php
@@ -0,0 +1,53 @@
+<?php
+
+ require_once('include/modules/naplo/share/hirnok.php');
+ global $_TANEV;
+
+ if (isset($_SESSION['lastLogin']) && strtotime(getTanitasinapvissza(2))>strtotime($_SESSION['lastLogin'])) $rDt = $_SESSION['lastLogin'];
+ else $rDt = getTanitasiNapVissza(2);
+ $tolDt = readVariable($_POST['tolDt'],'date',
+ readVariable($_GET['tolDt'], 'date',
+ $rDt
+ )
+ );
+ if (strtotime($tolDt)>strtotime(date('Y-m-d H:i:s'))) $tolDt = date('Y-m-d',strtotime('-10 day'));
+
+ $osztalyId = readVariable($_POST['osztalyId'], 'id');
+ if (__NAPLOADMIN === true) { // csak adminnak engedjük kiválasztani - lásd még include
+ $diakId = readVariable($_POST['diakId'], 'id', readVariable($_GET['diakId'], 'id'));
+ $tanarId = readVariable($_POST['tanarId'], 'id', readVariable($_GET['tanarId'], 'id'));
+ $feliratkozott = getHirnokFeliratkozasok();
+ if ($diakId==0 && count($feliratkozott['diak'])>0) $diakId = $feliratkozott['diak'];
+ if ($tanarId==0 && count($feliratkozott['tanar'])>0) $tanarId = $feliratkozott['tanar'];
+ if ($tanarId==0 && defined('__USERTANARID')) $tanarId = __USERTANARID;
+ } else {
+ if (__DIAK===true) { // diák nézet
+ $diakId = __USERDIAKID;
+ } elseif (__TANAR ===true) { // tanár nézet
+ $tanarId = __USERTANARID;
+ }
+ }
+
+ $ADAT['hirnokFolyam'] = hirnokWrapper(array('tolDt'=>$tolDt,'diakId'=>$diakId,'tanarId'=>$tanarId));
+ $ADAT['tolDt'] = $tolDt;
+ $ADAT['igDt'] = $igDt = date('Y-m-d');
+
+ if (__NAPLOADMIN===true) {
+ $TOOL['vissza'] = array('tipus'=>'vissza','paramName'=>'','icon'=>'bullhorn');
+ $TOOL['tanarSelect'] = array('tipus'=>'cella','paramName'=>'tanarId', 'post'=>array('tolDt', 'igDt'));
+ $TOOL['osztalySelect'] = array('tipus'=>'cella','paramName' => 'osztalyId', 'post'=>array('tolDt', 'igDt'));
+ $TOOL['diakSelect'] = array('tipus'=>'cella','paramName'=>'diakId', 'post'=>array('osztalyId','tolDt', 'igDt', 'osztalyId'));
+ if ($diakId>0)$TOOL['diakLapozo'] = array('tipus'=>'sor','paramName'=>'diakId', 'post'=>array('osztalyId','tolDt', 'igDt', 'osztalyId'));
+ }
+ $TOOL['datumTolIgSelect'] = array(
+ 'tipus' => 'sor', 'title' => '',
+ 'post'=>array('tolDt','tanarId','osztalyId','tankorId','mkId','diakId','telephely'),
+ 'tolParamName' => 'tolDt', 'igParamName' => 'igDt', 'hanyNaponta' => 1,
+ 'override' => true,
+ 'tolDt' => $_TANEV['kezdesDt'],
+ 'igDt' => $igDt,
+ );
+
+ getToolParameters();
+
+?> \ No newline at end of file
diff --git a/mayor-orig/www/policy/private/naplo/hirnok/hirnok.php b/mayor-orig/www/policy/private/naplo/hirnok/hirnok.php
new file mode 100644
index 00000000..ce3b7f72
--- /dev/null
+++ b/mayor-orig/www/policy/private/naplo/hirnok/hirnok.php
@@ -0,0 +1,6 @@
+<?php
+
+ global $ADAT;
+ putHirnokFolyam($ADAT);
+
+?> \ No newline at end of file
diff --git a/mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas-pre.php b/mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas-pre.php
new file mode 100644
index 00000000..d8fb3d33
--- /dev/null
+++ b/mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas-pre.php
@@ -0,0 +1,47 @@
+<?php
+
+ require_once('include/modules/naplo/share/hirnok.php');
+ global $_TANEV;
+
+ if (__EMAIL_ENABLED!==true) $_SESSION['alert'][] = 'page:hiba:az e-mail küldés nincs engedélyezve, keresd az üzemeltetőt!';
+
+ $tolDt = readVariable($_POST['tolDt'],'date',readVariable($_GET['tolDt'], 'date', getTanitasinapvissza(7)));
+ if (strtotime($tolDt)>strtotime(date('Y-m-d'))) $tolDt = date('Y-m-d',strtotime('-10 day'));
+
+ $osztalyId = readVariable($_POST['osztalyId'], 'id');
+ if (__NAPLOADMIN === true) { // csak adminnak engedjük kiválasztani - lásd még include
+ if ($action=='hirnokFeliratkozas') {
+ $S['naploId'] = readVariable($_POST['naploId'],'numeric');
+ $S['naploTipus'] = readVariable($_POST['naploTipus'],'string',null,array('tanar','diak'));
+ $S['email'] = readVariable($_POST['email'],'email');
+ $S['hirnokFeliratkozasId'] = readVariable($_POST['hirnokFeliratkozasId'],'numeric');
+ if ($S['hirnokFeliratkozasId']>0) delHirnokFeliratkozas($S);
+ elseif ($S['email']!='') addHirnokFeliratkozas($S);
+ }
+ $ADAT['hirnokFeliratkozas'] = $feliratkozott = getHirnokFeliratkozasok(true);
+// if ($diakId==0 && count($feliratkozott['diak'])>0) $diakId = $feliratkozott['diak'];
+// if ($tanarId==0 && count($feliratkozott['tanar'])>0) $tanarId = $feliratkozott['tanar'];
+// if ($tanarId==0 && defined('__USERTANARID')) $tanarId = __USERTANARID;
+ } else {
+ if (__DIAK===true) { // diák nézet + szülő?
+ $diakId = $naploId = __USERDIAKID;
+ $naploTipus = 'diak'; // szulo???
+ } elseif (__TANAR ===true) { // tanár nézet
+ $tanarId = $naploId = __USERTANARID;
+ $naploTipus = 'tanar';
+ }
+ if ($action=='hirnokFeliratkozas') {
+ $S['email'] = readVariable($_POST['email'],'email');
+ $S['naploId'] = $naploId;
+ $S['naploTipus'] = $naploTipus;
+
+ $S['hirnokFeliratkozasId'] = readVariable($_POST['hirnokFeliratkozasId'],'numeric');
+ if ($S['hirnokFeliratkozasId']>0) delHirnokFeliratkozas($S);
+ elseif ($S['email']!='') addHirnokFeliratkozas($S);
+ }
+ $ADAT['email'] = ''; // lekérdezhetnénk az objektum e-mail címét később
+ $ADAT['hirnokFeliratkozas'] = $feliratkozott = getHirnokFeliratkozasok(true);
+
+ }
+
+?> \ No newline at end of file
diff --git a/mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas.php b/mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas.php
new file mode 100644
index 00000000..a5c9056b
--- /dev/null
+++ b/mayor-orig/www/policy/private/naplo/hirnok/hirnokFeliratkozas.php
@@ -0,0 +1,7 @@
+<?php
+
+ global $ADAT;
+ if (__NAPLOADMIN ===true) putHirnokFeliratkozas($ADAT);
+ else putHirnokFeliratkozas_user($ADAT);
+
+?> \ No newline at end of file