2015-08-03 11:35:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace modl;
|
|
|
|
|
2015-08-19 11:28:28 +02:00
|
|
|
class Subscription extends Model {
|
2015-08-03 11:35:01 +02:00
|
|
|
public $jid;
|
2015-09-10 10:11:09 +02:00
|
|
|
public $server;
|
|
|
|
public $node;
|
|
|
|
public $subscription;
|
|
|
|
public $subid;
|
|
|
|
public $title;
|
2015-08-03 11:35:01 +02:00
|
|
|
public $description;
|
|
|
|
public $tags;
|
|
|
|
public $timestamp;
|
|
|
|
public $name;
|
2015-08-19 11:28:28 +02:00
|
|
|
public $servicename;
|
|
|
|
|
2015-08-03 11:35:01 +02:00
|
|
|
public function __construct() {
|
|
|
|
$this->_struct = '
|
|
|
|
{
|
2015-08-19 11:28:28 +02:00
|
|
|
"jid" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"string", "size":64, "mandatory":true, "key":true },
|
2015-08-19 11:28:28 +02:00
|
|
|
"server" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"string", "size":64, "mandatory":true, "key":true },
|
2015-08-19 11:28:28 +02:00
|
|
|
"node" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"string", "size":128, "mandatory":true, "key":true },
|
2015-08-19 11:28:28 +02:00
|
|
|
"subscription" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"string", "size":128, "mandatory":true },
|
2015-08-19 11:28:28 +02:00
|
|
|
"subid" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"string", "size":128 },
|
2015-08-19 11:28:28 +02:00
|
|
|
"title" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"string", "size":128 },
|
2015-08-19 11:28:28 +02:00
|
|
|
"tags" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"text" },
|
2015-08-19 11:28:28 +02:00
|
|
|
"timestamp" :
|
2015-08-03 11:35:01 +02:00
|
|
|
{"type":"date" }
|
|
|
|
}';
|
2015-08-19 11:28:28 +02:00
|
|
|
|
2015-08-03 11:35:01 +02:00
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
function set($jid, $server, $node, $s) {
|
2015-09-10 10:11:09 +02:00
|
|
|
$this->jid = $jid;
|
|
|
|
$this->server = $server;
|
|
|
|
$this->node = $node;
|
|
|
|
$this->jid = (string)$s->attributes()->jid;
|
|
|
|
$this->subscription = (string)$s->attributes()->subscription;
|
|
|
|
$this->subid = (string)$s->attributes()->subid;
|
|
|
|
$this->tags = serialize(array());
|
2015-08-19 11:28:28 +02:00
|
|
|
|
2015-08-03 11:35:01 +02:00
|
|
|
if($this->subid = '')
|
|
|
|
$this->subid = 'default';
|
|
|
|
}
|
|
|
|
}
|