ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilLMEditorGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once ("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
5 include_once ("./Services/Utilities/classes/class.ilDOMUtil.php");
6 include_once ("./Services/COPage/classes/class.ilPageEditorGUI.php");
7 include_once ("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
8 include_once ("./Modules/LearningModule/classes/class.ilEditClipboard.php");
9 
10 
23 {
29  var $ilias;
30  var $tpl;
31  var $lng;
33  var $ref_id;
34  var $lm_obj;
35 
36  var $tree;
37  var $obj_id;
38 
43  function __construct()
44  {
46  $rbacsystem, $ilNavigationHistory;
47 
48  // init module (could be done in ilctrl)
49  //define("ILIAS_MODULE", "content");
50  $lng->loadLanguageModule("content");
51 
52  // check write permission
53  if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
54  {
55  $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->MESSAGE);
56  }
57 
58 
59  $this->ctrl = $ilCtrl;
60 
61  //$this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
62  $this->ctrl->saveParameter($this, array("ref_id", "transl"));
63 
64  // initiate variables
65  $this->ilias = $ilias;
66  $this->tpl = $tpl;
67  $this->lng = $lng;
68  $this->objDefinition = $objDefinition;
69  $this->ref_id = $_GET["ref_id"];
70  $this->obj_id = $_GET["obj_id"];
71 
72  $this->lm_obj = $this->ilias->obj_factory->getInstanceByRefId($this->ref_id);
73  $this->tree = new ilTree($this->lm_obj->getId());
74  $this->tree->setTableNames('lm_tree','lm_data');
75  $this->tree->setTreeTablePK("lm_id");
76 
77  if ($this->obj_id > 0 && ilLMObject::_lookupContObjID($this->obj_id) != $this->lm_obj->getId())
78  {
79  throw new ilException("Object ID does not match learning module.");
80  }
81  if ($_REQUEST["active_node"] > 0 && ilLMObject::_lookupContObjID((int) $_REQUEST["active_node"]) != $this->lm_obj->getId())
82  {
83  throw new ilException("Active node does not match learning module.");
84  }
85 
86  $ilNavigationHistory->addItem($_GET["ref_id"],
87  "ilias.php?baseClass=ilLMEditorGUI&ref_id=".$_GET["ref_id"], "lm");
88 
89  }
90 
94  function executeCommand()
95  {
96 
97  global $ilHelp;
98 
99  if ($_GET["to_page"]== 1)
100  {
101  $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $_GET["obj_id"]);
102  $this->ctrl->redirectByClass(array("ilobjlearningmodulegui", "illmpageobjectgui"), "edit");
103  }
104 
105  if ($cmd != "showTree")
106  {
107  $this->showTree();
108  }
109 
110  $next_class = $this->ctrl->getNextClass($this);
111 //echo "lmeditorgui:$next_class:".$this->ctrl->getCmdClass().":$cmd:<br>";
112 
113  if ($next_class == "" && ($cmd != "explorer")
114  && ($cmd != "showImageMap"))
115  {
116  $next_class = "ilobjlearningmodulegui";
117  }
118 
119  // show footer
120  $show_footer = ($cmd == "explorer")
121  ? false
122  : true;
123 
124 // if ($this->lm_obj->getType()
125  switch($next_class)
126  {
127  case "ilobjlearningmodulegui":
128  include_once ("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
129  include_once ("./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php");
130  $this->main_header($this->lm_obj->getType());
131  $lm_gui = new ilObjLearningModuleGUI("", $_GET["ref_id"], true, false);
132  //$ret =& $lm_gui->executeCommand();
133  $ret = $this->ctrl->forwardCommand($lm_gui);
134  if (strcmp($cmd, "explorer") != 0)
135  {
136  // don't call the locator in the explorer frame
137  // this prevents a lot of log errors
138  // Helmut Schottmüller, 2006-07-21
139  $this->displayLocator();
140  }
141 //echo "*".$this->tpl->get()."*";
142  // (horrible) workaround for preventing template engine
143  // from hiding paragraph text that is enclosed
144  // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
145 // $this->tpl->fillTabs();
146  $output = $this->tpl->get("DEFAULT", true, true, $show_footer,true);
147  $output = str_replace("&#123;", "{", $output);
148  $output = str_replace("&#125;", "}", $output);
149  header('Content-type: text/html; charset=UTF-8');
150  echo $output;
151  break;
152 
153  default:
154  $ret = $this->$cmd();
155  break;
156  }
157  }
158 
165  function showTree()
166  {
167  global $tpl;
168 
169  include_once("./Modules/LearningModule/classes/class.ilLMEditorExplorerGUI.php");
170  $exp = new ilLMEditorExplorerGUI($this, "showTree", $this->lm_obj);
171  if (!$exp->handleCommand())
172  {
173  $tpl->setLeftNavContent($exp->getHTML());
174  }
175  }
176 
181  {
182  global $lng;
183 
184  $this->tpl->getStandardTemplate();
185 
186  // content style
187  $this->tpl->setCurrentBlock("ContentStyle");
188  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
189  ilObjStyleSheet::getContentStylePath($this->lm_obj->getStyleSheetId()));
190  $this->tpl->parseCurrentBlock();
191 
192  // syntax style
193  $this->tpl->setCurrentBlock("SyntaxStyle");
194  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
196  $this->tpl->parseCurrentBlock();
197 
198  }
199 
200 
204  function displayLocator()
205  {
206  global $lng;
207 
208  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
209 
210  $modifier = 1;
211 
212  $locations = $this->ctrl->getLocations();
213 
214  foreach ($locations as $key => $row)
215  {
216  if ($key < count($locations)-$modifier)
217  {
218  $this->tpl->touchBlock("locator_separator");
219  }
220 
221  if ($row["ref_id"]> 0 && $row["ref_id"] != ROOT_FOLDER_ID)
222  {
223  $oid = ilObject::_lookupObjId($row["ref_id"]);
224  $t = ilObject::_lookupType($oid);
225  $this->tpl->setCurrentBlock("locator_img");
226  $this->tpl->setVariable("IMG_SRC",
227  ilUtil::getImagePath("icon_".$t.".svg"));
228  $this->tpl->setVariable("IMG_ALT",
229  $lng->txt("obj_".$type));
230  $this->tpl->parseCurrentBlock();
231  }
232 
233  if ($row["link"] != "")
234  {
235  $this->tpl->setCurrentBlock("locator_item");
236  $this->tpl->setVariable("ITEM", $row["title"]);
237  $this->tpl->setVariable("LINK_ITEM", $row["link"]);
238  if ($row["target"] != "")
239  {
240  $this->tpl->setVariable("LINK_TARGET", ' target="'.$row["target"].'" ');
241  }
242  $this->tpl->parseCurrentBlock();
243  }
244  else
245  {
246  $this->tpl->setCurrentBlock("locator_item");
247  $this->tpl->setVariable("PREFIX", $row["title"]);
248  $this->tpl->parseCurrentBlock();
249  }
250  }
251 
252  $this->tpl->setCurrentBlock("locator");
253  $this->tpl->parseCurrentBlock();
254 
255  }
256 
257 }
258 ?>
__construct()
Constructor public.
Base class for ILIAS Exception handling.
main_header($a_type)
output main header (title and locator)
GUI class for learning module editor.
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
LM editor explorer GUI class.
Class ilLearningModuleGUI.
global $ilCtrl
Definition: ilias.php:18
executeCommand()
execute command
$a_type
Definition: workflow.php:93
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
redirection script todo: (a better solution should control the processing via a xml file) ...
Add a drawing to the header
Definition: 04printing.php:69
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 &#39;obj_id&#39; You may use...
displayLocator()
display locator
static getSyntaxStylePath()
get syntax style path
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 _lookupType($a_id, $a_reference=false)
lookup object type
static getContentStylePath($a_style_id)
get content style path
$ret
Definition: parser.php:6
showTree()
Show tree.