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

content/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("./content/classes/class.ilLMObjectGUI.php");
00025 require_once("content/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", true);
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", true);
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", 2);
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                         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                 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                                 $new_page =& $lm_page->copyToOtherContObject($this->content_object);
00567                                 $id = $new_page->getId();
00568                         }
00569                 }
00570                 
00571                 if (ilEditClipboard::getAction() == "cut")
00572                 {
00573                         // check wether page belongs not to lm
00574                         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId())
00575                                 != $this->content_object->getID())
00576                         {
00577                                 $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
00578                                 $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
00579                                 $lm_page = new ilLMPageObject($lm_obj, $id);
00580                                 $lm_page->setLMId($this->content_object->getID());
00581                                 $lm_page->update();
00582                                 $page =& $lm_page->getPageObject();
00583                                 $page->buildDom();
00584                                 $page->setParentId($this->content_object->getID());
00585                                 $page->update();
00586                         }
00587                 }
00588 
00589                 if(!$tree->isInTree($id))
00590                 {
00591                         if(!isset($_POST["id"]))
00592                         {
00593                                 $target = IL_FIRST_NODE;
00594                         }
00595                         else
00596                         {
00597                                 $target = $_POST["id"][0];
00598                         }
00599                         $tree->insertNode($id, $this->obj->getId(), $target);
00600                         ilEditClipboard::clear();
00601                 }
00602 
00603                 // write history comments
00604                 include_once("classes/class.ilHistory.php");
00605                 $parent_id = $tree->getParentId($id);
00606                 ilHistory::_createEntry($id, "paste",
00607                         array(ilLMObject::_lookupTitle($this->obj->getId()), $this->obj->getId()),
00608                         $this->content_object->getType().":pg");
00609                 ilHistory::_createEntry($parent_id, "paste_page",
00610                         array(ilLMObject::_lookupTitle($id), $id),
00611                         $this->content_object->getType().":st");
00612 
00613                 // check the tree
00614                 $this->checkTree();
00615 
00616                 $this->ctrl->redirect($this, "view");
00617         }
00618 
00619 
00623         function moveChapter()
00624         {
00625                 $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
00626                         true, false);
00627                 $cont_obj_gui->moveChapter($this->obj->getId());
00628 
00629                 $this->ctrl->redirect($this, "subchap");
00630         }
00631 
00635         function copyChapter()
00636         {
00637                 $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
00638                         true, false);
00639                 $cont_obj_gui->copyChapter($this->obj->getId());
00640 
00641                 $this->ctrl->redirect($this, "subchap");
00642         }
00643 
00647         function pasteChapter()
00648         {
00649                 $id = ilEditClipboard::getContentObjectId();
00650                 if($id == $_POST["id"][0])
00651                 {
00652                         ilEditClipboard::clear();
00653                         $this->subchap();
00654                         return;
00655                 }
00656                 $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
00657                         true, false);
00658                 $cont_obj_gui->pasteChapter($this->obj->getId());
00659 
00660                 $this->ctrl->redirect($this, "subchap");
00661         }
00662 
00666         function activatePages()
00667         {
00668                 if (is_array($_POST["id"]))
00669                 {
00670                         foreach($_POST["id"] as $id)
00671                         {
00672                                 $act = ilLMObject::_lookupActive($id);
00673                                 ilLMObject::_writeActive($id, !$act);
00674 //echo "-".$a_id."-".!$act."-";
00675                         }
00676                 }
00677 
00678                 $this->ctrl->redirect($this, "view");
00679         }
00680 
00681         //
00682         // Condition handling stuff
00683         //
00684 
00685         function initConditionHandlerInterface()
00686         {
00687                 include_once("classes/class.ilConditionHandlerInterface.php");
00688 
00689                 $this->condHI =& new ilConditionHandlerInterface($this);
00690                 $this->condHI->setBackButtons(array());
00691                 $this->condHI->setAutomaticValidation(false);
00692                 $this->condHI->setTargetType("st");
00693                 $this->condHI->setTargetId($this->obj->getId());
00694                 $this->condHI->setTargetTitle($this->obj->getTitle());
00695         }
00696 
00697 
00701         function cancel()
00702         {
00703                 sendInfo($this->lng->txt("msg_cancel"), true);
00704                 if ($_GET["obj_id"] != 0)
00705                 {
00706                         if ($_GET["new_type"] == "pg")
00707                         {
00708                                 $this->ctrl->redirect($this, "view");
00709                         }
00710                         else
00711                         {
00712                                 $this->ctrl->redirect($this, "subchap");
00713                         }
00714                 }
00715         }
00716 
00717 
00721         function setTabs()
00722         {
00723                 global $ilTabs;
00724 
00725                 // catch feedback message
00726                 #include_once("classes/class.ilTabsGUI.php");
00727                 #$tabs_gui =& new ilTabsGUI();
00728                 //$this->getTabs($tabs_gui);
00729                 $ilTabs->getTargetsByObjectType($this, "st");
00730 
00731                 $ilTabs->addTarget("meta_data",
00732                          $this->ctrl->getLinkTargetByClass("ilmdeditorgui",''),
00733                          "", "ilmdeditorgui");
00734                          
00735                 $this->tpl->setCurrentBlock("header_image");
00736                 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_st_b.gif"));
00737                 $this->tpl->parseCurrentBlock();
00738                 $this->tpl->setCurrentBlock("content");
00739 
00740                 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00741                 $this->tpl->setVariable("HEADER",
00742                         $this->lng->txt($this->obj->getType()).": ".$this->obj->getTitle());
00743         }
00744 
00750         function getTabs(&$tabs_gui)
00751         {
00752                 // back to upper context
00753                 $tabs_gui->addTarget("edit", $this->ctrl->getLinkTarget($this, "view")
00754                         , "view", get_class($this));
00755 
00756                 $tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview")
00757                         , "preview", get_class($this));
00758 
00759                 $tabs_gui->addTarget("meta_data",
00760                          $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
00761                          "", get_class($this));
00762 
00763                 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
00764                         , "view", "ilEditClipboardGUI");
00765 
00766         }
00767 
00773         function _goto($a_target, $a_target_ref_id = "")
00774         {
00775                 global $rbacsystem, $ilErr, $lng, $ilAccess;
00776 
00777                 // determine learning object
00778                 $lm_id = ilLMObject::_lookupContObjID($a_target);
00779 
00780                 // get all references
00781                 $ref_ids = ilObject::_getAllReferences($lm_id);
00782                 
00783                 // always try passed ref id first
00784                 if (in_array($a_target_ref_id, $ref_ids))
00785                 {
00786                         $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
00787                 }
00788 
00789                 // check read permissions
00790                 foreach ($ref_ids as $ref_id)
00791                 {
00792                         // Permission check
00793                         if ($ilAccess->checkAccess("read", "", $ref_id))
00794                         {
00795                                 // don't redirect anymore, just set parameters
00796                                 // (goto.php includes  "ilias.php")
00797                                 $_GET["baseClass"] = "ilLMPresentationGUI";
00798                                 $_GET["obj_id"] = $a_target;
00799                                 $_GET["ref_id"] = $ref_id;
00800                                 include_once("ilias.php");
00801                                 exit;;
00802                         }
00803                 }
00804                 
00805                 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
00806                 {
00807                         $_GET["cmd"] = "frameset";
00808                         $_GET["target"] = "";
00809                         $_GET["ref_id"] = ROOT_FOLDER_ID;
00810                         sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
00811                                 ilObject::_lookupTitle($lm_id)), true);
00812                         include("repository.php");
00813                         exit;
00814                 }
00815 
00816                 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
00817         }
00818 
00819 }
00820 ?>

Generated on Fri Dec 13 2013 13:52:09 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1