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
00035 require_once "class.ilObjectGUI.php";
00036
00037 class ilObjObjectFolderGUI extends ilObjectGUI
00038 {
00047 function ilObjObjectFolderGUI($a_data,$a_id,$a_call_by_reference)
00048 {
00049 $this->type = "objf";
00050 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference);
00051 }
00052
00058 function viewObject()
00059 {
00060 global $rbacsystem;
00061
00062 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00063 {
00064 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00065 }
00066
00067
00068 $this->data = array();
00069 $this->data["data"] = array();
00070 $this->data["ctrl"] = array();
00071
00072 $this->data["cols"] = array("type","title","last_change");
00073
00074 if ($list = getObjectList("typ",$_GET["order"], $_GET["direction"]))
00075 {
00076 foreach ($list as $key => $val)
00077 {
00078
00079 $this->data["data"][] = array(
00080 "type" => $val["type"],
00081 "title" => $val["title"]."#separator#".$val["desc"],
00082
00083 "last_change" => $val["last_update"],
00084 "obj_id" => $val["obj_id"]
00085 );
00086
00087 }
00088 }
00089
00090 $this->maxcount = count($this->data["data"]);
00091
00092
00093 $this->data["data"] = ilUtil::sortArray($this->data["data"],$_GET["sort_by"],$_GET["sort_order"]);
00094 $this->data["data"] = array_slice($this->data["data"],$_GET["offset"],$_GET["limit"]);
00095
00096
00097 foreach ($this->data["data"] as $key => $val)
00098 {
00099 $this->data["ctrl"][$key] = array(
00100 "ref_id" => $this->id,
00101 "obj_id" => $val["obj_id"],
00102 "type" => $val["type"],
00103 );
00104
00105 unset($this->data["data"][$key]["obj_id"]);
00106 $this->data["data"][$key]["last_change"] = ilFormat::formatDate($this->data["data"][$key]["last_change"]);
00107 }
00108
00109 $this->displayList();
00110 }
00111
00117 function displayList()
00118 {
00119 include "./classes/class.ilTableGUI.php";
00120
00121
00122 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00123
00124
00125 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
00126
00127 $num = 0;
00128
00129 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
00130 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
00131
00132
00133 $tbl = new ilTableGUI();
00134
00135
00136 $tbl->setTitle($this->object->getTitle(),"icon_".$this->object->getType()."_b.gif",$this->lng->txt("obj_".$this->object->getType()));
00137 $tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00138
00139 foreach ($this->data["cols"] as $val)
00140 {
00141 $header_names[] = $this->lng->txt($val);
00142 }
00143
00144 $tbl->setHeaderNames($header_names);
00145
00146 $header_params = array("ref_id" => $this->ref_id);
00147 $tbl->setHeaderVars($this->data["cols"],$header_params);
00148 $tbl->setColumnWidth(array("15","75%","25%"));
00149
00150
00151 $tbl->setOrderColumn($_GET["sort_by"]);
00152 $tbl->setOrderDirection($_GET["sort_order"]);
00153 $tbl->setLimit($_GET["limit"]);
00154 $tbl->setOffset($_GET["offset"]);
00155 $tbl->setMaxCount($this->maxcount);
00156
00157
00158 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00159
00160
00161
00162 $tbl->render();
00163
00164 if (is_array($this->data["data"][0]))
00165 {
00166
00167 for ($i=0; $i < count($this->data["data"]); $i++)
00168 {
00169 $data = $this->data["data"][$i];
00170 $ctrl = $this->data["ctrl"][$i];
00171
00172
00173 $css_row = ilUtil::switchColor($i+1,"tblrow1","tblrow2");
00174
00175 $this->tpl->setCurrentBlock("table_cell");
00176 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
00177 $this->tpl->parseCurrentBlock();
00178
00179 foreach ($data as $key => $val)
00180 {
00181
00182 $link = "adm_object.php?";
00183
00184 $n = 0;
00185
00186 foreach ($ctrl as $key2 => $val2)
00187 {
00188 $link .= $key2."=".$val2;
00189
00190 if ($n < count($ctrl)-1)
00191 {
00192 $link .= "&";
00193 $n++;
00194 }
00195 }
00196
00197 if ($key == "title")
00198 {
00199 $name_field = explode("#separator#",$val);
00200 }
00201
00202 if ($key == "title" || $key == "type")
00203 {
00204 $this->tpl->setCurrentBlock("begin_link");
00205 $this->tpl->setVariable("LINK_TARGET", $link);
00206
00207 $this->tpl->parseCurrentBlock();
00208 $this->tpl->touchBlock("end_link");
00209 }
00210
00211 $this->tpl->setCurrentBlock("text");
00212
00213 if ($key == "type")
00214 {
00215 $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath);
00216 }
00217
00218 if ($key == "title")
00219 {
00220 $this->tpl->setVariable("TEXT_CONTENT", $name_field[0]);
00221
00222 $this->tpl->setCurrentBlock("subtitle");
00223 $this->tpl->setVariable("DESC", $name_field[1]);
00224 $this->tpl->parseCurrentBlock();
00225 }
00226 else
00227 {
00228 $this->tpl->setVariable("TEXT_CONTENT", $val);
00229 }
00230
00231 $this->tpl->parseCurrentBlock();
00232
00233 $this->tpl->setCurrentBlock("table_cell");
00234 $this->tpl->parseCurrentBlock();
00235
00236 }
00237
00238 $this->tpl->setCurrentBlock("tbl_content");
00239 $this->tpl->setVariable("CSS_ROW", $css_row);
00240 $this->tpl->parseCurrentBlock();
00241 }
00242
00243 }
00244 else
00245 {
00246 $this->tpl->setCurrentBlock("notfound");
00247 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00248 $this->tpl->setVariable("NUM_COLS", $num);
00249 $this->tpl->parseCurrentBlock();
00250 }
00251 }
00252 }
00253 ?>