ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\MediaObjects\Usage\UsageDBRepository Class Reference
+ Collaboration diagram for ILIAS\MediaObjects\Usage\UsageDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 getHistoryUsagesLowerEqualThan (string $a_type, int $a_id, int $a_usage_hist_nr, string $a_lang="-")
 
 deleteHistoryUsagesLowerEqualThan (string $a_type, int $a_id, int $a_usage_hist_nr, string $a_lang="-")
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.UsageDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 30 of file class.UsageDBRepository.php.

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

31  {
32  $this->db = $db;
33  }

Member Function Documentation

◆ deleteHistoryUsagesLowerEqualThan()

ILIAS\MediaObjects\Usage\UsageDBRepository::deleteHistoryUsagesLowerEqualThan ( string  $a_type,
int  $a_id,
int  $a_usage_hist_nr,
string  $a_lang = "-" 
)

Definition at line 58 of file class.UsageDBRepository.php.

References ILIAS\MediaObjects\Usage\UsageDBRepository\$db, and ilDBInterface\quote().

Referenced by ilPCMediaObject\deleteHistoryLowerEqualThan().

63  : void {
64  $db = $this->db;
65 
66  $and_hist = " AND usage_hist_nr > 0 AND usage_hist_nr <= " . $db->quote($a_usage_hist_nr, "integer");
67  $q = "DELETE FROM mob_usage WHERE usage_type = " .
68  $db->quote($a_type, "text") .
69  " AND usage_id= " . $db->quote($a_id, "integer") .
70  " AND usage_lang = " . $db->quote($a_lang, "text") .
71  $and_hist;
72  $db->manipulate($q);
73  }
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHistoryUsagesLowerEqualThan()

ILIAS\MediaObjects\Usage\UsageDBRepository::getHistoryUsagesLowerEqualThan ( string  $a_type,
int  $a_id,
int  $a_usage_hist_nr,
string  $a_lang = "-" 
)

Definition at line 35 of file class.UsageDBRepository.php.

References ILIAS\MediaObjects\Usage\UsageDBRepository\$db, and ilDBInterface\quote().

Referenced by ilPCMediaObject\deleteHistoryLowerEqualThan().

40  : array {
41  $db = $this->db;
42 
43  $and_hist = " AND usage_hist_nr > 0 AND usage_hist_nr <= " . $db->quote($a_usage_hist_nr, "integer");
44 
45  $mob_ids = array();
46  $set = $db->query("SELECT DISTINCT(id) FROM mob_usage" .
47  " WHERE usage_type = " . $db->quote($a_type, "text") .
48  " AND usage_id = " . $db->quote($a_id, "integer") .
49  " AND usage_lang = " . $db->quote($a_lang, "text") .
50  $and_hist);
51 
52  while ($row = $db->fetchAssoc($set)) {
53  $mob_ids[] = $row["id"];
54  }
55  return $mob_ids;
56  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db


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