41 $this->tpl =
$DIC[
"tpl"];
42 $this->ctrl =
$DIC->ctrl();
43 $this->tabs =
$DIC->tabs();
45 $this->lng =
$DIC->language();
55 $this->obj = $a_pg_obj;
56 $this->obj->setLMId($this->content_object->getId());
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
75 switch ($next_class) {
80 $showViewInFrameset =
true;
83 $this->ctrl->setReturn($this,
"edit");
86 if (
$_GET[
"totransl"] ==
"") {
88 $ilCtrl->setCmd(
"switchToLanguage");
90 $ilCtrl->setCmdClass(
"illmpagegui");
91 $page_gui =
new ilLMPageGUI($this->obj->getId(), 0,
false,
"-");
95 $page_gui->setEditPreview(
true);
96 $page_gui->activateMetaDataEditor(
97 $this->content_object,
98 $this->obj->getType(),
103 if (
$ilSetting->get(
"block_activated_news")) {
104 $page_gui->setEnabledNews(
106 $this->obj->content_object->getId(),
107 $this->obj->content_object->getType()
112 if ($showViewInFrameset) {
115 $view_frame =
"ilContObj" . $this->content_object->getID();
117 $page_gui->setViewPageLink(
119 "_" .
$_GET[
"ref_id"],
124 $this->content_object->getStyleSheetId(),
127 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
128 $page_gui->getPageObject()->buildDom();
129 $int_links = $page_gui->getPageObject()->getInternalLinks();
131 $page_gui->setLinkXML($link_xml);
133 $page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
134 $page_gui->setFileDownloadLink(
"ilias.php?cmd=downloadFile&ref_id=" .
$_GET[
"ref_id"] .
"&baseClass=ilLMPresentationGUI");
135 $page_gui->setFullscreenLink(
"ilias.php?cmd=fullscreen&ref_id=" .
$_GET[
"ref_id"] .
"&baseClass=ilLMPresentationGUI");
136 $page_gui->setLinkParams(
"ref_id=" . $this->content_object->getRefId());
137 $page_gui->setSourcecodeDownloadScript(
"ilias.php?ref_id=" .
$_GET[
"ref_id"] .
"&baseClass=ilLMPresentationGUI");
138 $page_gui->setPresentationTitle(
141 $this->content_object->getPageHeader(),
142 $this->content_object->isActiveNumbering()
145 $page_gui->setLocator($contObjLocator);
146 $page_gui->setHeader($this->lng->txt(
"page") .
": " . $this->obj->getTitle());
147 $page_gui->setActivationListener($this,
"activatePage");
149 $up_gui =
"ilobjlearningmodulegui";
150 $ilCtrl->setParameterByClass($up_gui,
"active_node", $this->obj->getId());
153 $tpl->setTitle($this->lng->txt(
"page") .
": " . $this->obj->getTitle());
154 if ($this->content_object->getLayoutPerPage()) {
155 $page_gui->setTabHook($this,
"addPageTabs");
157 $ret = $this->ctrl->forwardCommand($page_gui);
164 $ret = $this->$cmd();
176 $this->ctrl->setCmdClass(
"ilLMPageGUI");
177 $this->ctrl->setCmd(
"edit");
187 $this->ctrl->setCmdClass(
"ilLMPageGUI");
188 $this->ctrl->setCmd(
"preview");
199 if (
$_GET[
"obj_id"] != 0) {
201 "ilStructureObjectGUI",
207 $up_gui =
"ilobjlearningmodulegui";
208 $this->ctrl->redirectByClass($up_gui,
"pages");
216 if ($a_layoutframes ==
"") {
217 $a_layoutframes = array();
219 $link_info =
"<IntLinkInfos>";
220 foreach ($a_int_links as $int_link) {
221 $target = $int_link[
"Target"];
222 if (substr($target, 0, 4) ==
"il__") {
225 $type = $int_link[
"Type"];
226 $targetframe = ($int_link[
"TargetFrame"] !=
"")
227 ? $int_link[
"TargetFrame"]
231 $anc = $anc_add =
"";
232 if ($int_link[
"Anchor"] !=
"") {
233 $anc = $int_link[
"Anchor"];
234 $anc_add =
"_" . rawurlencode($int_link[
"Anchor"]);
239 case "StructureObject":
242 if ($lm_id == $cont_obj->getId()) {
244 if (
$type ==
"PageObject") {
245 $this->ctrl->setParameter($this,
"obj_id",
$target_id);
246 $href = $this->ctrl->getLinkTargetByClass(
254 $this->ctrl->setParameterByClass(
"ilstructureobjectgui",
"obj_id",
$target_id);
255 $href = $this->ctrl->getLinkTargetByClass(
256 "ilstructureobjectgui",
263 $href = str_replace(
"&",
"&", $href);
264 $this->ctrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
266 if (
$type ==
"PageObject") {
267 $href =
"goto.php?target=pg_" .
$target_id . $anc_add;
271 $ltarget =
"ilContObj" . $lm_id;
279 $ltarget = $nframe =
"_blank";
280 $href =
"ilias.php?cmdClass=illmpresentationgui&baseClass=ilLMPresentationGUI&" .
281 "obj_type=$type&cmd=glossary&ref_id=" .
$_GET[
"ref_id"] .
282 "&obj_id=" .
$target_id .
"&frame=$nframe";
286 $ltarget = $nframe =
"_blank";
287 $href =
"ilias.php?cmdClass=illmpresentationgui&baseClass=ilLMPresentationGUI&obj_type=$type&cmd=media&ref_id=" .
$_GET[
"ref_id"] .
288 "&mob_id=" .
$target_id .
"&frame=$nframe";
291 case "RepositoryItem":
294 $href =
"./goto.php?target=" . $obj_type .
"_" .
$target_id;
300 $this->ctrl->setParameter($this,
"file_id",
"il__file_" .
$target_id);
301 $href = $this->ctrl->getLinkTarget(
308 $this->ctrl->setParameter($this,
"file_id",
"");
313 if ($obj_type ==
"usr") {
314 $back = $this->ctrl->getLinkTarget(
322 $this->ctrl->setParameterByClass(
"ilpublicuserprofilegui",
"user_id",
$target_id);
323 $this->ctrl->setParameterByClass(
324 "ilpublicuserprofilegui",
330 $href = $this->ctrl->getLinkTargetByClass(
331 "ilpublicuserprofilegui",
338 $this->ctrl->setParameterByClass(
"ilpublicuserprofilegui",
"user_id",
"");
346 $anc_par =
'Anchor="' . $anc .
'"';
347 $link_info .=
"<IntLinkInfo Target=\"$target\" Type=\"$type\" " .
348 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" $anc_par/>";
352 $link_info .=
"</IntLinkInfos>";
366 $this->content_object->getType() .
":pg",
377 public static function _goto($a_target)
381 $rbacsystem =
$DIC->rbac()->system();
384 $ilAccess =
$DIC->access();
386 $first = strpos($a_target,
"_");
387 $second = strpos($a_target,
"_", $first + 1);
388 $page_id = substr($a_target, 0, $first);
390 $page_id = substr($a_target, 0, $first);
392 $ref_id = substr($a_target, $first + 1, $second - ($first + 1));
393 $anchor = substr($a_target, $second + 1);
395 $ref_id = substr($a_target, $first + 1);
398 $page_id = $a_target;
408 if (in_array($ref_id, $ref_ids)) {
409 $ref_ids = array_merge(array($ref_id), $ref_ids);
413 foreach ($ref_ids as $ref_id) {
415 if ($ilAccess->checkAccess(
"read",
"", $ref_id)) {
418 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
419 $_GET[
"obj_id"] = $page_id;
420 $_GET[
"ref_id"] = $ref_id;
421 $_GET[
"anchor"] = $anchor;
422 include_once(
"ilias.php");
427 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
430 $lng->txt(
"msg_no_perm_read_item"),
434 $lng->loadLanguageModule(
"content");
453 $page_gui->setEditPreview(
true);
454 $page_gui->activateMetaDataEditor(
455 $this->content_object,
456 $this->obj->getType(),
461 $page_gui->setActivationListener($this,
"activatePage");
462 $page_gui->setTabHook($this,
"addPageTabs");
465 $tpl->setTitle($this->lng->txt(
"page") .
": " . $this->obj->getTitle());
467 $ilTabs->setTabActive(
"cont_layout");
469 $tpl->setContent($this->form->getHTML());
487 if (is_file($im =
ilUtil::getImagePath(
"layout_" . $this->content_object->getLayout() .
".png"))) {
488 $im_tag =
ilUtil::img($im, $this->content_object->getLayout());
490 $layout->addOption(
new ilRadioOption(
"<table><tr><td>" . $im_tag .
"</td><td><b>" .
491 $lng->txt(
"cont_lm_default_layout") .
492 "</b>: " .
$lng->txt(
"cont_layout_" . $this->content_object->getLayout()) .
493 "</td></tr></table>",
""));
500 $layout->addOption(
new ilRadioOption(
"<table><tr><td>" . $im_tag .
"</td><td><b>" .
501 $lng->txt(
"cont_layout_" . $l) .
"</b>: " .
$lng->txt(
"cont_layout_" . $l .
"_desc") .
502 "</td></tr></table>", $l));
505 $layout->setValue($this->obj->getLayout());
506 $this->form->addItem($layout);
508 $this->form->addCommandButton(
"saveLayout",
$lng->txt(
"save"));
510 $this->form->setTitle(
$lng->txt(
"cont_page_layout"));
511 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
525 if ($this->form->checkInput()) {
527 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
528 $ilCtrl->redirect($this,
"editLayout");
530 $this->form->setValuesByPost();
531 $tpl->setContent($this->form->getHtml());
544 $ilCtrl->getLinkTarget($this,
'editLayout'),
554 $pg_obj = $this->obj->getPageObject();
556 $int_links = $pg_obj->getInternalLinks();
557 foreach ($int_links as $il) {
558 if ($il[
"Target"] == str_replace(
"_file_",
"_dfile_",
$_GET[
"file_id"])) {
559 $file = explode(
"_",
$_GET[
"file_id"]);
560 $file_id = (int) $file[count($file) - 1];
561 $fileObj =
new ilObjFile($file_id,
false);
562 $fileObj->sendFile();
578 $tabs->setBackTarget(
$lng->txt(
"back"),
$ctrl->getLinkTarget($this,
"cancel"));
580 $ctrl->setParameter($this,
"new_type",
"pg");
583 $this->tpl->setContent(
$ui->renderer()->render($form) . self::getLayoutCssFix());
597 $fields[
"title"] =
$f->input()->field()->text(
$lng->txt(
"title"),
"");
599 $fields[
"description"] =
$f->input()->field()->textarea(
$lng->txt(
"description"));
603 $fields[
"layout_id"] = $ts;
607 $section1 =
$f->input()->field()->section($fields,
$lng->txt(
"cont_insert_pagelayout"));
609 $form_action =
$ctrl->getLinkTarget($this,
"save");
610 return $f->input()->container()->form()->standard($form_action, [
"sec" => $section1]);
620 $request =
$DIC->http()->request();
624 if ($request->getMethod() ==
"POST") {
625 $form = $form->withRequest($request);
626 $data = $form->getData()[
"sec"];
628 $layout_id = (int)
$data[
"layout_id"];
631 $this->obj->setType(
"pg");
634 $this->obj->setLMId($this->content_object->getId());
635 if ($layout_id > 0) {
636 $this->obj->create(
false,
false, $layout_id);
638 $this->obj->create();
640 ilUtil::sendSuccess(
$lng->txt(
"cont_page_created"),
true);
654 .form-control.il-input-radiooption > label {
655 vertical-align: middle;
657 .form-control.il-input-radiooption > .help-block {
An exception for terminatinating execution or to throw for unit testing.
static _createEntry( $a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.
Extension of ilPageObjectGUI for learning modules.
__construct(&$a_content_obj)
Constructor.
editLayout()
Edit layout of page.
initEditLayoutForm()
Init edit layout form.
setLMPageObject($a_pg_obj)
Set content object dependent page object (co page)
downloadFile()
download file of file lists
executeCommand()
execute command
static getLayoutCssFix()
Get layout css fix (workaround for broken radio options)
addPageTabs()
Add page tabs.
create()
structure / page object creation form
initNewPageForm()
Init insert template form.
static _goto($a_target)
redirect script
getLinkXML($a_int_links)
get link targets
updateHistory()
update history
static _getPresentationTitle( $a_pg_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static getAvailableLayouts()
get all available lm layouts
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
This class represents an option in a radio group.
static hasPublicProfile($a_user_id)
Has public profile.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc