Ejemplo n.º 1
0
    $days_back = $first_day_dow == 7 ? 0 : $first_day_dow;
}
$first_cell_date = $period_first_date->sub(new DateInterval('P' . $days_back . 'D'));
$cell_date = $first_cell_date;
$cell_in_row = 0;
while ($cell_date->diff($period_last_date)->format('%R%a') >= 0 || $cell_in_row != 7) {
    //error_log("\nwd:$watchdog cell_in_row=$cell_in_row diff=" . print_r($cell_date->diff($period_last_date)->format('%R%a'), true), 3, 'my_errors.txt');
    $cell_in_row = $cell_in_row == 7 ? 0 : $cell_in_row;
    if ($cell_in_row == 0) {
        echo "<tr class=\"cal-row\">";
    }
    echo "<td>";
    if (\Utility\DateHelper::IsDateInSamePeriod($tpl_browse_period, $cell_date)) {
        $day_index = $cell_date->format('j');
        echo "<div class=\"cal-day\">" . $day_index . "</div><br>";
        foreach ($tpl_browse_calendar[$day_index] as $appItem) {
            echo "<div class=\"cal-entry\"><a href=\"#\" onclick=\"openDetailsWindow(this)\" data-link=\"" . $tpl_site_root . DETAILS_URL . "/edit/" . $appItem->getId() . "\">" . \Utility\DateHelper::FormatTimeAccordingRule($appItem->getTimeStart(), $tpl_browse_hour_mode) . " - " . \Utility\DateHelper::FormatTimeAccordingRule($appItem->getTimeEnd(), $tpl_browse_hour_mode) . "</a></div>";
        }
    }
    echo "</td>";
    if ($cell_in_row == 6) {
        echo "</tr>";
    }
    $cell_in_row++;
    $cell_date->add(new \DateInterval('P1D'));
}
//error_log("\ndayList:" . print_r($dayList, true), 3, 'my_errors.txt');
?>
    </tbody>
</table>
Ejemplo n.º 2
0
 public function act($urlParameters, \Core\Http $http, \Core\Application $app, \Core\Database $db, \DBMappers\AppointmentItem $appMapper, \DBMappers\EmpItem $empItemMapper)
 {
     $appointment = $appMapper->getById($urlParameters[0], $db);
     $chain = $appMapper->getChain($appointment->getChain(), $db);
     $full_chain_count = $chain->count();
     $chain->applyFilter(new \DateTime());
     $can_modify = $chain->count() > 0;
     $values = $this->getValuesArray($appointment);
     $values['apply_chain_proxy'] = 0;
     $detailsErrors = array();
     if ($http->getRequestMethod() == 'GET') {
         $app->setStateDetails(array('details_appointment' => $appointment, 'details_errors' => $detailsErrors, 'details_values' => $values, 'can_modify' => $can_modify, 'is_chain' => $full_chain_count > 1, 'hour_mode' => $app->getHourMode()));
     } else {
         //error_log("\npost:" . print_r($http->post(), true), 3, 'my_errors.txt');
         $values = array_merge(array(), $http->post());
         $bookingData = new \Application\BookingChange();
         $this->validateForm($values, $detailsErrors, $bookingData);
         if ($this->isEmptyValues($detailsErrors)) {
             //error_log("\nBookData:" . print_r($bookingData, true), 3, 'my_errors.txt');
             if ($bookingData->isApplyChain()) {
                 $chain->applyChange($bookingData);
             } else {
                 $chain->applyChangeToMember($appointment->getId(), $bookingData);
             }
             $appMatcher = new \Application\AppointmentMatcher();
             $crossings = $appMatcher->getCrossingAppointments($chain, $appMapper, $db);
             if (count($crossings) > 0) {
                 $message = \Utility\HtmlHelper::MakeCrossingMessage($crossings, $empItemMapper, $db);
                 $app->setStateDetails(array('details_appointment' => $appointment, 'details_errors' => $detailsErrors, 'details_values' => $values, 'can_modify' => $can_modify, 'error_message' => $message, 'is_chain' => $chain->count() > 1, 'hour_mode' => $app->getHourMode()));
             } else {
                 if ($bookingData->isApplyChain()) {
                     foreach ($chain as $member) {
                         $appMapper->save($member, $db);
                     }
                     $chain->rewind();
                     if ($chain->count() > 0) {
                         $appointment = $chain->current();
                     } else {
                         $appointment = null;
                     }
                 } else {
                     $appointment = $chain->get($appointment->getId());
                     if ($chain->isMeetFilter($appointment)) {
                         $appMapper->save($chain->get($appointment->getId()), $db);
                     } else {
                         $appointment = null;
                     }
                 }
                 if (is_null($appointment)) {
                     $message = "No changes were applied.";
                 } else {
                     $message = '<span style="font-weight:normal">The event has been modified to <strong>' . \Utility\DateHelper::FormatTimeAccordingRule($appointment->getTimeStart(), $app->getHourMode()) . ' - ' . \Utility\DateHelper::FormatTimeAccordingRule($appointment->getTimeEnd(), $app->getHourMode()) . '</strong>.<br>' . 'The text for this event is: ' . $appointment->getNotes() . '</span>';
                 }
                 $app->setMessage($message);
                 $app->setStateRedirect(DETAILS_RETURN_URL);
             }
         } else {
             $app->setStateDetails(array('details_appointment' => $appointment, 'details_errors' => $detailsErrors, 'details_values' => $values, 'can_modify' => $can_modify, 'is_chain' => $chain->count() > 1, 'hour_mode' => $app->getHourMode()));
         }
     }
 }
Ejemplo n.º 3
0
 public static function MakeSuccessAppCreationMessage(\Application\AppointmentItem $leadingApp, $hourMode)
 {
     $message = '<span style="font-weight:normal">The event <strong>' . \Utility\DateHelper::FormatTimeAccordingRule($leadingApp->getTimeStart(), $hourMode) . ' - ' . \Utility\DateHelper::FormatTimeAccordingRule($leadingApp->getTimeEnd(), $hourMode) . '</strong> has been added.<br>' . 'The text for this event is: ' . $leadingApp->getNotes() . '</span>';
     return $message;
 }
Ejemplo n.º 4
0
<?php

$caption = \Utility\DateHelper::FormatTimeAccordingRule($tpl_details_appointment->getTimeStart(), $tpl_hour_mode) . ' - ' . \Utility\DateHelper::FormatTimeAccordingRule($tpl_details_appointment->getTimeEnd(), $tpl_hour_mode);
echo $caption;