function getWvListe() { $ret = array(); $mailcnt = 0; //Mails holen $mail = holeMailHeader($_SESSION["loginCRM"], $_SESSION['MailFlag']); if ($mail) { foreach ($mail as $col) { $ret[] = array('Type' => "M", 'Status' => $col["Gelesen"], 'cause' => $col["Betreff"], 'Initdate' => $col["Datum"], 'ID' => $col["Nr"], 'IniUser' => htmlspecialchars($col["Abs"]), 'Art' => "E", 'End' => 0); $mailcnt++; } } //Termine holen $termine = getTermin(date("d"), date("m"), date("Y"), "T", $_SESSION["loginCRM"]); //Wiedervorlagen holen $wvl = getWvl($_SESSION["loginCRM"]); if ($termine && $wvl) { $wvl = array_merge($termine, $wvl); } else { if ($termine) { $wvl = $termine; } } $nunD = date("Y-m-d 00:00:00"); $nunT = date("Y-m-d H:i"); if ($wvl) { foreach ($wvl as $col) { if ($col["finishdate"] || $col["stoptag"]) { if ($col["finishdate"] != "" && $col["finishdate"] < $nunD || $col["stoptag"] != "" && $col["stoptag"] . " " . $col["stopzeit"] < $nunT) { $end = 3; } else { $end = 2; } $datum = mkdate($col["finishdate"] ? $col["finishdate"] : $col["stoptag"] . " " . $col["stopzeit"] . ":00"); } else { if ($col["trans_module"]) { $datum = mkdate($col["initdate"] . " 00:00:00"); } else { $datum = mkdate($col["initdate"] ? $col["initdate"] : $col["starttag"] . " " . $col["startzeit"] . ":00"); } $end = 1; } if ($col["status"] == "F") { $Art = "F"; } else { if ($col["starttag"]) { $Art = "T"; } else { $Art = "D"; } } $ret[] = array('Type' => $col["kontakt"] ? $col["kontakt"] : "X", 'Status' => $col["status"] ? $col["status"] : "-", 'cause' => $col["cause"], 'Initdate' => $datum, 'ID' => $col["id"], 'IniUser' => $col["ename"] ? $col["ename"] : $col["employee"], 'Art' => $Art, 'End' => $end); } } echo json_encode($ret); }
$kaldrk = array("MO" => $kalterm, "DI" => $kalterm, "MI" => $kalterm, "DO" => $kalterm, "FR" => $kalterm, "SA" => $kalterm, "SO" => $kalterm); $drkwt = array("MO", "DI", "MI", "DO", "FR", "SA", "SO"); $vars = array("JAHR" => "", "MO" => "", "DI" => "", "MI" => "", "DO" => "", "FR" => "", "SA" => "", "SO" => "", "TERMINMO" => "", "TERMINDI" => "", "TERMINMI" => "", "TERMINDO" => "", "TERMINFR" => "", "TERMINSA" => "", "TERMINSO" => ""); $kw = $_GET["kw"]; $year = $_GET["year"]; if (!$kw) { list($day, $month, $year) = explode("\\.", $datum); $kw = date("W", mktime(0, 0, 0, $month, $day, $year)); } $ft = feiertage($year); $ftk = array_keys($ft); $x = mondaykw($kw, $year); $tag = date("d", $x); $month = date("m", $x); $startday = date("d", $x); $data = getTermin($startday, date("m", $x), $year, "W"); $vars["JAHR"] = $year; $vars["KW"] = $kw; $usr = getUserStamm($_SESSION["loginCRM"]); $vars["NAME"] = $usr["name"]; for ($i = 0; $i < 7; $i++) { $vars[$drkwt[$i]] = date("d.m.", mktime(0, 0, 0, $month, $tag + $i, $year)); } if ($data) { foreach ($data as $row) { if ($row["termin"] != $lastt || $lastd != $row["tag"]) { $w = date("w", mktime(0, 0, 0, $row["monat"], $row["tag"], $row["jahr"])) - 1; $vars["TERMIN" . $drkwt[$w]] .= ($vars["TERMIN" . $drkwt[$w]] ? "\n" : "") . $row["startzeit"] . " " . utf8_decode($row["cause"]); $lastt = $row["termin"]; $lastd = $row["tag"]; } else {
<?php require_once "inc/stdLib.php"; include "inc/crmLib.php"; include_once "inc/UserLib.php"; include 'inc/phpOpenOffice.php'; $usr = getUserStamm($_SESSION["loginCRM"]); $kalterm = array("zeit" => "", "txt" => ""); $year = $_GET["year"]; $month = $_GET["month"]; $day = $_GET["day"]; $vars = array("JAHR" => $year, "MONAT" => $month, "TAG" => $day, "NAME" => $usr["name"]); $data = getTermin($day, $month, $year, "T"); $ft = feiertage($year); $ftk = array_keys($ft); for ($i = 0; $i < 24; $i++) { $x = sprintf("%02d", $i); $vars[$x . "00"] = "{$x}:00"; $vars[$x . "30"] = "{$x}:30"; $vars["TERMIN{$x}" . "00"] = ""; $vars["TERMIN{$x}" . "30"] = ""; } $termdata = array(); $tlist = array(); if ($data) { foreach ($data as $row) { if (!in_array($row["id"], $tlist)) { if ($row["stoptag"] > "{$year}-{$month}-{$day}" && $row["repeat"] == "0") { $row["stopzeit"] = "24:00"; } if ($row["starttag"] < "{$year}-{$month}-{$day}" && $row["repeat"] == "0") {
if (empty($kw) || $kw == 0 || $kw == "") { list($day, $month, $year) = explode(".", $datum); $kw = date("W", mktime(0, 0, 0, $month, $day, $year)); } $firstmonday = firstkw($year); $ft = feiertage($year); $ftk = array_keys($ft); $x = mondaykw($kw, $year); $kw = date("W", $x); $kw1 = date("W", $x - 604800); $kw2 = date("W", $x + 604800); $year1 = date("Y", $x - 604800); $year2 = date("Y", $x + 604800); $tag = date("d.m.Y", $x); $startday = date("d", $x); $data = getTermin($startday, date("m", $x), $year, "W", $_GET["cuid"]); $termdate = array(); for ($i = 0; $i < 7; $i++) { if ($ft[$x + $i * 86400]) { $termdate[$i][] = array("id" => 0, "txt" => $ft[$x + $i * 86400], "ft" => 1); } } $kalterm = array("datum" => "", "txt" => ""); $kaldrk = array("Mo" => $kalterm, "Di" => $kalterm, "Mi" => $kalterm, "Do" => $kalterm, "Fr" => $kalterm, "Sa" => $kalterm, "So" => $kalterm); $drkwt = array("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"); $lastt = 0; $lastd = 0; // Mehrfachtermine wegen Gruppe/n und UID if ($data) { foreach ($data as $row) { if ($row["termin"] != $lastt || $lastd != $row["tag"]) {
&year=<?php echo $year; ?> "><?php echo $month . "/" . $year; ?> </a>] <input type="button" value="-->" onClick="monplu()"> <br> <table style="width:29em" class="klein"> <tr><th style="width:2.1em" class="gr">Kw</th><th style="width:3.9em" class="gr">Mo</th><th style="width:3.9em" class="gr">Di</th><th style="width:3.9em" class="gr">Mi</th><th style="width:3.9em" class="gr">Do</th><th style="width:3.9em" class="gr">Fr</th><th style="width:3.0em" class="gr">Sa</th><th style="width:3.0em" class="gr">So</th></tr> <?php $firstday = mktime(0, 0, 0, $month, 1, $year); $anztage = date("t", mktime(0, 0, 0, $month + 1, 0, $year)); $ft = feiertage($year); $ftk = array_keys($ft); $data = getTermin(0, $month, $year, "M", $CUID); $tmp = array(); if ($data) { foreach ($data as $term) { $tmp[$term["tag"]] += 1; } } $days = array_keys($tmp); //first week, still in last month? if (date("w", mktime(0, 0, 0, $month, 1, $year)) == 0) { $da = -6; } elseif (date("w", mktime(0, 0, 0, $month, 1, $year)) != 1) { $da = -date("w", mktime(0, 0, 0, $month, 1, $year)) + 1; } else { $da = 1; }