1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107:
<?php
/**
* FlexiPeeHP - Objekt záznamu změn.
*
* @author Vítězslav Dvořák <vitex@arachne.cz>
* @copyright (C) 2016-2017 Spoje.Net
*/
namespace FlexiPeeHP;
/**
* Log změn v evidencích
*
* @link https://www.flexibee.eu/api/dokumentace/ref/changes-api/ Dokumentace
*/
class Changes extends FlexiBeeRO
{
/**
* Evidence užitá objektem.
*
* @var string
*/
public $evidence = 'changes';
/**
* Povolí oznamování změn
* Allow changes notification
*
* @return boolean
*/
public function enable()
{
$this->performRequest('enable.xml', 'POST', 'xml');
return $this->lastResponseCode == 200;
}
/**
* Zakáže oznamování změn
* Disallow changes notification
*
* @return boolean
*/
public function disable()
{
$this->performRequest('disable.xml', 'POST', 'xml');
return $this->lastResponseCode == 200;
}
/**
* Vrátí stav zapnutí ChangesAPI
*
* @return boolean
*/
public function getStatus()
{
$status = $this->performRequest('status.xml', 'GET', 'xml');
return (($this->lastResponseCode == 200) && ($status['changes'][0]['success']
=== 'true'));
}
/**
* Test if given record exists in FlexiBee .
*
* @param array $data
* @return null Method is disabled for Changes
*/
public function recordExists($data = null)
{
return null;
}
/**
* Obtain actual GlobalVersion
* Vrací aktuální globální verzi změn
*
* @link https://www.flexibee.eu/api/dokumentace/ref/changes-api#globalVersion Globální Verze
* @return int
*/
public function getGlobalVersion()
{
$this->getColumnsFromFlexibee('id', ['start' => 0, 'limit' => 0]);
return $this->globalVersion;
}
/**
* Convert FlexiBee Response XML to Array
*
* @param string $rawXML
*
* @return array
*/
public function rawXmlToArray($rawXML)
{
return [$this->getEvidence() => parent::rawXmlToArray($rawXML)];
}
/**
* Changes has no relations
*
* @return null
*/
public function getVazby($id = null)
{
throw new \Exception(_('Changes has no relations'));
}
}