17 public static function saveUsage($a_pc_type, $a_pc_id, $a_usage_type, $a_usage_id, $a_usage_hist_nr = 0, $a_lang =
"-")
21 $ilDB = $DIC->database();
23 $ilDB->replace(
"page_pc_usage", array(
24 "pc_type" => array(
"text", $a_pc_type),
25 "pc_id" => array(
"integer", (
int) $a_pc_id),
26 "usage_type" => array(
"text", $a_usage_type),
27 "usage_id" => array(
"integer", (
int) $a_usage_id),
28 "usage_lang" => array(
"text", $a_lang),
29 "usage_hist_nr" => array(
"integer", (
int) $a_usage_hist_nr)
36 public static function deleteAllUsages($a_pc_type, $a_usage_type, $a_usage_id, $a_usage_hist_nr = 0, $a_lang =
"-")
40 $ilDB = $DIC->database();
42 $and_hist = ($a_usage_hist_nr !==
false)
43 ?
" AND usage_hist_nr = " .
$ilDB->quote((
int) $a_usage_hist_nr,
"integer")
46 $ilDB->manipulate($q =
"DELETE FROM page_pc_usage WHERE usage_type = " .
47 $ilDB->quote($a_usage_type,
"text") .
48 " AND usage_id = " .
$ilDB->quote((
int) $a_usage_id,
"integer") .
49 " AND usage_lang = " .
$ilDB->quote($a_lang,
"text") .
51 " AND pc_type = " .
$ilDB->quote($a_pc_type,
"text"));
57 public static function getUsages($a_pc_type, $a_pc_id, $a_incl_hist =
true)
61 $ilDB = $DIC->database();
63 $q =
"SELECT * FROM page_pc_usage " .
64 " WHERE pc_type = " .
$ilDB->quote($a_pc_type,
"text") .
65 " AND pc_id = " .
$ilDB->quote($a_pc_id,
"integer");
68 $q .=
" AND usage_hist_nr = " .
$ilDB->quote(0,
"integer");
71 $set =
$ilDB->query($q);
73 while ($rec =
$ilDB->fetchAssoc($set)) {
85 public static function getUsagesOfPage($a_usage_id, $a_usage_type, $a_hist_nr = 0, $a_all_hist_nrs =
false, $a_lang =
"-")
89 $ilDB = $DIC->database();
91 if (!$a_all_hist_nrs) {
92 $hist_str =
" AND usage_hist_nr = " .
$ilDB->quote($a_hist_nr,
"integer");
96 "SELECT pc_type, pc_id FROM page_pc_usage WHERE " .
97 " usage_id = " .
$ilDB->quote($a_usage_id,
"integer") .
" AND " .
98 " usage_lang = " .
$ilDB->quote($a_lang,
"text") .
" AND " .
99 " usage_type = " .
$ilDB->quote($a_usage_type,
"text") .
104 while ($rec =
$ilDB->fetchAssoc($set)) {
105 $usages[$rec[
"pc_type"] .
":" . $rec[
"pc_id"]] = array(
106 "type" => $rec[
"pc_type"],
107 "id" => $rec[
"pc_id"]
static getUsagesOfPage($a_usage_id, $a_usage_type, $a_hist_nr=0, $a_all_hist_nrs=false, $a_lang="-")
Get page content usages for page.
static getUsages($a_pc_type, $a_pc_id, $a_incl_hist=true)
Get usages.
static deleteAllUsages($a_pc_type, $a_usage_type, $a_usage_id, $a_usage_hist_nr=0, $a_lang="-")
Delete all usages.
static saveUsage($a_pc_type, $a_pc_id, $a_usage_type, $a_usage_id, $a_usage_hist_nr=0, $a_lang="-")
Save usages.
Saves usages of page content elements in pages.