ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLMEditorGUI Class Reference

GUI class for learning module editor. More...

+ Collaboration diagram for ilLMEditorGUI:

Public Member Functions

 __construct ()
 Constructor public. More...
 
 executeCommand ()
 
 showTree ()
 Show tree. More...
 
 main_header ($a_type)
 output main header (title and locator) More...
 
 displayLocator ()
 display locator More...
 

Data Fields

 $tpl
 
 $lng
 
 $objDefinition
 
 $ref_id
 
 $lm_obj
 
 $tree
 
 $obj_id
 

Protected Member Functions

 checkRequestParameters ()
 Check request parameters. More...
 

Protected Attributes

 $ctrl
 
 $rbacsystem
 
 $nav_history
 
 $error
 
 $help
 

Detailed Description

GUI class for learning module editor.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilLMEditorGUI: ilObjLearningModuleGUI

Definition at line 22 of file class.ilLMEditorGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMEditorGUI::__construct ( )

Constructor public.

Definition at line 62 of file class.ilLMEditorGUI.php.

References $_GET, $DIC, $ilCtrl, $ilErr, $lng, $objDefinition, $rbacsystem, $tpl, array, checkRequestParameters(), ilObjectFactory\getInstanceByRefId(), and ilTree\setTableNames().

63  {
64  global $DIC;
65 
66  $this->rbacsystem = $DIC->rbac()->system();
67  $this->nav_history = $DIC["ilNavigationHistory"];
68  $this->error = $DIC["ilErr"];
69  $this->help = $DIC["ilHelp"];
70  $tpl = $DIC["tpl"];
71  $lng = $DIC->language();
72  $objDefinition = $DIC["objDefinition"];
73  $ilCtrl = $DIC->ctrl();
74  $rbacsystem = $DIC->rbac()->system();
75  $ilNavigationHistory = $DIC["ilNavigationHistory"];
76  $ilErr = $DIC["ilErr"];
77 
78  $lng->loadLanguageModule("content");
79  $lng->loadLanguageModule("lm");
80 
81  // check write permission
82  if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
83  $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
84  }
85 
86 
87  $this->ctrl = $ilCtrl;
88 
89  //$this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
90  $this->ctrl->saveParameter($this, array("ref_id", "transl"));
91 
92  // initiate variables
93  $this->tpl = $tpl;
94  $this->lng = $lng;
95  $this->objDefinition = $objDefinition;
96  $this->ref_id = $_GET["ref_id"];
97  $this->obj_id = $_GET["obj_id"];
98 
99  $this->lm_obj = ilObjectFactory::getInstanceByRefId($this->ref_id);
100  $this->tree = new ilTree($this->lm_obj->getId());
101  $this->tree->setTableNames('lm_tree', 'lm_data');
102  $this->tree->setTreeTablePK("lm_id");
103 
104 
105  $ilNavigationHistory->addItem(
106  $_GET["ref_id"],
107  "ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"],
108  "lm"
109  );
110 
111  $this->checkRequestParameters();
112  }
global $ilErr
Definition: raiseError.php:16
checkRequestParameters()
Check request parameters.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:

Member Function Documentation

◆ checkRequestParameters()

ilLMEditorGUI::checkRequestParameters ( )
protected

Check request parameters.

Exceptions
ilCtrlException
ilException

Definition at line 119 of file class.ilLMEditorGUI.php.

References ilLMObject\_lookupContObjID().

Referenced by __construct().

120  {
121  $forwards_to_role = $this->ctrl->checkCurrentPathForClass("ilobjrolegui");
122 
123  if (!$forwards_to_role && $this->obj_id > 0 && ilLMObject::_lookupContObjID($this->obj_id) != $this->lm_obj->getId()) {
124  throw new ilException("Object ID does not match learning module.");
125  }
126  if ($_REQUEST["active_node"] > 0 && ilLMObject::_lookupContObjID((int) $_REQUEST["active_node"]) != $this->lm_obj->getId()) {
127  throw new ilException("Active node does not match learning module.");
128  }
129  }
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayLocator()

ilLMEditorGUI::displayLocator ( )

display locator

Definition at line 242 of file class.ilLMEditorGUI.php.

References $key, $lng, $row, $t, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), and ilUtil\getImagePath().

Referenced by executeCommand().

243  {
244  $lng = $this->lng;
245 
246  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
247 
248  $modifier = 1;
249 
250  $locations = $this->ctrl->getLocations();
251 
252  foreach ($locations as $key => $row) {
253  if ($key < count($locations)-$modifier) {
254  $this->tpl->touchBlock("locator_separator");
255  }
256 
257  if ($row["ref_id"]> 0 && $row["ref_id"] != ROOT_FOLDER_ID) {
258  $oid = ilObject::_lookupObjId($row["ref_id"]);
259  $t = ilObject::_lookupType($oid);
260  $this->tpl->setCurrentBlock("locator_img");
261  $this->tpl->setVariable(
262  "IMG_SRC",
263  ilUtil::getImagePath("icon_" . $t . ".svg")
264  );
265  $this->tpl->setVariable(
266  "IMG_ALT",
267  $lng->txt("obj_" . $type)
268  );
269  $this->tpl->parseCurrentBlock();
270  }
271 
272  if ($row["link"] != "") {
273  $this->tpl->setCurrentBlock("locator_item");
274  $this->tpl->setVariable("ITEM", $row["title"]);
275  $this->tpl->setVariable("LINK_ITEM", $row["link"]);
276  if ($row["target"] != "") {
277  $this->tpl->setVariable("LINK_TARGET", ' target="' . $row["target"] . '" ');
278  }
279  $this->tpl->parseCurrentBlock();
280  } else {
281  $this->tpl->setCurrentBlock("locator_item");
282  $this->tpl->setVariable("PREFIX", $row["title"]);
283  $this->tpl->parseCurrentBlock();
284  }
285  }
286 
287  $this->tpl->setCurrentBlock("locator");
288  $this->tpl->parseCurrentBlock();
289  }
$type
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilLMEditorGUI::executeCommand ( )
Exceptions
ilCtrlException
ilException

Definition at line 136 of file class.ilLMEditorGUI.php.

References $_GET, $help, $output, $ret, array, displayLocator(), header, main_header(), and showTree().

137  {
138  $ilHelp = $this->help;
139 
140  if ($_GET["to_page"]== 1) {
141  $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $_GET["obj_id"]);
142  $this->ctrl->redirectByClass(array("ilobjlearningmodulegui", "illmpageobjectgui"), "edit");
143  }
144 
145  if ($cmd != "showTree") {
146  $this->showTree();
147  }
148 
149  $next_class = $this->ctrl->getNextClass($this);
150  //echo "lmeditorgui:$next_class:".$this->ctrl->getCmdClass().":$cmd:<br>";
151 
152  if ($next_class == "" && ($cmd != "explorer")
153  && ($cmd != "showImageMap")) {
154  $next_class = "ilobjlearningmodulegui";
155  }
156 
157  // show footer
158  $show_footer = ($cmd == "explorer")
159  ? false
160  : true;
161 
162  // if ($this->lm_obj->getType()
163  switch ($next_class) {
164  case "ilobjlearningmodulegui":
165  include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
166  include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php");
167  $this->main_header($this->lm_obj->getType());
168  $lm_gui = new ilObjLearningModuleGUI("", $_GET["ref_id"], true, false);
169  //$ret =& $lm_gui->executeCommand();
170  $ret = $this->ctrl->forwardCommand($lm_gui);
171  if (strcmp($cmd, "explorer") != 0) {
172  // don't call the locator in the explorer frame
173  // this prevents a lot of log errors
174  // Helmut Schottmüller, 2006-07-21
175  $this->displayLocator();
176  }
177 //echo "*".$this->tpl->get()."*";
178  // (horrible) workaround for preventing template engine
179  // from hiding paragraph text that is enclosed
180  // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
181 // $this->tpl->fillTabs();
182  $output = $this->tpl->get("DEFAULT", true, true, $show_footer, true);
183  $output = str_replace("&#123;", "{", $output);
184  $output = str_replace("&#125;", "}", $output);
185  header('Content-type: text/html; charset=UTF-8');
186  echo $output;
187  break;
188 
189  default:
190  $ret = $this->$cmd();
191  break;
192  }
193  }
main_header($a_type)
output main header (title and locator)
$_GET["client_id"]
Class ilLearningModuleGUI.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
Add a drawing to the header
Definition: 04printing.php:69
displayLocator()
display locator
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
showTree()
Show tree.
+ Here is the call graph for this function:

◆ main_header()

ilLMEditorGUI::main_header (   $a_type)

output main header (title and locator)

Definition at line 215 of file class.ilLMEditorGUI.php.

References $lng, ilObjStyleSheet\getContentStylePath(), and ilObjStyleSheet\getSyntaxStylePath().

Referenced by executeCommand().

216  {
217  $lng = $this->lng;
218 
219  $this->tpl->getStandardTemplate();
220 
221  // content style
222  $this->tpl->setCurrentBlock("ContentStyle");
223  $this->tpl->setVariable(
224  "LOCATION_CONTENT_STYLESHEET",
225  ilObjStyleSheet::getContentStylePath($this->lm_obj->getStyleSheetId())
226  );
227  $this->tpl->parseCurrentBlock();
228 
229  // syntax style
230  $this->tpl->setCurrentBlock("SyntaxStyle");
231  $this->tpl->setVariable(
232  "LOCATION_SYNTAX_STYLESHEET",
234  );
235  $this->tpl->parseCurrentBlock();
236  }
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTree()

ilLMEditorGUI::showTree ( )

Show tree.

Parameters

Definition at line 201 of file class.ilLMEditorGUI.php.

References $tpl.

Referenced by executeCommand().

202  {
203  $tpl = $this->tpl;
204 
205  include_once("./Modules/LearningModule/classes/class.ilLMEditorExplorerGUI.php");
206  $exp = new ilLMEditorExplorerGUI($this, "showTree", $this->lm_obj);
207  if (!$exp->handleCommand()) {
208  $tpl->setLeftNavContent($exp->getHTML());
209  }
210  }
LM editor explorer GUI class.
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilLMEditorGUI::$ctrl
protected

Definition at line 27 of file class.ilLMEditorGUI.php.

◆ $error

ilLMEditorGUI::$error
protected

Definition at line 42 of file class.ilLMEditorGUI.php.

◆ $help

ilLMEditorGUI::$help
protected

Definition at line 47 of file class.ilLMEditorGUI.php.

Referenced by executeCommand().

◆ $lm_obj

ilLMEditorGUI::$lm_obj

Definition at line 53 of file class.ilLMEditorGUI.php.

◆ $lng

ilLMEditorGUI::$lng

Definition at line 50 of file class.ilLMEditorGUI.php.

Referenced by __construct(), displayLocator(), and main_header().

◆ $nav_history

ilLMEditorGUI::$nav_history
protected

Definition at line 37 of file class.ilLMEditorGUI.php.

◆ $obj_id

ilLMEditorGUI::$obj_id

Definition at line 56 of file class.ilLMEditorGUI.php.

◆ $objDefinition

ilLMEditorGUI::$objDefinition

Definition at line 51 of file class.ilLMEditorGUI.php.

Referenced by __construct().

◆ $rbacsystem

ilLMEditorGUI::$rbacsystem
protected

Definition at line 32 of file class.ilLMEditorGUI.php.

Referenced by __construct().

◆ $ref_id

ilLMEditorGUI::$ref_id

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

◆ $tpl

ilLMEditorGUI::$tpl

Definition at line 49 of file class.ilLMEditorGUI.php.

Referenced by __construct(), and showTree().

◆ $tree

ilLMEditorGUI::$tree

Definition at line 55 of file class.ilLMEditorGUI.php.


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