N°6043 - Booking: Add prerequisites in iTop core - CRUD extensibility (#520)

This commit is contained in:
bdalsass
2023-07-04 16:22:53 +02:00
committed by GitHub
parent 40dc3deabb
commit 9d38b4d1d6
28 changed files with 1665 additions and 123 deletions

View File

@@ -0,0 +1,45 @@
<?php
/*
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Service\TemporaryObjects;
/**
* TemporaryObjectHelper.
*
* Helper with useful functions.
*
* @since 3.1
*/
class TemporaryObjectHelper
{
// Global configuration
const CONFIG_FORCE = 'temporary_object.force_creation';
const CONFIG_TEMP_LIFETIME = 'temporary_object.lifetime';
const CONFIG_WATCHDOG_INTERVAL = 'temporary_object.watchdog_interval';
const CONFIG_GARBAGE_INTERVAL = 'temporary_object.garbage_interval';
// Temporary descriptor operation
const OPERATION_CREATE = 'create';
const OPERATION_DELETE = 'delete';
/**
* GetWatchDogJS.
*
* @param string $sTempId
*
* @return string
*/
static public function GetWatchDogJS(string $sTempId): string
{
$iWatchdogInterval = TemporaryObjectConfig::GetInstance()->GetWatchdogInterval();
return <<<JS
window.setInterval(function() {
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php?route=temporary_object.watch_dog', {temp_id: '$sTempId'});
}, $iWatchdogInterval * 1000)
JS;
}
}