ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLikeUserOrgUnitSearch.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
29  public const ORG_ASSIGNMENTS_TABLE = 'orgu_user_assignements';
30 
32 
33 
34 
35  public function __construct($qp_obj)
36  {
37  parent::__construct($qp_obj);
38 
39  $this->org_tree = ilObjOrgUnitTree::_getInstance();
40  $this->org_tree->buildTempTableWithUsrAssignements(self::ORG_ASSIGNMENTS_TABLE);
41  }
42 
43 
44  public function performSearch(): ilSearchResult
45  {
46  $where = $this->__createWhereCondition();
47  $locate = $this->__createLocateString();
48 
49  $query = 'SELECT user_id ' .
50  'FROM ' . self::ORG_ASSIGNMENTS_TABLE . ' ' .
51  $where;
52 
53  $res = $this->db->query($query);
54  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
55  $this->search_result->addEntry((int) $row->user_id, 'user', $this->__prepareFound($row));
56  }
57  return $this->search_result;
58  }
59 
60 
61  public function __createWhereCondition(): string
62  {
63  $and = '';
64  $where = 'WHERE ';
65  $counter = 0;
66  foreach ($this->query_parser->getQuotedWords() as $word) {
67  if ($counter++) {
68  $and .= " OR ";
69  }
70  $where .= ('ref_id = ' . $this->db->quote($word, 'integer'));
71  }
72  return $where;
73  }
74 }
$res
Definition: ltiservices.php:69
$query
__construct(Container $dic, ilPlugin $plugin)
ilSearchResult $search_result
Description of class class.