ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLikeAdvancedSearch.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
29 public function __createTaxonWhereCondition(): string
30 {
31 if ($this->options['lom_taxon']) {
32 $where = " WHERE (";
33
34 $counter = 0;
35 foreach ($this->query_parser->getQuotedWords() as $word) {
36 if ($counter++) {
37 $where .= "OR";
38 }
39
40 $where .= $this->db->like('taxon', 'text', '%' . $word . '%');
41 }
42 $where .= ') ';
43 return $where;
44 }
45 return '';
46 }
47
48 public function __createKeywordWhereCondition(): string
49 {
50 $where = " WHERE (";
51
52 $counter = 0;
53 foreach ($this->query_parser->getQuotedWords() as $word) {
54 if ($counter++) {
55 $where .= "OR";
56 }
57
58 $where .= $this->db->like('keyword', 'text', '%' . $word . '%');
59 }
60 $where .= ') ';
61 return $where;
62 }
63
64 public function __createLifecycleWhereCondition(): string
65 {
66 if ($this->options['lom_version']) {
67 $where = " WHERE (";
68
69 $counter = 0;
70 foreach ($this->query_parser->getQuotedWords() as $word) {
71 if ($counter++) {
72 $where .= "OR";
73 }
74
75 $where .= $this->db->like('meta_version', 'text', '%' . $word . '%');
76 }
77 $where .= ') ';
78 return $where;
79 }
80 return '';
81 }
82
83 public function __createEntityWhereCondition(): string
84 {
85 if ($this->options['lom_role_entry']) {
86 $where = " WHERE (";
87
88 $counter = 0;
89 foreach ($this->query_parser->getQuotedWords() as $word) {
90 if ($counter++) {
91 $where .= "OR";
92 }
93
94 $where .= $this->db->like('entity', 'text', '%' . $word . '%');
95 }
96 $where .= ') ';
97 return $where;
98 }
99 return '';
100 }
101
102 public function __createCoverageAndCondition(): string
103 {
104 if ($this->options['lom_coverage']) {
105 $where = " AND (";
106
107 $counter = 0;
108 foreach ($this->query_parser->getQuotedWords() as $word) {
109 if ($counter++) {
110 $where .= "OR";
111 }
112
113 $where .= $this->db->like('coverage', 'text', '%' . $word . '%');
114 }
115 $where .= ') ';
116 return $where;
117 }
118 return '';
119 }
120
121 public function __createObjectPropertiesWhereCondition(string ...$fields): string
122 {
123 $concat_array = [];
124 foreach ($fields as $field) {
125 $concat_array[] = [$field, 'text'];
126 }
127 $concat = $this->db->concat($concat_array);
128
129 $where = " WHERE (";
130
131 $counter = 0;
132 foreach ($this->query_parser->getQuotedWords() as $word) {
133 if ($counter++) {
134 $where .= "OR";
135 }
136
137 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
138 }
139 $where .= ') ';
140
141 return $where;
142 }
143}
__createObjectPropertiesWhereCondition(string ... $fields)
$counter