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

752 lines
38 KiB
PHP
Raw Permalink Blame History

<?php
/*=======================================================================
*
* start.php
*
=======================================================================*/
include_once("../include/dbconnect.inc.php");
include_once("../include/caglobal.inc.php");
include_once("../include/auth.inc.php");
include_once("../include/inc_user.inc.php");
include_once("../include/grid.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "noResetUserStates"));
// Id of the actual employee and the costcenter (individual root-node) logged in
if ($cscIdRoot == ""): $cscIdRoot = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id"); endif;
if ($customerId == ""): $customerId = getFieldValueFromId("costcenter","csc_id",$cscIdRoot,"cs_id"); endif;
if ($cscIdActual == ""): $cscIdActual = $cscIdRoot; endif;
// Reset user states data after login
// Has to be executed before including "menu.php" (!!!!)
if (!isset($noResetUserStates) || $noResetUserStates == "") :
resetUserStates();
$noResetUserStates = "1";
endif;
getLanguage(__FILE__);
$pageTitel = getLngt("STARTSEITE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// GRID
// 1. Parameter: Initial column width
// 2. Parameter: Number of rows and columns
$grid = new Grid("600px", array(4,2));
// All output has to match a special grid container
$gridJsOut = "";
// Grid container sequential number, read from left to right and then row by row from top to button
// E.g. array(3,2) has 6 = 3 x 2 containers ([0][0] = 1)
// Reset the counter (= 0)
$grid->resetContainerPageCounter();
// Returns container page counter values
// $mode: "0" or empty <=> returns the array(row, col) regarding current container ID
// "1" returns the page counter by itself
// "2" returns the ID of the container
// $gridMatrix = $grid->getNextContainerPageCounter();
// Current user data
$sqlquery = "SELECT usr.usr_name, usr.usr_firstname, usr.usr_type"
. " FROM user AS usr"
. " WHERE usr.usr_id = " . $usr_id;
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$v_usr_type = $row["usr_type"];
$v_usr_name = $row["usr_name"];
$v_usr_firstname = $row["usr_firstname"];
endwhile;
$result->free();
if ($v_usr_type == "1") :
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "11")) :
include ("../groupware/calendar.php");
endif;
endif;
// Get the emp_id of the root admin, e.g. setting new passwords of employees
$empIdRootAdmin = getEmpIdOfRootAdmin("hq");
// Company-data
$sqlquery = "";
if ($v_usr_type == "3") :
// Courier
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, courier AS cr"
. " WHERE cr.usr_id = " . $usr_id
. " AND cmp.cmp_id = cr.cmp_id";
elseif ($v_usr_type == "2") :
// Customer
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, customer AS cs"
. " WHERE cs.cs_admin = " . $emp_id
. " AND cmp.cmp_id = cs.cmp_id";
elseif ($v_usr_type == "1") :
// Headquarter
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, headquarters AS hq"
. " WHERE hq.hq_id = " . $hq_id
. " AND hq.cmp_id = cmp.cmp_id";
endif;
if ($sqlquery != "") :
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$v_cmp_id = $row["cmp_id"];
$v_cmp_comp = $row["cmp_comp"];
$v_cmp_comp2 = $row["cmp_comp2"];
$v_cmp_logo = $row["cmp_logo"];
$v_cmp_logo_width = $row["cmp_logo_width"];
$v_cmp_logo_height = $row["cmp_logo_height"];
endwhile;
$result->free();
endif;
$companyLogo = "";
if (trim($v_cmp_logo) == "") :
$v_cmp_id = getFieldValueFromId("headquarters", "hq_id", $hq_id, "cmp_id");
list ($v_cmp_logo, $v_cmp_logo_width, $v_cmp_logo_height) = getFieldsValueFromId("company","cmp_id",$v_cmp_id,array("cmp_logo","cmp_logo_width","cmp_logo_height"));
endif;
if (trim($v_cmp_logo) != "") :
$companyLogo = "<img src=\"../images/external/" . $v_cmp_logo . "\" border=\"0\" height=\"" . $v_cmp_logo_height . "\" width=\"" . $v_cmp_logo_width . "\">";
endif;
// Container
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "red"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $v_cmp_comp . " " . $v_cmp_comp2, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "14pt", "font-weight", "bold"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center>" . $companyLogo . "</br></br>" . getLngt("Hallo") . " " . $v_usr_firstname . " " . $v_usr_name . "</br></br></center>", "bd");
// **********************************************
// *** Birthdays, newsticker and appointments ***
// **********************************************
$currentTime = getDateTime("0");
$birthdateOut = "";
$newstickerOut = "";
$appointmentOut = "";
// FOR HEADQUARTERS ONLY
if ($v_usr_type == "1") :
// Birthday data
/*
$sqlquery = "SELECT DISTINCT hq.hq_mnemonic, usr.usr_name, usr.usr_firstname, usr.usr_type"
. " FROM user AS usr, headquarters AS hq"
. " WHERE usr.hq_id = hq.hq_id AND RIGHT(usr.usr_birthdate, 5) = RIGHT(CURDATE(), 5)"
. " ORDER BY usr.usr_type, usr.usr_name";
$result = $db->dbQ($sqlquery);
$tmpUsrTypeArray = array(0,0,0,0);
while ($row = $result->fetch_assoc()):
if ($tmpUsrTypeArray[$row["usr_type"]] == "0") :
$tmpUsrTypeArray[$row["usr_type"]] = "1";
if ($row["usr_type"] == "1") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Mitarbeiter") . ":</td></tr>"; endif;
if ($row["usr_type"] == "2") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Kunden") . ":</td></tr>"; endif;
if ($row["usr_type"] == "3") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Transporteure") . ":</td></tr>"; endif;
endif;
$birthdateOut .= "<tr>";
$birthdateOut .= "<td>(" . $row["hq_mnemonic"] . ")&nbsp;&nbsp;</td>";
$birthdateOut .= "<td>" . $row["usr_firstname"] . "&nbsp;" . $row["usr_name"] . "</td>";
$birthdateOut .= "</tr>";
endwhile;
$result->free();
*/
$sqlquery = "SELECT DISTINCT hq.hq_mnemonic, usr.usr_name, usr.usr_firstname, usr.usr_type, cr_cmp.cmp_authenticated, cr_cmp.cmp_visible"
. " FROM headquarters AS hq, user AS usr LEFT JOIN courier AS cr ON cr.usr_id = usr.usr_id AND usr.usr_type = '3'"
. " LEFT JOIN company AS cr_cmp ON cr.cmp_id = cr_cmp.cmp_id"
. " WHERE usr.hq_id = hq.hq_id AND RIGHT(usr.usr_birthdate, 5) = RIGHT(CURDATE(), 5)"
. " ORDER BY usr.usr_type, usr.usr_name";
$result = $db->dbQ($sqlquery);
$tmpUsrTypeArray = array(0,0,0,0);
while ($row = $result->fetch_assoc()):
if ($tmpUsrTypeArray[$row["usr_type"]] == "0") :
$tmpUsrTypeArray[$row["usr_type"]] = "1";
if ($row["usr_type"] == "1") : $birthdateOut .= "<tr><td colspan=\"2\"><b>" . getLngt("Mitarbeiter") . ":</b></td></tr>"; endif;
if ($row["usr_type"] == "2") : $birthdateOut .= "<tr><td colspan=\"2\"><b>" . getLngt("Kunden") . ":</b></td></tr>"; endif;
if ($row["usr_type"] == "3") : $birthdateOut .= "<tr><td colspan=\"2\"><b>" . getLngt("Transporteure") . ":</b></td></tr>"; endif;
endif;
if ($row["usr_type"] != "3" || ($row["usr_type"] == "3" && $row["cmp_authenticated"] == "1" && $row["cmp_visible"] == "1")) :
$birthdateOut .= "<tr>";
$birthdateOut .= "<td>(" . $row["hq_mnemonic"] . ")&nbsp;&nbsp;</td>";
$birthdateOut .= "<td>" . $row["usr_firstname"] . "&nbsp;" . $row["usr_name"] . "</td>";
$birthdateOut .= "</tr>";
endif;
endwhile;
$result->free();
// Container birthdays
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("Wir gratulieren herzlich zum Geburtstag!"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "14pt", "font-weight", "bold"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . "<table>" . $birthdateOut . "</table>" . "</br></center>", "bd");
// DIRECT SEARCH
$bdOut = "<div><center></br><b>" . getLngt("Auftrag, Kunde, Fahrer, Fahrzeug") . ":</b>&nbsp;&nbsp;"
. "<input type=\"text\" id=\"metaSearch\" name=\"metaSearch\" value=\"\" size=\"15\">&nbsp;&nbsp;"
. "<button type=\"button\" class=\"buttonIcon\" onClick=\"metasearchStart();\">" . "&nbsp;" . "</button></br></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_01\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_02\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_03\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_04\"></div>";
// Container meta search
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("DIREKTSUCHE"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "12pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $bdOut, "bd");
// SPECIAL RIGHTS FOR reports !!!!!!!!!!!!!!!!!!!!!!!!!!!!
$lastLoginTime = "";
$newCsReportsOut = "";
$newCrReportsOut = "";
$numOfNewCrReports = 0;
$presetDays = 7;
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "16")) :
$numOfNewCsReports = 0;
$listOfLoginsArray = getListOfLogEntries(array('52','53'), array(0,0,0,0,-($presetDays),0), array("log_createtime"), $emp_id, "log_createtime DESC");
$listOfLoginsArrayLen = count($listOfLoginsArray);
if ($listOfLoginsArrayLen > 0) :
$lastLoginTime = $listOfLoginsArray[1][0];
if ($lastLoginTime != "") :
$numOfNewCsReports = getCountOfTable("phoenix_group.report_process", "hq_id = '" . $hq_id . "' AND rp_objtype = 'cs' AND rp_createtime >= '" . $lastLoginTime . "'");
if ($numOfNewCsReports == -1) : $numOfNewCsReports = 0; endif;
$numOfNewCrReports = getCountOfTable("phoenix_group.report_process", "hq_id = '" . $hq_id . "' AND rp_objtype = 'cr' AND rp_createtime >= '" . $lastLoginTime . "'");
if ($numOfNewCrReports == -1) : $numOfNewCrReports = 0; endif;
endif;
endif;
$newCsReportsOut = "<a href=\"../groupware/report.php?currentNavigationItem=vertrieb&rpObjType=cs&day_from=". ec(substr($lastLoginTime,8,2)) . "&month_from=". ec(substr($lastLoginTime,5,2)) . "&year_from=". ec(substr($lastLoginTime,0,4)) . "&day_to=" . ec(getDateTime("day")) . "&month_to=". ec(getDateTime("month")) . "&year_to=". ec(getDateTime("year")) . "\" target=\"_blank\">" . getLngt("[Kundenberichte]") . "</a>";
$newCrReportsOut = "<a href=\"../groupware/report.php?currentNavigationItem=vertrieb&rpObjType=cr&day_from=". ec(substr($lastLoginTime,8,2)) . "&month_from=". ec(substr($lastLoginTime,5,2)) . "&year_from=". ec(substr($lastLoginTime,0,4)) . "&day_to=" . ec(getDateTime("day")) . "&month_to=". ec(getDateTime("month")) . "&year_to=". ec(getDateTime("year")) . "\" target=\"_blank\">" . getLngt("[Transporteursberichte]") . "</a>";
endif; // SPECIAL RIGHTS FOR reports !!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Number of reports
$reportOut = "";
$lastLoginTimestamp = "";
if ($lastLoginTime != "") :
$lastLoginTimestamp = substr($lastLoginTime,8,2) . "." . substr($lastLoginTime,5,2) . "." . substr($lastLoginTime,0,4). "&nbsp;&nbsp;" . substr($lastLoginTime,11,2) . "." . substr($lastLoginTime,14,2) . "." . substr($lastLoginTime,17,2);
endif;
if ($newCsReportsOut != "" || $newCrReportsOut != "") :
$reportOut .= "<div><table>";
$reportOut .= "<tr><td align=\"center\"><b>" . getLngt("BERICHTE seit letztem Login") . "&nbsp;[" . $lastLoginTimestamp . "]&nbsp;" . getLngt("(max. eine Woche)") . "<br><br></td></tr>";
if ($newCsReportsOut != "") :
$reportOut .= "<tr><td align=\"center\">" . $newCsReportsOut . "&nbsp;&nbsp;[" . getLngt("Anzahl") . "&nbsp;" . $numOfNewCsReports . "]<br><br></td></tr>";
endif;
if ($newCrReportsOut != "") :
$reportOut .= "<tr><td align=\"center\">" . $newCrReportsOut . "&nbsp;&nbsp;[" . getLngt("Anzahl") . "&nbsp;" . $numOfNewCrReports . "]<br><br></td></tr>";
endif;
$reportOut .= "</table></div>";
// Container reports
$gridMatrix = $grid->getNextContainerPageCounter();
// $gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "blue"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("BERICHTE seit letztem Login") . "&nbsp;[" . $lastLoginTimestamp . "]&nbsp;" . getLngt("(max. eine Woche)"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . $reportOut . "</center>", "bd");
endif;
// SPECIAL RIGHTS FOR calendar !!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "11")) :
// Appointment data
$f_hq_id = array($hq_id);
$f_selUsrId = $usr_id;
// Monitored appointments
$f_ap_cat_search_4 = "1"; // Get only appointments with activated "alarm"
$tmpApRangeStarttime = getDateTime("date_plus_offset", array(-1,0,0), "Ymd");
$tmpApRangeEndtime = getDateTime("date_plus_offset", array(0,7,0), "Ymd");
$apArray = getAppointmentsFromDB(substr($tmpApRangeStarttime,0,4), substr($tmpApRangeStarttime,4,2) , substr($tmpApRangeStarttime,6,2), substr($tmpApRangeEndtime,0,4), substr($tmpApRangeEndtime,4,2) , substr($tmpApRangeEndtime,6,2));
// Normal appointments
$f_ap_cat_search_4 = "0"; // Get normal appointments
$tmpApRangeStarttime = getDateTime("date_plus_offset", array(0,0,0), "Ymd");
$tmpApRangeEndtime = getDateTime("date_plus_offset", array(0,1,0), "Ymd");
$apArray2 = getAppointmentsFromDB(substr($tmpApRangeStarttime,0,4), substr($tmpApRangeStarttime,4,2) , substr($tmpApRangeStarttime,6,2), substr($tmpApRangeEndtime,0,4), substr($tmpApRangeEndtime,4,2) , substr($tmpApRangeEndtime,6,2));
// Merge arrays
$apArray = array_merge($apArray, $apArray2);
$lenApArray = count($apArray);
$apOut = "";
for ($j = 0; $j < $lenApArray; $j++) :
$tmpId = $apArray[$j][0];
$tmpText = $apArray[$j][1];
$tmpExecDateTime = $apArray[$j][2];
$tmpExecDate = substr($tmpExecDateTime,8,2) . "." . substr($tmpExecDateTime,5,2) . "." . substr($tmpExecDateTime,0,4);
$tmpExecTime = substr($tmpExecDateTime,11,5);
$tmpExecDateYear = substr($apArray[$j][2],0,4);
$tmpExecDateMonth = substr($apArray[$j][2],5,2);
$tmpExecDateDay = substr($apArray[$j][2],8,2);
$tmpCmpId = trim($apArray[$j][3]);
$tmpCmpComp = trim($apArray[$j][4]);
$tmpCmpComp2 = trim($apArray[$j][5]);
$tmpCsId = $apArray[$j][6];
$tmpCsEid = $apArray[$j][7];
$tmpEndDateTime = $apArray[$j][8];
$tmpEndDate = substr($tmpEndDateTime,8,2) . "." . substr($tmpEndDateTime,5,2) . "." . substr($tmpEndDateTime,0,4);
$tmpEndTime = substr($tmpEndDateTime,11,5);
$tmpUsrId = trim($apArray[$j][9]);
$tmpUsrFirstname = trim($apArray[$j][10]);
$tmpUsrName = trim($apArray[$j][11]);
$tmpParticipants = trim($apArray[$j][12]);
$tmpParticipants = substr($tmpParticipants,1,-1); // Remove commata from db-field
$tmpConfirmed = trim($apArray[$j][13]);
$tmpConfirmed = substr($tmpConfirmed,1,-1); // Remove commata from db-field
$tmpPtCmpComp = trim($apArray[$j][14]);
$tmpPtCmpComp2 = trim($apArray[$j][15]);
$tmpPtCsEid = $apArray[$j][16];
$tmpPtId = $apArray[$j][17];
$tmpApCat1 = $apArray[$j][18];
$tmpApCat2 = $apArray[$j][19];
$tmpApCat3 = $apArray[$j][20];
$tmpApCat4 = $apArray[$j][21];
$cellCol = "FFFFFF";
$apOut .= "<tr><td>" . getLngt("Beginn") . "</td><td>" . getLngt("Ende") . "</td><td>" . getLngt("Ersteller") . "</td><td>" . getLngt("Teilnehmer") . "</td><td>" . getLngt("Beschreibung") . "</td><td>" . getLngt("Kunde") . "</td><td>&nbsp;</td></tr>";
$apOut .= "<tr>";
// Dates (From, To)
$apOut .= "<td width=\"90\" align=\"center\" valign=\"center\" bgcolor=\"#" . $cellCol . "\"><b>" . $tmpExecDate . "<br>" . ($tmpApCat4 == "1" ? "<img src=\"../images/ap_clock.png\" width=\"15\" height=\"15\" style=\"border:none;\">" : "") . "<br>" . $tmpExecTime . "</b></td>";
if ($tmpEndTime != "00:00") :
$apOut .= "<td width=\"90\" align=\"center\" valign=\"center\" bgcolor=\"#" . $cellCol . "\"><b>" . $tmpEndDate . "<br><br>" . $tmpEndTime . "</b></td>";
else :
$apOut .= "<td width=\"90\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
// User
if ($tmpUsrId != "") :
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpUsrFirstname . "<br>" . $tmpUsrName . "</td>";
else :
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
// Participants
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">";
if ($tmpParticipants != "") :
$tmpParticipants = spliti(",", $tmpParticipants); // It has to be an array
$tmpParticipantsLen = count($tmpParticipants);
// Needs array of users confirmed the appointment
$tmpConfirmed = spliti(",", $tmpConfirmed);
for ($k = 0; $k < $tmpParticipantsLen; $k++) :
$participantName = getOneStmt("SELECT CONCAT(usr_name,', ',usr_firstname) AS name FROM user WHERE usr_id = '" . $tmpParticipants[$k] . "'", "name");
$participantConfirmed = "[?]";
$l = array_search($tmpParticipants[$k], $tmpConfirmed);
if (!($l === FALSE)) :
$participantConfirmed = getLngt("[OK]");
else :
if ($tmpParticipants[$k] == $tmpUsrId) :
$participantConfirmed = getLngt("[OK]");
elseif ($tmpParticipants[$k] == $usr_id) : // Only the user has a link to confirm his/her own entry
// $participantConfirmed = "<a href=\"javascript:confirmAppointmentFinishPage('" . $tmpId . "');\">" . getLngt("[Best<73>tigen]") . "</a>";
$participantConfirmed = getLngt("[Best<73>tigen]");
endif;
endif;
$apOut .= $participantName . "&nbsp;" . $participantConfirmed . "<br>";
endfor;
else :
$apOut .= "&nbsp;";
endif;
$apOut .= "</td>";
// Text
$apOut .= "<td align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . my_nl2br($tmpText) . "</td>";
// Potential customer relation (Company name and EID)
if ($tmpCsId != "") :
$apOut .= "<td width=\"205\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpCmpComp . "<br>" . ($tmpCmpComp2 != "" ? $tmpCmpComp2 . "<br>" : "") . $tmpCsEid . "<br>";
// . "<input type=\"button\" name=\"action\" value=\"Details\" onClick=\"openCustomerSpecial('" . $tmpCmpId . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Berichte\" onClick=\"getCsHistory('" . $tmpCsEid . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Statistik\" onClick=\"openCustomerStatistics('" . $tmpCsEid . "');\">"
// . "</td>";
// elseif ($tmpPtId != "") :
// $apOut .= "<td width=\"205\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpPtCmpComp . "<br>" . ($tmpPtCmpComp2 != "" ? $tmpPtCmpComp2 . "<br>" : "") . $tmpPtCsEid . "<br>"
// . "<input type=\"button\" name=\"action\" value=\"Details\" onClick=\"openProspectSpecial('" . $tmpPtId . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Berichte\" onClick=\"getPtHistory('','" . $tmpPtCsEid . "');\">"
// . "</td>";
else :
$apOut .= "<td width=\"200\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
$apOut .= "<td width=\"100\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">";
$apOut .= "&nbsp;&nbsp;<a href=\"../groupware/appointment.php?currentNavigationItem=vertrieb&f_selUsrId=" . ec($usr_id) . "&viewMode=" . ec(0) . "&selYear=" . ec($tmpExecDateYear) . "&selMonth=" . ec($tmpExecDateMonth) . "&selDay=" . ec($tmpExecDateDay) . "\">" . getLngt("[Zum Termin]") . "</a>";
$apOut .= "</td>";
// if ($j < $lenApArray - 1) : $apOut .= "</tr><tr>"; endif;
$apOut .= "</tr>";
endfor;
if (true || $lenApArray > 0) :
// Container appointments
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "blue"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("AKTUELLE TERMINE") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"document.location.href = \'../groupware/appointment.php?currentNavigationItem=vertrieb&f_selUsrId=" . ec($usr_id) . "\';\">" . getLngt("Kalender") . "</button>", "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . "<table>" . $apOut . "</table>" . "</center>", "bd");
endif;
endif; // SPECIAL RIGHTS FOR calendar !!!!!!!!!!!!!!!!!!!!!!!!!!!!
endif;
// A text, transmitted by ajax from client to server with "encodeURI(escape(content))" in javascript,
// stored - urldecoded in PHP - into the DB and read by PHP from the database again like here for (editable) output
function my_str_check_ajax($aStr, $nl2br_enabled = true)
{
while (strpos($aStr, "\\")) :
$aStr = str_replace("\\n", "\n", $aStr);
$aStr = str_replace("\\r", "\r", $aStr);
endwhile;
if ($nl2br_enabled) :
$aStr = str_replace("\n\r", "</br>", $aStr);
$aStr = str_replace("\r\n", "</br>", $aStr);
$aStr = str_replace("\n", "</br>", $aStr);
$aStr = str_replace("\r", "</br>", $aStr);
endif;
return $aStr;
}
// CUSTOMER NEWS, visible for headquarter and customers, editable by headquarters only regarding access rights
if ($v_usr_type == "1" || $v_usr_type == "2") :
$csGlobalInfoByHq = "";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","hq2cs","gdc_obj_id",$hq_id,"gdc_gen_fieldname","global_cs_info"))) :
$csGlobalInfoByHq = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'hq2cs' AND gdc_obj_id = '" . $hq_id . "' AND gdc_gen_fieldname = 'global_cs_info'");
endif;
// Check for access right to edit the text
if ($v_usr_type == "1") :
$outCsGlobalInfoByHqHeadline = getLngt("Aktuelle Infos f<>r die Kunden");
else :
$outCsGlobalInfoByHqHeadline = getLngt("Aktuelle Informationen f<>r Sie");
endif;
if ($v_usr_type == "1" && authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeGdcValue(\'hq2cs\',\'global_cs_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalInfoByHqBody = "<center><textarea id=\"global_cs_info\" name=\"global_cs_info\" cols=\"65\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalInfoByHq) . "</textarea></center>";
else :
$outCsGlobalInfoByHqBody = my_str_check_ajax($csGlobalInfoByHq);
endif;
// Container customer news
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCsGlobalInfoByHqHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCsGlobalInfoByHqBody, "bd");
endif;
// CUSTOMER EMAIL NEWS, visible for and editable by headquarter only regarding access rights
if ($v_usr_type == "1") :
$csGlobalEmailInfoByHq = "";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","hq2cs","gdc_obj_id",$hq_id,"gdc_gen_fieldname","global_cs_email_info"))) :
$csGlobalEmailInfoByHq = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'hq2cs' AND gdc_obj_id = '" . $hq_id . "' AND gdc_gen_fieldname = 'global_cs_email_info'");
endif;
// Check for access right to edit the text
$outCsGlobalEmailInfoByHqHeadline = getLngt("Aktuelle Infos in den Kunden-Emails");
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalEmailInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeGdcValue(\'hq2cs\',\'global_cs_email_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalEmailInfoByHqBody = "<center><textarea id=\"global_cs_email_info\" name=\"global_cs_email_info\" cols=\"65\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalEmailInfoByHq) . "</textarea></center>";
else :
$outCsGlobalEmailInfoByHqBody = my_str_check_ajax($csGlobalEmailInfoByHq);
endif;
// Container customer news
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCsGlobalEmailInfoByHqHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCsGlobalEmailInfoByHqBody, "bd");
endif;
// 2-FA-Registration
$usrTypeEnabledFor2FA = getParameterValue("0", "USERTYPE_2FA_ENABLED", "0");
$usrNoDeactivationByUserOf2FA = getParameterValue("0", "USER_2FA_NO_DEACTIVATION", "0");
$ut2FAarr = explode(",", $usrTypeEnabledFor2FA);
if ($v_usr_type == "1" && $ut2FAarr[0] || $v_usr_type == "2" && $ut2FAarr[1] || $v_usr_type == "3" && $ut2FAarr[2]) :
// Get current state of 2-FA regarding the user logged in
$usrTotpSecret = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_secret");
$usrTotpActivated = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_activated");
if ($usrTotpSecret == "" || $usrTotpActivated != "1") :
$outCellBody = "<b><span class=\"f10bp1_red\">" . getLngt("BITTE BEACHTEN:") . "</span></b></br></br>"
. getLngt("Hier k<>nnen Sie f<>r Ihren Benutzerzugang eine Authenticator-App zur zus<75>tzlichen Best<73>tigung des Logins einrichten.") . "</br></br>"
. getLngt("Installieren Sie eine Authenticator-App auf Ihrem Smartphone, z.B. die Google Authenticator-App:") . "</br>"
. "[<a href=\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\" target=\"_blank\">" . getLngt("Google Play Store") . "</a>]" . "&nbsp;&nbsp;&nbsp;&nbsp;"
. "[<a href=\"https://apps.apple.com/de/app/google-authenticator/id388497605\" target=\"_blank\">" . getLngt("Apple App Store") . "</a>]" . "</br></br>"
. "[<a href=\"javascript:open2FA();\">" . getLngt("Bitte hier klicken zur Aktivierung der Zwei-Faktor-Authentifikation") . "</a>]</br></br>";
else :
if ($v_usr_type != "1" || $usrNoDeactivationByUserOf2FA != "1") :
$outCellBody = "</br></br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" . getLngt("Hier bitte deaktivieren:") . "</b>&nbsp;&nbsp;&nbsp;&nbsp;[<a href=\"javascript:deactivate2FA();\">" . getLngt("Deaktivierung") . "</a>]";
else :
$outCellBody = "</br></br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" . getLngt("F<EFBFBD>r eine Deaktivierung wenden Sie sich bitte an den zust<73>ndigen Mitarbeiter!") . "</b>";
endif;
endif;
// $outCellBody = my_str_check_ajax($outCellBody);
// Check for access right to edit the text
$outCellHeadline = getLngt("Zwei-Faktor-Authentifikation");
// $outCellHeadline = my_str_check_ajax($outCellHeadline);
/*
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalEmailInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeGdcValue(\'hq2cs\',\'global_cs_email_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalEmailInfoByHqBody = "<center><textarea id=\"global_cs_email_info\" name=\"global_cs_email_info\" cols=\"65\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalEmailInfoByHq) . "</textarea></center>";
else :
$outCsGlobalEmailInfoByHqBody = my_str_check_ajax($csGlobalEmailInfoByHq);
endif;
*/
// 2-FA-Registration
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "red"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCellHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCellBody, "bd");
endif;
// Hide remaining containers without content
$gridJsOut .= $grid->gridHideRemaining();
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<script>
//Quelle: https://msdn.microsoft.com/en-us/library/cc197053%28v=vs.85%29.aspx
window.onerror=fnErrorTrap;
function fnErrorTrap(sMsg,sUrl,sLine){
//parent.job_tour.document.tourForm.
//parent.job_options.document.tourOptions.
var tmp_jb_id = "";
if(typeof(jb_id)!='undefined')
tmp_jb_id = jb_id;
var out = '';
// if(typeof(parent.job_options.document.tourOptions) != 'undefined') {
// for (var i = 0; i <= parent.job_options.document.tourOptions.elements.length; i++) {
//// out += i + ": " + parent.job_options.document.tourOptions.elements[i].name + " = " + parent.job_options.document.tourOptions.elements[i].value + "\n";
// out += parent.job_options.document.forms[0].elements[i].value + "\n";
// }
// }
iframe = document.createElement("IFRAME");
iframe.setAttribute("src", "../include/ajaxJsError.php?url="+escape(sUrl) + "&line=" + escape(sLine) + "&message=" + escape(sMsg) + "&user_agent=" + escape(navigator.userAgent) + "&jb_id=" + tmp_jb_id + "&out=" + escape(out));
iframe.width = 1;
iframe.height = 1;
iframe.style.display = 'none';
setTimeout(function(){
document.body.appendChild(iframe);
},10);
return false;
}
//alert('test');
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<style type="text/css">
<?php
if ($browserOk) :
echo $grid->getGridItemParameter("output_css");
echo "input[type=text] {width:200px; height:25px; background-image: url('../images/loupe.png'); background-repeat:no-repeat; background-position: 4px 4px; background-size: 12px 12px; padding-left: 25px;}";
endif;
?>
.bar1
{ width:100%; height:100px;
font-size:12pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#1b12b9; color:white;
}
.bar2
{ width:100%; height:100px;
font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#4e45ec; color:white;
}
.bar3
{ width:100%;
font-size:10pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#4e45ec; color:white;
}
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script language="JavaScript">
<!--
var searchResult = '';
var d = new Date();
d.setTime(d.getTime() + (10 * 24 * 60 * 60 * 1000));
document.cookie = "deviceIsKnown=1;expires=" + d.toUTCString() + ";path=/";
function checkStartTickerOut () {
myhide('startTickerOut');
if (max > 0) {
tickerActive = true;
myshow('startTickerOut');
ticker('startTickerOut');
}
}
function metasearchStart () {
metasearch();
<?php
if ($v_usr_type == "1") :
// echo "$('#metaSearch').focus();";
endif;
?>
}
function storeGdcValue (gdcType, elem) {
var content = $('#' + elem).val();
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=500&wrap_html=1&value_01=' + gdcType + '&value_02=<?php echo ec($hq_id) ?>&value_03=' + elem + '&value_04=' + encodeURI(escape(content)) + '&value_05=');
}
// Opens a new (popup-)window with specified parameters
function popupSearch (url,title,config) {
var widthPopupWin = screen.width - 80;
var heightPopupWin = screen.height - 180;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2);
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2);
var popup;
popup = window.open(url,title, "dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
function openLinkByObject (objType, objValue) {
// alert(objType + ' ' + objValue);
if (objType == 'jb') {
popupSearch('../admin/jb_detail.php?job_id=' + objValue,'','');
}
if (objType == 'cs') {
popupSearch('../admin/customer_special.php?companyId=' + objValue,'','');
}
if (objType == 'cr') {
popupSearch('../admin/courier_special.php?companyId=' + objValue,'','');
}
if (objType == 'crvh') {
popupSearch('../admin/courier_vehicle.php?courierId=' + objValue,'','');
}
}
function open2FA() {
if (confirm('<?php echo getLngt("Haben Sie Ihre Authentication-App ge<67>ffnet zum Scannen des gleich angezeigten Barcodes?") ?>')) {
var widthPopupWin = 500;
var heightPopupWin = 800;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/GA_generateBarcode.php","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
};
function deactivate2FA () {
// Reset 2-FA secret
if (confirm('<?php echo getLngt("M<>chten Sie wirklich die Zwei-Faktor-Authentifikation abschalten? Der entsprechende Eintrag in Ihrer Authentication-App w<>re dann sofort ung<6E>ltig und sollte manuell gel<65>scht werden.") ?>')) {
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=user&db_id_field=usr_id&db_op_field=usr_totp_secret&new_content=&search_value=<?php echo $usr_id ?>');
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=user&db_id_field=usr_id&db_op_field=usr_totp_activated&new_content=0&search_value=<?php echo $usr_id ?>');
document.forms[0].submit();
}
}
function execBodyOnLoad() {
<?php
if ($browserOk) :
echo $gridJsOut;
endif;
?>
// checkStartTickerOut();
<?php
if ($browserOk && $v_usr_type == "1") :
echo "$('#metaSearch').focus();";
endif;
?>
}
<?php if ($browserOk) : ?>
$(document).keypress(function(e) {
if (e.keyCode === 13 && e.target.nodeName == 'INPUT') {
e.preventDefault(); //prevent default if it is INPUT
var focused = $(':focus');
if ($(focused).attr('id') == "metaSearch") {
metasearch();
};
}
});
<?php endif; ?>
// -->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>execBodyOnLoad();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<?php echo htmlDivLineSpacer("10px"); ?>
<form name="start" action="../admin/start.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="noResetUserStates" value="<?php echo ec($noResetUserStates) ?>">
<div>
<?php
if ($browserOk) :
echo $grid->getGridItemParameter("output_html");
endif;
?>
</div>
</form>
</div>
</body>
</html>