Files
votianng/html/tools/checkStateCI.php
2026-03-29 10:34:57 +02:00

154 lines
5.6 KiB
PHP

<?php
/*=======================================================================
*
* checkStateCI.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
$autoMode = false;
if (!isset($argv[1]) || $argv[1] == "") :
include_once ("../include/auth.inc.php");
getSecHttpVars("1", array("f_act", "objId", "objType"));
$autoMode = false;
$hqIdMail = $hq_id;
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
$accessOK = authCheckForAccess($hq_id, $usr_id, $emp_id, "", $customerId, $cscIdRoot, $cscIdActual);
else :
if ($argv[1] == "acapella7890") :
$autoMode = true;
$hqIdMail = trim($argv[2]);
else :
die();
endif;
endif;
// Get the rights of the employee logged in and check the accessibility
if (!authCheckEmployeeRights($emp_id, "1")) : die ("$PHP_SELF: Access denied!"); endif;
getSecHttpVars("1", array("f_act", "dbConnection", "hqId", "pageType"));
getLanguage(__FILE__);
include_once ("../include/html.inc.php");
// include_once ("../include/inc_dbinspector.inc.php");
getCurrentScript(__FILE__);
// INIT
$debug = false;
$output = array();
$mapArrayCI = array("Kein Eintrag", "HT-CI", "Neutral", "Kunden-CI", "Fremd-CI");
// Get export templates from "exportparameters" from "template customer"
$sqlquery = "SELECT hq.hq_mnemonic, crvh.crvh_sid, crvh.crvh_corporate_identity, cr.cr_eid, usr.usr_name, usr.usr_firstname"
. " FROM couriervehicle AS crvh, courier AS cr, user AS usr, headquarters AS hq"
. " WHERE crvh.cr_id = cr.cr_id AND
cr.usr_id = usr.usr_id AND
cr.hq_id = hq.hq_id"
. " ORDER BY hq.hq_mnemonic, cr.cr_eid";
// echo $sqlquery . "<br><br>";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$outArray = array();
$colorArray = array();
$count = 0;
while ($row = $result->fetch_assoc()):
$outArray[$count] = $row;
$colorArray[$count] = "FF0000";
if (((int)$row["crvh_corporate_identity"] & 15) >= 1 && (((int)$row["crvh_corporate_identity"] / 16) & 15) >= 1) :
$colorArray[$count] = "00FF00";
endif;
$count++;
endwhile;
$result->free();
$outArrayLen = count($outArray);
if ($debug) : print_r($outArray); echo "<br><br><br><br>"; endif;
if ($outArrayLen > 0) :
$tableOut .= "<table>\n";
$tableOut .= "<tr>\n";
$tableOut .= "<td class=\"f12bp1_blue\">" . getLngt("ÜBERSICHT CORPORATE IDENTITY") . "</td>";
$tableOut .= "</tr>\n";
$tableOut .= "</table>\n";
$tableOut .= "<br><br>";
$tableOut .= "<table>\n";
$tableOut .= "<tr>\n";
$tableOut .= "<td style=\"background-color: #FF0000;\">&nbsp;&nbsp;&nbsp;Mindestens ein Eintrag fehlt&nbsp;&nbsp;&nbsp;</td>";
$tableOut .= "<td style=\"background-color: #00FF00;\">&nbsp;&nbsp;&nbsp;Beide Einträge sind gesetzt&nbsp;&nbsp;&nbsp;</td>";
$tableOut .= "</tr>\n";
$tableOut .= "</table>\n";
$tableOut .= "<br><br>";
$tableOut .= "<table>\n";
$tableOut .= "<tr>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("NL") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("Fzg.") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("CI-Fzg.") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("CI-Kleidung") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("EID") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("Name") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center;\">" . getLngt("Vorname") . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "</tr>\n";
// Iterate all items
for ($i = 0; $i < $outArrayLen; $i++) :
$tmpArr = $outArray[$i];
$rowColor = $colorArray[$i];
$tableOut .= "<tr>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $tmpArr["hq_mnemonic"] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $tmpArr["crvh_sid"] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $mapArrayCI[((int)$tmpArr["crvh_corporate_identity"] & 15)] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $mapArrayCI[(((int)$tmpArr["crvh_corporate_identity"] / 16) & 15)] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $tmpArr["cr_eid"] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $tmpArr["usr_name"] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $tmpArr["usr_firstname"] . "&nbsp;&nbsp;&nbsp;</td>\n";
$tableOut .= "</tr>\n";
endfor;
$tableOut .= "</table>\n";
else :
$output[] = "Keine Daten aufgefunden!";
endif;
// Output
$outputLen = count($output);
for ($i = 0; $i < $outputLen; $i++) :
echo $output[$i] . "<br>";
endfor;
?>
<?php if (!$autoMode) : ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
</head>
<body class="menu_bgcol" >
<center>
<br><br><br>
<b><?php echo $tableOut ?></b>
</center>
</body>
</html>
<?php endif; ?>