19 declare(strict_types=1);
28 protected \ilDBInterface
$db;
35 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
36 $this->db = $DIC->database();
51 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem" .
52 " | //Table | //TableData | //Tabs | //List";
54 $nodes = $this->dom_util->path($a_domdoc,
$path);
55 foreach ($nodes as $node) {
56 switch ($node->localName) {
58 $sname = $node->getAttribute(
"Characteristic");
59 $stype =
"text_block";
64 $sname = $node->getAttribute(
"Characteristic");
70 $sname = $node->getAttribute(
"Class");
71 $stype =
"media_cont";
76 $sname = $node->getAttribute(
"Class");
82 $sname = $node->getAttribute(
"Template");
84 $sname = $node->getAttribute(
"Class");
94 $sname = $node->getAttribute(
"Class");
95 $stype =
"table_cell";
100 $sname = $node->getAttribute(
"Template");
102 if ($node->getAttribute(
"Type") ==
"HorizontalAccordion") {
103 $stype =
"haccordion";
105 if ($node->getAttribute(
"Type") ==
"VerticalAccordion") {
106 $stype =
"vaccordion";
113 $sname = $node->getAttribute(
"Class");
114 if ($node->getAttribute(
"Type") ==
"Ordered") {
122 if ($sname !=
"" && $stype !=
"") {
123 $usages[$sname .
":" . $stype .
":" . $template] = array(
"sname" => $sname,
125 "template" => $template
132 foreach ($usages as $u) {
133 $id = $this->db->nextId(
'page_style_usage');
134 $this->db->manipulate(
"INSERT INTO page_style_usage " .
135 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" .
136 $this->db->quote(
$id,
"integer") .
"," .
137 $this->db->quote($page->
getId(),
"integer") .
"," .
139 $this->db->quote($page->
getLanguage(),
"text") .
"," .
140 $this->db->quote($a_old_nr,
"integer") .
"," .
141 $this->db->quote($u[
"template"],
"integer") .
"," .
142 $this->db->quote($u[
"stype"],
"text") .
"," .
143 $this->db->quote(\
ilStr::subStr($u[
"sname"], 0, 30),
"text") .
156 if ($a_old_nr !== 0) {
157 $and_old_nr =
" AND page_nr = " . $this->db->quote($a_old_nr,
"integer");
160 $this->db->manipulate(
161 "DELETE FROM page_style_usage WHERE " .
162 " page_id = " . $this->db->quote($page->
getId(),
"integer") .
163 " AND page_type = " . $this->db->quote($page->
getParentType(),
"text") .
164 " AND page_lang = " . $this->db->quote($page->
getLanguage(),
"text") .
ILIAS COPage Dom DomUtil $dom_util
deleteStyleUsages(\ilPageObject $page, int $a_old_nr=0)
Delete style usages.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
saveStyleUsage(\ilPageObject $page, \DOMDocument $a_domdoc, int $a_old_nr=0)
Save all style class/template usages.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins