Exemple #1
0
?>
> weekly</label><br>
            <label><input type="radio" name="recurring-period" value="2" <?php 
checkedIfTrue($recurringPeriodValue == 2);
?>
> bi-weekly</label><br>
            <label><input type="radio" name="recurring-period" value="3" <?php 
checkedIfTrue($recurringPeriodValue == 3);
?>
> monthly</label>
        <br><br>
        If weekly or bi-weekly, specify the number of weeks for it to keep recurring. If monthly, specify the number of months. (If you choose "bi-weekly" and put in an odd number of weeks, the computer will round down.)<br><br>
            <label><input type="number" min="0" max="4" name="duration" size="3" style="width:4em;" value="<?php 
\Utility\HtmlHelper::EchoIfPresent($tpl_book_values, 'duration');
?>
"> duration (max 4 weeks)</label>
            <div class="book-input-error-message" <?php 
\Utility\HtmlHelper::HideIfEmptyOrNull($tpl_book_errors, 'duration');
?>
><?php 
\Utility\HtmlHelper::EchoIfPresent($tpl_book_errors, 'duration');
?>
</div>
        <br>
        <hr>
        <div>
            <input type="submit" value="Submit">
        </div>
    </fieldset>
</form>
Exemple #2
0
<div class="error-message-panel"<?php 
\Utility\HtmlHelper::HideIfEmpty($tpl_error_message);
?>
>
    <?php 
echo $tpl_error_message;
?>
</div>

Exemple #3
0
 public function act($urlParameters, \Core\Http $http, \Core\Application $app, \Core\Database $db, \DBMappers\AppointmentItem $appMapper, \DBMappers\EmpItem $empItemMapper)
 {
     if ($http->getRequestMethod() == 'GET') {
         $app->setStateBook(array());
     } else {
         if ($http->getRequestMethod() == 'POST') {
             $bookErrors = array();
             $bookValues = array_merge(array(), $http->post());
             $bookingOrder = new \Application\BookingOrder();
             $this->validateForm($bookValues, $bookErrors, $bookingOrder, $app->getHourMode());
             //error_log("\nbookingData:" . print_r($bookingOrder, true), 3, 'my_errors.txt');
             if ($this->isEmptyValues($bookErrors)) {
                 $appMatcher = new \Application\AppointmentMatcher();
                 $chain = $appMatcher->makeChain($bookingOrder, $app->getEmpId(), $app->getCurrentRoom());
                 $crossings = $appMatcher->getCrossingAppointments($chain, $appMapper, $db);
                 // test for crossing appointments
                 if (count($crossings) > 0) {
                     $message = \Utility\HtmlHelper::MakeCrossingMessage($crossings, $empItemMapper, $db);
                     $app->setStateBook(array('book_values' => $bookValues, 'book_errors' => $bookErrors, 'error_message' => $message, 'book_crossings' => $crossings));
                 } else {
                     $max_chain_id = $appMapper->getMaxChainId($db);
                     if ($max_chain_id === false) {
                         $max_chain_id = 1;
                     } else {
                         ++$max_chain_id;
                     }
                     $chain->setChainId($max_chain_id);
                     foreach ($chain as $appointment) {
                         $appMapper->save($appointment, $db);
                     }
                     $chain->rewind();
                     $message = \Utility\HtmlHelper::MakeSuccessAppCreationMessage($chain->current(), $app->getHourMode());
                     $app->setMessage($message);
                     $app->setStateRedirect(BROWSE_URL);
                 }
             } else {
                 $app->setStateBook(array('book_values' => $bookValues, 'book_errors' => $bookErrors, 'error_message' => isset($bookErrors['common']) ? $bookErrors['common'] : null));
             }
         }
     }
 }
Exemple #4
0
?>
" readonly>
        </div>
        <div class="details-form-input"<?php 
hideIfEmpty($tpl_is_chain);
?>
>
            <label class="checkbox-label" style="width:inherit;">
            <input type="checkbox" onchange="setApplyChainProxy();" name="apply_chain" id="df-apply_chain"<?php 
checkedIfTrue(\Utility\HtmlHelper::ValueOrFalse($tpl_details_values, 'apply_chain_proxy') == 1);
readonlyIfFalse($tpl_can_modify);
?>
> Apply to all occurencies?
            </label>
            <input type="hidden" name="apply_chain_proxy" id="df-apply_chain_proxy" value="<?php 
echo \Utility\HtmlHelper::ValueOrFalse($tpl_details_values, 'apply_chain_proxy') == 1 ? '1' : '0';
?>
">
        </div>

        <hr>
        <div <?php 
hideIfEmpty($tpl_can_modify);
?>
>
            <input type="submit" value="Update">
            <button onclick="return deleteOnConfirm(this);" formaction="<?php 
echo $tpl_site_root . DETAILS_URL . '/delete/' . $tpl_appointment_id;
?>
">Delete</button>
<!--            <input type="button" value="Delete" onclick="return deleteOnConfirm(this);">
Exemple #5
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()));
         }
     }
 }