ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLMPageObjectGUI Class Reference

Class ilLMPageObjectGUI. More...

+ Inheritance diagram for ilLMPageObjectGUI:
+ Collaboration diagram for ilLMPageObjectGUI:

Public Member Functions

 ilLMPageObjectGUI (&$a_content_obj)
 Constructor.
 setLMPageObject ($a_pg_obj)
 Set content object dependent page object (co page)
executeCommand ()
 execute command
 edit ()
 preview ()
 save ()
 save co page object
 cancel ()
 cancel
 getLinkXML ($a_int_links)
 get link targets
 updateHistory ()
 update history
 _goto ($a_target)
 redirect script
 editLayout ()
 Edit layout of page.
 initEditLayoutForm ()
 Init edit layout form.
 saveLayout ()
 Save layout.
 addPageTabs ()
 Add page tabs.
- Public Member Functions inherited from ilLMObjectGUI
 ilLMObjectGUI (&$a_content_obj)
 constructor
 setActions ($a_actions="")
 build action array
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 create ()
 structure / page object creation form
 putInTree ()
 put this object into content object tree
 delete ()
 Confirm deletion screen (delete page or structure objects)
 cancelDelete ()
 cancel deletion of page/structure objects
 confirmedDelete ()
 page and structure object deletion
 add_cell ($val, $link="")
 output a cell in object list
 showActions ($a_actions)
 show possible action (form buttons)
 checkTree ()
 check the content object tree

Data Fields

 $obj
- Data Fields inherited from ilLMObjectGUI
 $ilias
 $tpl
 $lng
 $obj
 $ctrl
 $content_object
 $actions

Detailed Description

Class ilLMPageObjectGUI.

User Interface for Learning Module Page Objects Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilLMPageObjectGUI.php 45642 2013-10-18 13:41:09Z akill

ilLMPageObjectGUI: ilLMPageGUI, ilAssGenFeedbackPageGUI

Definition at line 21 of file class.ilLMPageObjectGUI.php.

Member Function Documentation

ilLMPageObjectGUI::_goto (   $a_target)

redirect script

Parameters
string$a_target

Definition at line 341 of file class.ilLMPageObjectGUI.php.

References $_GET, $ilErr, ilLMObjectGUI\$lng, $ref_id, ilObject\_getAllReferences(), ilObjectGUI\_gotoRepositoryRoot(), ilLMObject\_lookupContObjID(), ilObject\_lookupTitle(), exit, and ilUtil\sendFailure().

{
global $rbacsystem, $ilErr, $lng, $ilAccess;
$first = strpos($a_target, "_");
$second = strpos($a_target, "_", $first + 1);
$page_id = substr($a_target, 0, $first);
if ($first > 0)
{
$page_id = substr($a_target, 0, $first);
if ($second > 0)
{
$ref_id = substr($a_target, $first + 1, $second - ($first + 1));
$anchor = substr($a_target, $second + 1);
}
else
{
$ref_id = substr($a_target, $first + 1);
}
}
else
{
$page_id = $a_target;
}
// determine learning object
$lm_id = ilLMObject::_lookupContObjID($page_id);
// get all references
$ref_ids = ilObject::_getAllReferences($lm_id);
// always try passed ref id first
if (in_array($ref_id, $ref_ids))
{
$ref_ids = array_merge(array($ref_id), $ref_ids);
}
// check read permissions
foreach ($ref_ids as $ref_id)
{
// check read permissions
if ($ilAccess->checkAccess("read", "", $ref_id))
{
// don't redirect anymore, just set parameters
// (goto.php includes "ilias.php")
$_GET["baseClass"] = "ilLMPresentationGUI";
$_GET["obj_id"] = $page_id;
$_GET["ref_id"] = $ref_id;
$_GET["anchor"] = $anchor;
include_once("ilias.php");
}
}
if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
{
if ($lm_id > 0)
{
ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
ilObject::_lookupTitle($lm_id)), true);
}
else
{
$lng->loadLanguageModule("content");
ilUtil::sendFailure($lng->txt("page_does_not_exist"), true);
}
include_once("./Services/Object/classes/class.ilObjectGUI.php");
}
$ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::addPageTabs ( )

Add page tabs.

Definition at line 505 of file class.ilLMPageObjectGUI.php.

References $ilCtrl.

{
global $ilTabs, $ilCtrl;
$ilTabs->addTarget("cont_layout",
$ilCtrl->getLinkTarget($this, 'editLayout'), "editLayout");
}
ilLMPageObjectGUI::cancel ( )

cancel

Definition at line 213 of file class.ilLMPageObjectGUI.php.

References $_GET, and ilUtil\redirect().

{
if ($_GET["obj_id"] != 0)
{
ilUtil::redirect($this->ctrl->getLinkTargetByClass("ilStructureObjectGUI",
"view", "", true));
}
$up_gui = ($this->content_object->getType() == "dbk")
? "ilobjdlbookgui"
: "ilobjlearningmodulegui";
$this->ctrl->redirectByClass($up_gui, "pages");
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::edit ( )

Definition at line 159 of file class.ilLMPageObjectGUI.php.

References executeCommand().

{
//echo "<br>umschuss";
$this->ctrl->setCmdClass("ilLMPageGUI");
$this->ctrl->setCmd("edit");
$this->executeCommand();
//$this->setTabs();
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::editLayout ( )

Edit layout of page.

Definition at line 417 of file class.ilLMPageObjectGUI.php.

References $ilCtrl, $obj, ilLMObjectGUI\$tpl, ilUtil\getImagePath(), initEditLayoutForm(), and ilPageObjectGUI\setEditPreview().

{
global $tpl, $ilCtrl, $ilTabs;
$page_gui = new ilLMPageGUI($this->obj->getId());
$page_gui->setEditPreview(true);
$page_gui->activateMetaDataEditor($this->content_object->getID(),
$this->obj->getId(), $this->obj->getType(),
$this->obj, "MDUpdateListener");
$page_gui->setActivationListener($this, "activatePage");
$page_gui->setTabHook($this, "addPageTabs");
$lm_set = new ilSetting("lm");
$tpl->setTitleIcon(ilUtil::getImagePath("icon_pg_b.png"));
$tpl->setTitle($this->lng->txt("page").": ".$this->obj->getTitle());
$ilCtrl->getHTML($page_gui);
$ilTabs->setTabActive("cont_layout");
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

& ilLMPageObjectGUI::executeCommand ( )

execute command

Definition at line 52 of file class.ilLMPageObjectGUI.php.

References $_GET, $cmd, $ilCtrl, $ilSetting, $obj, $ret, ilLMObjectGUI\$tpl, ilPageObject\_exists(), ilFrameTargetInfo\_getFrame(), ilLMPageObject\_getPresentationTitle(), ilObjStyleSheet\getEffectiveContentStyleId(), ilUtil\getImagePath(), getLinkXML(), and ilPageObjectGUI\setEditPreview().

Referenced by edit(), and preview().

{
global $tpl, $ilCtrl, $ilTabs, $ilSetting;
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
//echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":".
// ":nextClass:".$next_class.":"; flush();
switch($next_class)
{
case "illmpagegui":
// Determine whether the view of a learning resource should
// be shown in the frameset of ilias, or in a separate window.
//$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
$showViewInFrameset = true;
$lm_set = new ilSetting("lm");
$this->ctrl->setReturn($this, "edit");
if (!ilPageObject::_exists("lm", $this->obj->getId(), $_GET["transl"]) &&
ilPageObject::_exists("lm", $this->obj->getId(), "-"))
{
if ($_GET["totransl"] == "")
{
$_GET["totransl"] = $_GET["transl"];
$ilCtrl->setCmd("switchToLanguage");
}
$ilCtrl->setCmdClass("illmpagegui");
$page_gui = new ilLMPageGUI($this->obj->getId(), 0, false, "-");
}
else
{
$page_gui = new ilLMPageGUI($this->obj->getId());
}
$page_gui->setEditPreview(true);
$page_gui->activateMetaDataEditor($this->content_object->getID(),
$this->obj->getId(), $this->obj->getType(),
$this->obj, "MDUpdateListener");
if ($ilSetting->get("block_activated_news"))
{
$page_gui->setEnabledNews(true, $this->obj->content_object->getId(),
$this->obj->content_object->getType());
}
// set page view link
if ($showViewInFrameset)
{
$view_frame = ilFrameTargetInfo::_getFrame("MainContent");
}
else
{
$view_frame = "ilContObj".$this->content_object->getID();
}
$page_gui->setViewPageLink(ILIAS_HTTP_PATH."/goto.php?target=pg_".$this->obj->getId().
"_".$_GET["ref_id"],
$view_frame);
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$this->content_object->getStyleSheetId(), "lm"));
$page_gui->setTemplateTargetVar("ADM_CONTENT");
$page_gui->getPageObject()->buildDom();
$int_links = $page_gui->getPageObject()->getInternalLinks();
$link_xml = $this->getLinkXML($int_links);
$page_gui->setLinkXML($link_xml);
$page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
$page_gui->setFileDownloadLink("ilias.php?cmd=downloadFile&ref_id=".$_GET["ref_id"]."&baseClass=ilLMPresentationGUI");
$page_gui->setFullscreenLink("ilias.php?cmd=fullscreen&ref_id=".$_GET["ref_id"]."&baseClass=ilLMPresentationGUI");
$page_gui->setLinkParams("ref_id=".$this->content_object->getRefId());
$page_gui->setSourcecodeDownloadScript("ilias.php?ref_id=".$_GET["ref_id"]."&baseClass=ilLMPresentationGUI");
$page_gui->setPresentationTitle(
$this->content_object->getPageHeader(), $this->content_object->isActiveNumbering()));
$page_gui->setLocator($contObjLocator);
$page_gui->setHeader($this->lng->txt("page").": ".$this->obj->getTitle());
$page_gui->setActivationListener($this, "activatePage");
$up_gui = ($this->content_object->getType() == "dbk")
? "ilobjdlbookgui"
: "ilobjlearningmodulegui";
$ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
$page_gui->setExplorerUpdater("tree", "tree_div",
$ilCtrl->getLinkTargetByClass($up_gui, "explorer", "", true));
$tpl->setTitleIcon(ilUtil::getImagePath("icon_pg_b.png"));
$tpl->setTitle($this->lng->txt("page").": ".$this->obj->getTitle());
if ($this->content_object->getLayoutPerPage())
{
$page_gui->setTabHook($this, "addPageTabs");
}
$ret = $this->ctrl->forwardCommand($page_gui);
$tpl->setContent($ret);
break;
default:
$ret =& $this->$cmd();
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMPageObjectGUI::getLinkXML (   $a_int_links)

get link targets

Definition at line 229 of file class.ilLMPageObjectGUI.php.

References $_GET, ilLMObjectGUI\$content_object, $target_arr, $target_id, ilFrameTargetInfo\_getFrame(), ilLMObject\_lookupContObjID(), ilObject\_lookupObjId(), and ilObject\_lookupType().

Referenced by executeCommand().

{
if ($a_layoutframes == "")
{
$a_layoutframes = array();
}
$link_info = "<IntLinkInfos>";
foreach ($a_int_links as $int_link)
{
$target = $int_link["Target"];
if (substr($target, 0, 4) == "il__")
{
$target_arr = explode("_", $target);
$type = $int_link["Type"];
$targetframe = ($int_link["TargetFrame"] != "")
? $int_link["TargetFrame"]
: "None";
// anchor
$anc = $anc_add = "";
if ($int_link["Anchor"] != "")
{
$anc = $int_link["Anchor"];
$anc_add = "_".rawurlencode($int_link["Anchor"]);
}
switch($type)
{
case "PageObject":
case "StructureObject":
$cont_obj =& $this->content_object;
if ($lm_id == $cont_obj->getId())
{
$ltarget = "";
if ($type == "PageObject")
{
$this->ctrl->setParameter($this, "obj_id", $target_id);
$href = $this->ctrl->getLinkTargetByClass(get_class($this), "edit");
}
else
{
$this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $target_id);
$href = $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view");
}
$href = str_replace("&", "&amp;", $href);
$this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
}
else
{
if ($type == "PageObject")
{
$href = "goto.php?target=pg_".$target_id.$anc_add;
}
else
{
$href = "goto.php?target=st_".$target_id;
}
$ltarget = "ilContObj".$lm_id;
}
break;
case "GlossaryItem":
$ltarget = $nframe = "_blank";
$href = "ilias.php?cmdClass=illmpresentationgui&amp;baseClass=ilLMPresentationGUI&amp;".
"obj_type=$type&amp;cmd=glossary&amp;ref_id=".$_GET["ref_id"].
"&amp;obj_id=".$target_id."&amp;frame=$nframe";
break;
case "MediaObject":
$ltarget = $nframe = "_blank";
$href = "ilias.php?cmdClass=illmpresentationgui&amp;baseClass=ilLMPresentationGUI&amp;obj_type=$type&amp;cmd=media&amp;ref_id=".$_GET["ref_id"].
"&amp;mob_id=".$target_id."&amp;frame=$nframe";
break;
case "RepositoryItem":
$obj_type = ilObject::_lookupType($target_id, true);
$href = "./goto.php?target=".$obj_type."_".$target_id;
$t_frame = ilFrameTargetInfo::_getFrame("MainContent", $obj_type);
$ltarget = $t_frame;
break;
}
$anc_par = 'Anchor="'.$anc.'"';
$link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".
"TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" $anc_par/>";
}
}
$link_info.= "</IntLinkInfos>";
//echo ":".htmlentities($link_info).":";
return $link_info;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMPageObjectGUI::ilLMPageObjectGUI ( $a_content_obj)

Constructor.

Parameters
object$a_content_objcontent object (lm | dbk) public

Definition at line 31 of file class.ilLMPageObjectGUI.php.

References ilLMObjectGUI\$ilias, ilLMObjectGUI\$lng, ilLMObjectGUI\$tpl, and ilLMObjectGUI\ilLMObjectGUI().

{
global $ilias, $tpl, $lng;
parent::ilLMObjectGUI($a_content_obj);
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::initEditLayoutForm ( )

Init edit layout form.

Parameters
int$a_modeEdit Mode

Definition at line 442 of file class.ilLMPageObjectGUI.php.

References $ilCtrl, ilLMObjectGUI\$lng, ilObjContentObject\getAvailableLayouts(), ilUtil\getImagePath(), and ilUtil\img().

Referenced by editLayout(), and saveLayout().

{
global $lng, $ilCtrl;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
// default layout
$layout = new ilRadioGroupInputGUI($lng->txt("cont_layout"), "layout");
if (is_file($im = ilUtil::getImagePath("layout_".$this->content_object->getLayout().".png")))
{
$im_tag = ilUtil::img($im, $this->content_object->getLayout());
}
$layout->addOption(new ilRadioOption("<table><tr><td>".$im_tag."</td><td><b>".
$lng->txt("cont_lm_default_layout").
"</b>: ".$lng->txt("cont_layout_".$this->content_object->getLayout()).
"</td></tr></table>", ""));
{
$im_tag = "";
if (is_file($im = ilUtil::getImagePath("layout_".$l.".png")))
{
$im_tag = ilUtil::img($im, $l);
}
$layout->addOption(new ilRadioOption("<table><tr><td>".$im_tag."</td><td><b>".
$lng->txt("cont_layout_".$l)."</b>: ".$lng->txt("cont_layout_".$l."_desc").
"</td></tr></table>", $l));
}
$layout->setValue($this->obj->getLayout());
$this->form->addItem($layout);
$this->form->addCommandButton("saveLayout", $lng->txt("save"));
$this->form->setTitle($lng->txt("cont_page_layout"));
$this->form->setFormAction($ilCtrl->getFormAction($this));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLMPageObjectGUI::preview ( )

Definition at line 171 of file class.ilLMPageObjectGUI.php.

References executeCommand().

{
$this->ctrl->setCmdClass("ilLMPageGUI");
$this->ctrl->setCmd("preview");
$this->executeCommand();
// $this->setTabs();
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::save ( )

save co page object

Definition at line 182 of file class.ilLMPageObjectGUI.php.

References $_GET, $_POST, ilLMObjectGUI\checkTree(), ilLMObjectGUI\putInTree(), ilUtil\redirect(), and ilUtil\stripSlashes().

{
$this->obj =& new ilLMPageObject($this->content_object);
$this->obj->setType("pg");
$this->obj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
$this->obj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
$this->obj->setLMId($this->content_object->getId());
$this->obj->create();
// obj_id is empty, if page is created from "all pages" screen
// -> a free page is created (not in the tree)
//echo "<br>savePage:".$_GET["obj_id"].":";
if ($_GET["obj_id"] != 0)
{
$this->putInTree();
// check the tree
$this->checkTree();
ilUtil::redirect($this->ctrl->getLinkTargetByClass("ilStructureObjectGUI",
"edit", "", true));
}
$up_gui = ($this->content_object->getType() == "dbk")
? "ilobjdlbookgui"
: "ilobjlearningmodulegui";
$this->ctrl->redirectByClass($up_gui, "pages");
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::saveLayout ( )

Save layout.

Definition at line 487 of file class.ilLMPageObjectGUI.php.

References $ilCtrl, ilLMObjectGUI\$lng, ilLMObjectGUI\$tpl, initEditLayoutForm(), ilUtil\sendSuccess(), and ilLMObject\writeLayout().

{
global $tpl, $lng, $ilCtrl;
if ($this->form->checkInput())
{
ilLMObject::writeLayout($this->obj->getId(), $this->form->getInput("layout"));
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$ilCtrl->redirect($this, "editLayout");
}
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHtml());
}

+ Here is the call graph for this function:

ilLMPageObjectGUI::setLMPageObject (   $a_pg_obj)

Set content object dependent page object (co page)

Definition at line 43 of file class.ilLMPageObjectGUI.php.

{
$this->obj = $a_pg_obj;
$this->obj->setLMId($this->content_object->getId());
}
ilLMPageObjectGUI::updateHistory ( )

update history

Definition at line 328 of file class.ilLMPageObjectGUI.php.

References ilHistory\_createEntry().

{
require_once("./Services/History/classes/class.ilHistory.php");
ilHistory::_createEntry($this->obj->getId(), "update",
"", $this->content_object->getType().":pg",
"", true);
}

+ Here is the call graph for this function:

Field Documentation

ilLMPageObjectGUI::$obj

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

Referenced by editLayout(), and executeCommand().


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