ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Taxonomy\Usage\UsageDBRepository Class Reference
+ Collaboration diagram for ILIAS\Taxonomy\Usage\UsageDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 getUsageOfObject (int $obj_id, bool $include_titles=false)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 23 of file UsageDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Taxonomy\Usage\UsageDBRepository::__construct ( \ilDBInterface  $db)

Definition at line 27 of file UsageDBRepository.php.

29 {
30 $this->db = $db;
31 }

References ILIAS\Taxonomy\Usage\UsageDBRepository\$db.

Member Function Documentation

◆ getUsageOfObject()

ILIAS\Taxonomy\Usage\UsageDBRepository::getUsageOfObject ( int  $obj_id,
bool  $include_titles = false 
)

Definition at line 33 of file UsageDBRepository.php.

33 : array
34 {
35 $set = $this->db->query(
36 "SELECT tax_id FROM tax_usage " .
37 " WHERE obj_id = " . $this->db->quote($obj_id, "integer")
38 );
39 $tax = array();
40 while ($rec = $this->db->fetchAssoc($set)) {
41 if (!$include_titles) {
42 $tax[] = (int) $rec["tax_id"];
43 } else {
44 $tax[] = array("tax_id" => (int) $rec["tax_id"],
45 "title" => \ilObject::_lookupTitle((int) $rec["tax_id"])
46 );
47 }
48 }
49 if ($include_titles) {
50 $tax = \ilArrayUtil::sortArray($tax, "title");
51 }
52 return $tax;
53 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle(), ILIAS\Repository\int(), and ilArrayUtil\sortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\Taxonomy\Usage\UsageDBRepository::$db
protected

The documentation for this class was generated from the following file: