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

classes/class.ilObjObjectFolderGUI.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 ilObjObjectFolderGUI extends ilObjectGUI
00039 {
00048         function ilObjObjectFolderGUI($a_data,$a_id,$a_call_by_reference)
00049         {
00050                 $this->type = "objf";
00051                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
00052         }
00053 
00059         function viewObject()
00060         {
00061                 global $rbacsystem;
00062 
00063                 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00064                 {
00065                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00066                 }
00067 
00068                 //prepare objectlist
00069                 $this->data = array();
00070                 $this->data["data"] = array();
00071                 $this->data["ctrl"] = array();
00072 
00073                 $this->data["cols"] = array("type","title","last_change");
00074 
00075                 $this->maxcount = count($this->data["data"]);
00076 
00077                 // now compute control information
00078                 foreach ($this->data["data"] as $key => $val)
00079                 {
00080                         $this->data["ctrl"][$key] = array(
00081                                                                                         "ref_id"        => $this->id,
00082                                                                                         "obj_id"        => $val["obj_id"],
00083                                                                                         "type"          => $val["type"],
00084                                                                                         );              
00085 
00086                         unset($this->data["data"][$key]["obj_id"]);
00087                         $this->data["data"][$key]["last_change"] = ilFormat::formatDate($this->data["data"][$key]["last_change"]);
00088                 }
00089 
00090                 $this->displayList();   
00091         }
00092 
00098         function displayList()
00099         {
00100                 include_once "./Services/Table/classes/class.ilTableGUI.php";
00101                 return;
00102 
00103                 // load template for table
00104                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00105 
00106                 // load template for table content data
00107                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
00108 
00109                 $num = 0;
00110 
00111                 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
00112                 $this->tpl->setVariable("FORMACTION",
00113                         $this->ctrl->getFormAction($this));
00114 
00115                 // create table
00116                 $tbl = new ilTableGUI();
00117 
00118                 // title & header columns
00119                 $tbl->setTitle($this->object->getTitle(),"icon_".$this->object->getType()."_b.gif",$this->lng->txt("obj_".$this->object->getType()));
00120                 $tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00121 
00122                 foreach ($this->data["cols"] as $val)
00123                 {
00124                         $header_names[] = $this->lng->txt($val);
00125                 }
00126 
00127                 $tbl->setHeaderNames($header_names);
00128 
00129                 //$header_params = array("ref_id" => $this->ref_id);
00130                 $header_params = $this->ctrl->getParameterArray($this, "view");
00131                 $tbl->setHeaderVars($this->data["cols"],$header_params);
00132                 $tbl->setColumnWidth(array("15","75%","25%"));
00133 
00134                 // control
00135                 $tbl->setOrderColumn($_GET["sort_by"]);
00136                 $tbl->setOrderDirection($_GET["sort_order"]);
00137                 $tbl->setLimit($_GET["limit"]);
00138                 $tbl->setOffset($_GET["offset"]);
00139                 $tbl->setMaxCount($this->maxcount);
00140 
00141                 // footer
00142                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00143                 //$tbl->disable("footer");
00144                 
00145                 // render table
00146                 $tbl->render();
00147 
00148                 if (is_array($this->data["data"][0]))
00149                 {
00150                         //table cell
00151                         for ($i=0; $i < count($this->data["data"]); $i++)
00152                         {
00153                                 $data = $this->data["data"][$i];
00154                                 $ctrl = $this->data["ctrl"][$i];
00155 
00156                                 // color changing
00157                                 $css_row = ilUtil::switchColor($i+1,"tblrow1","tblrow2");
00158 
00159                                 $this->tpl->setCurrentBlock("table_cell");
00160                                 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
00161                                 $this->tpl->parseCurrentBlock();
00162 
00163                                 foreach ($data as $key => $val)
00164                                 {
00165                                         //build link
00166                                         /*
00167 
00168                                         $n = 0;
00169 
00170                                         foreach ($ctrl as $key2 => $val2)
00171                                         {
00172                                                 $link .= $key2."=".$val2;
00173 
00174                                                 if ($n < count($ctrl)-1)
00175                                                 {
00176                                                 $link .= "&";
00177                                                         $n++;
00178                                                 }
00179                                         }
00180 
00181                                         if ($key == "title")
00182                                         {
00183                                                 $name_field = explode("#separator#",$val);
00184                                         }
00185 
00186                                         if ($key == "title" || $key == "type")
00187                                         {
00188                                                 $this->tpl->setCurrentBlock("begin_link");
00189                                                 $this->tpl->setVariable("LINK_TARGET", $link);
00190 
00191                                                 $this->tpl->parseCurrentBlock();
00192                                                 $this->tpl->touchBlock("end_link");
00193                                         }
00194 
00195                                         $this->tpl->setCurrentBlock("text");
00196 
00197                                         if ($key == "type")
00198                                         {
00199                                                 $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath);                                             
00200                                         }
00201 
00202                                         if ($key == "title")
00203                                         {
00204                                                 $this->tpl->setVariable("TEXT_CONTENT", $name_field[0]);
00205                                                 
00206                                                 $this->tpl->setCurrentBlock("subtitle");
00207                                                 $this->tpl->setVariable("DESC", $name_field[1]);
00208                                                 $this->tpl->parseCurrentBlock();
00209                                         }
00210                                         else
00211                                         {
00212                                                 $this->tpl->setVariable("TEXT_CONTENT", $val);
00213                                         }
00214                                 
00215                                         $this->tpl->parseCurrentBlock();
00216 
00217                                         $this->tpl->setCurrentBlock("table_cell");
00218                                         $this->tpl->parseCurrentBlock();
00219                                         */
00220                                 } //foreach
00221 
00222                                 $this->tpl->setCurrentBlock("tbl_content");
00223                                 $this->tpl->setVariable("CSS_ROW", $css_row);
00224                                 $this->tpl->parseCurrentBlock();
00225                         } //for
00226 
00227                 } //if is_array
00228                 else
00229                 {
00230                         $this->tpl->setCurrentBlock("notfound");
00231                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00232                         $this->tpl->setVariable("NUM_COLS", $num);
00233                         $this->tpl->parseCurrentBlock();
00234                 }
00235         }
00236         
00237         function &executeCommand()
00238         {
00239                 $next_class = $this->ctrl->getNextClass($this);
00240                 $cmd = $this->ctrl->getCmd();
00241                 $this->prepareOutput();
00242 
00243                 switch($next_class)
00244                 {
00245                         case 'ilpermissiongui':
00246                                 include_once("./classes/class.ilPermissionGUI.php");
00247                                 $perm_gui =& new ilPermissionGUI($this);
00248                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00249                                 break;
00250 
00251                         default:
00252                                 if(!$cmd)
00253                                 {
00254                                         $cmd = "view";
00255                                 }
00256                                 $cmd .= "Object";
00257                                 $this->$cmd();
00258 
00259                                 break;
00260                 }
00261                 return true;
00262         }
00263         
00269         function getTabs(&$tabs_gui)
00270         {
00271                 global $rbacsystem;
00272 
00273                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00274                 {
00275                         $tabs_gui->addTarget("settings",
00276                                 $this->ctrl->getLinkTarget($this, "view"), array("view",""), "", "");
00277 
00278                         $tabs_gui->addTarget("perm_settings",
00279                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00280                 }
00281         }
00282 } // END class.ilObjObjectFolderGUI
00283 ?>

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