ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLikeUserOrgUnitSearch.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/Search/classes/class.ilAbstractSearch.php';
6include_once './Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
14{
15 const ORG_ASSIGNMENTS_TABLE = 'orgu_user_assignments';
16
20 private $org_tree = null;
21
22
23
24 public function __construct($qp_obj)
25 {
26 parent::__construct($qp_obj);
27
28 $this->org_tree = ilObjOrgUnitTree::_getInstance();
29 $this->org_tree->buildTempTableWithUsrAssignements(self::ORG_ASSIGNMENTS_TABLE);
30 }
31
32
33 public function performSearch()
34 {
35 $where = $this->__createWhereCondition();
36 $locate = $this->__createLocateString();
37
38 $query = 'SELECT user_id ' .
39 'FROM ' . self::ORG_ASSIGNMENTS_TABLE . ' ' .
40 $where;
41
42 $GLOBALS['DIC']->logger()->src()->debug($query);
43
44 $res = $this->db->query($query);
45 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
46 $this->search_result->addEntry($row->user_id, 'user', $this->__prepareFound($row));
47 }
48
50 }
51
52
58 public function __createWhereCondition()
59 {
60 global $ilDB;
61
62 $where = 'WHERE ';
63 $counter = 0;
64 foreach ($this->query_parser->getQuotedWords() as $word) {
65 if ($counter++) {
66 $and .= " OR ";
67 }
68 $where .= ('ref_id = ' . $ilDB->quote($word, 'integer'));
69 }
70 return $where;
71 }
72}
An exception for terminatinating execution or to throw for unit testing.
__createLocateString()
build locate string in case of AND search
__createWhereCondition()
Create where condition @global type $ilDB.
__construct($qp_obj)
Constructor @access public.
$counter
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$query
foreach($_POST as $key=> $value) $res
global $ilDB