26 public const SEQ_TEMPLATE_DIR =
'./components/ILIAS/Scorm2004/templates/editor/page_layouts_temp/thumbnails';
47 $this->db = $DIC->database();
48 $ilDB = $DIC->database();
52 $this->layout_id =
$ilDB->nextId(
"page_layout");
53 $ilDB->insert(
"page_layout", array(
54 "layout_id" => array(
"integer", $this->layout_id),
55 "active" => array(
"integer", 0),
56 "title" => array(
"text",
""),
57 "content" => array(
"clob",
""),
58 "description" => array(
"text",
"")
66 $this->active =
false;
68 $this->layout_id = $a_id;
70 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
85 $this->description = $a_description;
93 public function setTitle(
string $a_title): void
95 $this->title = $a_title;
120 $this->modules = array_intersect($a_values,
$valid);
122 $this->modules = array();
135 bool $a_setting =
true 139 $query =
"UPDATE page_layout SET active=" .
$ilDB->quote($a_setting,
"integer") .
140 " WHERE layout_id =" .
$ilDB->quote($this->layout_id,
"integer");
141 $result =
$ilDB->manipulate($query);
147 public function delete():
void 151 $query =
"DELETE FROM page_layout WHERE layout_id =" .
$ilDB->quote($this->layout_id,
"integer");
152 $result =
$ilDB->manipulate($query);
162 $mod_scorm = $mod_portfolio = $mod_lm = 0;
163 if (in_array(self::MODULE_SCORM, $this->modules)) {
166 if (in_array(self::MODULE_PORTFOLIO, $this->modules)) {
169 if (in_array(self::MODULE_LM, $this->modules)) {
173 $query =
"UPDATE page_layout SET title=" .
$ilDB->quote($this->title,
"text") .
174 ",description =" .
$ilDB->quote($this->description,
"text") .
175 ",active =" .
$ilDB->quote($this->active,
"integer") .
176 ",mod_scorm =" .
$ilDB->quote($mod_scorm,
"integer") .
177 ",mod_portfolio =" .
$ilDB->quote($mod_portfolio,
"integer") .
178 ",mod_lm =" .
$ilDB->quote($mod_lm,
"integer") .
179 " WHERE layout_id =" .
$ilDB->quote($this->layout_id,
"integer");
181 $result =
$ilDB->manipulate($query);
187 $query =
"SELECT * FROM page_layout WHERE layout_id =" .
$ilDB->quote($this->layout_id,
"integer");
188 $result =
$ilDB->query($query);
189 $row =
$ilDB->fetchAssoc($result);
190 $this->title = (string) $row[
'title'];
191 $this->description = (string) $row[
'description'];
192 $this->active = (bool) $row[
'active'];
195 if ($row[
"mod_scorm"]) {
196 $mods[] = self::MODULE_SCORM;
198 if ($row[
"mod_portfolio"]) {
199 $mods[] = self::MODULE_PORTFOLIO;
201 if ($row[
"mod_lm"]) {
202 $mods[] = self::MODULE_LM;
209 $this->xml_content = $content;
214 if (!is_null($this->xml_content)) {
218 return $layout_page->getXMLContent();
224 return $layout_page->copyXmlContent(
true, 0, 0, $self_ass);
234 if (is_file(
"./components/ILIAS/COPage/Layout/xml/layout2html.xsl")) {
235 return "./components/ILIAS/COPage/Layout/xml/layout2html.xsl";
237 return "../components/ILIAS/COPage/Layout/xml/layout2html.xsl";
243 $dom = $this->dom_util->docFromString($this->
getXMLContent(), $error);
244 $path =
"////PlaceHolder";
245 $nodes = $this->dom_util->path($dom,
$path);
246 foreach ($nodes as $node) {
247 $height = $node->getAttribute(
"Height");
249 $height = str_ireplace(
"px",
"", $height);
250 $height = $height / 10;
251 $node->setAttribute(
"Height", $height .
"px");
254 $xml = $this->dom_util->dump($dom->documentElement);
255 $output = $this->
xslt($xml, []);
263 $xslt = new \XSLTProcessor();
264 $xsl = file_get_contents($this->
getXSLPath());
265 $xslt_domdoc = new \DomDocument();
266 $xslt_domdoc->loadXML($xsl);
267 $xslt->importStylesheet($xslt_domdoc);
268 foreach ($params as $key => $value) {
269 $xslt->setParameter(
"", $key, (
string) $value);
271 $xml_domdoc = new \DomDocument();
272 $xml_domdoc->loadXML($xml);
274 $result = $xslt->transformToXml($xml_domdoc);
285 $ilDB = $DIC->database();
286 $arr_layouts = array();
288 if ($a_active != 0) {
289 $add =
"WHERE (active=1)";
291 $query =
"SELECT * FROM page_layout $add ORDER BY title ";
292 $result =
$ilDB->query($query);
295 $arr_layouts[] = $row;
302 bool $a_active =
false,
307 $ilDB = $DIC->database();
308 $arr_layouts = array();
312 $add .= $conc .
" (active = 1)";
316 case self::MODULE_SCORM:
317 $add .= $conc .
" mod_scorm = 1";
320 case self::MODULE_PORTFOLIO:
321 $add .= $conc .
" mod_portfolio = 1";
324 case self::MODULE_LM:
325 $add .= $conc .
" mod_lm = 1";
328 $query =
"SELECT layout_id FROM page_layout $add ORDER BY title ";
329 $result =
$ilDB->query($query);
343 return self::getLayouts(
true, $a_module);
349 public static function import(
358 "components/ILIAS/COPage" 366 $lng = $DIC->language();
369 self::MODULE_PORTFOLIO =>
$lng->txt(
"style_page_layout_module_portfolio"),
370 self::MODULE_LM =>
$lng->txt(
"style_page_layout_module_learning_module")
setDescription(string $a_description)
ILIAS COPage Dom DomUtil $dom_util
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
setTitle(string $a_title)
setModules(array $a_values=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
copyXmlContent(bool $self_ass=true)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getLayoutsAsArray(int $a_active=0)
static activeLayouts(int $a_module=0)
Get active layouts.
activate(bool $a_setting=true)
(De-)Activate layout
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static getAvailableModules()
setXMLContent(string $content)
static getLayouts(bool $a_active=false, int $a_module=0)
xslt(string $xml, array $params)
update()
Update page layout.