ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPageContentUsage Class Reference

Saves usages of page content elements in pages. More...

+ Collaboration diagram for ilPageContentUsage:

Static Public Member Functions

static saveUsage ($a_pc_type, $a_pc_id, $a_usage_type, $a_usage_id, $a_usage_hist_nr=0, $a_lang="-")
 Save usages. More...
 
static deleteAllUsages ($a_pc_type, $a_usage_type, $a_usage_id, $a_usage_hist_nr=0, $a_lang="-")
 Delete all usages. More...
 
static getUsages ($a_pc_type, $a_pc_id, $a_incl_hist=true)
 Get usages. More...
 
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. More...
 

Detailed Description

Saves usages of page content elements in pages.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilPageContentUsage.php.

Member Function Documentation

◆ deleteAllUsages()

static ilPageContentUsage::deleteAllUsages (   $a_pc_type,
  $a_usage_type,
  $a_usage_id,
  $a_usage_hist_nr = 0,
  $a_lang = "-" 
)
static

Delete all usages.

Definition at line 36 of file class.ilPageContentUsage.php.

References $DIC, and $ilDB.

Referenced by ilPCSkills\beforePageDelete(), ilPCContentInclude\beforePageDelete(), ilPCContentInclude\saveContentIncludeUsage(), and ilPCSkills\saveSkillUsage().

37  {
38  global $DIC;
39 
40  $ilDB = $DIC->database();
41 
42  $and_hist = ($a_usage_hist_nr !== false)
43  ? " AND usage_hist_nr = " . $ilDB->quote((int) $a_usage_hist_nr, "integer")
44  : "";
45 
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") .
50  $and_hist .
51  " AND pc_type = " . $ilDB->quote($a_pc_type, "text"));
52  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ getUsages()

static ilPageContentUsage::getUsages (   $a_pc_type,
  $a_pc_id,
  $a_incl_hist = true 
)
static

Get usages.

Definition at line 57 of file class.ilPageContentUsage.php.

References $DIC, $ilDB, and array.

Referenced by ilObjMediaPoolGUI\confirmRemove().

58  {
59  global $DIC;
60 
61  $ilDB = $DIC->database();
62 
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");
66 
67  if (!$a_incl_hist) {
68  $q.= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
69  }
70 
71  $set = $ilDB->query($q);
72  $usages = array();
73  while ($rec = $ilDB->fetchAssoc($set)) {
74  $usages[] = $rec;
75  }
76  return $usages;
77  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getUsagesOfPage()

static ilPageContentUsage::getUsagesOfPage (   $a_usage_id,
  $a_usage_type,
  $a_hist_nr = 0,
  $a_all_hist_nrs = false,
  $a_lang = "-" 
)
static

Get page content usages for page.

Parameters

Definition at line 85 of file class.ilPageContentUsage.php.

References $DIC, $ilDB, and array.

Referenced by ilCOPageHTMLExport\collectPageElements(), ilPageObjectGUI\downloadFile(), and ilObjContentObject\exportHTMLPages().

86  {
87  global $DIC;
88 
89  $ilDB = $DIC->database();
90 
91  if (!$a_all_hist_nrs) {
92  $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_hist_nr, "integer");
93  }
94 
95  $set = $ilDB->query(
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") .
100  $hist_str
101  );
102 
103  $usages = array();
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"]
108  );
109  }
110 
111  return $usages;
112  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ saveUsage()

static ilPageContentUsage::saveUsage (   $a_pc_type,
  $a_pc_id,
  $a_usage_type,
  $a_usage_id,
  $a_usage_hist_nr = 0,
  $a_lang = "-" 
)
static

Save usages.

Definition at line 17 of file class.ilPageContentUsage.php.

References $DIC, $ilDB, and array.

Referenced by ilPCContentInclude\saveContentIncludeUsage(), and ilPCSkills\saveSkillUsage().

18  {
19  global $DIC;
20 
21  $ilDB = $DIC->database();
22 
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)
30  ), array());
31  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

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