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

classes/class.ilTabsGUI.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 
00033 class ilTabsGUI
00034 {
00035         var $target_script;
00036         var $obj_type;
00037         var $tpl;
00038         var $lng;
00039         var $tabs;
00040         var $objDefinition;
00041         var $target = array();
00042 
00047         function ilTabsGUI()
00048         {
00049                 global $tpl, $objDefinition, $lng;
00050 
00051                 $this->tpl =& $tpl;
00052                 $this->lng =& $lng;
00053                 $this->objDefinition =& $objDefinition;
00054 
00055                 $this->temp_var = "TABS";
00056         }
00057 
00058         /*
00059         function setTemplateVariable($a_temp_var)
00060         {
00061                 $this->temp_var = $a_temp_var;
00062         }
00063 
00064         function setObjectType($a_type)
00065         {
00066                 $this->obj_type = $a_type;
00067         }
00068 
00069         function setTargetScript($a_script)
00070         {
00071                 $this->target_script = $a_script;
00072         }
00073 
00074         function getTargetScript()
00075         {
00076                 return $this->target_script;
00077         }
00078 
00079         function setTabs($a_tabs)
00080         {
00081                 $this->tabs = $a_tabs;
00082         }*/
00083 
00084 
00085         /*
00086         function display()
00087         {
00088 
00089                 $tabs = array();
00090                 $this->tpl->addBlockFile($this->temp_var, "tabs", "tpl.tabs.html");
00091 
00092                 if(!is_array($this->tabs))
00093                 {
00094                         $d = $this->objDefinition->getProperties($this->obj_type);
00095 
00096                         foreach ($d as $key => $row)
00097                         {
00098                                 $tabs[] = array($row["lng"], $row["name"]);
00099                         }
00100                 }
00101                 else
00102                 {
00103                         $tabs = $this->tabs;
00104                 }
00105 
00106                 if ($_GET["cmd"] == "")
00107                 {
00108                         if (is_array($_POST["cmd"]))
00109                         {
00110                                 $cmd = key($_POST["cmd"]);
00111                         }
00112                 }
00113                 else if ($_GET["cmd"] == "edpost")
00114                 {
00115                         $cmd_arr = explode("_", key($_POST["cmd"]));
00116                         $cmd = $_POST["command".$cmd_arr[1]];
00117                 }
00118                 else
00119                 {
00120                         $cmd = $_GET["cmd"];
00121                 }
00122 
00123                 foreach ($tabs as $row)
00124                 {
00125                         $i++;
00126                         if ($row[1] == $cmd)
00127                         {
00128                                 $tabtype = "tabactive";
00129                                 $tab = $tabtype;
00130                         }
00131                         else
00132                         {
00133                                 $tabtype = "tabinactive";
00134                                 $tab = "tab";
00135                         }
00136 
00137                         $this->tpl->setCurrentBlock("tab");
00138                         $this->tpl->setVariable("TAB_TYPE", $tabtype);
00139                         $this->tpl->setVariable("TAB_TYPE2", $tab);
00140                         $this->tpl->setVariable("IMG_LEFT", ilUtil::getImagePath("eck_l.gif"));
00141                         $this->tpl->setVariable("IMG_RIGHT", ilUtil::getImagePath("eck_r.gif"));
00142                         $this->tpl->setVariable("TAB_LINK",
00143                                 ilUtil::appendUrlParameterString($this->target_script, "cmd=".$row[1]));
00144                         $this->tpl->setVariable("TAB_TEXT", $this->lng->txt($row[0]));
00145                         $this->tpl->parseCurrentBlock();
00146                 }
00147         }*/
00148 
00149         function getTargetsByObjectType(&$a_gui_obj, $a_type)
00150         {
00151                 global $ilCtrl;
00152 
00153                 $d = $this->objDefinition->getProperties($a_type);
00154 
00155                 foreach ($d as $key => $row)
00156                 {
00157                         $this->addTarget($row["lng"],
00158                                 $ilCtrl->getLinkTarget($a_gui_obj, $row["name"]),
00159                                 $row["name"], get_class($a_gui_obj));
00160                 }
00161         }
00162 
00163         function addTarget($a_text, $a_link, $a_cmd = "", $a_cmdClass = "", $a_frame = "")
00164         {
00165                 $a_cmdClass = strtolower($a_cmdClass);
00166 
00167                 $this->target[] = array("text" => $a_text, "link" => $a_link,
00168                         "cmd" => $a_cmd, "cmdClass" => $a_cmdClass);
00169 //echo "<br>addTarget:".$a_link."::";
00170         }
00171 
00172         function getHTML()
00173         {
00174                 global $ilCtrl, $lng;
00175 
00176                 $cmd = $ilCtrl->getCmd();
00177                 $cmdClass = $ilCtrl->getCmdClass();
00178 
00179                 $tpl = new ilTemplate("tpl.tabs.html", true, true);
00180 
00181                 foreach ($this->target as $target)
00182                 {
00183                         $i++;
00184                         if ($target["cmd"] == $cmd &&
00185                                 ($target["cmdClass"] == $cmdClass))
00186                         {
00187                                 $tabtype = "tabactive";
00188                         }
00189                         else
00190                         {
00191                                 $tabtype = "tabinactive";
00192                         }
00193 
00194                         $tpl->setCurrentBlock("tab");
00195                         $tpl->setVariable("TAB_TYPE", $tabtype);
00196                         $tpl->setVariable("TAB_LINK", $target["link"]);
00197                         $tpl->setVariable("TAB_TEXT", $lng->txt($target["text"]));
00198                         $tpl->setVariable("TAB_TARGET", $target["frame"]);
00199                         $tpl->parseCurrentBlock();
00200                 }
00201 
00202                 return $tpl->get();
00203         }
00204 
00205 
00206 
00207 
00208 }
00209 ?>

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