17 public static function _deleteAllUsages($a_type, $a_id, $a_usage_hist_nr = 0, $a_usage_lang =
"-")
22 $and_hist = ($a_usage_hist_nr !==
false) ?
" AND usage_hist_nr = " 23 .
$ilDB->quote($a_usage_hist_nr,
"integer") :
"";
26 $set =
$ilDB->query(
"SELECT id FROM file_usage" .
" WHERE usage_type = " 27 .
$ilDB->quote($a_type,
"text") .
" AND usage_id= " 28 .
$ilDB->quote($a_id,
"integer") .
" AND usage_lang= " 29 .
$ilDB->quote($a_usage_lang,
"text") . $and_hist);
30 while ($row =
$ilDB->fetchAssoc($set)) {
31 $file_ids[] = $row[
"id"];
34 $ilDB->manipulate(
"DELETE FROM file_usage WHERE usage_type = " 35 .
$ilDB->quote($a_type,
"text") .
" AND usage_id = " 36 .
$ilDB->quote((
int) $a_id,
"integer") .
" AND usage_lang= " 37 .
$ilDB->quote($a_usage_lang,
"text") .
" AND usage_hist_nr = " 38 .
$ilDB->quote((
int) $a_usage_hist_nr,
"integer"));
50 public static function _saveUsage($a_file_id, $a_type, $a_id, $a_usage_hist_nr = 0, $a_usage_lang =
"-")
60 $ilDB->replace(
"file_usage", array(
61 "id" => array(
"integer", (
int) $a_file_id),
62 "usage_type" => array(
"text", (
string) $a_type),
63 "usage_id" => array(
"integer", (
int) $a_id),
64 "usage_hist_nr" => array(
"integer", (
int) $a_usage_hist_nr),
65 "usage_lang" => array(
"text", $a_usage_lang),
72 public function getUsages()
78 $q =
"SELECT * FROM file_usage WHERE id = " .
$ilDB->quote($this->getId(),
"integer");
79 $us_set =
$ilDB->query($q);
81 while ($us_rec =
$ilDB->fetchAssoc($us_set)) {
83 "type" => $us_rec[
"usage_type"],
84 "id" => $us_rec[
"usage_id"],
85 "lang" => $us_rec[
"usage_lang"],
86 "hist_nr" => $us_rec[
"usage_hist_nr"],
101 public static function _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr = 0, $a_usage_lang =
"-")
104 $ilDB = $DIC[
'ilDB'];
107 if ($a_usage_lang !=
"") {
108 $lstr =
"usage_lang = " .
$ilDB->quote((
string) $a_usage_lang,
"text") .
" AND ";
112 $q =
"SELECT * FROM file_usage WHERE " .
"usage_id = " .
$ilDB->quote((
int) $a_id,
"integer")
113 .
" AND " .
"usage_type = " .
$ilDB->quote((
string) $a_type,
"text") .
" AND " . $lstr
114 .
"usage_hist_nr = " .
$ilDB->quote((
int) $a_usage_hist_nr,
"integer");
115 $file_set =
$ilDB->query($q);
117 while ($file_rec =
$ilDB->fetchAssoc($file_set)) {
118 $ret[$file_rec[
"id"]] = $file_rec[
"id"];
static _lookupType($a_id, $a_reference=false)
lookup object type