43 $attributes = array())
47 $this->active = $active;
48 $this->anonymizable = $anonymizable;
49 $this->description = $description;
50 $this->created = $created;
51 $this->updated = $updated;
52 $this->attributes = $attributes;
63 if (isset($xmlElement->id)) $this->
id = $xmlElement->id;
64 if (isset($xmlElement->name)) $this->name = $xmlElement->name;
65 if (isset($xmlElement->active)) $this->active = $xmlElement->active;
66 if (isset($xmlElement->anonymizable)) $this->anonymizable = $xmlElement->anonymizable;
67 if (isset($xmlElement->description)) $this->description = $xmlElement->description;
68 if (isset($xmlElement->created)) $this->created = $xmlElement->created;
69 if (isset($xmlElement->updated)) $this->updated = $xmlElement->updated;
71 if (isset($xmlElement->attributes)) {
72 $this->attributes = array();
73 foreach ($xmlElement->attributes->children() as $xmlAttribute) {
75 if (isset($xmlAttribute->name)) $attribute[
'name'] = trim($xmlAttribute->name);
77 if (isset($xmlAttribute->description)) $attribute[
'description'] = trim($xmlAttribute->description);
78 if (isset($xmlAttribute->required)) $attribute[
'required'] = $xmlAttribute->required;
79 array_push($this->attributes, $attribute);
92 if (isset($this->attributes)) {
93 foreach ($this->attributes as $index => $value) {
94 $attributes .=
"attribute (name=" . $value[
'name'] .
", datatype=" . $value[
'datatype']->getValue() .
", description=" . $value[
'description'] .
", required=" . (($value[
'required'] ==
true) ?
"true" :
"false") .
"), ";
96 $attributes = rtrim($attributes,
' ');
97 $attributes = rtrim($attributes,
',');
101 return "ContactEventType [id=" . $this->
id .
", name=" . $this->name .
", active=" . $this->active .
", anonymizable="
102 . $this->anonymizable .
", description=" . $this->description .
", created=" . $this->created .
", updated=" . $this->updated .
", attributes=" . $attributes .
"]";
111 $xml =
new SimpleXMLElement(
"<?xml version=\"1.0\"?><contacteventtype></contacteventtype>");
114 if (isset($this->
id)) $xml->addChild(
"id", $this->
id);
115 if (isset($this->active)) $xml->addChild(
"active", $this->active);
116 if (isset($this->anonymizable)) $xml->addChild(
"anonymizable", ($this->anonymizable ==
true) ?
"true" :
"false");
117 if (isset($this->description)) $xml->addChild(
"description", $this->description);
118 if (isset($this->created)) $xml->addChild(
"created", $this->created);
119 if (isset($this->updated)) $xml->addChild(
"updated", $this->updated);
120 if (isset($this->updated)) $xml->addChild(
"name", $this->name);
122 if (isset($this->attributes) &&
sizeof($this->attributes) > 0) {
124 $attributes = $xml->addChild(
"attributes");
125 foreach ($this->attributes as $index => $value) {
126 $field = $attributes->addChild(
"attribute");
127 $field->addChild(
"name", $value->name);
128 $field->addChild(
"datatype", $value->datatype->getValue());
129 $field->addChild(
"description", $value->description);
130 $field->addChild(
"required", ($value->required ==
true) ?
"true" :
"false");
143 $xml = $this->
toXML();
144 return $xml->asXML();