mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 08:52:21 +00:00
Email-Benachrichtigung bei Ampeln, wenn Flag gesetzt
Studenten werden einen Tag vor der Prüfung automatisch bestätigt
This commit is contained in:
+18
-4
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 20011 FH Technikum-Wien
|
||||
/* Copyright (C) 2011 fhcomplete.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
@@ -37,6 +37,7 @@ class ampel extends basis_db
|
||||
public $deadline; // date
|
||||
public $vorlaufzeit; // smallint
|
||||
public $verfallszeit; // smallint
|
||||
public $email; // boolean
|
||||
public $insertamum; // timestamp
|
||||
public $insertvon; // varchar(32)
|
||||
public $updateamum; // timestamp
|
||||
@@ -87,6 +88,7 @@ class ampel extends basis_db
|
||||
$this->deadline = $row->deadline;
|
||||
$this->vorlaufzeit = $row->vorlaufzeit;
|
||||
$this->verfallszeit = $row->verfallszeit;
|
||||
$this->email = $row->email;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
@@ -109,13 +111,20 @@ class ampel extends basis_db
|
||||
|
||||
/**
|
||||
* Laedt alle vorhandenen Ampeln
|
||||
* @param aktiv lade nur aktive Ampeln
|
||||
*/
|
||||
public function getAll()
|
||||
public function getAll($aktiv=false)
|
||||
{
|
||||
$sprache = new sprache();
|
||||
$beschreibung = $sprache->getSprachQuery('beschreibung');
|
||||
|
||||
$qry = "SELECT *,".$beschreibung." FROM public.tbl_ampel ORDER BY deadline";
|
||||
$qry = "SELECT *,".$beschreibung." FROM public.tbl_ampel";
|
||||
if($aktiv)
|
||||
{
|
||||
$qry .= " WHERE (NOW()>(deadline-(vorlaufzeit || ' days')::interval)::date)";
|
||||
$qry .= " AND (NOW()<(deadline+(verfallszeit || ' days')::interval)::date)";
|
||||
}
|
||||
$qry .= " ORDER BY deadline";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
@@ -130,6 +139,7 @@ class ampel extends basis_db
|
||||
$obj->deadline = $row->deadline;
|
||||
$obj->vorlaufzeit = $row->vorlaufzeit;
|
||||
$obj->verfallszeit = $row->verfallszeit;
|
||||
$obj->email = $this->db_parse_bool($row->email);
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
@@ -243,6 +253,7 @@ class ampel extends basis_db
|
||||
$obj->deadline = $row->deadline;
|
||||
$obj->vorlaufzeit = $row->vorlaufzeit;
|
||||
$obj->verfallszeit = $row->verfallszeit;
|
||||
$obj->email = $row->email;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
@@ -306,7 +317,7 @@ class ampel extends basis_db
|
||||
}
|
||||
|
||||
$qry.=" benutzer_select, deadline,
|
||||
vorlaufzeit, verfallszeit, insertamum, insertvon , updateamum, updatevon) VALUES(".
|
||||
vorlaufzeit, verfallszeit, email, insertamum, insertvon , updateamum, updatevon) VALUES(".
|
||||
$this->db_add_param($this->kurzbz).',';
|
||||
reset($this->beschreibung);
|
||||
foreach($this->beschreibung as $key=>$value)
|
||||
@@ -316,6 +327,7 @@ class ampel extends basis_db
|
||||
$this->db_add_param($this->deadline).','.
|
||||
$this->db_add_param($this->vorlaufzeit).','.
|
||||
$this->db_add_param($this->verfallszeit).','.
|
||||
$this->db_add_param($this->email, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->updateamum).','.
|
||||
@@ -336,6 +348,7 @@ class ampel extends basis_db
|
||||
' deadline = '.$this->db_add_param($this->deadline).','.
|
||||
' vorlaufzeit = '.$this->db_add_param($this->vorlaufzeit).','.
|
||||
' verfallszeit = '.$this->db_add_param($this->verfallszeit).','.
|
||||
' email = '.$this->db_add_param($this->email, FHC_BOOLEAN).','.
|
||||
' updateamum ='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon ='.$this->db_add_param($this->updatevon).
|
||||
' WHERE ampel_id='.$this->db_add_param($this->ampel_id, FHC_INTEGER).';';
|
||||
@@ -486,6 +499,7 @@ class ampel extends basis_db
|
||||
$obj->deadline = $row->deadline;
|
||||
$obj->vorlaufzeit = $row->vorlaufzeit;
|
||||
$obj->verfallszeit = $row->verfallszeit;
|
||||
$obj->email = $row->email;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 fhcomplete.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Martin Tatzber <tatzberm@technikum-wien.at>
|
||||
*/
|
||||
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/basis_db.class.php');
|
||||
require_once('../include/mail.class.php');
|
||||
require_once('../include/ampel.class.php');
|
||||
|
||||
$db = new basis_db();
|
||||
$ampel=new ampel();
|
||||
$ampel->getAll(true);
|
||||
|
||||
foreach($ampel->result as $a)
|
||||
{
|
||||
if(!$a->email)
|
||||
continue;
|
||||
|
||||
$qry=$a->benutzer_select;
|
||||
$message = $a->beschreibung['German'];
|
||||
$subject = $a->kurzbz;
|
||||
|
||||
if($result = $db->db_query($qry))
|
||||
{
|
||||
while($row = $db->db_fetch_object($result))
|
||||
{
|
||||
$uid = $row->uid;
|
||||
|
||||
$mail = new mail($uid.'@'.DOMAIN, 'cis@'.DOMAIN, $subject, $message);
|
||||
if($mail->send())
|
||||
echo "Email an $uid versandt\n";
|
||||
else
|
||||
echo "Fehler beim Versenden des Erinnerungsmails an $uid\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 fhcomplete.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/basis_db.class.php');
|
||||
require_once('../include/datum.class.php');
|
||||
require_once('../include/mail.class.php');
|
||||
require_once('../include/pruefungCis.class.php');
|
||||
require_once('../include/pruefungsanmeldung.class.php');
|
||||
|
||||
$date = new datum();
|
||||
$db = new basis_db();
|
||||
|
||||
$pruefungen=new pruefungCis();
|
||||
$pruefungen->getAllPruefungen();
|
||||
|
||||
echo date('Y-m-d',strtotime('now + 1 day'));
|
||||
echo '=====<br>';
|
||||
echo 'Start<br>';
|
||||
foreach($pruefungen->result as $p)
|
||||
{
|
||||
if($p->storniert)
|
||||
continue;
|
||||
|
||||
$p->getTermineByPruefung();
|
||||
foreach($p->termine as $termin)
|
||||
{
|
||||
// echo $date->formatDatum($termin->von,'Y-m-d');
|
||||
if($date->formatDatum($termin->von,'Y-m-d') == date('Y-m-d',strtotime('now + 1 day'))) //Datumsüberprüfung
|
||||
{
|
||||
$anm_obj=new pruefungsanmeldung();
|
||||
$anmeldungen=$anm_obj->getAnmeldungenByTermin($termin->pruefungstermin_id);
|
||||
foreach($anmeldungen as $anm)
|
||||
{
|
||||
$anm_obj->changeState($anm->pruefungsanmeldung_id,'bestaetigt');
|
||||
}
|
||||
echo 'true<br>';
|
||||
}
|
||||
else
|
||||
echo 'false<br>';
|
||||
}
|
||||
}
|
||||
echo 'Ende';
|
||||
?>
|
||||
@@ -68,6 +68,7 @@ $datum_obj = new datum();
|
||||
$deadline = (isset($_POST['deadline'])?$_POST['deadline']:die('Deadline fehlt'));
|
||||
$vorlaufzeit = (isset($_POST['vorlaufzeit'])?$_POST['vorlaufzeit']:die('Vorlaufzeit fehlt'));
|
||||
$verfallszeit = (isset($_POST['verfallszeit'])?$_POST['verfallszeit']:die('verfallszeit fehlt'));
|
||||
$email = isset($_POST['email']);
|
||||
$new = (isset($_POST['new'])?$_POST['new']:'true');
|
||||
if($new=='true')
|
||||
{
|
||||
@@ -89,6 +90,7 @@ $datum_obj = new datum();
|
||||
$ampel->deadline = $datum_obj->formatDatum($deadline,'Y-m-d');
|
||||
$ampel->vorlaufzeit = $vorlaufzeit;
|
||||
$ampel->verfallszeit = $verfallszeit;
|
||||
$ampel->email = $email;
|
||||
$ampel->updateamum = date('Y-m-d H:i:s');
|
||||
$ampel->updatevon = $user;
|
||||
|
||||
@@ -133,46 +135,53 @@ $datum_obj = new datum();
|
||||
break;
|
||||
}
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?action=save" method="POST">';
|
||||
echo '<input type="hidden" name="new" value="'.htmlspecialchars($new).'">';
|
||||
echo '<input type="hidden" name="ampel_id" value="'.htmlspecialchars($ampel->ampel_id).'">';
|
||||
echo '<table>';
|
||||
echo '<tr>';
|
||||
echo ' <td>Kurzbz</td>';
|
||||
echo ' <td><input type="text" name="kurzbz" size="30" maxlength="64" value="'.htmlspecialchars($ampel->kurzbz).'"></td>';
|
||||
echo ' <td></td>';
|
||||
echo ' <td>Deadline</td>';
|
||||
echo ' <td><input type="text" name="deadline" size="10" maxlength="10" value="'.htmlspecialchars($datum_obj->formatDatum($ampel->deadline,'d.m.Y')).'"></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td rowspan="2">Benutzer Select</td>';
|
||||
echo ' <td rowspan="2"><textarea name="benutzer_select" cols="60" rows="5">'.htmlspecialchars($ampel->benutzer_select).'</textarea></td>';
|
||||
echo ' <td></td>';
|
||||
echo ' <td valign="middle">Vorlaufzeit (in Tagen)</td>';
|
||||
echo ' <td valign="middle"><input type="text" name="vorlaufzeit" size="4" maxlength="4" value="'.htmlspecialchars($ampel->vorlaufzeit).'"></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td></td>';
|
||||
echo ' <td>Verfallszeit (in Tagen)</td>';
|
||||
echo ' <td><input type="text" name="verfallszeit" size="4" maxlength="4" value="'.htmlspecialchars($ampel->verfallszeit).'"></td>';
|
||||
echo '</tr>';
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?action=save" method="POST">
|
||||
<input type="hidden" name="new" value="'.htmlspecialchars($new).'">
|
||||
<input type="hidden" name="ampel_id" value="'.htmlspecialchars($ampel->ampel_id).'">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Kurzbz</td>
|
||||
<td><input type="text" name="kurzbz" size="30" maxlength="64" value="'.htmlspecialchars($ampel->kurzbz).'"></td>
|
||||
<td></td>
|
||||
<td>Deadline</td>
|
||||
<td><input type="text" name="deadline" size="10" maxlength="10" value="'.htmlspecialchars($datum_obj->formatDatum($ampel->deadline,'d.m.Y')).'"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td rowspan="3">Benutzer Select</td>
|
||||
<td rowspan="3"><textarea name="benutzer_select" cols="60" rows="5">'.htmlspecialchars($ampel->benutzer_select).'</textarea></td>
|
||||
<td></td>
|
||||
<td valign="middle">Vorlaufzeit (in Tagen)</td>
|
||||
<td valign="middle"><input type="text" name="vorlaufzeit" size="4" maxlength="4" value="'.htmlspecialchars($ampel->vorlaufzeit).'"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td></td>
|
||||
<td>Verfallszeit (in Tagen)</td>
|
||||
<td><input type="text" name="verfallszeit" size="4" maxlength="4" value="'.htmlspecialchars($ampel->verfallszeit).'"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td></td>
|
||||
<td>Erinnerung per Email</td>
|
||||
<td><input type="checkbox" name="email" '.($db->db_parse_bool($ampel->email)?'checked':'').'></td>
|
||||
</tr>';
|
||||
|
||||
$sprache = new sprache();
|
||||
$sprache->getAll();
|
||||
foreach($sprache->result as $lang)
|
||||
{
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td>Beschreibung '.$lang->sprache.'</td>';
|
||||
echo ' <td><textarea name="beschreibung'.$lang->sprache.'" cols="60" rows="5">'.htmlspecialchars((isset($ampel->beschreibung[$lang->sprache])?$ampel->beschreibung[$lang->sprache]:'')).'</textarea></td>';
|
||||
echo ' <td></td>';
|
||||
echo '</tr>';
|
||||
echo '
|
||||
<tr valign="top">
|
||||
<td>Beschreibung '.$lang->sprache.'</td>
|
||||
<td><textarea name="beschreibung'.$lang->sprache.'" cols="60" rows="5">'.htmlspecialchars((isset($ampel->beschreibung[$lang->sprache])?$ampel->beschreibung[$lang->sprache]:'')).'</textarea></td>
|
||||
<td></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '<tr valign="bottom">';
|
||||
echo ' <td></td>';
|
||||
echo ' <td></td>';
|
||||
echo ' <td><input type="submit" value="Speichern" name="save"></td>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
echo '
|
||||
<tr valign="bottom">
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Speichern" name="save"></td>
|
||||
</tr>
|
||||
</table></form>';
|
||||
|
||||
echo '</fieldset>';
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user