. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 94.23.64.18  /  Your IP : 216.73.216.185   [ Reverse IP ]
Web Server : Apache
System : 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 : villadal ( 6036)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/villadal/www/old/booked/lib/Application/Reporting/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/villadal/www/old/booked/lib/Application/Reporting/ReportingService.php
<?php
/**
Copyright 2012-2014 Nick Korbel

This file is part of Booked SchedulerBooked SchedulereIt 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 versBooked SchedulerduleIt 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
alBooked SchedulercheduleIt.  If not, see <http://www.gnu.org/licenses/>.
 */

require_once(ROOT_DIR . 'lib/Application/Reporting/namespace.php');
require_once(ROOT_DIR . 'lib/Email/namespace.php');
require_once(ROOT_DIR . 'lib/Email/Messages/ReportEmailMessage.php');
require_once(ROOT_DIR . 'Domain/Access/ReportingRepository.php');

interface IReportingService
{
	/**
	 * @abstract
	 * @param Report_Usage $usage
	 * @param Report_ResultSelection $selection
	 * @param Report_GroupBy $groupBy
	 * @param Report_Range $range
	 * @param Report_Filter $filter
	 * @return IReport
	 */
	public function GenerateCustomReport(Report_Usage $usage, Report_ResultSelection $selection, Report_GroupBy $groupBy, Report_Range $range, Report_Filter $filter);

	/**
	 * @abstract
	 * @param string $reportName
	 * @param int $userId
	 * @param Report_Usage $usage
	 * @param Report_ResultSelection $selection
	 * @param Report_GroupBy $groupBy
	 * @param Report_Range $range
	 * @param Report_Filter $filter
	 */
	public function Save($reportName, $userId, Report_Usage $usage, Report_ResultSelection $selection, Report_GroupBy $groupBy, Report_Range $range, Report_Filter $filter);

	/**
	 * @abstract
	 * @param int $userId
	 * @return array|SavedReport[]
	 */
	public function GetSavedReports($userId);

	/**
	 * @abstract
	 * @param int $reportId
	 * @param int $userId
	 * @return IGeneratedSavedReport
	 */
	public function GenerateSavedReport($reportId, $userId);

	/**
	 * @param IGeneratedSavedReport $report
	 * @param IReportDefinition $definition
	 * @param string $toAddress
	 * @param UserSession $reportUser
	 */
	public function SendReport($report, $definition, $toAddress, $reportUser);

	/**
	 * @abstract
	 * @param int $reportId
	 * @param int $userId
	 */
	public function DeleteSavedReport($reportId, $userId);

	/**
	 * @abstract
	 * @param ICannedReport $cannedReport
	 * @return IReport
	 */
	public function GenerateCommonReport(ICannedReport $cannedReport);
}


class ReportingService implements IReportingService
{
	/**
	 * @var IReportingRepository
	 */
	private $repository;

	public function __construct(IReportingRepository $repository)
	{
		$this->repository = $repository;
	}

	public function GenerateCustomReport(Report_Usage $usage, Report_ResultSelection $selection, Report_GroupBy $groupBy, Report_Range $range, Report_Filter $filter)
	{
		$builder = new ReportCommandBuilder();

		$selection->Add($builder);
		if ($selection->Equals(Report_ResultSelection::FULL_LIST))
		{
			$usage->Add($builder);
		}
		$groupBy->Add($builder);
		$range->Add($builder);
		$filter->Add($builder);

		$data = $this->repository->GetCustomReport($builder);
		return new CustomReport($data);
	}

	public function Save($reportName, $userId, Report_Usage $usage, Report_ResultSelection $selection, Report_GroupBy $groupBy, Report_Range $range, Report_Filter $filter)
	{
		$report = new SavedReport($reportName, $userId, $usage, $selection, $groupBy, $range, $filter);
		$this->repository->SaveCustomReport($report);
	}

	public function GetSavedReports($userId)
	{
		return $this->repository->LoadSavedReportsForUser($userId);
	}

	public function GenerateSavedReport($reportId, $userId)
	{
		$savedReport = $this->repository->LoadSavedReportForUser($reportId, $userId);

		if ($savedReport == null)
		{
			return null;
		}

		$report = $this->GenerateCustomReport($savedReport->Usage(), $savedReport->Selection(), $savedReport->GroupBy(), $savedReport->Range(), $savedReport->Filter());

		return new GeneratedSavedReport($savedReport, $report);
	}

	public function SendReport($report, $definition, $toAddress, $reportUser)
	{
		$message = new ReportEmailMessage($report, $definition, $toAddress, $reportUser);
		ServiceLocator::GetEmailService()->Send($message);
	}

	public function DeleteSavedReport($reportId, $userId)
	{
		$this->repository->DeleteSavedReport($reportId, $userId);
	}

	public function GenerateCommonReport(ICannedReport $cannedReport)
	{
		$data = $this->repository->GetCustomReport($cannedReport->GetBuilder());
		return new CustomReport($data);
	}
}



?>

Anon7 - 2022
AnonSec Team