";
$out .= $calWeekDays[$calCurrentDayNumOfTheWeek - 1] . ", "; // Name of the week day (E.g.: "Donnerstag")
$out .= $selDay . ". " . $calMonthNames[$selMonth - 1] . " " . $selYear; // Day, Name of the month and year (E.g.: "29 Juni 2006")
$out .= " ";
$out .= $calCurrentWeekName . " " . $calCurrentWeekNum; // calendar week (E.g.: "KW 26")
$out .= " ";
$out .= $calCurrentDayNumOfTheYear . ". Tag des Jahres";
$out .= "
";
$out .= "";
return $out;
}
// Prints the title of the output table
// $cellCol : Colour of the cell
function printAppointmentTitle($cellCol = "FFFFFF") {
global $emp_id, $usr_id, $f_selUsrId, $f_hq_id;
$out = "
";
$out .= "
Beginn
";
$out .= "
Ende
";
$out .= "
Ersteller
";
$out .= "
Teilnehmer
";
$out .= "
Beschreibung
";
$out .= "
Kunde
";
$out .= "
Aktion
";
$out .= "
";
if (authCheckEmployeeRights($emp_id, "10")) :
$out .= "
";
$out .= "
";
$out .= "
";
$out .= "
";
$out .= "
";
$out .= "
";
$out .= "
";
$out .= "
";
$out .= "
";
endif;
return $out;
}
// Gets exactly the value of one specified field from the specified row by key of a certain table
function getAppointmentsFromDB($selYearFrom, $selMonthFrom, $selDayFrom, $selYearTo = "", $selMonthTo = "", $selDayTo = "", $csId = "") {
global $db, $PHP_SELF;
global $emp_id, $f_selUsrId, $f_hq_id;
$retArray = array();
$dayStringFrom = $selYearFrom . "-" . pad($selMonthFrom,2,"0") . "-" . pad($selDayFrom,2,"0");
$dayStringTo = $selYearTo . "-" . pad($selMonthTo,2,"0") . "-" . pad($selDayTo,2,"0");
if ($selYearTo == "" || $selYearTo == "" || $selYearTo == "") :
$dayStringTo = $dayStringFrom;
endif;
// Filter to display appointments of other users
$whereClauseCreatorFilter = " AND ap.usr_id = '" . $f_selUsrId . "'";
if (authCheckEmployeeRights($emp_id, "10") && $f_selUsrId == "all") :
$whereClauseCreatorFilter = "";
endif;
$sqlStmt = "SELECT ap.ap_id, ap.ap_text, ap.ap_execdate, ap.ap_enddate,"
. " cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cs.cs_id, cs.cs_eid,"
. " ap.usr_id, usr.usr_firstname, usr.usr_name, ap.ap_participants"
. " FROM phoenix_group.appointment AS ap"
. " LEFT JOIN customer AS cs ON ap.cs_id = cs.cs_id"
. " LEFT JOIN company AS cmp ON cs.cmp_id = cmp.cmp_id"
. " LEFT JOIN user AS usr ON ap.usr_id = usr.usr_id"
. " WHERE ap.ap_execdate >= ' " . $dayStringFrom . " 00:00:00' AND"
. " ap.ap_execdate <= ' " . $dayStringTo . " 23:59:59'"
. $whereClauseCreatorFilter . " AND"
. " ap.hq_id IN " . getSQLMandatorArray($f_hq_id)
. " ORDER BY ap.ap_execdate";
// echo $sqlStmt . " ";
$result = $db->query($sqlStmt);
if (DB::isError($result)) die ("$PHP_SELF: $sqlStmt " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$retArray[] = array($row["ap_id"], $row["ap_text"], $row["ap_execdate"], $row["cmp_id"], $row["cmp_comp"], $row["cmp_comp2"], $row["cs_id"], $row["cs_eid"], $row["ap_enddate"], $row["usr_id"], $row["usr_firstname"], $row["usr_name"], $row["ap_participants"]);
endwhile;
$result->free();
return $retArray;
}
// Prints the headline with the current day
// $selYear : Selected year
// $selMonth : Selected month
// $selDay : Selected day
// $cellCol : Colour of the cell
// $csId : Special customer
function printAppointmentsOfOneDay($selYear, $selMonth, $selDay, $cellCol = "FFFFFF", $csId = "") {
global $db, $PHP_SELF;
global $f_apIdToUpdate;
$apArray = getAppointmentsFromDB($selYear, $selMonth, $selDay);
$lenApArray = count($apArray);
$out = "