Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
147 righe
5.3 KiB
147 righe
5.3 KiB
<? |
|
|
|
class conferenceManager { |
|
public static function startMeeting($modulo,$elemento,$type = "general",$sub, $redirect = true) { |
|
$provider = settingsManager::getValue("provider"); |
|
if (!empty($provider)) { |
|
if ($provider == "zoom") { |
|
$client = new zoomMtg; |
|
} else { |
|
$client = new goToMtg; |
|
} |
|
$meetingDBRecord = $client->getMeetingFromDB($modulo,$elemento,$sub,$type); |
|
if (!empty($meetingDBRecord)) { |
|
$meetingRecord = json_decode($meetingDBRecord["response"],true); |
|
if ($provider == "zoom") { |
|
$status = $client->getMeetingDetails($meetingRecord["id"]); |
|
if (empty($status["status"]) || $status["status"] == "finished") { |
|
unset($meetingRecord); |
|
} |
|
} else { |
|
$host = $client->getHostFromID($meetingDBRecord["host"]); |
|
$status = $client->getMeetingDetails($meetingRecord["meetingid"],$_SESSION["ente"]->codice,$host["codice"]); |
|
if (!empty($status["status"]) && $status["status"] == "INACTIVE") { $url = $client->getHostURL($meetingDBRecord["codice"]); } |
|
if (empty($url)) { unset($meetingRecord); } |
|
} |
|
} |
|
if (empty($meetingRecord)) { |
|
$meetingRecord = $client->createMeeting($modulo,$elemento,$sub,$type); |
|
$meetingDBRecord = $client->getMeetingFromDB($modulo,$elemento,$sub,$type); |
|
} |
|
if (!empty($meetingRecord)) { |
|
if ($provider == "zoom") { |
|
if (!empty($meetingRecord["id"])) { |
|
if ($redirect) { |
|
header("location: {$meetingRecord["start_url"]}"); |
|
die(); |
|
} else { |
|
return $meetingRecord["start_url"]; |
|
} |
|
} |
|
} else { |
|
if (!empty($meetingRecord["meetingid"])) { |
|
if (empty($url)) { |
|
$url = $client->getHostURL($meetingDBRecord["codice"]); |
|
} |
|
if ($redirect) { |
|
if (!empty($url)) { |
|
header("location: {$url}"); |
|
die(); |
|
} |
|
} else { |
|
return $url; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
public static function getMeetingsFromDB($modulo,$elemento,$type,$sub) { |
|
global $pdo; |
|
$provider = settingsManager::getValue("provider"); |
|
if (!empty($provider)) { |
|
$bind = [":sezione"=>$modulo,":codice_elemento"=>$elemento,":sub_elemento"=>$sub,":contesto"=>$type,":ente"=>$_SESSION["ente"]->codice,":provider"=>$provider]; |
|
$sql = "SELECT * FROM b_conference |
|
WHERE provider = :provider AND codice_ente = :ente AND sezione = :sezione AND codice_elemento = :codice_elemento |
|
AND sub_elemento = :sub_elemento AND contesto = :contesto |
|
ORDER BY timestamp DESC"; |
|
$meetings = $pdo->go($sql,$bind); |
|
if ($meetings->rowCount() > 0) { return $meetings->fetchAll(PDO::FETCH_ASSOC); } |
|
} |
|
return false; |
|
} |
|
|
|
public static function printLog($id) { |
|
$provider = settingsManager::getValue("provider"); |
|
if (!empty($provider)) { |
|
if ($provider == "zoom") { |
|
$client = new zoomMtg; |
|
} else { |
|
$client = new goToMtg; |
|
} |
|
$client->printLog($id); |
|
} |
|
} |
|
|
|
public static function checkStatus($modulo,$elemento,$type = "general",$sub) { |
|
$provider = settingsManager::getValue("provider"); |
|
$url = ""; |
|
$codice = ""; |
|
if ($provider == "zoom") { |
|
$client = new zoomMtg; |
|
} else { |
|
$client = new goToMtg; |
|
} |
|
$meetingDBRecord = $client->getMeetingFromDB($modulo,$elemento,$sub,$type); |
|
$started = false; |
|
/* |
|
$conferenceStatus |
|
0 - NON INIZIATO |
|
1 - INIZIATO |
|
2 - TERMINATO |
|
*/ |
|
$conferenceStatus = 0; |
|
if (!empty($meetingDBRecord)) { |
|
$codice = $meetingDBRecord["codice"]; |
|
$meetingRecord = json_decode($meetingDBRecord["response"],true); |
|
if ($provider == "zoom") { |
|
$status = $client->getMeetingDetails($meetingRecord["id"]); |
|
if (empty($status)) { |
|
$old = $client->getPastMeeting($meetingRecord["uuid"]); |
|
} else { |
|
if ($status["status"] != "finished") { |
|
$conferenceStatus = 1; |
|
$url = $meetingRecord["join_url"]; |
|
} else { |
|
$conferenceStatus = 2; |
|
} |
|
} |
|
} else { |
|
$host = $client->getHostFromID($meetingDBRecord["host"]); |
|
$status = $client->getMeetingDetails($meetingRecord["meetingid"],$_SESSION["azienda"]->codice,$host["codice"]); |
|
if (!empty($status["status"]) && $status["status"] == "ACTIVE") { |
|
$conferenceStatus = 1; |
|
$url = $meetingRecord["joinURL"]; |
|
} else if (empty($status)) { |
|
$conferenceStatus = 2; |
|
} |
|
} |
|
} |
|
return ["esito"=>$conferenceStatus,"url"=>$url,"codice"=>$codice]; |
|
} |
|
|
|
public static function printPingScript($codice) { |
|
if (!empty($codice)) { |
|
/* |
|
DISABILITATO - LA FUNZIONE DEL PING NON GARANTISCE UN'IDENTIFICAZIONE AFFIDABILE DEGLI UTENTI COLLEGATI |
|
?> |
|
<script> |
|
setInterval(function() { $.ajax({url:"/conference/ping.php?id=<?= $codice ?>"}) }, 10000); |
|
</script> |
|
<? |
|
*/ |
|
} |
|
} |
|
} |
|
?>
|