Uname: Linux webm005.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: 6036 (villadal)
Group: 100 (users)
Disabled functions: NONE
Safe mode: On[ PHPinfo ]
//home/villadal/www/////old/booked/Pages/      ( Reset | Go to )
File Name: ReservationPage.php
Edit
<?php
/**
Copyright 2011-2014 Nick Korbel

This file is part of Booked Scheduler.

Booked Scheduler is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Booked Scheduler is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Booked Scheduler.  If not, see <http://www.gnu.org/licenses/>.
 */

require_once(ROOT_DIR 'Pages/SecurePage.php');
require_once(
ROOT_DIR 'Presenters/Reservation/ReservationPresenter.php');

interface 
IReservationPage extends IPage
{
    
/**
     * Set the schedule period items to be used when presenting reservations
     * @param $startPeriods array|SchedulePeriod[]
     * @param $endPeriods array|SchedulePeriod[]
     */
    
function BindPeriods($startPeriods$endPeriods);

    
/**
     * Set the resources that can be reserved by this user
     * @param $resources array|ResourceDto[]
     */
    
function BindAvailableResources($resources);

    
/**
     * @param $accessories array|AccessoryDto[]
     * @return void
     */
    
function BindAvailableAccessories($accessories);

    
/**
     * @param $groups ResourceGroupTree
     */
    
function BindResourceGroups($groups);

    
/**
     * @param SchedulePeriod $selectedStart
     * @param Date $startDate
     */
    
function SetSelectedStart(SchedulePeriod $selectedStartDate $startDate);

    
/**
     * @param SchedulePeriod $selectedEnd
     * @param Date $endDate
     */
    
function SetSelectedEnd(SchedulePeriod $selectedEndDate $endDate);

    
/**
     * @param $repeatTerminationDate Date
     */
    
function SetRepeatTerminationDate($repeatTerminationDate);

    
/**
     * @param UserDto $user
     */
    
function SetReservationUser(UserDto $user);

    
/**
     * @param ResourceDto $resource
     */
    
function SetReservationResource($resource);

    
/**
     * @param int $scheduleId
     */
    
function SetScheduleId($scheduleId);

    
/**
     * @param ReservationUserView[] $participants
     */
    
function SetParticipants($participants);

    
/**
     * @param ReservationUserView[] $invitees
     */
    
function SetInvitees($invitees);

    
/**
     * @param $accessories ReservationAccessory[]|array
     */
    
function SetAccessories($accessories);

    
/**
     * @param $attachments ReservationAttachmentView[]|array
     */
    
function SetAttachments($attachments);

    
/**
     * @param $canChangeUser
     */
    
function SetCanChangeUser($canChangeUser);

    
/**
     * @param bool $canShowAdditionalResources
     */
    
function ShowAdditionalResources($canShowAdditionalResources);

    
/**
     * @param bool $canShowUserDetails
     */
    
function ShowUserDetails($canShowUserDetails);

    
/**
     * @param bool $shouldShow
     */
    
function SetShowParticipation($shouldShow);

    
/**
     * @param bool $showReservationDetails
     */
    
function ShowReservationDetails($showReservationDetails);

    
/**
     * @param $attributes array|Attribute[]
     */
    
function SetCustomAttributes($attributes);

    
/**
     * @param bool $isHidden
     */
    
function HideRecurrence($isHidden);
}

abstract class 
ReservationPage extends Page implements IReservationPage
{
    protected 
$presenter;
    
/**
     * @var PermissionServiceFactory
     */
    
protected $permissionServiceFactory;

    
/**
     * @var ReservationInitializerFactory
     */
    
protected $initializationFactory;

    public function 
__construct($title null)
    {
        
parent::__construct($title);

        if (
is_null($this->permissionServiceFactory))
        {
            
$this->permissionServiceFactory = new PermissionServiceFactory();
        }

        
$userRepository = new UserRepository();

        
$this->initializationFactory = new ReservationInitializerFactory(
            new 
ScheduleRepository(),
            
$userRepository,
            new 
ResourceService(new ResourceRepository(), $this->permissionServiceFactory->GetPermissionService(), new AttributeService(new AttributeRepository()), $userRepository),
            new 
ReservationAuthorization(AuthorizationServiceFactory::GetAuthorizationService()),
            new 
AttributeRepository(),
            
ServiceLocator::GetServer()->GetUserSession()
        );

        
$this->presenter $this->GetPresenter();
    }

    
/**
     * @return IReservationPresenter
     */
    
protected abstract function GetPresenter();

    
/**
     * @return string
     */
    
protected abstract function GetTemplateName();

    
/**
     * @return string
     */
    
protected abstract function GetReservationAction();

    public function 
PageLoad()
    {
        
$this->presenter->PageLoad();
        
$this->Set('ReturnUrl'$this->GetLastPage(Pages::SCHEDULE));
        
$this->Set('ReservationAction'$this->GetReservationAction());
        
$this->Set('MaxUploadSize'UploadedFile::GetMaxSize());
        
$this->Set('MaxUploadCount'UploadedFile::GetMaxUploadCount());
        
$this->Set('UploadsEnabled'Configuration::Instance()->GetSectionKey(ConfigSection::UPLOADS,
                                                                              
ConfigKeys::UPLOAD_ENABLE_RESERVATION_ATTACHMENTS,
                                                                              new 
BooleanConverter()));
        
$this->Set('AllowParticipation', !Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION,
                                                                                  
ConfigKeys::RESERVATION_PREVENT_PARTICIPATION,
                                                                                  new 
BooleanConverter()));
        
$remindersEnabled Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION,
                                                                     
ConfigKeys::RESERVATION_REMINDERS_ENABLED,
                                                                     new 
BooleanConverter());
        
$emailEnabled Configuration::Instance()->GetKey(ConfigKeys::ENABLE_EMAIL,
                                                          new 
BooleanConverter());
        
$this->Set('RemindersEnabled'$remindersEnabled && $emailEnabled);

        
$this->Set('RepeatEveryOptions'range(120));
        
$this->Set('RepeatOptions', array(
                                      
'none' => array('key' => 'DoesNotRepeat''everyKey' => ''),
                                      
'daily' => array('key' => 'Daily''everyKey' => 'days'),
                                      
'weekly' => array('key' => 'Weekly''everyKey' => 'weeks'),
                                      
'monthly' => array('key' => 'Monthly''everyKey' => 'months'),
                                      
'yearly' => array('key' => 'Yearly''everyKey' => 'years'),
                                  )
        );
        
$this->Set('DayNames', array(
                                 
=> 'DaySundayAbbr',
                                 
=> 'DayMondayAbbr',
                                 
=> 'DayTuesdayAbbr',
                                 
=> 'DayWednesdayAbbr',
                                 
=> 'DayThursdayAbbr',
                                 
=> 'DayFridayAbbr',
                                 
=> 'DaySaturdayAbbr',
                             )
        );

        
$this->Display($this->GetTemplateName());
    }

    public function 
BindPeriods($startPeriods$endPeriods)
    {
        
$this->Set('StartPeriods'$startPeriods);
        
$this->Set('EndPeriods'$endPeriods);
    }

    public function 
BindAvailableResources($resources)
    {
        
$this->Set('AvailableResources'$resources);
    }

    public function 
ShowAdditionalResources($shouldShow)
    {
        
$this->Set('ShowAdditionalResources'$shouldShow);
    }

    public function 
BindAvailableAccessories($accessories)
    {
        
$this->Set('AvailableAccessories'$accessories);
    }

    public function 
BindResourceGroups($groups)
    {
        
$this->Set('ResourceGroupsAsJson'json_encode($groups->GetGroups()));
    }

    public function 
SetSelectedStart(SchedulePeriod $selectedStartDate $startDate)
    {
        
$this->Set('SelectedStart'$selectedStart);
        
$this->Set('StartDate'$startDate);
    }

    public function 
SetSelectedEnd(SchedulePeriod $selectedEndDate $endDate)
    {
        
$this->Set('SelectedEnd'$selectedEnd);
        
$this->Set('EndDate'$endDate);
    }

    
/**
     * @param UserDto $user
     * @return void
     */
    
public function SetReservationUser(UserDto $user)
    {
        
$this->Set('ReservationUserName'$user->FullName());
        
$this->Set('UserId'$user->Id());
    }

    
/**
     * @param $resource ResourceDto
     * @return void
     */
    
public function SetReservationResource($resource)
    {
        
$this->Set('ResourceName'$resource->Name);
        
$this->Set('ResourceId'$resource->Id);
    }

    public function 
SetScheduleId($scheduleId)
    {
        
$this->Set('ScheduleId'$scheduleId);
    }

    public function 
SetRepeatTerminationDate($repeatTerminationDate)
    {
        
$this->Set('RepeatTerminationDate'$repeatTerminationDate);
    }

    public function 
SetParticipants($participants)
    {
        
$this->Set('Participants'$participants);
    }

    public function 
SetInvitees($invitees)
    {
        
$this->Set('Invitees'$invitees);
    }

    public function 
SetAccessories($accessories)
    {
        
$this->Set('Accessories'$accessories);
    }

    public function 
SetAttachments($attachments)
    {
        
$this->Set('Attachments'$attachments);
    }

    public function 
SetCanChangeUser($canChangeUser)
    {
        
$this->Set('CanChangeUser'$canChangeUser);
    }

    public function 
ShowUserDetails($canShowUserDetails)
    {
        
$this->Set('ShowUserDetails'$canShowUserDetails);
    }

    public function 
SetShowParticipation($shouldShow)
    {
        
$this->Set('ShowParticipation'$shouldShow);
    }

    public function 
ShowReservationDetails($showReservationDetails)
    {
        
$this->Set('ShowReservationDetails'$showReservationDetails);
    }

    public function 
SetCustomAttributes($attributes)
    {
        
$this->Set('Attributes'$attributes);
    }

    public function 
HideRecurrence($isHidden)
    {
        
$this->Set('HideRecurrence'$isHidden);
    }
}

All system for education purposes only. For more tools: Telegram @jackleet

Mr.X Private Shell

Logo
-
New File | New Folder
Command
SQL