mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Bugfix Ampelinfomail wenn Vorlaufzeit oder Verfallszeit Null ist
Pfad zu Ampelverwaltung korrigiert Anzeige des Ampel Popup überarbeitet
This commit is contained in:
@@ -17,10 +17,10 @@ if (! defined('BASEPATH'))
|
||||
class AmpelMail extends FHC_Controller
|
||||
{
|
||||
const CIS_AMPELVERWALTUNG_URL =
|
||||
CIS_ROOT. "index.php?sprache=German&content_id=&menu=".
|
||||
CIS_ROOT. "menu.php?content_id=&content=".
|
||||
CIS_ROOT. "private/tools/ampelverwaltung.php";
|
||||
|
||||
CIS_ROOT. "cis/index.php?menu=".
|
||||
CIS_ROOT. "cis/menu.php?content_id=&content=".
|
||||
CIS_ROOT. "cis/private/tools/ampelverwaltung.php";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -39,11 +39,11 @@ class AmpelMail extends FHC_Controller
|
||||
echo "Jobs must be run from the CLI";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Load models
|
||||
$this->load->model('content/Ampel_model', 'AmpelModel');
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('sancho');
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class AmpelMail extends FHC_Controller
|
||||
|
||||
echo $result. PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates mail content for new and overdue Ampeln, which
|
||||
* 1. are not confirmed by the user yet and
|
||||
@@ -81,7 +81,7 @@ class AmpelMail extends FHC_Controller
|
||||
if (hasData($result_active_ampeln))
|
||||
{
|
||||
$ampel_arr = $result_active_ampeln->retval;
|
||||
|
||||
|
||||
// Loop through ampeln
|
||||
foreach ($ampel_arr as $ampel)
|
||||
{
|
||||
@@ -95,11 +95,11 @@ class AmpelMail extends FHC_Controller
|
||||
|
||||
// get all user, who get this ampel
|
||||
$result_ampel_user = $this->AmpelModel->execBenutzerSelect($qry_all_ampel_user);
|
||||
|
||||
|
||||
if (hasData($result_ampel_user))
|
||||
{
|
||||
$ampel_user_arr = $result_ampel_user->retval;
|
||||
|
||||
|
||||
// loop through all user, who get this ampel
|
||||
foreach ($ampel_user_arr as $ampel_user)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ class AmpelMail extends FHC_Controller
|
||||
$html_text = '
|
||||
<p><strong>'. strtoupper($ampel->kurzbz). '</strong><br>
|
||||
<small>
|
||||
<i style="color: #65696E;">Die Deadline für die Bestätigung war am
|
||||
<i style="color: #65696E;">Die Deadline für die Bestätigung war am
|
||||
<span style="color: #FF0000;">'. date_format($deadline, 'Y-m-d'). '</span>
|
||||
</i>
|
||||
</small></p><br>';
|
||||
@@ -177,7 +177,7 @@ class AmpelMail extends FHC_Controller
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Private methods
|
||||
/**
|
||||
@@ -190,10 +190,10 @@ class AmpelMail extends FHC_Controller
|
||||
private function _getAmpelContentData($uid, $html_text, $ampel_data_arr)
|
||||
{
|
||||
$firstName = $this->PersonModel->getByUid($uid)->retval[0]->vorname;
|
||||
|
||||
|
||||
// check if user already exists in the array
|
||||
$key_position = array_search($uid, array_column($ampel_data_arr, 'uid'));
|
||||
|
||||
|
||||
// If user already exists in the array, add only new ampel data to users ampel list
|
||||
if ($key_position !== false)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ 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
|
||||
@@ -25,24 +25,24 @@ class Ampel_model extends DB_Model
|
||||
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)';
|
||||
|
||||
(NOW()<(deadline+(COALESCE(verfallszeit,0) || \' days\')::interval)::date)
|
||||
OR (verfallszeit IS NULL)
|
||||
AND (NOW()>(deadline-(COALESCE(vorlaufzeit,0) || \' 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.
|
||||
@@ -55,7 +55,7 @@ class Ampel_model extends DB_Model
|
||||
return $this->execQuery($benutzer_select);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if Ampel was confirmed by the user.
|
||||
* @param int $ampel_id Ampel-ID
|
||||
@@ -75,7 +75,7 @@ class Ampel_model extends DB_Model
|
||||
{
|
||||
$result = $this->execQuery($query, array($ampel_id, $uid));
|
||||
}
|
||||
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if (count($result->retval) > 0)
|
||||
@@ -87,7 +87,7 @@ class Ampel_model extends DB_Model
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
return $result; //will contain the error-msg from execQuery
|
||||
}
|
||||
}
|
||||
|
||||
+30
-30
@@ -24,75 +24,75 @@ function hide_ampel_div()
|
||||
if(is_user_logged_in())
|
||||
{
|
||||
$user = get_uid();
|
||||
|
||||
|
||||
$ampel = new ampel();
|
||||
$ampel->loadUserAmpel($user);
|
||||
$rot=0;
|
||||
$gelb = 0;
|
||||
$gelb = 0;
|
||||
$gruen = 0;
|
||||
$verpflichtend = false;
|
||||
$cnt_verpflichtend = 0;
|
||||
$cnt_abgelaufen = 0;
|
||||
$cnt_verpflichtend = 0;
|
||||
$cnt_abgelaufen = 0;
|
||||
$cnt_notConf_notOverdue = 0; //counts mandatory, not confirmed && not overdued ampeln (for popup)
|
||||
|
||||
|
||||
$datum = new datum();
|
||||
$now = $datum->mktime_fromdate(date('Y-m-d'));
|
||||
foreach($ampel->result as $row)
|
||||
{
|
||||
{
|
||||
$deadline =$datum->mktime_fromdate($row->deadline);
|
||||
$vorlaufzeit = $row->vorlaufzeit;
|
||||
$verfallszeit = $row->verfallszeit;
|
||||
$bestaetigt = $ampel->isBestaetigt($user, $row->ampel_id);
|
||||
$verpflichtend = $row->verpflichtend;
|
||||
$abgelaufen = false;
|
||||
|
||||
|
||||
$datum_liegt_vor_vorlaufzeit = false;
|
||||
$datum_liegt_nach_verfallszeit = false;
|
||||
|
||||
|
||||
if (!is_null($vorlaufzeit))
|
||||
$datum_liegt_vor_vorlaufzeit = $now < strtotime('-' . $vorlaufzeit . ' day', $deadline);
|
||||
|
||||
$datum_liegt_vor_vorlaufzeit = $now < strtotime('-' . $vorlaufzeit . ' day', $deadline);
|
||||
|
||||
if (!is_null($verfallszeit))
|
||||
$datum_liegt_nach_verfallszeit = $now > strtotime('+' . $verfallszeit . ' day', $deadline);
|
||||
|
||||
|
||||
//count mandatory
|
||||
if($verpflichtend == 't')
|
||||
$cnt_verpflichtend++;
|
||||
|
||||
|
||||
//count overdue
|
||||
if ($datum_liegt_nach_verfallszeit)
|
||||
$cnt_abgelaufen++;
|
||||
|
||||
//set status
|
||||
if ($bestaetigt)
|
||||
$gruen++;
|
||||
else if ($now >= $deadline && !$datum_liegt_nach_verfallszeit && !$bestaetigt)
|
||||
$gruen++;
|
||||
else if ($now >= $deadline && !$datum_liegt_nach_verfallszeit && !$bestaetigt)
|
||||
$rot++;
|
||||
else if (!$datum_liegt_nach_verfallszeit && !$datum_liegt_vor_vorlaufzeit)
|
||||
$gelb++;
|
||||
|
||||
$gelb++;
|
||||
|
||||
//count mandatory ampeln that are not confirmed and not overdue (for popup)
|
||||
if ($verpflichtend == 't' && !$bestaetigt && !$datum_liegt_nach_verfallszeit && !$datum_liegt_vor_vorlaufzeit)
|
||||
$cnt_notConf_notOverdue++;
|
||||
$cnt_notConf_notOverdue++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if at least ONE mandatory notification, which is not overdue -> trigger notification-POPUP
|
||||
if ($cnt_notConf_notOverdue > 0)
|
||||
{
|
||||
{
|
||||
echo ' <script>
|
||||
$(document).ready(function()
|
||||
{
|
||||
function resizeIframe(obj)
|
||||
{
|
||||
function resizeIframe(obj)
|
||||
{
|
||||
obj.style.height = obj.contentWindow.document.body.scrollHeight + \'px\';
|
||||
}
|
||||
|
||||
var html_content = \'<iframe src="'.APP_ROOT.'cis/private/tools/ampelverwaltung.php?verpflichtend=true" name="ampel" frameborder="0" width="100%" height="100% onload="resizeIframe(this) id="ampel_frame"></iframe><button id="close_button" onclick="hide_ampel_div()">Close</button>\';
|
||||
|
||||
var html_content = \'<iframe src="'.APP_ROOT.'cis/private/tools/ampelverwaltung.php?verpflichtend=true" name="ampel" frameborder="0" width="100%" height="100% onload="resizeIframe(this) id="ampel_frame"></iframe><button id="close_button" class="btn btn-default" onclick="hide_ampel_div()">'.$p->t('tools/ampelClose').'</button>\';
|
||||
$("#ampel_div").html(html_content);
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
echo ' <style type="text/css">
|
||||
#ampel_div
|
||||
{
|
||||
@@ -107,8 +107,8 @@ if(is_user_logged_in())
|
||||
background-color: #fefefe;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
border: 3px solid black;
|
||||
/*padding-top: 20px;*/
|
||||
/*border: 3px solid black;*/
|
||||
-webkit-box-shadow: 0px 0px 0px 2000px rgba(0,0,0,0.47);
|
||||
-moz-box-shadow: 0px 0px 0px 2000px rgba(0,0,0,0.47);
|
||||
box-shadow: 0px 0px 0px 2000px rgba(0,0,0,0.47);
|
||||
@@ -120,24 +120,24 @@ if(is_user_logged_in())
|
||||
#close_button
|
||||
{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
top: 0px;
|
||||
font-size: 150%;
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>';
|
||||
}
|
||||
|
||||
|
||||
//show & color header ampel-link
|
||||
if($rot > 0)
|
||||
echo '<a href="private/tools/ampelverwaltung.php" target="content" title="'.$p->t("tools/ampelsystem").'"><span style="color: red;">'.$p->t("tools/ampelsystem").'</span></a> <span style="color: #A5AFB6">|</span> ';
|
||||
elseif($gelb > 0)
|
||||
echo '<a href="private/tools/ampelverwaltung.php" target="content" title="'.$p->t("tools/ampelsystem").'"><span style="color: orange;">'.$p->t("tools/ampelsystem").'</span></a> <span style="color: #A5AFB6">|</span> ';
|
||||
elseif($rot==0 || $rot <= $cnt_abgelaufen && $gelb==0)
|
||||
echo '<a href="private/tools/ampelverwaltung.php" target="content" title="'.$p->t("tools/ampelsystem").'"><span style="color: #A5AFB6">'.$p->t("tools/ampelsystem").'</span></a> <span style="color: #A5AFB6">|</span> ';
|
||||
echo '<a href="private/tools/ampelverwaltung.php" target="content" title="'.$p->t("tools/ampelsystem").'"><span style="color: #A5AFB6">'.$p->t("tools/ampelsystem").'</span></a> <span style="color: #A5AFB6">|</span> ';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>window.setTimeout('loadampel()',1000);</script>";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
+6
-5
@@ -165,11 +165,12 @@ $db = new basis_db();
|
||||
<link rel="stylesheet" href="../skin/jquery.css" type="text/css">
|
||||
<link href="../skin/style.css.php" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="../skin/jquery-ui-1.9.2.custom.min.css">
|
||||
<script type="text/javascript" src="../vendor/jquery/jqueryV1/jquery-1.12.4.min.js"></script>
|
||||
<script type="text/javascript" src="../vendor/christianbach/tablesorter/jquery.tablesorter.min.js"></script>
|
||||
<script type="text/javascript" src="../vendor/components/jqueryui/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="../include/js/jquery.ui.datepicker.translation.js"></script>
|
||||
<script type="text/javascript" src="../vendor/jquery/sizzle/sizzle.js"></script>
|
||||
<script type="text/javascript" src="../vendor/jquery/jqueryV1/jquery-1.12.4.min.js"></script>
|
||||
<script type="text/javascript" src="../vendor/christianbach/tablesorter/jquery.tablesorter.min.js"></script>
|
||||
<script type="text/javascript" src="../vendor/components/jqueryui/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="../include/js/jquery.ui.datepicker.translation.js"></script>
|
||||
<script type="text/javascript" src="../vendor/jquery/sizzle/sizzle.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
|
||||
</head>
|
||||
<script type="text/javascript">
|
||||
function changeSprache(sprache)
|
||||
|
||||
@@ -59,6 +59,7 @@ $this->phrasen['tools/ampelAbgelaufenTxt']='Sie können diese Ampeln weiterhin l
|
||||
$this->phrasen['tools/ampelBestaetigtAbgelaufen']='Bereits bestätigt oder abgelaufen';
|
||||
$this->phrasen['tools/ampelKeineAktuellen']='Keine aktuellen Ampeln';
|
||||
$this->phrasen['tools/ampelKeineAktuellenTxt']='Sie haben zur Zeit keine aktuellen Ampeln.';
|
||||
$this->phrasen['tools/ampelClose']='Jetzt nicht';
|
||||
|
||||
//Software fuer Lehre -> Softgrid
|
||||
$this->phrasen['tools/applikationsliste']='Applikationsliste';
|
||||
|
||||
Reference in New Issue
Block a user