851
* Store the media inventory for a client
852
* @param <type> $hardwareKey
853
* @param <type> $inventory
855
public function MediaInventory($version, $serverKey, $hardwareKey, $inventory)
860
$serverKey = Kit::ValidateParam($serverKey, _STRING);
861
$hardwareKey = Kit::ValidateParam($hardwareKey, _STRING);
862
$version = Kit::ValidateParam($version, _STRING);
863
$inventory = Kit::ValidateParam($inventory, _HTMLSTRING);
865
// Make sure we are talking the same language
866
if (!$this->CheckVersion($version))
867
throw new SoapFault('Receiver', "Your client is not of the correct version for communication with this server. You can get the latest from http://www.xibo.org.uk");
869
// Auth this request...
870
if (!$this->AuthDisplay($hardwareKey))
871
throw new SoapFault('Receiver', 'This display client is not licensed');
873
if ($this->isAuditing == 1) Debug::LogEntry ($db, 'audit', $inventory, 'xmds', 'MediaInventory', '', $this->displayId);
875
// Check that the $inventory contains something
876
if ($inventory == '')
877
throw new SoapFault('Receiver', 'Inventory Cannot be Empty');
879
// Load the XML into a DOMDocument
880
$document = new DOMDocument("1.0");
881
$document->loadXML($inventory);
883
// Assume we are complete (but we are getting some)
884
$mediaInventoryComplete = 1;
886
foreach ($document->documentElement->childNodes as $node)
888
// Make sure we dont consider any text nodes
889
if ($node->nodeType == XML_TEXT_NODE) continue;
891
$mediaId = $node->getAttribute('id');
892
$complete = $node->getAttribute('complete');
893
$md5 = $node->getAttribute('md5');
894
$lastChecked = $node->getAttribute('lastChecked');
898
// If this item is a 0 then set not complete
900
$mediaInventoryComplete = 2;
903
// Touch the display record
904
$displayObject = new Display($db);
905
$displayObject->Touch($hardwareKey, '', $mediaInventoryComplete, $inventory);
851
911
* Authenticates the display
852
912
* @param <type> $hardwareKey