39 $this->tpl = $DIC[
"tpl"];
40 $this->
ctrl = $DIC->ctrl();
41 $this->
tabs = $DIC->tabs();
43 $this->
lng = $DIC->language();
45 $cs = $DIC->contentStyle();
46 $this->content_style_domain = $cs->domain();
54 $this->obj = $a_pg_obj;
55 $this->obj->
setLMId($this->content_object->getId());
64 $next_class = $this->
ctrl->getNextClass($this);
65 $cmd = $this->
ctrl->getCmd();
67 switch ($next_class) {
70 $this->
ctrl->setReturn($this,
"edit");
73 if ($this->requested_totransl ==
"") {
75 $ilCtrl->setParameterByClass(
"illmpagegui",
"totransl", $this->requested_transl);
76 $ilCtrl->redirectByClass(
"illmpagegui",
"switchToLanguage");
78 $page_gui =
new ilLMPageGUI($this->obj->getId(), 0,
false,
"-");
83 $page_gui->activateMetaDataEditor(
84 $this->content_object,
85 $this->obj->getType(),
91 $page_gui->setEnabledNews(
93 $this->obj->content_object->getId(),
94 $this->obj->content_object->getType()
98 $page_gui->setViewPageLink(
99 ILIAS_HTTP_PATH .
"/goto.php?target=pg_" . $this->obj->getId() .
103 $page_gui->setStyleId($this->content_style_domain
104 ->styleForRefId($this->content_object->getRefId())
105 ->getEffectiveStyleId());
106 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
107 $page_gui->getPageObject()->buildDom();
108 $int_links = $page_gui->getPageObject()->getInternalLinks();
110 $page_gui->setLinkXml($link_xml);
112 $page_gui->setFileDownloadLink(
"ilias.php?cmd=downloadFile&ref_id=" . $this->requested_ref_id .
"&baseClass=ilLMPresentationGUI");
113 $page_gui->setFullscreenLink(
"ilias.php?cmd=fullscreen&ref_id=" . $this->requested_ref_id .
"&baseClass=ilLMPresentationGUI");
114 $page_gui->setLinkParams(
"ref_id=" . $this->content_object->getRefId());
115 $page_gui->setSourcecodeDownloadScript(
"ilias.php?ref_id=" . $this->requested_ref_id .
"&baseClass=ilLMPresentationGUI");
116 $page_gui->setPresentationTitle(
119 $this->content_object->getPageHeader(),
120 $this->content_object->isActiveNumbering(),
124 $page_gui->getLanguage()
128 $page_gui->setHeader($this->
lng->txt(
"page") .
": " . $this->obj->getTitle());
129 $page_gui->setActivationListener($this,
"activatePage");
131 $up_gui =
"ilobjlearningmodulegui";
132 $ilCtrl->setParameterByClass($up_gui,
"active_node", $this->obj->getId());
135 $tpl->
setTitle($this->
lng->txt(
"page") .
": " . $this->obj->getTitle());
136 if ($this->content_object->getLayoutPerPage()) {
137 $page_gui->setTabHook($this,
"addPageTabs");
139 $ret = $this->
ctrl->forwardCommand($page_gui);
157 $this->
ctrl->redirectByClass(ilLMPageGUI::class,
"edit");
165 $this->
ctrl->redirectByClass(ilLMPageGUI::class,
"preview");
174 if ($this->requested_obj_id != 0) {
176 "ilStructureObjectGUI",
182 $up_gui =
"ilobjlearningmodulegui";
183 $this->
ctrl->redirectByClass($up_gui,
"pages");
191 $link_info =
"<IntLinkInfos>";
192 foreach ($a_int_links as $int_link) {
193 $target = $int_link[
"Target"];
197 if (substr($target, 0, 4) ==
"il__") {
198 $target_arr = explode(
"_", $target);
199 $target_id = $target_arr[count($target_arr) - 1];
200 $type = $int_link[
"Type"];
201 $targetframe = ($int_link[
"TargetFrame"] !=
"")
202 ? $int_link[
"TargetFrame"]
206 $anc = $anc_add =
"";
207 if (($int_link[
"Anchor"] ??
"") !=
"") {
208 $anc = $int_link[
"Anchor"];
209 $anc_add =
"_" . rawurlencode($int_link[
"Anchor"]);
214 case "StructureObject":
217 if ($lm_id == $cont_obj->getId()) {
219 if ($type ==
"PageObject") {
220 $this->
ctrl->setParameter($this,
"obj_id", $target_id);
221 $href = $this->
ctrl->getLinkTargetByClass(
229 $this->
ctrl->setParameterByClass(
"ilstructureobjectgui",
"obj_id", $target_id);
230 $href = $this->
ctrl->getLinkTargetByClass(
231 "ilstructureobjectgui",
238 $href = str_replace(
"&",
"&", $href);
239 $this->
ctrl->setParameter($this,
"obj_id", $this->requested_obj_id);
241 if ($type ==
"PageObject") {
242 $href =
"goto.php?target=pg_" . $target_id . $anc_add;
244 $href =
"goto.php?target=st_" . $target_id;
246 $ltarget =
"ilContObj" . $lm_id;
254 $ltarget = $nframe =
"_blank";
255 $href =
"ilias.php?cmdClass=illmpresentationgui&baseClass=ilLMPresentationGUI&" .
256 "obj_type=$type&cmd=glossary&ref_id=" . $this->requested_ref_id .
257 "&obj_id=" . $target_id .
"&frame=$nframe";
261 $ltarget = $nframe =
"_blank";
262 $href =
"ilias.php?cmdClass=illmpresentationgui&baseClass=ilLMPresentationGUI&obj_type=$type&cmd=media&ref_id=" . $this->requested_ref_id .
263 "&mob_id=" . $target_id .
"&frame=$nframe";
266 case "RepositoryItem":
269 $href =
"./goto.php?target=" . $obj_type .
"_" . $target_id;
275 $this->
ctrl->setParameter($this,
"file_id",
"il__file_" . $target_id);
276 $href = $this->
ctrl->getLinkTarget(
283 $this->
ctrl->setParameter($this,
"file_id",
null);
292 if ($obj_type ==
"usr") {
293 $back = $this->
ctrl->getLinkTarget(
301 $this->
ctrl->setParameterByClass(
"ilpublicuserprofilegui",
"user_id", $target_id);
302 $this->
ctrl->setParameterByClass(
303 "ilpublicuserprofilegui",
309 $href = $this->
ctrl->getLinkTargetByClass(
310 "ilpublicuserprofilegui",
317 $this->
ctrl->setParameterByClass(
"ilpublicuserprofilegui",
"user_id",
null);
324 $anc_par =
'Anchor="' . $anc .
'"';
325 $link_info .=
"<IntLinkInfo Target=\"$target\" Type=\"$type\" " .
326 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" $anc_par/>";
330 $link_info .=
"</IntLinkInfos>";
337 public static function _goto(
string $a_target): void
340 $main_tpl = $DIC->ui()->mainTemplate();
343 $lng = $DIC->language();
344 $ilAccess = $DIC->access();
345 $ctrl = $DIC->ctrl();
349 $first = strpos($a_target,
"_");
350 $second = strpos($a_target,
"_", $first + 1);
352 $page_id = substr($a_target, 0, $first);
354 $ref_id = substr($a_target, $first + 1, $second - ($first + 1));
355 $anchor = substr($a_target, $second + 1);
357 $ref_id = substr($a_target, $first + 1);
360 $page_id = $a_target;
370 if (in_array(
$ref_id, $ref_ids)) {
371 $ref_ids = array_merge(array(
$ref_id), $ref_ids);
375 foreach ($ref_ids as
$ref_id) {
377 if ($ilAccess->checkAccess(
"read",
"", $ref_id)) {
387 $main_tpl->setOnScreenMessage(
'failure', sprintf(
388 $lng->
txt(
"msg_no_perm_read_item"),
393 $main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"page_does_not_exist"),
true);
412 $page_gui->activateMetaDataEditor(
413 $this->content_object,
414 $this->obj->getType(),
419 $page_gui->setActivationListener($this,
"activatePage");
420 $page_gui->setTabHook($this,
"addPageTabs");
423 $tpl->
setTitle($this->
lng->txt(
"page") .
": " . $this->obj->getTitle());
424 $ilCtrl->getHTML($page_gui);
425 $ilTabs->setTabActive(
"cont_layout");
441 if (is_file($im =
ilUtil::getImagePath(
"layout_" . $this->content_object->getLayout() .
".png"))) {
442 $im_tag =
ilUtil::img($im, $this->content_object->getLayout());
444 $layout->addOption(
new ilRadioOption(
"<table><tr><td>" . $im_tag .
"</td><td><strong>" .
445 $lng->
txt(
"cont_lm_default_layout") .
446 "</strong>: " .
$lng->
txt(
"cont_layout_" . $this->content_object->getLayout()) .
447 "</td></tr></table>",
""));
454 $layout->addOption(
new ilRadioOption(
"<table><tr><td>" . $im_tag .
"</td><td><strong>" .
455 $lng->
txt(
"cont_layout_" . $l) .
"</strong>: " .
$lng->
txt(
"cont_layout_" . $l .
"_desc") .
456 "</td></tr></table>", $l));
459 $layout->setValue($this->obj->getLayout());
460 $this->
form->addItem($layout);
462 $this->
form->addCommandButton(
"saveLayout",
$lng->
txt(
"save"));
464 $this->
form->setTitle(
$lng->
txt(
"cont_page_layout"));
465 $this->
form->setFormAction($ilCtrl->getFormAction($this));
475 if ($this->
form->checkInput()) {
477 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
478 $ilCtrl->redirect($this,
"editLayout");
480 $this->
form->setValuesByPost();
491 $ilCtrl->getLinkTarget($this,
'editLayout'),
501 $pg_obj = $this->obj->getPageObject();
503 $int_links = $pg_obj->getInternalLinks();
504 foreach ($int_links as $il) {
505 if ($il[
"Target"] == str_replace(
508 $this->request->getFileId()
510 $file = explode(
"_", $this->request->getFileId());
511 $file_id = (
int) $file[count($file) - 1];
512 $fileObj =
new ilObjFile($file_id,
false);
513 $fileObj->sendFile();
531 $this->tpl->setContent(
$ui->renderer()->render($form) . self::getLayoutCssFix());
541 $fields[
"title"] =
$f->input()->field()->text(
$lng->
txt(
"title"),
"");
543 $fields[
"description"] =
$f->input()->field()->textarea(
$lng->
txt(
"description"));
547 $fields[
"layout_id"] = $ts;
551 $section1 =
$f->input()->field()->section($fields,
$lng->
txt(
"cont_insert_pagelayout"));
554 return $f->input()->container()->form()->standard($form_action, [
"sec" => $section1]);
568 if (
$request->getMethod() ==
"POST") {
569 $form = $form->withRequest(
$request);
570 $data = $form->getData()[
"sec"];
572 $layout_id = (
int) (
$data[
"layout_id"] ?? 0);
575 $this->obj->setType(
"pg");
578 $this->obj->setLMId($this->content_object->getId());
579 if ($layout_id > 0) {
580 $this->obj->create(
false,
false, $layout_id);
582 $this->obj->create();
584 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"cont_page_created"),
true);
597 .form-control.il-input-radiooption > label { 598 vertical-align: middle; 600 .form-control.il-input-radiooption > .help-block { setEditPreview(bool $a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
EditingGUIRequest $request
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _getAllReferences(int $id)
get all reference ids for object ID
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
static getAvailableLayouts()
get all available lm layouts
setContent(string $a_html)
Sets content for standard template.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
loadLanguageModule(string $a_module)
Load language module.
static getLayoutCssFix()
Get layout css fix (workaround for broken radio options)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)
static _lookupObjId(int $ref_id)
preview()
display content of page (edit view)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(ilObjLearningModule $a_content_obj)
ILIAS Style Content DomainService $content_style_domain
edit()
display content of page (edit view)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
Extension of ilPageObjectGUI for learning modules.
static _goto(string $a_target)
redirect script
editLayout()
Edit layout of page.
setBackTarget(string $a_title, string $a_target, string $a_frame="")
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
static redirect(string $a_script)
ilObjLearningModule $content_object
User Interface for Learning Module Page Objects Editing.
form( $class_path, string $cmd, string $submit_caption="")
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static getGotoForWikiPageTarget(string $a_target, bool $a_offline=false)
__construct(Container $dic, ilPlugin $plugin)
static hasPublicProfile(int $a_user_id)
static _lookupContObjID(int $a_id)
get learning module id for lm object
downloadFile()
download file of file lists
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
static _lookupType(int $id, bool $reference=false)
getLinkXML(array $a_int_links)
get link targets
setLMPageObject(ilLMPageObject $a_pg_obj)
Set content object dependent page object (co page)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.