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

Generated on Fri Dec 13 2013 11:57:54 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1