ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLikeUserOrgUnitSearch.php
Go to the documentation of this file.
1<?php
2
19declare(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($row->user_id, 'user', $this->__prepareFound($row));
56 }
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}
ilSearchResult $search_result
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$counter