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

classes/class.ilObjLearningObjectGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 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 
00036 //require_once "class.ilObjectGUI.php";
00037 
00038 //class ilLearningObjectGUI extends ilObjectGUI
00039 //{
00045         function ilLearningObjectGUI($a_data,$a_id,$a_call_by_reference)
00046         {
00047                 $this->type = "lo";
00048                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference);
00049         } 
00050 
00051         function viewObject()
00052         {
00053                 global $rbacsystem, $tree, $tpl;
00054                 
00055                 if (empty($_GET["lo_id"]))
00056                 {
00057                         $_GET["lo_id"] = $_GET["obj_id"];
00058                         $_GET["lo_parent"] = $_GET["parent"];
00059                 }
00060 
00061                 if (empty($_GET["lo_parent"]))
00062                 {
00063                         $_GET["lo_parent"] = $_GET["lm_id"];
00064                 }
00065                 
00066                 // TODO get rid of these $_GET variables
00067                 $lotree = new ilTree($_GET["lm_id"],$_GET["lm_id"]);
00068                 //prepare objectlist
00069                 $this->data = array();
00070                 $this->data["data"] = array();
00071                 $this->data["ctrl"] = array();
00072 
00073                 $this->data["cols"] = array("", "view", "title", "description", "last_change");
00074                 
00075                 $lo_childs = $lotree->getChilds($_GET["lo_id"], $a_order, $a_direction);
00076 
00077                 foreach ($lo_childs as $key => $val)
00078             {
00079                         // visible
00080                         //if (!$rbacsystem->checkAccess("visible",$val["id"]))
00081                         //{
00082                         //      continue;
00083                         //}
00084         
00085                         //visible data part
00086                         $this->data["data"][] = array(
00087                                 "type" => "<img src=\"".$tpl->tplPath."/images/enlarge.gif\" border=\"0\">",
00088                                 "title" => $val["title"],
00089                                 "description" => $val["desc"],
00090                                 "last_change" => $val["last_update"]
00091                         );
00092 
00093                         //control information
00094                         $this->data["ctrl"][] = array(
00095                                 "type" => $val["type"],
00096                                 "obj_id" => $_GET["obj_id"],
00097                                 "parent" => $_GET["parent"],
00098                                 "parent_parent" => $val["parent_parent"],
00099                                 "lm_id" => $_GET["lm_id"],
00100                                 "lo_id" => $val["child"],
00101                                 "lo_parent" => $val["parent"]
00102                         );
00103             } //foreach
00104 
00105                 $this->setLOLocator($lotree, $_GET["lo_id"], $_GET["lo_parent"]); 
00106                 
00107                 parent::displayList();
00108         }
00134         function setLOLocator($a_tree = "", $a_obj_id = "", $a_parent = "", $a_parent_parent = "")
00135         {
00136                 if (!is_object($a_tree))
00137                 {
00138                         $a_tree =& $this->tree;
00139                 }
00140 
00141                 if (!($a_obj_id))
00142                 {
00143                         $a_obj_id = $_GET["obj_id"];
00144                 }
00145 
00146                 if (!($a_parent))
00147                 {
00148                         $a_parent = $_GET["parent"];
00149                 }
00150 
00151                 if (!($a_parent_parent))
00152                 {
00153                         $a_parent_parent = $_GET["parent_parent"];
00154                 }
00155 
00156                 global $lng;
00157 
00158                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00159 
00160                 if ($a_parent_parent)
00161                 {
00162                         $path = $a_tree->getPathFull($a_parent);
00163                 }
00164                 else
00165                 {
00166                         $path = $a_tree->getPathFull($a_obj_id);
00167                 }
00168 
00169                 //check if object isn't in tree, this is the case if parent_parent is set
00170                 if ($a_parent_parent)
00171                 {
00172                         //$subObj = getObject($a_obj_id);
00173                         $subObj =& $this->ilias->obj_factory->getInstanceByObjId($a_obj_id);
00174 
00175                         $path[] = array(
00176                                 "id"     => $a_obj_id,
00177                                 "title"  => $this->lng->txt($subObj->getTitle()),
00178                                 "parent" => $a_parent,
00179                                 "parent_parent" => $a_parent_parent
00180                                 );
00181                 }
00182 
00183                 foreach ($path as $key => $row)
00184                 {
00185                         if ($key < count($path)-1)
00186                         {
00187                                 $this->tpl->touchBlock("locator_separator");
00188                         }
00189 
00190                         $this->tpl->setCurrentBlock("locator_item");
00191                         $this->tpl->setVariable("ITEM", $row["title"]);
00192                         $this->tpl->setVariable("LINK_ITEM", "adm_object.php?".$type_lo."obj_id=".$_GET["obj_id"].
00193                                                           "&lm_id=".$_GET["lm_id"]."&lo_id=".$row["child"]."&lo_parent=".$row["parent"]);
00194                         $this->tpl->parseCurrentBlock();
00195 
00196                         if ($row["child"] == $_GET["lm_id"])
00197                         {
00198                                 $type_lo = "type=lo&";
00199                         }
00200                 }
00201 
00202                 $this->tpl->setCurrentBlock("locator");
00203 
00204                 $this->tpl->setVariable("TXT_PATH","LO-Path: ");
00205                 $this->tpl->parseCurrentBlock();
00206         }
00207 
00214         function displayStructure ($a_tree)
00215         {
00216                 echo "<table border=\"1\">" . "<tr>" . "<th>id</th>" . "<th>value</th>" . "<th>name</th>" . "<th>type</th>" . "<th>depth</th>" . "<th>parent</th>" . "<th>first</th>" . "<th>prev</th>" . "<th>next</th>" . "<th>left</th>" . "<th>right</th>" . "<th>db_id</th>" . "</tr>";
00217 
00218                 foreach ($a_tree as $id => $node)
00219                 {
00220                         echo "<tr>";
00221                         echo "<td>" . $id . "</td>";
00222 
00223                         foreach ($node as $key => $value)
00224                         {
00225                                 echo "<td>" . $value . "</td>";
00226                         } 
00227                         echo "</tr>";
00228                 }
00229                 echo "</table>";
00230         }
00231 //}
00232 ?>

Generated on Fri Dec 13 2013 09:06:34 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1