ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  {
54  return;
55  }
56 
57  $hits = new SimpleXMLElement($this->getXml());
58  foreach($hits->children() as $user)
59  {
60  foreach($user->children() as $item)
61  {
65  $fields = array();
66  foreach($item->children() as $field)
67  {
71  $name = (string)$field['name'];
72  $content = (string)$field;
73  $fields[] = array(
74  $name, $content
75  );
76  }
77  $this->getResult()->addItem((int)$item['id'], $fields);
78  }
79  }
80  }
81 }