ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMailSearchLuceneResultParser.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
10 {
14  protected $result;
15 
19  protected $xml;
20 
26  {
27  $this->result = $result;
28  $this->xml = $xml;
29  }
30 
34  public function getXml()
35  {
36  return $this->xml;
37  }
38 
42  public function getResult()
43  {
44  return $this->result;
45  }
46 
50  public function parse()
51  {
52  if (!strlen($this->getXml())) {
53  return;
54  }
55 
56  $hits = new SimpleXMLElement($this->getXml());
57  foreach ($hits->children() as $user) {
58  foreach ($user->children() as $item) {
62  $fields = array();
63  foreach ($item->children() as $field) {
67  $name = (string) $field['name'];
68  $content = (string) $field;
69  $fields[] = array(
70  $name, $content
71  );
72  }
73  $this->getResult()->addItem((int) $item['id'], $fields);
74  }
75  }
76  }
77 }
__construct(ilMailSearchResult $result, $xml)
$user
Definition: migrateto20.php:57
parse($uri)
Parses a URI and returns its individual components.
Definition: functions.php:181