mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Added Sancho Mail cronjob (CI)
. jobs/AmpelMail.php: -- generates ampel mails for new and for overdue mails -- this script is run by the cronjob . sancho_helper.php: -- generates and sends Sancho Mails with Sancho Design and Layout using Sancho-mail-templates . Ampel_model.php: functions to retrieve correct ampeln . Sancho pictures: -- sancho_header_neue_nachrichten_in_ampelsystem: is set by default -- sancho_header_TEMPLATE.xcf: template to quickly reproduce new sancho header images (change the text and export as jpg)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Ampel_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -11,4 +10,84 @@ class Ampel_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_ampel';
|
||||
$this->pk = 'ampel_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all active Ampeln, that are actually:
|
||||
* 1. not after the deadline date
|
||||
* 2. not before the vorlaufszeit
|
||||
* @param bool $email If true, then only ampeln are retrieved that are marked to be sent by mail.
|
||||
* @return array Returns array of objects.
|
||||
*/
|
||||
public function active($email = false)
|
||||
{
|
||||
$parametersArray = null;
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM public.tbl_ampel
|
||||
WHERE';
|
||||
|
||||
if ($email === true)
|
||||
{
|
||||
$parametersArray['email'] = $email;
|
||||
$query .= ' email = ? AND';
|
||||
}
|
||||
|
||||
$query .= '
|
||||
(NOW()<(deadline+(verfallszeit || \' days\')::interval)::date)
|
||||
OR (verfallszeit IS NULL AND NOW() < deadline)
|
||||
AND (NOW()>(deadline-(vorlaufzeit || \' days\')::interval)::date)
|
||||
OR (vorlaufzeit IS NULL AND NOW() > deadline)';
|
||||
|
||||
$query .= ' ORDER BY deadline DESC';
|
||||
|
||||
return $this->execQuery($query, $parametersArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all Ampel-receiver of a specific Ampel.
|
||||
* @param string $benutzer_select SQL Statement which defines the Ampel-receiver.
|
||||
* @return array Returns array of objects with property 'uid'.
|
||||
*/
|
||||
public function execBenutzerSelect($benutzer_select)
|
||||
{
|
||||
if (isset($benutzer_select) && !empty(trim($benutzer_select)))
|
||||
{
|
||||
return $this->execQuery($benutzer_select);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Ampel was confirmed by the user.
|
||||
* @param int $ampel_id Ampel-ID
|
||||
* @param string $uid UID
|
||||
* @return bool
|
||||
*/
|
||||
public function isConfirmed($ampel_id, $uid)
|
||||
{
|
||||
$result = null;
|
||||
$query = '
|
||||
SELECT 1
|
||||
FROM public.tbl_ampel_benutzer_bestaetigt
|
||||
WHERE ampel_id = ?
|
||||
AND uid = ?';
|
||||
|
||||
if (isset($ampel_id, $uid))
|
||||
{
|
||||
$result = $this->execQuery($query, array($ampel_id, $uid));
|
||||
}
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if (count($result->retval) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return $result; //will contain the error-msg from execQuery
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user