00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once ("content/classes/class.ilLMObjectFactory.php");
00025 include_once ("classes/class.ilDOMUtil.php");
00026 include_once ("content/classes/Pages/class.ilPageEditorGUI.php");
00027 include_once ("classes/class.ilObjStyleSheet.php");
00028 include_once ("content/classes/class.ilEditClipboard.php");
00029
00030
00042 class ilLMEditorGUI
00043 {
00049 var $ilias;
00050 var $tpl;
00051 var $lng;
00052 var $objDefinition;
00053 var $ref_id;
00054 var $lm_obj;
00055
00056 var $tree;
00057 var $obj_id;
00058
00063 function ilLMEditorGUI()
00064 {
00065 global $ilias, $tpl, $lng, $objDefinition, $ilCtrl,
00066 $rbacsystem;
00067
00068
00069
00070 $lng->loadLanguageModule("content");
00071
00072
00073 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
00074 {
00075 $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->MESSAGE);
00076 }
00077
00078
00079 $this->ctrl =& $ilCtrl;
00080
00081
00082 $this->ctrl->saveParameter($this, array("ref_id"));
00083
00084
00085 $this->ilias =& $ilias;
00086 $this->tpl =& $tpl;
00087 $this->lng =& $lng;
00088 $this->objDefinition =& $objDefinition;
00089 $this->ref_id = $_GET["ref_id"];
00090 $this->obj_id = $_GET["obj_id"];
00091
00092 $this->lm_obj =& $this->ilias->obj_factory->getInstanceByRefId($this->ref_id);
00093 $this->tree = new ilTree($this->lm_obj->getId());
00094 $this->tree->setTableNames('lm_tree','lm_data');
00095 $this->tree->setTreeTablePK("lm_id");
00096
00097 }
00098
00102 function &executeCommand()
00103 {
00104
00105 global $ilHelp;
00106
00107 $ilHelp->setTarget("lm_intro");
00108
00109 $cmd = $this->ctrl->getCmd("frameset");
00110
00111 $next_class = $this->ctrl->getNextClass($this);
00112
00113 $cmd = $this->ctrl->getCmd("frameset");
00114
00115 if ($next_class == "" && ($cmd != "explorer") && ($cmd != "frameset")
00116 && ($cmd != "showImageMap"))
00117 {
00118 switch($this->lm_obj->getType())
00119 {
00120 case "lm":
00121
00122 $next_class = "ilobjlearningmodulegui";
00123 break;
00124
00125 case "dbk":
00126
00127 $next_class = "ilobjdlbookgui";
00128 break;
00129 }
00130
00131 }
00132
00133
00134 $show_footer = ($cmd == "explorer")
00135 ? false
00136 : true;
00137
00138
00139 switch($next_class)
00140 {
00141 case "ilobjdlbookgui":
00142 include_once ("content/classes/class.ilObjDlBook.php");
00143 include_once ("content/classes/class.ilObjDlBookGUI.php");
00144
00145 $this->main_header($this->lm_obj->getType());
00146 $book_gui =& new ilObjDlBookGUI("", $_GET["ref_id"], true, false);
00147
00148 $ret =& $this->ctrl->forwardCommand($book_gui);
00149 if (strcmp($cmd, "explorer") != 0)
00150 {
00151
00152
00153
00154 $this->displayLocator();
00155 }
00156
00157
00158
00159
00160 $this->tpl->fillTabs();
00161 $output = $this->tpl->get("DEFAULT", true, true, $show_footer,true);
00162 $output = str_replace("{", "{", $output);
00163 $output = str_replace("}", "}", $output);
00164 header('Content-type: text/html; charset=UTF-8');
00165 echo $output;
00166 break;
00167
00168 case "ilobjlearningmodulegui":
00169 include_once ("content/classes/class.ilObjLearningModule.php");
00170 include_once ("content/classes/class.ilObjLearningModuleGUI.php");
00171 $this->main_header($this->lm_obj->getType());
00172 $lm_gui =& new ilObjLearningModuleGUI("", $_GET["ref_id"], true, false);
00173
00174 $ret =& $this->ctrl->forwardCommand($lm_gui);
00175 if (strcmp($cmd, "explorer") != 0)
00176 {
00177
00178
00179
00180 $this->displayLocator();
00181 }
00182
00183
00184
00185
00186 $this->tpl->fillTabs();
00187 $output = $this->tpl->get("DEFAULT", true, true, $show_footer,true);
00188 $output = str_replace("{", "{", $output);
00189 $output = str_replace("}", "}", $output);
00190 header('Content-type: text/html; charset=UTF-8');
00191 echo $output;
00192 break;
00193
00194 default:
00195 $ret =& $this->$cmd();
00196 break;
00197 }
00198 }
00199
00205 function frameset()
00206 {
00207 include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
00208 $fs_gui = new ilFramesetGUI();
00209
00210 $fs_gui->setFramesetTitle($this->lng->txt("editor"));
00211 $fs_gui->setMainFrameName("content");
00212 $fs_gui->setSideFrameName("tree");
00213 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00214 if ($this->lm_obj->getType() == "dbk")
00215 {
00216 $fs_gui->setSideFrameSource(
00217 $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer"));
00218 if ($_GET["to_page"]== 1)
00219 {
00220 $fs_gui->setMainFrameSource(
00221 $this->ctrl->getLinkTargetByClass(
00222 array("ilobjdlbookgui", "illmpageobjectgui"),
00223 "view"));
00224 }
00225 else
00226 {
00227 $fs_gui->setMainFrameSource(
00228 $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "properties"));
00229 }
00230 }
00231 else
00232 {
00233 $fs_gui->setSideFrameSource(
00234 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer"));
00235 if ($_GET["to_page"]== 1)
00236 {
00237 $fs_gui->setMainFrameSource(
00238 $this->ctrl->getLinkTargetByClass(
00239 array("ilobjlearningmodulegui", "illmpageobjectgui"),
00240 "view"));
00241 }
00242 else
00243 {
00244 $fs_gui->setMainFrameSource(
00245 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "properties"));
00246 }
00247 }
00248 $fs_gui->show();
00249 exit;
00250 }
00251
00252
00253
00257 function main_header($a_type)
00258 {
00259 global $lng;
00260
00261 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00262
00263 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00264
00265
00266
00267
00268 $this->tpl->setCurrentBlock("ContentStyle");
00269 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00270 ilObjStyleSheet::getContentStylePath($this->lm_obj->getStyleSheetId()));
00271 $this->tpl->parseCurrentBlock();
00272
00273
00274 $this->tpl->setCurrentBlock("SyntaxStyle");
00275 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00276 ilObjStyleSheet::getSyntaxStylePath());
00277 $this->tpl->parseCurrentBlock();
00278
00279 }
00280
00281
00285 function displayLocator()
00286 {
00287 global $lng;
00288
00289 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00290
00291 $modifier = 1;
00292
00293 $locations = $this->ctrl->getLocations();
00294
00295 foreach ($locations as $key => $row)
00296 {
00297 if ($key < count($locations)-$modifier)
00298 {
00299 $this->tpl->touchBlock("locator_separator");
00300 }
00301
00302 if ($row["link"] != "")
00303 {
00304 $this->tpl->setCurrentBlock("locator_item");
00305 $this->tpl->setVariable("ITEM", $row["title"]);
00306 $this->tpl->setVariable("LINK_ITEM", $row["link"]);
00307 if ($row["target"] != "")
00308 {
00309 $this->tpl->setVariable("LINK_TARGET", ' target="'.$row["target"].'" ');
00310 }
00311 $this->tpl->parseCurrentBlock();
00312 }
00313 else
00314 {
00315 $this->tpl->setCurrentBlock("locator_item");
00316 $this->tpl->setVariable("PREFIX", $row["title"]);
00317 $this->tpl->parseCurrentBlock();
00318 }
00319 }
00320
00321 $this->tpl->setCurrentBlock("locator");
00322 $this->tpl->parseCurrentBlock();
00323
00324 }
00325
00326 }
00327 ?>