ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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}
An exception for terminatinating execution or to throw for unit testing.
__construct(ilMailSearchResult $result, $xml)
if($format !==null) $name
Definition: metadata.php:230