ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPageContentUsage Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilPageContentUsage:

Static Public Member Functions

static saveUsage (string $a_pc_type, int $a_pc_id, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")
 
static deleteAllUsages (string $a_pc_type, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")
 
static getUsages (string $a_pc_type, int $a_pc_id, bool $a_incl_hist=true)
 Get usages. More...
 
static getUsagesOfPage (int $a_usage_id, string $a_usage_type, int $a_hist_nr=0, bool $a_all_hist_nrs=false, string $a_lang="-")
 Get page content usages for page. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Saves usages of page content elements in pages

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

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

Member Function Documentation

◆ deleteAllUsages()

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

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

References $DIC, and $ilDB.

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

53  : void {
54  global $DIC;
55 
56  $ilDB = $DIC->database();
57 
58  $and_hist = ($a_usage_hist_nr !== 0)
59  ? " AND usage_hist_nr = " . $ilDB->quote($a_usage_hist_nr, "integer")
60  : "";
61 
62  $ilDB->manipulate($q = "DELETE FROM page_pc_usage WHERE usage_type = " .
63  $ilDB->quote($a_usage_type, "text") .
64  " AND usage_id = " . $ilDB->quote($a_usage_id, "integer") .
65  " AND usage_lang = " . $ilDB->quote($a_lang, "text") .
66  $and_hist .
67  " AND pc_type = " . $ilDB->quote($a_pc_type, "text"));
68  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getUsages()

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

Get usages.

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

References $DIC, and $ilDB.

Referenced by ilObjMediaPoolGUI\confirmRemove().

77  : array {
78  global $DIC;
79 
80  $ilDB = $DIC->database();
81 
82  $q = "SELECT * FROM page_pc_usage " .
83  " WHERE pc_type = " . $ilDB->quote($a_pc_type, "text") .
84  " AND pc_id = " . $ilDB->quote($a_pc_id, "integer");
85 
86  if (!$a_incl_hist) {
87  $q .= " AND usage_hist_nr = " . $ilDB->quote(0, "integer");
88  }
89 
90  $set = $ilDB->query($q);
91  $usages = array();
92  while ($rec = $ilDB->fetchAssoc($set)) {
93  $usages[] = $rec;
94  }
95  return $usages;
96  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getUsagesOfPage()

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

Get page content usages for page.

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

References $DIC, and $ilDB.

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

107  : array {
108  global $DIC;
109 
110  $ilDB = $DIC->database();
111 
112  $hist_str = "";
113  if (!$a_all_hist_nrs) {
114  $hist_str = " AND usage_hist_nr = " . $ilDB->quote($a_hist_nr, "integer");
115  }
116 
117  $set = $ilDB->query(
118  "SELECT pc_type, pc_id FROM page_pc_usage WHERE " .
119  " usage_id = " . $ilDB->quote($a_usage_id, "integer") . " AND " .
120  " usage_lang = " . $ilDB->quote($a_lang, "text") . " AND " .
121  " usage_type = " . $ilDB->quote($a_usage_type, "text") .
122  $hist_str
123  );
124 
125  $usages = array();
126  while ($rec = $ilDB->fetchAssoc($set)) {
127  $usages[$rec["pc_type"] . ":" . $rec["pc_id"]] = array(
128  "type" => $rec["pc_type"],
129  "id" => $rec["pc_id"]
130  );
131  }
132  return $usages;
133  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ saveUsage()

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

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

References $DIC, and $ilDB.

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

32  : void {
33  global $DIC;
34 
35  $ilDB = $DIC->database();
36 
37  $ilDB->replace("page_pc_usage", array(
38  "pc_type" => array("text", $a_pc_type),
39  "pc_id" => array("integer", $a_pc_id),
40  "usage_type" => array("text", $a_usage_type),
41  "usage_id" => array("integer", $a_usage_id),
42  "usage_lang" => array("text", $a_lang),
43  "usage_hist_nr" => array("integer", $a_usage_hist_nr)
44  ), array());
45  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

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