• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/LearningModule/classes/class.ilStructureObjectGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once("./Modules/LearningModule/classes/class.ilLMObjectGUI.php");
00025 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
00026 
00039 class ilStructureObjectGUI extends ilLMObjectGUI
00040 {
00041         var $obj;       // structure object
00042         var $tree;
00043 
00048         function ilStructureObjectGUI(&$a_content_obj, &$a_tree)
00049         {
00050                 global $ilias, $tpl, $lng;
00051 
00052                 parent::ilLMObjectGUI($a_content_obj);
00053                 $this->tree =& $a_tree;
00054         }
00055 
00061         function setStructureObject(&$a_st_object)
00062         {
00063                 $this->obj =& $a_st_object;
00064                 $this->actions = $this->objDefinition->getActions("st");
00065         }
00066         
00067         
00071         function getType()
00072         {
00073                 return "st";
00074         }
00075 
00079         function &executeCommand()
00080         {
00081 //echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":";
00082                 $next_class = $this->ctrl->getNextClass($this);
00083                 $cmd = $this->ctrl->getCmd();
00084 
00085                 switch($next_class)
00086                 {
00087                         case 'ilmdeditorgui':
00088 
00089                                 $this->setTabs();
00090                                 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00091 
00092                                 $md_gui =& new ilMDEditorGUI($this->content_object->getID(),
00093                                         $this->obj->getId(), $this->obj->getType());
00094                                 $md_gui->addObserver($this->obj,'MDUpdateListener','General');
00095 
00096                                 $this->ctrl->forwardCommand($md_gui);
00097                                 break;
00098 
00099                         case "ilconditionhandlerinterface":
00100                                 global $ilTabs;
00101                                 include_once './classes/class.ilConditionHandlerInterface.php';
00102 
00103                                 $this->setTabs();
00104                                 $this->initConditionHandlerInterface();
00105                                 $this->ctrl->forwardCommand($this->condHI);
00106                                 $ilTabs->setTabActive('preconditions');
00107                                 break;
00108 
00109                         default:
00110                                 if($cmd == 'listConditions')
00111                                 {
00112                                         $this->setTabs();
00113                                         $this->initConditionHandlerInterface();
00114                                         $ret =& $this->condHI->executeCommand();
00115                                 }
00116                                 elseif(($cmd == "create") && ($_POST["new_type"] == "pg"))
00117                                 {
00118                                         $this->setTabs();
00119                                         $pg_gui =& new ilLMPageObjectGUI($this->content_object);
00120                                         $ret =& $pg_gui->executeCommand();
00121                                 }
00122                                 else
00123                                 {
00124                                         $ret =& $this->$cmd();
00125                                 }
00126                                 break;
00127                 }
00128         }
00129 
00130 
00134         function create()
00135         {
00136                 if ($_GET["obj_id"] != "")
00137                 {
00138                         $this->setTabs();
00139                 }
00140                 parent::create();
00141         }
00142 
00143 
00144         /*
00145         * display pages of structure object
00146         */
00147         function view()
00148         {
00149                 global $tree;
00150 
00151                 $this->setTabs();
00152 
00153                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
00154                 $num = 0;
00155 
00156                 $this->tpl->setCurrentBlock("form");
00157                 $this->ctrl->setParameter($this, "backcmd", "view");
00158                 $this->tpl->setVariable("FORMACTION",
00159                         $this->ctrl->getFormAction($this));
00160                 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_pages"));
00161                 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
00162 
00163                 $cnt = 0;
00164                 $childs = $this->tree->getChilds($this->obj->getId());
00165                 foreach ($childs as $child)
00166                 {
00167                         if($child["type"] != "pg")
00168                         {
00169                                 continue;
00170                         }
00171                         
00172                         // check activation
00173                         if (!ilLMPageObject::_lookupActive($child["obj_id"]))
00174                         {
00175                                 $this->tpl->setCurrentBlock("deactivated");
00176                                 $this->tpl->setVariable("TXT_DEACTIVATED",
00177                                         $this->lng->txt("cont_page_deactivated"));
00178                                 $this->tpl->parseCurrentBlock();
00179                         }
00180                         else
00181                         {
00182                                 if (ilPageObject::_lookupContainsDeactivatedElements($child["obj_id"],
00183                                         $this->content_object->getType()))
00184                                 {
00185                                         $this->tpl->setCurrentBlock("deactivated");
00186                                         $this->tpl->setVariable("TXT_DEACTIVATED",
00187                                                 $this->lng->txt("cont_page_deactivated_elements"));
00188                                         $this->tpl->parseCurrentBlock();
00189                                 }
00190                         }
00191                         
00192                         $this->tpl->setCurrentBlock("table_row");
00193                         // color changing
00194                         $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
00195 
00196                         // checkbox
00197                         $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
00198                         $this->tpl->setVariable("CSS_ROW", $css_row);
00199                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_pg.gif"));
00200 
00201                         // link
00202                         $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $child["obj_id"]);
00203                         $link = $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI", "view", "", true);
00204                         $this->tpl->setVariable("LINK_TARGET", $link);
00205 
00206                         // title
00207                         $this->tpl->setVariable("TEXT_CONTENT", $child["title"]);
00208 
00209                         $this->tpl->parseCurrentBlock();
00210                 }
00211                 if($cnt == 0)
00212                 {
00213                         $this->tpl->setCurrentBlock("notfound");
00214                         $this->tpl->setVariable("NUM_COLS", 3);
00215                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00216                         $this->tpl->parseCurrentBlock();
00217                 }
00218                 //else
00219                 //{
00220                         // SHOW VALID ACTIONS
00221                         $this->tpl->setVariable("NUM_COLS", 3);
00222                         //$this->setActions(array("confirmTermDeletion" => "delete", "addDefinition" => "cont_add_definition"));
00223                         $acts = array("delete" => "delete", "cutPage" => "cutPage",
00224                                 "copyPage" => "copyPage", "activatePages" => "cont_de_activate");
00225 //echo ":".$this->checkClipboardContentType().":<br>";
00226                         if(ilEditClipboard::getContentObjectType() == "pg")
00227                         {
00228                                 if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
00229                                         == $this->content_object->getId()
00230                                         || ilEditClipboard::getAction() == "copy")
00231                                 {
00232                                         $acts["pastePage"] = "pastePage";
00233                                 }
00234                         }
00235                         $this->setActions($acts);
00236                         $this->showActions();
00237                 //}
00238 
00239                 // SHOW POSSIBLE SUB OBJECTS
00240                 $this->tpl->setVariable("NUM_COLS", 3);
00241                 //$this->showPossibleSubObjects("st");
00242                 $subobj = array("pg");
00243                 $opts = ilUtil::formSelect(12,"new_type",$subobj);
00244                 //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00245                 $this->tpl->setCurrentBlock("add_object");
00246                 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
00247                 //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]);
00248                 $this->tpl->setVariable("BTN_NAME", "create");
00249                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
00250                 $this->tpl->parseCurrentBlock();
00251 
00252 
00253                 $this->tpl->setCurrentBlock("form");
00254                 $this->tpl->parseCurrentBlock();
00255 
00256         }
00257 
00258 
00259         /*
00260         * display subchapters of structure object
00261         */
00262         function subchap()
00263         {
00264                 global $tree;
00265 
00266                 $this->setTabs();
00267 
00268                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
00269                 $num = 0;
00270 
00271                 $this->tpl->setCurrentBlock("form");
00272                 $this->ctrl->setParameter($this, "backcmd", "subchap");
00273                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00274                 $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_subchapters"));
00275                 $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
00276 
00277                 $cnt = 0;
00278                 $childs = $this->tree->getChilds($this->obj->getId());
00279                 foreach ($childs as $child)
00280                 {
00281                         if($child["type"] != "st")
00282                         {
00283                                 continue;
00284                         }
00285                         $this->tpl->setCurrentBlock("table_row");
00286                         // color changing
00287                         $css_row = ilUtil::switchColor($cnt++,"tblrow1","tblrow2");
00288 
00289                         // checkbox
00290                         $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
00291                         $this->tpl->setVariable("CSS_ROW", $css_row);
00292                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.gif"));
00293 
00294                         // type
00295                         $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
00296                         $link = $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view");
00297                         $this->tpl->setVariable("LINK_TARGET", $link);
00298 
00299                         // title
00300                         $this->tpl->setVariable("TEXT_CONTENT",
00301                                 ilStructureObject::_getPresentationTitle($child["obj_id"],
00302                                         $this->content_object->isActiveNumbering()));
00303 
00304                         $this->tpl->parseCurrentBlock();
00305                 }
00306                 if($cnt == 0)
00307                 {
00308                         $this->tpl->setCurrentBlock("notfound");
00309                         $this->tpl->setVariable("NUM_COLS", 3);
00310                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00311                         $this->tpl->parseCurrentBlock();
00312                 }
00313                 //else
00314                 //{
00315                         // SHOW VALID ACTIONS
00316                         $this->tpl->setVariable("NUM_COLS", 3);
00317                         $acts = array("delete" => "delete", "moveChapter" => "moveChapter",
00318                                 "copyChapter" => "copyChapter");
00319                         if(ilEditClipboard::getContentObjectType() == "st")
00320                         {
00321                                 if ($this->tree->isInTree(ilEditClipboard::getContentObjectId())
00322                                         || ilEditClipboard::getAction() == "copy")
00323                                 {
00324                                         $acts["pasteChapter"] =  "pasteChapter";
00325                                 }
00326                         }
00327                         /*if(!empty($_SESSION["ilEditClipboard"]))
00328                         {
00329                                 $acts["paste"] = "paste";
00330                         }*/
00331                         $this->setActions($acts);
00332                         $this->showActions();
00333                 //}
00334 
00335                 // SHOW POSSIBLE SUB OBJECTS
00336                 $this->tpl->setVariable("NUM_COLS", 3);
00337                 //$this->showPossibleSubObjects("st");
00338                 $subobj = array("st");
00339                 $opts = ilUtil::formSelect(12,"new_type",$subobj);
00340                 //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00341                 $this->tpl->setCurrentBlock("add_object");
00342                 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
00343                 //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]);
00344                 $this->tpl->setVariable("BTN_NAME", "create");
00345                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
00346                 $this->tpl->parseCurrentBlock();
00347 
00348                 //$this->tpl->setVariable("NUM_COLS", 2);
00349                 //$this->showPossibleSubObjects("st");
00350 
00351                 $this->tpl->setCurrentBlock("form");
00352                 $this->tpl->parseCurrentBlock();
00353 
00354         }
00355 
00359         function add_cell($val, $link = "")
00360         {
00361                 if(!empty($link))
00362                 {
00363                         $this->tpl->setCurrentBlock("begin_link");
00364                         $this->tpl->setVariable("LINK_TARGET", $link);
00365                         $this->tpl->parseCurrentBlock();
00366                         $this->tpl->touchBlock("end_link");
00367                 }
00368 
00369                 $this->tpl->setCurrentBlock("text");
00370                 $this->tpl->setVariable("TEXT_CONTENT", $val);
00371                 $this->tpl->parseCurrentBlock();
00372                 $this->tpl->setCurrentBlock("table_cell");
00373                 $this->tpl->parseCurrentBlock();
00374         }
00375 
00376 
00380         function save()
00381         {
00382 
00383                 $this->obj =& new ilStructureObject($this->content_object);
00384 
00385                 $this->obj->setType("st");
00386                 $this->obj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
00387                 $this->obj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
00388                 $this->obj->setLMId($this->content_object->getId());
00389                 $this->obj->create();
00390 
00391                 $this->putInTree();
00392 
00393                 // check the tree
00394                 $this->checkTree();
00395 
00396                 if (!empty($_GET["obj_id"]))
00397                 {
00398                         $this->ctrl->redirect($this, "subchap");
00399                 }
00400 
00401         }
00402 
00406         function putInTree()
00407         {
00408 //echo "st:putInTree";
00409                 // chapters should be behind pages in the tree
00410                 // so if target is first node, the target is substituted with
00411                 // the last child of type pg
00412                 if ($_GET["target"] == IL_FIRST_NODE)
00413                 {
00414                         $tree = new ilTree($this->content_object->getId());
00415                         $tree->setTableNames('lm_tree','lm_data');
00416                         $tree->setTreeTablePK("lm_id");
00417 
00418                         // determine parent node id
00419                         $parent_id = (!empty($_GET["obj_id"]))
00420                                 ? $_GET["obj_id"]
00421                                 : $tree->getRootId();
00422                         // determine last child of type pg
00423                         $childs =& $tree->getChildsByType($parent_id, "pg");
00424                         if (count($childs) != 0)
00425                         {
00426                                 $_GET["target"] = $childs[count($childs) - 1]["obj_id"];
00427                         }
00428                 }
00429                 if (empty($_GET["target"]))
00430                 {
00431                         $_GET["target"] = IL_LAST_NODE;
00432                 }
00433 
00434                 parent::putInTree();
00435         }
00436 
00440         function cutPage()
00441         {
00442                 if(!isset($_POST["id"]))
00443                 {
00444                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00445 
00446                 }
00447                 if(count($_POST["id"]) > 1)
00448                 {
00449                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00450                 }
00451 
00452                 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
00453                 {
00454                         $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
00455                 }
00456 
00457                 // SAVE POST VALUES
00458                 ilEditClipboard::storeContentObject("pg",$_POST["id"][0]);
00459 
00460                 $tree = new ilTree($this->content_object->getId());
00461                 $tree->setTableNames('lm_tree','lm_data');
00462                 $tree->setTreeTablePK("lm_id");
00463 
00464                 // cut selected object
00465                 $cutted = 0;
00466                 foreach ($_POST["id"] as $id)
00467                 {
00468                         if ($id == -1)
00469                         {
00470                                 continue;
00471                         }
00472                         
00473                         $obj =& ilLMObjectFactory::getInstance($this->content_object, $id);
00474                         $obj->setLMId($this->content_object->getId());
00475                         $node_data = $tree->getNodeData($id);
00476                         //$obj->delete();
00477                         if($tree->isInTree($id))
00478                         {
00479                                 $parent_id = $tree->getParentId($id);
00480                                 $tree->deleteTree($node_data);
00481                                 
00482                                 // write history entry
00483                                 require_once("classes/class.ilHistory.php");
00484                                 ilHistory::_createEntry($id, "cut",
00485                                         array(ilLMObject::_lookupTitle($parent_id), $parent_id),
00486                                         $this->content_object->getType().":pg");
00487                                 ilHistory::_createEntry($parent_id, "cut_page",
00488                                         array(ilLMObject::_lookupTitle($id), $id),
00489                                         $this->content_object->getType().":st");
00490                         }
00491                         $cutted++;
00492                 }
00493 
00494                 // tree check
00495                 $this->checkTree();
00496 
00497                 if($cutted > 0)
00498                 {
00499                         ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"), true);
00500                 }
00501 
00502                 $this->ctrl->redirect($this, "view");
00503         }
00504 
00508         function copyPage()
00509         {
00510                 if(!isset($_POST["id"]))
00511                 {
00512                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00513                 }
00514                 if(count($_POST["id"]) > 1)
00515                 {
00516                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00517                 }
00518 
00519                 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
00520                 {
00521                         $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
00522                 }
00523 
00524                 // SAVE POST VALUES
00525                 ilEditClipboard::storeContentObject("pg",$_POST["id"][0],"copy");
00526 
00527                 ilUtil::sendInfo($this->lng->txt("msg_copy_clipboard"), true);
00528 
00529                 $this->ctrl->redirect($this, "view");
00530         }
00531 
00535         function pastePage()
00536         {
00537                 if(ilEditClipboard::getContentObjectType() != "pg")
00538                 {
00539                         $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
00540                 }
00541 
00542                 $tree = new ilTree($this->content_object->getId());
00543                 $tree->setTableNames('lm_tree','lm_data');
00544                 $tree->setTreeTablePK("lm_id");
00545 
00546                 // paste selected object
00547                 $id = ilEditClipboard::getContentObjectId();
00548 
00549                 // copy page, if action is copy
00550                 if (ilEditClipboard::getAction() == "copy")
00551                 {
00552                         // check wether page belongs to lm
00553                         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
00554                                 == $this->content_object->getID())
00555                         {
00556                                 $lm_page = new ilLMPageObject($this->content_object, $id);
00557                                 $new_page =& $lm_page->copy();
00558                                 $id = $new_page->getId();
00559                         }
00560                         else
00561                         {
00562                                 // get page from other content object into current content object
00563                                 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
00564                                 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
00565                                 $lm_page = new ilLMPageObject($lm_obj, $id);
00566                                 $copied_nodes = array();
00567                                 $new_page =& $lm_page->copyToOtherContObject($this->content_object, $copied_nodes);
00568                                 $id = $new_page->getId();
00569                                 ilLMObject::updateInternalLinks($copied_nodes);
00570                         }
00571                 }
00572                 
00573                 if (ilEditClipboard::getAction() == "cut")
00574                 {
00575                         // check wether page belongs not to lm
00576                         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
00577                                 != $this->content_object->getID())
00578                         {
00579                                 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
00580                                 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
00581                                 $lm_page = new ilLMPageObject($lm_obj, $id);
00582                                 $lm_page->setLMId($this->content_object->getID());
00583                                 $lm_page->update();
00584                                 $page =& $lm_page->getPageObject();
00585                                 $page->buildDom();
00586                                 $page->setParentId($this->content_object->getID());
00587                                 $page->update();
00588                         }
00589                 }
00590 
00591                 if(!$tree->isInTree($id))
00592                 {
00593                         if(!isset($_POST["id"]))
00594                         {
00595                                 $target = IL_FIRST_NODE;
00596                         }
00597                         else
00598                         {
00599                                 $target = $_POST["id"][0];
00600                         }
00601                         $tree->insertNode($id, $this->obj->getId(), $target);
00602                         ilEditClipboard::clear();
00603                 }
00604 
00605                 // write history comments
00606                 include_once("classes/class.ilHistory.php");
00607                 $parent_id = $tree->getParentId($id);
00608                 ilHistory::_createEntry($id, "paste",
00609                         array(ilLMObject::_lookupTitle($this->obj->getId()), $this->obj->getId()),
00610                         $this->content_object->getType().":pg");
00611                 ilHistory::_createEntry($parent_id, "paste_page",
00612                         array(ilLMObject::_lookupTitle($id), $id),
00613                         $this->content_object->getType().":st");
00614 
00615                 // check the tree
00616                 $this->checkTree();
00617 
00618                 $this->ctrl->redirect($this, "view");
00619         }
00620 
00621 
00625         function moveChapter()
00626         {
00627                 $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
00628                         true, false);
00629                 $cont_obj_gui->moveChapter($this->obj->getId());
00630 
00631                 $this->ctrl->redirect($this, "subchap");
00632         }
00633 
00637         function copyChapter()
00638         {
00639                 $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
00640                         true, false);
00641                 $cont_obj_gui->copyChapter($this->obj->getId());
00642 
00643                 $this->ctrl->redirect($this, "subchap");
00644         }
00645 
00649         function pasteChapter()
00650         {
00651                 $id = ilEditClipboard::getContentObjectId();
00652                 if($id == $_POST["id"][0])
00653                 {
00654                         ilEditClipboard::clear();
00655                         $this->subchap();
00656                         return;
00657                 }
00658                 $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
00659                         true, false);
00660                 $cont_obj_gui->pasteChapter($this->obj->getId());
00661 
00662                 $this->ctrl->redirect($this, "subchap");
00663         }
00664 
00668         function activatePages()
00669         {
00670                 if (is_array($_POST["id"]))
00671                 {
00672                         foreach($_POST["id"] as $id)
00673                         {
00674                                 $act = ilLMObject::_lookupActive($id);
00675                                 ilLMObject::_writeActive($id, !$act);
00676 //echo "-".$a_id."-".!$act."-";
00677                         }
00678                 }
00679 
00680                 $this->ctrl->redirect($this, "view");
00681         }
00682 
00683         //
00684         // Condition handling stuff
00685         //
00686 
00687         function initConditionHandlerInterface()
00688         {
00689                 include_once("classes/class.ilConditionHandlerInterface.php");
00690 
00691                 $this->condHI =& new ilConditionHandlerInterface($this);
00692                 $this->condHI->setBackButtons(array());
00693                 $this->condHI->setAutomaticValidation(false);
00694                 $this->condHI->setTargetType("st");
00695                 $this->condHI->setTargetRefId($this->content_object->getRefId());
00696                 $this->condHI->setTargetId($this->obj->getId());
00697                 $this->condHI->setTargetTitle($this->obj->getTitle());
00698         }
00699 
00700 
00704         function cancel()
00705         {
00706                 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
00707                 if ($_GET["obj_id"] != 0)
00708                 {
00709                         if ($_GET["new_type"] == "pg")
00710                         {
00711                                 $this->ctrl->redirect($this, "view");
00712                         }
00713                         else
00714                         {
00715                                 $this->ctrl->redirect($this, "subchap");
00716                         }
00717                 }
00718         }
00719 
00720 
00724         function setTabs()
00725         {
00726                 global $ilTabs;
00727 
00728                 // catch feedback message
00729                 #include_once("classes/class.ilTabsGUI.php");
00730                 #$tabs_gui =& new ilTabsGUI();
00731                 //$this->getTabs($tabs_gui);
00732                 $ilTabs->getTargetsByObjectType($this, "st");
00733 
00734                 $ilTabs->addTarget("meta_data",
00735                          $this->ctrl->getLinkTargetByClass("ilmdeditorgui",''),
00736                          "", "ilmdeditorgui");
00737                          
00738                 $this->tpl->setCurrentBlock("header_image");
00739                 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_st_b.gif"));
00740                 $this->tpl->parseCurrentBlock();
00741                 $this->tpl->setCurrentBlock("content");
00742 
00743                 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00744                 $this->tpl->setVariable("HEADER",
00745                         $this->lng->txt($this->obj->getType()).": ".$this->obj->getTitle());
00746         }
00747 
00753         function getTabs(&$tabs_gui)
00754         {
00755                 // back to upper context
00756                 $tabs_gui->addTarget("edit", $this->ctrl->getLinkTarget($this, "view")
00757                         , "view", get_class($this));
00758 
00759                 $tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview")
00760                         , "preview", get_class($this));
00761 
00762                 $tabs_gui->addTarget("meta_data",
00763                          $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
00764                          "", get_class($this));
00765 
00766                 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
00767                         , "view", "ilEditClipboardGUI");
00768 
00769         }
00770 
00776         function _goto($a_target, $a_target_ref_id = "")
00777         {
00778                 global $rbacsystem, $ilErr, $lng, $ilAccess;
00779 
00780                 // determine learning object
00781                 $lm_id = ilLMObject::_lookupContObjID($a_target);
00782 
00783                 // get all references
00784                 $ref_ids = ilObject::_getAllReferences($lm_id);
00785                 
00786                 // always try passed ref id first
00787                 if (in_array($a_target_ref_id, $ref_ids))
00788                 {
00789                         $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
00790                 }
00791 
00792                 // check read permissions
00793                 foreach ($ref_ids as $ref_id)
00794                 {
00795                         // Permission check
00796                         if ($ilAccess->checkAccess("read", "", $ref_id))
00797                         {
00798                                 // don't redirect anymore, just set parameters
00799                                 // (goto.php includes  "ilias.php")
00800                                 $_GET["baseClass"] = "ilLMPresentationGUI";
00801                                 $_GET["obj_id"] = $a_target;
00802                                 $_GET["ref_id"] = $ref_id;
00803                                 include_once("ilias.php");
00804                                 exit;;
00805                         }
00806                 }
00807                 
00808                 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
00809                 {
00810                         $_GET["cmd"] = "frameset";
00811                         $_GET["target"] = "";
00812                         $_GET["ref_id"] = ROOT_FOLDER_ID;
00813                         ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
00814                                 ilObject::_lookupTitle($lm_id)), true);
00815                         include("repository.php");
00816                         exit;
00817                 }
00818 
00819                 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
00820         }
00821 
00822 }
00823 ?>

Generated on Fri Dec 13 2013 17:56:52 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1