ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilLikeUserOrgUnitSearch.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
6 
14 {
15  public const ORG_ASSIGNMENTS_TABLE = 'orgu_user_assignements';
16 
18 
19 
20 
21  public function __construct($qp_obj)
22  {
23  parent::__construct($qp_obj);
24 
25  $this->org_tree = ilObjOrgUnitTree::_getInstance();
26  $this->org_tree->buildTempTableWithUsrAssignements(self::ORG_ASSIGNMENTS_TABLE);
27  }
28 
29 
30  public function performSearch(): ilSearchResult
31  {
32  $where = $this->__createWhereCondition();
33  $locate = $this->__createLocateString();
34 
35  $query = 'SELECT user_id ' .
36  'FROM ' . self::ORG_ASSIGNMENTS_TABLE . ' ' .
37  $where;
38 
39  $res = $this->db->query($query);
40  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
41  $this->search_result->addEntry($row->user_id, 'user', $this->__prepareFound($row));
42  }
43  return $this->search_result;
44  }
45 
46 
47  public function __createWhereCondition(): string
48  {
49  $and = '';
50  $where = 'WHERE ';
51  $counter = 0;
52  foreach ($this->query_parser->getQuotedWords() as $word) {
53  if ($counter++) {
54  $and .= " OR ";
55  }
56  $where .= ('ref_id = ' . $this->db->quote($word, 'integer'));
57  }
58  return $where;
59  }
60 }
$res
Definition: ltiservices.php:69
__construct(VocabulariesInterface $vocabularies)
ilSearchResult $search_result
Description of class class.