2017-03-22 17:57:21 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Manager for Mode Script Events
|
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
|
|
|
* @copyright 2014-2017 ManiaControl Team
|
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
|
2017-03-24 22:08:51 +01:00
|
|
|
namespace ManiaControl\Script;
|
2017-03-22 17:57:21 +01:00
|
|
|
|
2017-03-26 19:44:55 +02:00
|
|
|
use ManiaControl\General\UsageInformationAble;
|
|
|
|
use ManiaControl\General\UsageInformationTrait;
|
2017-03-22 17:57:21 +01:00
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
|
2017-03-26 19:44:55 +02:00
|
|
|
class ModeScriptEventManager implements UsageInformationAble {
|
|
|
|
use UsageInformationTrait;
|
|
|
|
|
2017-03-23 20:39:32 +01:00
|
|
|
const API_VERSION = "2.0.0";
|
|
|
|
|
2017-03-22 17:57:21 +01:00
|
|
|
/** @var ManiaControl $maniaControl */
|
|
|
|
private $maniaControl;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new ranking manager instance
|
|
|
|
*
|
|
|
|
* @param ManiaControl $maniaControl
|
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables XmlRpc Callbacks
|
|
|
|
*/
|
|
|
|
public function enableCallbacks() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('true'));
|
2017-03-22 18:21:33 +01:00
|
|
|
|
2017-03-23 20:39:32 +01:00
|
|
|
$this->setApiVersion(self::API_VERSION);
|
2017-03-22 18:21:33 +01:00
|
|
|
|
|
|
|
$this->getAllApiVersions();
|
|
|
|
|
|
|
|
$this->getCallbacksList(); //TODO verify why this does not work
|
2017-03-22 17:57:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disables XmlRpc Callbacks
|
|
|
|
*/
|
|
|
|
public function disableCallbacks() {
|
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('false'));
|
|
|
|
}
|
2017-03-22 18:21:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $responseId
|
|
|
|
* Triggers a Callback List Callback
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
public function getCallbacksList($responseId = "DefaultResponseId") {
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the Api Version
|
2017-03-26 19:44:55 +02:00
|
|
|
*
|
2017-03-22 18:21:33 +01:00
|
|
|
* @param string $version
|
|
|
|
*/
|
2017-03-26 19:44:55 +02:00
|
|
|
public function setApiVersion($version = self::API_VERSION) {
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.SetApiVersion', array($version));
|
|
|
|
}
|
|
|
|
|
2017-03-26 19:44:55 +02:00
|
|
|
public function getAllApiVersions($responseId = "DefaultResponseId") {
|
2017-03-22 18:21:33 +01:00
|
|
|
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId));
|
|
|
|
}
|
2017-03-22 17:57:21 +01:00
|
|
|
}
|