Maileon PHP client  1.2.5
Easily integrate your PHP application with Maileon.
Click.php
1 <?php
2 
10 {
14  public $timestamp;
15 
19  public $contact;
20 
24  public $mailingId;
25 
29  public $linkId;
30 
34  public $linkUrl;
35 
39  public $linkTags;
40 
45  function toString()
46  {
47 
48  // Generate custom field string
49  $linkTags = "";
50  if (isset($this->linkTags)) {
51  foreach ($this->linkTags as $value) {
52  $linkTags .= $value . "#";
53  }
54  $linkTags = rtrim($linkTags, '#');
55  }
56 
57  return "Click [timestamp=" . $this->timestamp .
58  ", contact=" . $this->contact->toString() .
59  ", mailingId=" . $this->mailingId .
60  ", linkId=" . $this->linkId .
61  ", linkUrl=" . $this->linkUrl .
62  ", linkTags=" . $linkTags ."]";
63  }
64 
71  function fromXML($xmlElement)
72  {
73  $this->contact = new com_maileon_api_reports_ReportContact();
74  $this->contact->fromXML($xmlElement->contact);
75 
76  if (isset($xmlElement->mailing_id)) $this->mailingId = $xmlElement->mailing_id;
77  if (isset($xmlElement->timestamp)) $this->timestamp = $xmlElement->timestamp;
78  if (isset($xmlElement->link_id)) $this->linkId = $xmlElement->link_id;
79  if (isset($xmlElement->link_url)) $this->linkUrl = $xmlElement->link_url;
80 
81  if (isset($xmlElement->link_tags)) {
82  $this->linkTags = array();
83  foreach ($xmlElement->link_tags->children() as $field) {
84  array_push($this->linkTags, $field[0]);
85  }
86  }
87  }
88 
93  function toCsvString()
94  {
95  return $this->timestamp .
96  ";" . $this->contact->toCsvString() .
97  ";" . $this->mailingId .
98  ";" . $this->linkId .
99  ";" . $this->linkUrl;
100  }
101 
108  function toXML()
109  {
110  // Not implemented yet.
111  }
112 }