/** * author:coster * date:21.10.05 * zeigt ein einzelnes monat für das webinterface in einer tabelle * */ function showWeek($day, $month, $year, $vermieter_id, $mietobjekt_id, $modus) { global $root; global $ansicht; //anzahl der tage des monats: $anzahlTage = getNumberOfDaysOfMonth($month, $year); include_once $root . "/include/reservierungFunctions.inc.php"; include_once $root . "/include/mieterFunctions.inc.php"; $lastDayOfWeek = getLastDayOfWeek($day, $month, $year); $lastDayMonth = $month; $lastDayYear = $year; if ($lastDayOfWeek < $day) { $lastDayMonth++; } if ($lastDayMonth > 12) { $lastDayMonth = 1; $lastDayYear++; } $firstDayOfWeek = getFirstDayOfWeek($day, $month, $year); $firstDayMonth = $month; $firstDayYear = $year; if ($firstDayOfWeek > $day) { $firstDayMonth--; } if ($firstDayMonth < 1) { $firstDayMonth = 12; $firstDayYear--; } ?> <table border="0" width="100%" cellspacing="1" cellpadding="0" class="<?php echo TABLE_COLOR; ?> "> <?php $status = getStatus($mietobjekt_id, 0, 0, $day, $month, $year, 59, 23, $day, $month, $year); if (isset($status) && sizeof($status) >= 1) { $statusString = BELEGT; } else { $statusString = FREI; } $mieter_id = -1; ?> <tr class="<?php echo TABLE_COLOR; ?> "> <!-- wochentag anzeigen --> <td class="<?php echo TABLE_COLOR; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo getUebersetzung("Woche") . " "; echo getUebersetzung("von") . " "; echo getUebersetzung(getDayName($firstDayOfWeek, $firstDayMonth, $firstDayYear)); ?> </td> <!-- datum anzeigen --> <td class="<?php echo TABLE_COLOR; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo $firstDayOfWeek . "."; echo $firstDayMonth . "."; echo $firstDayYear; ?> </td> <td class="<?php echo TABLE_COLOR; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo getUebersetzung("bis") . " "; echo getUebersetzung(getDayName($lastDayOfWeek, $lastDayMonth, $lastDayYear)); ?> </td> <!-- datum anzeigen --> <td class="<?php echo TABLE_COLOR; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo $lastDayOfWeek . "."; echo $lastDayMonth . "."; echo $lastDayYear; ?> </td> <!-- grafische reservierung anzeigen --> <td class="<?php echo TABLE_COLOR; ?> " class="<?php echo TABLE_STANDARD; ?> "> <?php //wie viele reservierungen sind in dieser Woche? $resIds = getReservierungIDs($mietobjekt_id, 0, 0, $firstDayOfWeek, $firstDayMonth, $firstDayYear, 59, 23, $lastDayOfWeek, $lastDayMonth, $lastDayYear); $anzahlRes = mysqli_num_rows($resIds); ?> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td width="5" class="<?php echo FREI; ?> "> </td> <?php for ($l = 0; $l < $anzahlRes; $l++) { ?> <td width="5" class="<?php echo BELEGT; ?> "> </td> <?php } ?> </tr> </table> </td> </tr> </table> <br/> <table cellpadding="0" cellspacing="1" border="0" class="<?php echo TABLE; ?> " width="100%"> <tr> <th>Tag</th> <th>Datum</th> <th></th> <th></th> <th></th> <th></th> </tr> <?php //anzeige der einzelnen wochentage: for ($iz = $firstDayOfWeek; $iz < $firstDayOfWeek + 7; $iz++) { $i_month = $firstDayMonth; $i_year = $firstDayYear; $i_day = $iz; if ($i_day > getNumberOfDaysOfMonth($firstDayMonth, $firstDayYear)) { $i_month++; $i_day = $iz - getNumberOfDaysOfMonth($firstDayMonth, $firstDayYear); } if ($i_month > 12) { $i_year++; } $anzahlResOnDayI = countReservierungIDs($mietobjekt_id, 0, 0, $i_day, $i_month, $i_year, 59, 23, $i_day, $i_month, $i_year); if ($anzahlResOnDayI > 0) { $resIds = getReservierungIDs($mietobjekt_id, 0, 0, $i_day, $i_month, $i_year, 59, 23, $i_day, $i_month, $i_year); while ($d = mysqli_fetch_array($resIds)) { $reservierungs_id = $d["RESERVIERUNG_ID"]; $mieter_id = getMieterIdOfReservierung($reservierungs_id); $mietdauer = getNumberOfDaysOfReservation($reservierungs_id); $isFirstDay = isFirstDayOfReservation($reservierungs_id, $i_day, $i_month, $i_year); $isLastDay = isLastDayOfReservation($reservierungs_id, $i_day, $i_month, $i_year); $timeVon = getTimeVonOfReservierung($reservierungs_id); $timeBis = getTimeBisOfReservierung($reservierungs_id); $allDay = false; if ($mietdauer > 1 && !$isFirstDay && !$isLastDay) { $allDay = true; } else { if ($timeVon == "00:00" && $timeBis == "24:00") { $allDay = true; } } ?> <form action="./mieterInfos/index.php" method="post" name="form<?php echo $day; ?> " target="_self"> <input type="hidden" name="mietobjekt_id" value="<?php echo $mietobjekt_id; ?> " /> <input type="hidden" name="monat" value="<?php echo $month; ?> " /> <input type="hidden" name="jahr" value="<?php echo $year; ?> " /> <input type="hidden" name="tag" value="<?php echo $day; ?> " /> <input type="hidden" name="ansicht" value="<?php echo $ansicht; ?> " /> <tr> <!-- wochentag anzeigen --> <td class="<?php echo TABLE_STANDARD; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo getUebersetzung(getDayName($i_day, $i_month, $i_year)); ?> </td> <!-- datum anzeigen --> <td class="<?php echo TABLE_STANDARD; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo $i_day . "."; echo $i_month . "."; echo $i_year; ?> </td> <!-- grafische reservierung anzeigen --> <td class="<?php echo TABLE_STANDARD; ?> "> <table cellpadding="0" cellspacing="0" border="0"> <tr> <?php if (!$allDay) { ?> <td width="5" class="<?php echo FREI; ?> "> </td> <?php } for ($z = 0; $z < $anzahlResOnDayI; $z++) { ?> <td width="5" class="<?php echo BELEGT; ?> "> </td> <?php } ?> </tr> </table> </td> <!-- text --> <?php if ($modus == MODUS_WEBINTERFACE) { ?> <td class="<?php echo TABLE_STANDARD; ?> "> <input name="mieter_id" type="hidden" value="<?php echo $mieter_id; ?> "> <?php //gast-namen ausgeben: if ($mieter_id != ANONYMER_MIETER_ID) { echo getNachnameOfMieter($mieter_id); echo ", "; echo getMieterOrt($mieter_id); } else { echo getUebersetzung("anonymer Mieter"); } ?> </td> <?php } else { if ($modus == MODUS_BELEGUNGSPLAN) { ?> <td class="<?php echo TABLE_STANDARD; ?> "> <?php echo getUebersetzung("reserviert"); ?> </td> <?php } } if ($modus == MODUS_BELEGUNGSPLAN && $mieter_id != ANONYMER_MIETER_ID) { ?> <td class="<?php echo TABLE_STANDARD; ?> "> <?php } else { ?> <td class="<?php echo TABLE_STANDARD; ?> " colspan="2"> <?php } //zeit ausgeben: //wenn mietdauer mehr als 3 tage, braucht nur bei //tag 1 und tag 3 die zeit ausgegeben werden: if ($mietdauer >= 2) { if ($isFirstDay) { echo $timeVon . " - 24:00 " . getUebersetzung("Uhr"); } else { if ($isLastDay) { echo "00:00 - " . $timeBis . " " . getUebersetzung("Uhr"); } else { ?> 00:00 - 24:00 <?php echo getUebersetzung("Uhr"); ?> <?php } } } ?> </td> <?php if ($modus == MODUS_WEBINTERFACE) { ?> <td class="<?php echo TABLE_STANDARD; ?> "> <?php //button für mieter infos ausgeben: if ($mieter_id != ANONYMER_MIETER_ID) { ?> <input type="submit" name="Submit" class="<?php echo BUTTON; ?> " onMouseOver="this.className='<?php echo BUTTON_HOVER; ?> ';" onMouseOut="this.className='<?php echo BUTTON; ?> ';" value="<?php echo getUebersetzung("Mieter-Info"); ?> "/> <?php } ?> </td> <?php } //ende wenn modus webinterface ?> </tr> </form> <?php } ?> <?php } else { ?> <tr> <!-- wochentag anzeigen --> <td class="<?php echo TABLE_STANDARD; ?> " valign="left" class="<?php echo TABLE_STANDARD; ?> "> <?php echo getUebersetzung(getDayName($i_day, $i_month, $i_year)); ?> </td> <!-- datum anzeigen --> <td valign="left" class="<?php echo TABLE_STANDARD; ?> " class="<?php echo TABLE_STANDARD; ?> "> <?php echo $i_day . "."; echo $i_month . "."; echo $i_year; ?> </td> <!-- grafische reservierung anzeigen --> <td class="<?php echo TABLE_STANDARD; ?> "> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td width="5" class="<?php echo FREI; ?> "> </td> </tr> </table> </td> <td colspan="3" class="<?php echo TABLE_STANDARD; ?> "><?php echo getUebersetzung("Keine Reservierung an diesem Tag vorhanden"); ?> .</td> </tr> <?php } //ende anzahl reservierungen < 0 } //ende for alle tage der woche ?> </table> <?php }
/** * Creates an PDF with the Orders of all SoliUsers in a given week or month. * @param $kw week/month number * @param $weekMode true, if filtered by week * false, if filtered by month */ function AllSoliOrdersToPDFByWeekOrMonth($dataContainer, $kw, $weekMode) { require_once PATH_ACCESS . '/UserManager.php'; require_once PATH_INCLUDE . '/pdf/GeneralPdf.php'; $userManager = new UserManager(); $pdo = $dataContainer->getPdo(); $smarty = $dataContainer->getSmarty(); if ($weekMode) { $firstDay = getFirstDayOfWeek(date('Y'), $kw); $days = 5; $title = "SoliBestellungen Kalenderwoche " . $kw; } else { $firstDay = mktime(0, 0, 0, $kw, 1, date('Y')); $days = cal_days_in_month(CAL_GREGORIAN, $kw, date('Y')); $month_ger = array('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'); $title = "SoliBestellungen " . $month_ger[$kw - 1]; $kw = $month_ger[$kw - 1]; } $secs_per_day = 86400; $number = 0; $sum_pricediff = 0.0; $solis = $userManager->getAllSoli(); foreach ($solis as $soli) { $pricediff = 0.0; $SoliOrders[$number]['soli'] = $soli; $orders = array(); for ($i = 0; $i < $days; $i++) { $buffer = array(); try { $buffer = $this->soliOrderManager->getOrdersByUserandMealdate($soli['ID'], date('Y-m-d', $firstDay + $i * $secs_per_day)); } catch (MySQLVoidDataException $e) { // $this->soliInterface->showMsg($this->msg['ERR_ORDERS_NOT_FOUND']); } foreach ($buffer as &$order) { $orders[] = $order; } } foreach ($orders as &$order) { $pricediff += $order['mealprice'] - $order['soliprice']; } $sum_pricediff += $pricediff; $SoliOrders[$number]['orders'] = $orders; $SoliOrders[$number]['pricediff'] = $pricediff; $number++; } $smarty->assign('SoliOrders', $SoliOrders); $smarty->assign('weekMode', $weekMode); $smarty->assign('ordering_date', $kw); $smarty->assign('sum', $sum_pricediff); $pdf_content = $smarty->fetch(PATH_SMARTY_TPL . '/pdf/orders_of_soliuser_per_week.pdf.tpl'); $pdf = new GeneralPdf($pdo); $pdf->create($title, $pdf_content); $pdf->output(); }
/** * returns the literal date * Ex : if period = DB_ARCHIVES_PERIOD_WEEK and $s_date = "2006-08-14" * Returned string will be "Week August 14 To August 20 2006" * * @param int period * @param string s_date */ function getLiteralDate($period, $s_date) { switch ($period) { case DB_ARCHIVES_PERIOD_DAY: return getDateDisplay(1, new Date($s_date)); break; case DB_ARCHIVES_PERIOD_WEEK: case DB_ARCHIVES_PERIOD_WEEK: $date = new Date($s_date); $mon = getFirstDayOfWeek($date); $sun = getDateFromTimestamp(mktime(0, 0, 0, $date->getMonth(), $date->getDay() - ($date->getWeekDayNumber() + 6) % 7 + 6, $date->getYear())); return getDateDisplay(3, new Date($mon), new Date($sun)); break; case DB_ARCHIVES_PERIOD_MONTH: return getDateDisplay(4, new Date($s_date)); break; case DB_ARCHIVES_PERIOD_YEAR: return getDateDisplay(11, new Date($s_date)); break; default: trigger_error("Period unknown !", E_USER_ERROR); break; } return; }
/** * Shows the Orders which are ordered by User $uid in week $weeknum * Enter description here ... * @param $weeknum the number of the week in the year * @param $uid the UserID of the soli-user who ordered meals */ function ShowSoliOrdersByDate($weeknum, $uid) { require_once PATH_ACCESS . '/UserManager.php'; $userManager = new UserManager(); if ($weeknum && $uid) { $orders = array(); $monday = getFirstDayOfWeek(date('Y'), $weeknum); $sum_pricediff = 0.0; $secs_per_day = 86400; for ($i = 0; $i < 5; $i++) { $buffer = array(); try { $buffer = $this->soliOrderManager->getOrdersByUserandMealdate($uid, date('Y-m-d', $monday + $i * $secs_per_day)); } catch (MySQLVoidDataException $e) { // $this->soliInterface->showMsg($this->msg['ERR_ORDERS_NOT_FOUND']); } foreach ($buffer as $order) { $orders[] = $order; } } $username = $userManager->getForename($uid) . ' ' . $userManager->getName($uid); if (!count($orders)) { //$this->soliInterface->dieError($this->msg['ERR_ORDERS_NOT_FOUND']); $this->soliInterface->ShowNoOrdersFound($weeknum, $username); } else { foreach ($orders as &$order) { $sum_pricediff += $order['mealprice'] - $order['soliprice']; } $this->soliInterface->ShowSpecOrders($orders, $weeknum, $username, $sum_pricediff); } } else { try { //Show Form to fill out Weeknumber and Soli $solis = $userManager->getAllSoli(); } catch (Exception $e) { $this->soliInterface->dieError($this->msg['ERR_USER_NO_SOLI_FOUND']); } $this->soliInterface->AskShowSoliUser($solis); } }
function getLastArchives($n, $boolOnlyGetPeriodNMinus = 0, $dateTextType = DATE_NORMAL, $o_site = false) { //var_dump($this->archive->date->get()); $date = new Date($this->archive->date->get()); //var_dump($date->get()); if ($o_site) { $o_siteToUse = $o_site; } else { $o_siteToUse = $this->archive->site; } $toArchive = array(); switch ($this->archive->periodType) { case DB_ARCHIVES_PERIOD_DAY: $ts = $date->getTimestamp() + 86400; while (sizeof($toArchive) < $n) { $toArchive[] = getDateFromTimestamp($ts -= 86400); } $typeDateDisplay = 2; $typeDateDisplayGraph = 8; $typeDateDisplayGraphLongAxis = 13; // only take N - x, only for page views comparisons if ($boolOnlyGetPeriodNMinus === 1) { $date0 = $toArchive[0]; $date1 = $toArchive[7]; $date2 = $toArchive[14]; unset($toArchive); $toArchive[] = $date0; $toArchive[] = $date1; $toArchive[] = $date2; $typeDateDisplay = 7; //print("date1 $date1 date2 $date2 "); } break; case DB_ARCHIVES_PERIOD_WEEK: $ts = $date->getTimestamp(); $ts += 86400 * 7; while (sizeof($toArchive) < $n) { $toArchive[] = getDateFromTimestamp($ts -= 86400 * 7); } $typeDateDisplay = 6; $typeDateDisplayGraph = 6; $typeDateDisplayGraphLongAxis = 13; break; case DB_ARCHIVES_PERIOD_MONTH: $s_date1 = getDateFromTimestamp(mktime(23, 59, 59, $date->getMonth() - $n % 12, 15, $date->getYear() - floor($n / 12))); $s_date2 = $date->get(); $toArchive = array_reverse(getDayOfMonthBetween($s_date1, $s_date2)); $typeDateDisplay = 5; $typeDateDisplayGraph = 10; $typeDateDisplayGraphLongAxis = 10; break; case DB_ARCHIVES_PERIOD_YEAR: for ($i = 0; $i < $n; $i++) { $a = $date->getYear() - $i; $toArchive[] = $a . "-01-01"; } $typeDateDisplay = 11; $typeDateDisplayGraph = 12; break; } //var_dump($this->archive->date->get()); $return = array(); foreach ($toArchive as $dateToArchive) { //print("boucle :"); // if day, and IF current date asked is today, then take current archive if ($dateToArchive == $this->archive->date->get() && $this->archive->periodType === DB_ARCHIVES_PERIOD_DAY && $o_siteToUse->getId() === $this->archive->site->getId()) { $a = $this->archive; // erreur possible ici ? } else { $a = $this->getArchive($o_siteToUse, $dateToArchive, $this->archive->periodType); } if ($dateTextType == DATE_GRAPH) { $dateToDisplay = getDateDisplay($typeDateDisplayGraph, new Date($dateToArchive)); $dateComputed = getDateDisplay($typeDateDisplayGraph, $a->date); } else { if ($dateTextType == DATE_NORMAL) { $dateToDisplay = getDateDisplay($typeDateDisplay, new Date($dateToArchive)); $dateComputed = getDateDisplay($typeDateDisplay, $a->date); } else { if ($dateTextType == DATE_GRAPH_LONG_AXIS) { $dateToDisplay = getDateDisplay($typeDateDisplayGraphLongAxis, new Date($dateToArchive)); $dateComputed = getDateDisplay($typeDateDisplayGraphLongAxis, $a->date); } } } if ($this->archive->periodType === DB_ARCHIVES_PERIOD_WEEK) { $firstDayOfWeek = new Date(getFirstDayOfWeek(new Date($dateToArchive))); $minDay = $o_siteToUse->getMinDay(); if ($firstDayOfWeek->getTimestamp() >= $minDay->getTimestamp()) { $dateToDisplay = getDateDisplay($typeDateDisplay, $firstDayOfWeek); } } if ($dateComputed == $dateToDisplay) { // print("$dateToDisplay is correctly computed ($dateComputed)<br>"); $return[$dateComputed] = $a; } else { // print("$dateToDisplay is not correctly computed ($dateComputed) ==> empty archive<br>"); $return[$dateToDisplay] = $this->getEmptyArchive($o_siteToUse, $dateToArchive, $this->archive->periodType); } } //print("\n\n");exit; return $return; }
echo BUTTON_HOVER; ?> ';" onMouseOut="this.className='<?php echo BUTTON; ?> ';" id="zurueck" value="<?php echo getUebersetzung("eine Woche zurück"); ?> "> </div> </form></td> <td> <?php $newTag2 = getFirstDayOfWeek($tag, $monat, $jahr) + 7; $mon = $monat; $jah = $jahr; if ($newTag2 > getNumberOfDaysOfMonth($monat, $jahr)) { $mon = $mon + 1; $newTag2 = 1; } if ($mon > 12) { $mon = 1; $jah = $jah + 1; } ?> <form action="./start.php" method="post" name="tagWeiter" target="_self" id="monatWeiter"> <input name="mietobjekt_id" type="hidden" id="mietobjekt_id" value="<?php echo $mietobjekt_id; ?>