31 public static function _deleteAllUsages($a_type, $a_id,
int $a_usage_hist_nr = 0,
string $a_usage_lang =
"-"): void
36 $and_hist = ($a_usage_hist_nr !==
false) ?
" AND usage_hist_nr = " 37 .
$ilDB->quote($a_usage_hist_nr,
"integer") :
"";
41 'SELECT id FROM file_usage WHERE usage_type = ' 42 .
$ilDB->quote($a_type,
"text") .
" AND usage_id= " 43 .
$ilDB->quote($a_id,
"integer") .
" AND usage_lang= " 44 .
$ilDB->quote($a_usage_lang,
"text") . $and_hist
46 while ($row =
$ilDB->fetchAssoc($set)) {
47 $file_ids[] = $row[
"id"];
51 "DELETE FROM file_usage WHERE usage_type = " 52 .
$ilDB->quote($a_type,
"text") .
" AND usage_id = " 53 .
$ilDB->quote((
int) $a_id,
"integer") .
" AND usage_lang= " 54 .
$ilDB->quote($a_usage_lang,
"text") .
" AND usage_hist_nr = " 55 .
$ilDB->quote($a_usage_hist_nr,
"integer")
65 public static function _saveUsage(
69 int $a_usage_hist_nr = 0,
70 string $a_usage_lang =
"-" 83 "id" => [
"integer", (
int) $a_file_id],
84 "usage_type" => [
"text", (
string) $a_type],
85 "usage_id" => [
"integer", (
int) $a_id],
86 "usage_hist_nr" => [
"integer", $a_usage_hist_nr],
87 "usage_lang" => [
"text", $a_usage_lang]
97 public function getUsages(): array
100 $ilDB = $DIC[
'ilDB'];
103 $q =
"SELECT * FROM file_usage WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
106 while ($us_rec =
$ilDB->fetchAssoc($us_set)) {
108 "type" => $us_rec[
"usage_type"],
109 "id" => $us_rec[
"usage_id"],
110 "lang" => $us_rec[
"usage_lang"],
111 "hist_nr" => $us_rec[
"usage_hist_nr"]
121 public static function _getFilesOfObject(
124 int $a_usage_hist_nr = 0,
125 string $a_usage_lang =
"-" 128 $ilDB = $DIC[
'ilDB'];
131 if ($a_usage_lang !==
"") {
132 $lstr =
"usage_lang = " .
$ilDB->quote($a_usage_lang,
"text") .
" AND ";
136 $q =
'SELECT * FROM file_usage WHERE usage_id = ' .
$ilDB->quote($a_id,
"integer")
137 .
" AND " .
"usage_type = " .
$ilDB->quote($a_type,
"text") .
" AND " . $lstr
138 .
"usage_hist_nr = " .
$ilDB->quote($a_usage_hist_nr,
"integer");
141 while ($file_rec =
$ilDB->fetchAssoc($file_set)) {
142 $ret[$file_rec[
"id"]] = $file_rec[
"id"];
static _lookupType(int $id, bool $reference=false)