00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00081 $this->data["data"][] = array(
00082 "type" => $val["type"],
00083 "title" => $val["title"]."#separator#".$val["desc"],
00084
00085 "last_change" => $val["last_update"],
00086 "obj_id" => $val["obj_id"]
00087 );
00088
00089 }
00090 }
00091
00092 $this->maxcount = count($this->data["data"]);
00093
00094
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
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
00125 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00126
00127
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
00137 $tbl = new ilTableGUI();
00138
00139
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
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
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
00163 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00164
00165
00166
00167 $tbl->render();
00168
00169 if (is_array($this->data["data"][0]))
00170 {
00171
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
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
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241 }
00242
00243 $this->tpl->setCurrentBlock("tbl_content");
00244 $this->tpl->setVariable("CSS_ROW", $css_row);
00245 $this->tpl->parseCurrentBlock();
00246 }
00247
00248 }
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 }
00304 ?>