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 include_once "classes/class.ilObjUser.php";
00025 include_once "classes/class.ilMail.php";
00026 include_once "classes/class.ilPersonalDesktopGUI.php";
00027
00028
00040 class ilPersonalDesktopGUI
00041 {
00042 var $tpl;
00043 var $lng;
00044 var $ilias;
00045
00046
00050 function ilPersonalDesktopGUI()
00051 {
00052 global $ilias, $tpl, $lng, $rbacsystem, $ilCtrl;
00053
00054
00055 $this->tpl =& $tpl;
00056 $this->lng =& $lng;
00057 $this->ilias =& $ilias;
00058 $this->ctrl =& $ilCtrl;
00059
00060
00061 if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
00062 {
00063 $this->ilias->raiseError($this->lng->txt("msg_not_available_for_anon"),$this->ilias->error_obj->MESSAGE);
00064 }
00065 }
00066
00070 function &executeCommand()
00071 {
00072 $next_class = $this->ctrl->getNextClass();
00073 $this->ctrl->setReturn($this, "show");
00074 switch($next_class)
00075 {
00076
00077 case "ilbookmarkadministrationgui":
00078 include_once("classes/class.ilBookmarkAdministrationGUI.php");
00079 $bookmark_gui = new ilBookmarkAdministrationGUI();
00080 if ($bookmark_gui->getMode() == 'tree') {
00081 $this->getTreeModeTemplates();
00082 } else {
00083 $this->getStandardTemplates();
00084 }
00085 $this->setTabs();
00086 $ret =& $this->ctrl->forwardCommand($bookmark_gui);
00087 break;
00088
00089
00090 case "ilpersonalprofilegui":
00091 $this->getStandardTemplates();
00092 $this->setTabs();
00093 include_once("classes/class.ilPersonalProfileGUI.php");
00094 $profile_gui = new ilPersonalProfileGUI();
00095 $ret =& $this->ctrl->forwardCommand($profile_gui);
00096 break;
00097
00098
00099 case "ilobjusergui":
00100 include_once("classes/class.ilObjUserGUI.php");
00101 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
00102 $ret =& $this->ctrl->forwardCommand($user_gui);
00103 break;
00104
00105
00106 case "ilpdnotesgui":
00107 $this->getStandardTemplates();
00108 $this->setTabs();
00109 include_once("classes/class.ilPDNotesGUI.php");
00110 $pd_notes_gui = new ilPDNotesGUI();
00111 $ret =& $this->ctrl->forwardCommand($pd_notes_gui);
00112 break;
00113
00114 case "illearningprogressgui":
00115 $this->getStandardTemplates();
00116 $this->setTabs();
00117
00118 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00119
00120 $new_gui =& new ilLearningProgressGUI(LP_MODE_PERSONAL_DESKTOP,0);
00121 $ret =& $this->ctrl->forwardCommand($new_gui);
00122
00123 break;
00124
00125
00126
00127
00128 default:
00129 $this->getStandardTemplates();
00130 $this->setTabs();
00131 $cmd = $this->ctrl->getCmd("show");
00132 $this->$cmd();
00133 break;
00134 }
00135 return true;
00136 }
00137
00141 function getStandardTemplates()
00142 {
00143
00144 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00145 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00146 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00147 }
00148
00152 function getTreeModeTemplates()
00153 {
00154
00155
00156 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00157 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00158 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00159 }
00160
00164 function show()
00165 {
00166
00167 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_personaldesktop.html");
00168
00169
00170 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00171 $this->tpl->setCurrentBlock("locator_item");
00172 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00173 $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this));
00174 $this->tpl->parseCurrentBlock();
00175
00176
00177 sendInfo();
00178
00179
00180 infoPanel();
00181
00182 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00183 $this->lng->txt("personal_desktop"));
00184 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00185
00186 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00187
00188
00189 $this->displaySelectedItems();
00190 $this->displaySystemMessages();
00191 $this->displayMails();
00192 $this->displayNotes();
00193 $this->displayUsersOnline();
00194 $this->displayBookmarks();
00195 $this->tpl->show();
00196 }
00197
00198
00202 function showUserProfile()
00203 {
00204
00205
00206
00207
00208 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00209 $this->tpl->setCurrentBlock("locator_item");
00210 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00211 $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this));
00212 $this->tpl->parseCurrentBlock();
00213
00214
00215 sendInfo();
00216
00217
00218 infoPanel();
00219
00220 $this->tpl->setCurrentBlock("header_image");
00221 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_pd_b.gif"));
00222 $this->tpl->parseCurrentBlock();
00223 $this->tpl->setCurrentBlock("adm_content");
00224 $this->tpl->setVariable("HEADER", $this->lng->txt("personal_desktop"));
00225
00226 include_once("classes/class.ilObjUserGUI.php");
00227 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
00228 $this->tpl->setVariable("ADM_CONTENT", $user_gui->getPublicProfile());
00229
00230 $this->tpl->show();
00231 }
00232
00236 function dropItem()
00237 {
00238 global $ilUser;
00239
00240 $ilUser->dropDesktopItem($_GET["item_ref_id"], $_GET["type"]);
00241 $this->show();
00242 }
00243
00247 function removeMember()
00248 {
00249 global $err_msg;
00250 if (strlen($err_msg) > 0)
00251 {
00252 $this->ilias->raiseError($this->lng->txt($err_msg),$this->ilias->error_obj->MESSAGE);
00253 }
00254 $this->show();
00255 }
00256
00260 function showSelectedItemsDetails()
00261 {
00262 global $ilUser;
00263
00264 $ilUser->writePref("pd_selected_items_details", "y");
00265 $this->show();
00266 }
00267
00271 function hideSelectedItemsDetails()
00272 {
00273 global $ilUser;
00274
00275 $ilUser->writePref("pd_selected_items_details", "n");
00276 $this->show();
00277 }
00278
00279
00283 function showUsersOnlineDetails()
00284 {
00285 global $ilUser;
00286
00287 $ilUser->writePref('show_users_online_details','y');
00288 $this->show();
00289 }
00290
00294 function hideUsersOnlineDetails()
00295 {
00296 global $ilUser;
00297
00298 $ilUser->writePref('show_users_online_details','n');
00299 $this->show();
00300 }
00301
00305 function showPDNotesDetails()
00306 {
00307 global $ilUser;
00308
00309 $ilUser->writePref('show_pd_notes_details','y');
00310 $this->show();
00311 }
00312
00316 function hidePDNotesDetails()
00317 {
00318 global $ilUser;
00319
00320 $ilUser->writePref('show_pd_notes_details','n');
00321 $this->show();
00322 }
00323
00327 function orderPDItemsByLocation()
00328 {
00329 global $ilUser;
00330
00331 $ilUser->writePref("pd_order_items", "location");
00332 $this->show();
00333 }
00334
00338 function orderPDItemsByType()
00339 {
00340 global $ilUser;
00341
00342 $ilUser->writePref("pd_order_items", "type");
00343 $this->show();
00344 }
00345
00346
00350 function displaySelectedItems()
00351 {
00352
00353 $html = "";
00354
00355 $html.= $this->getSelectedItemsBlockHTML();
00356
00357 if ($html != "")
00358 {
00359 $this->tpl->setCurrentBlock("selected_items");
00360 $this->tpl->setVariable("SELECTED_ITEMS", $html);
00361 $this->tpl->parseCurrentBlock();
00362 }
00363 $this->ctrl->clearParameters($this);
00364 }
00365
00366
00370 function getSelectedItemsBlockHTML()
00371 {
00372 global $ilUser, $rbacsystem, $objDefinition, $ilBench;
00373
00374 $tpl =& $this->newBlockTemplate();
00375
00376 switch ($ilUser->getPref("pd_order_items"))
00377 {
00378 case "location":
00379 $ok = $this->getSelectedItemsPerLocation($tpl);
00380 break;
00381
00382 default:
00383 $ok = $this->getSelectedItemsPerType($tpl);
00384 break;
00385 }
00386
00387
00388 if ($ok)
00389 {
00390 $tpl->setCurrentBlock("pd_header_row");
00391 $tpl->setVariable("PD_BLOCK_HEADER_CONTENT", $this->lng->txt("selected_items"));
00392 $tpl->setVariable("PD_BLOCK_HEADER_ID", "th_selected_items");
00393 if ($ilUser->getPref("pd_selected_items_details") == "y")
00394 {
00395 $tpl->setVariable("TXT_SEL_ITEMS_MODE", $this->lng->txt("hide_details"));
00396 $tpl->setVariable("LINK_SEL_ITEMS_MODE", $this->ctrl->getLinkTarget($this, "hideSelectedItemsDetails"));
00397 }
00398 else
00399 {
00400 $tpl->setVariable("TXT_SEL_ITEMS_MODE", $this->lng->txt("show_details"));
00401 $tpl->setVariable("LINK_SEL_ITEMS_MODE", $this->ctrl->getLinkTarget($this, "showSelectedItemsDetails"));
00402 }
00403 $tpl->parseCurrentBlock();
00404
00405
00406 $tpl->setCurrentBlock("footer_link");
00407 $tpl->setVariable("HREF_FOOT_LINK", $this->ctrl->getLinkTarget($this, "orderPDItemsByType"));
00408 $tpl->setVariable("TXT_FOOT_LINK", $this->lng->txt("by_type"));
00409 $tpl->parseCurrentBlock();
00410 $tpl->touchBlock("footer_item");
00411
00412 $tpl->touchBlock("footer_separator");
00413 $tpl->touchBlock("footer_item");
00414
00415
00416 $tpl->setCurrentBlock("footer_link");
00417 $tpl->setVariable("HREF_FOOT_LINK", $this->ctrl->getLinkTarget($this, "orderPDItemsByLocation"));
00418 $tpl->setVariable("TXT_FOOT_LINK", $this->lng->txt("by_location"));
00419 $tpl->parseCurrentBlock();
00420 $tpl->touchBlock("footer_item");
00421
00422 $tpl->setCurrentBlock("block_footer");
00423 $tpl->parseCurrentBlock();
00424 }
00425
00426 return $tpl->get();
00427 }
00428
00432 function getSelectedItemsPerType(&$tpl)
00433 {
00434 global $ilUser, $rbacsystem, $objDefinition, $ilBench;
00435
00436 $output = false;
00437 $types = array(
00438 array("title" => $this->lng->txt("objs_cat"), "types" => "cat"),
00439 array("title" => $this->lng->txt("objs_fold"), "types" => "fold"),
00440 array("title" => $this->lng->txt("objs_crs"), "types" => "crs"),
00441 array("title" => $this->lng->txt("objs_grp"), "types" => "grp"),
00442 array("title" => $this->lng->txt("objs_chat"), "types" => "chat"),
00443 array("title" => $this->lng->txt("objs_frm"), "types" => "frm"),
00444 array("title" => $this->lng->txt("learning_resources"),"types" => array("lm", "htlm", "sahs", "dbk")),
00445 array("title" => $this->lng->txt("objs_glo"), "types" => "glo"),
00446 array("title" => $this->lng->txt("objs_file"), "types" => "file"),
00447 array("title" => $this->lng->txt("objs_webr"), "types" => "webr"),
00448 array("title" => $this->lng->txt("objs_exc"), "types" => "exc"),
00449 array("title" => $this->lng->txt("objs_tst"), "types" => "tst"),
00450 array("title" => $this->lng->txt("objs_svy"), "types" => "svy"),
00451 array("title" => $this->lng->txt("objs_mep"), "types" => "mep"),
00452 array("title" => $this->lng->txt("objs_qpl"), "types" => "qpl"),
00453 array("title" => $this->lng->txt("objs_spl"), "types" => "spl"),
00454 array("title" => $this->lng->txt("objs_icrs"), "types" => "icrs"),
00455 array("title" => $this->lng->txt("objs_icla"), "types" => "icla")
00456 );
00457
00458 foreach ($types as $type)
00459 {
00460 $type = $type["types"];
00461 $title = $type["title"];
00462
00463 $items = $this->ilias->account->getDesktopItems($type);
00464 $item_html = array();
00465
00466 if ($ilUser->getPref("pd_selected_items_details") != "n")
00467 {
00468 $rel_header = (is_array($type))
00469 ? "th_lres"
00470 : "th_".$type;
00471 }
00472
00473 if (count($items) > 0)
00474 {
00475 $tstCount = 0;
00476 $unsetCount = 0;
00477 $progressCount = 0;
00478 $unsetFlag = 0;
00479 $progressFlag = 0;
00480 $completedFlag = 0;
00481 if (strcmp($a_type, "tst") == 0) {
00482 $items = $this->multiarray_sort($items, "used_tries; title");
00483 foreach ($items as $tst_item) {
00484 if (!isset($tst_item["used_tries"])) {
00485 $unsetCount++;
00486 }
00487 elseif ($tst_item["used_tries"] == 0) {
00488 $progressCount++;
00489 }
00490 }
00491 }
00492
00493 foreach($items as $item)
00494 {
00495
00496 if ($cur_obj_type != $item["type"])
00497 {
00498 $class = $objDefinition->getClassName($item["type"]);
00499 $location = $objDefinition->getLocation($item["type"]);
00500 $full_class = "ilObj".$class."ListGUI";
00501 include_once($location."/class.".$full_class.".php");
00502 $item_list_gui = new $full_class();
00503 $item_list_gui->enableDelete(false);
00504 $item_list_gui->enableCut(false);
00505 $item_list_gui->enablePayment(false);
00506 $item_list_gui->enableLink(false);
00507 $item_list_gui->enableInfoScreen(false);
00508 if ($ilUser->getPref("pd_selected_items_details") != "y")
00509 {
00510 $item_list_gui->enableDescription(false);
00511 $item_list_gui->enableProperties(false);
00512 $item_list_gui->enablePreconditions(false);
00513 }
00514 }
00515
00516 $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
00517
00518 $html = $item_list_gui->getListItemHTML($item["ref_id"],
00519 $item["obj_id"], $item["title"], $item["description"]);
00520 $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
00521 if ($html != "")
00522 {
00523 $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"],
00524 "item_obj_id" => $item["obj_id"]);
00525 }
00526 }
00527
00528
00529 if (count($item_html) > 0)
00530 {
00531
00532 if ($ilUser->getPref("pd_selected_items_details") == "y")
00533 {
00534 if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00535 {
00536 $this->addHeaderRow($tpl, $type, false);
00537 }
00538 else
00539 {
00540 $this->addHeaderRow($tpl, $type);
00541 }
00542 $this->resetRowType();
00543 }
00544
00545
00546 foreach($item_html as $item)
00547 {
00548 if ($ilUser->getPref("pd_selected_items_details") != "y" ||
00549 $this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00550 {
00551 $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $type, $rel_header);
00552 }
00553 else
00554 {
00555 $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], "", $rel_header);
00556 }
00557 $output = true;
00558 }
00559 }
00560 }
00561 }
00562
00563 return $output;
00564 }
00565
00569 function getSelectedItemsPerLocation(&$tpl)
00570 {
00571 global $ilUser, $rbacsystem, $objDefinition, $ilBench;
00572
00573 $output = false;
00574
00575 $items = $this->ilias->account->getDesktopItems();
00576 $item_html = array();
00577
00578 if (count($items) > 0)
00579 {
00580 foreach($items as $item)
00581 {
00582
00583
00584 if ($cur_obj_type != $item["type"])
00585 {
00586 $item_list_gui =& $this->getItemListGUI($item["type"]);
00587
00588 $item_list_gui->enableDelete(false);
00589 $item_list_gui->enableCut(false);
00590 $item_list_gui->enablePayment(false);
00591 $item_list_gui->enableLink(false);
00592 $item_list_gui->enableInfoScreen(false);
00593 if ($ilUser->getPref("pd_selected_items_details") != "y")
00594 {
00595
00596 $item_list_gui->enableDescription(false);
00597 $item_list_gui->enableProperties(false);
00598 $item_list_gui->enablePreconditions(false);
00599 }
00600 }
00601
00602 $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
00603
00604 $html = $item_list_gui->getListItemHTML($item["ref_id"],
00605 $item["obj_id"], $item["title"], $item["description"]);
00606 $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
00607 if ($html != "")
00608 {
00609 $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"],
00610 "item_obj_id" => $item["obj_id"], "parent_ref" => $item["parent_ref"],
00611 "type" => $item["type"]);
00612 }
00613 }
00614
00615
00616 if (count($item_html) > 0)
00617 {
00618 $cur_parent_ref = 0;
00619
00620
00621 foreach($item_html as $item)
00622 {
00623
00624 if ($cur_parent_ref != $item["parent_ref"])
00625 {
00626 if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00627 {
00628 $this->addParentRow($tpl, $item["parent_ref"], false);
00629 }
00630 else
00631 {
00632 $this->addParentRow($tpl, $item["parent_ref"]);
00633 }
00634 $this->resetRowType();
00635 $cur_parent_ref = $item["parent_ref"];
00636 }
00637
00638
00639
00640
00641 $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $item["type"],
00642 "th_".$cur_parent_ref);
00643
00644
00645
00646
00647
00648 $output = true;
00649 }
00650 }
00651 }
00652
00653 return $output;
00654 }
00655
00659 function &getItemListGUI($a_type)
00660 {
00661 global $objDefinition;
00662
00663 if (!is_object($this->item_list_guis[$a_type]))
00664 {
00665 $class = $objDefinition->getClassName($a_type);
00666 $location = $objDefinition->getLocation($a_type);
00667 $full_class = "ilObj".$class."ListGUI";
00668
00669 include_once($location."/class.".$full_class.".php");
00670 $item_list_gui = new $full_class();
00671 $this->item_list_guis[$a_type] =& $item_list_gui;
00672 }
00673 else
00674 {
00675 $item_list_gui =& $this->item_list_guis[$a_type];
00676 }
00677 return $item_list_gui;
00678 }
00679
00687 function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
00688 {
00689 if (!is_array($a_type))
00690 {
00691 $icon = ilUtil::getImagePath("icon_".$a_type.".gif");
00692 $title = $this->lng->txt("objs_".$a_type);
00693 $header_id = "th_".$a_type;
00694 }
00695 else
00696 {
00697 $icon = ilUtil::getImagePath("icon_lm.gif");
00698 $title = $this->lng->txt("learning_resources");
00699 $header_id = "th_lres";
00700 }
00701 if ($a_show_image)
00702 {
00703 $a_tpl->setCurrentBlock("container_header_row_image");
00704 $a_tpl->setVariable("HEADER_IMG", $icon);
00705 $a_tpl->setVariable("HEADER_ALT", $title);
00706 }
00707 else
00708 {
00709 $a_tpl->setCurrentBlock("container_header_row");
00710 }
00711
00712 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
00713 $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id);
00714 $a_tpl->parseCurrentBlock();
00715 $a_tpl->touchBlock("container_row");
00716 }
00717
00725 function addParentRow(&$a_tpl, $a_ref_id, $a_show_image = true)
00726 {
00727 global $tree;
00728
00729 $par_id = ilObject::_lookupObjId($a_ref_id);
00730 $type = ilObject::_lookupType($par_id);
00731 if (!in_array($type, array("lm", "dbk", "sahs", "htlm")))
00732 {
00733 $icon = ilUtil::getImagePath("icon_".$type.".gif");
00734 }
00735 else
00736 {
00737 $icon = ilUtil::getImagePath("icon_lm.gif");
00738 }
00739
00740
00741 if ($this->ilias->getSetting("custom_icons") &&
00742 in_array($type, array("cat","grp","crs")))
00743 {
00744 require_once("classes/class.ilContainer.php");
00745 if (($path = ilContainer::_lookupIconPath($par_id, "small")) != "")
00746 {
00747 $icon = $path;
00748 }
00749 }
00750
00751 if ($tree->getRootId() != $par_id)
00752 {
00753 $title = ilObject::_lookupTitle($par_id);
00754 }
00755 else
00756 {
00757 $title = $this->lng->txt("repository");
00758 }
00759
00760 $item_list_gui =& $this->getItemListGUI($type);
00761
00762 $item_list_gui->enableDelete(false);
00763 $item_list_gui->enableCut(false);
00764 $item_list_gui->enablePayment(false);
00765 $item_list_gui->enableLink(false);
00766 $item_list_gui->enableDescription(false);
00767 $item_list_gui->enableProperties(false);
00768 $item_list_gui->enablePreconditions(false);
00769 $item_list_gui->enablePath(true);
00770 $item_list_gui->enableCommands(false);
00771 $html = $item_list_gui->getListItemHTML($a_ref_id,
00772 $par_id, $title, "");
00773
00774 if ($a_show_image)
00775 {
00776 $a_tpl->setCurrentBlock("container_header_row_image");
00777 $a_tpl->setVariable("HEADER_IMG", $icon);
00778 $a_tpl->setVariable("HEADER_ALT", $title);
00779 }
00780 else
00781 {
00782 $a_tpl->setCurrentBlock("container_header_row");
00783 }
00784
00785 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $html);
00786 $a_tpl->setVariable("BLOCK_HEADER_ID", "th_".$a_ref_id);
00787 $a_tpl->parseCurrentBlock();
00788 $a_tpl->touchBlock("container_row");
00789 }
00790
00798 function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
00799 $a_image_type = "", $a_related_header = "")
00800 {
00801 $this->cur_row_type = ($this->cur_row_type == "row_type_1")
00802 ? "row_type_2"
00803 : "row_type_1";
00804 $a_tpl->touchBlock($this->cur_row_type);
00805
00806 if ($a_image_type != "")
00807 {
00808 if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs")))
00809 {
00810 $icon = ilUtil::getImagePath("icon_".$a_image_type.".gif");
00811 $title = $this->lng->txt("obj_".$a_image_type);
00812 }
00813 else
00814 {
00815 $icon = ilUtil::getImagePath("icon_lm.gif");
00816 $title = $this->lng->txt("learning_resource");
00817 }
00818
00819
00820 if ($this->ilias->getSetting("custom_icons") &&
00821 in_array($a_image_type, array("cat","grp","crs")))
00822 {
00823 require_once("classes/class.ilContainer.php");
00824 if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
00825 {
00826 $icon = $path;
00827 }
00828 }
00829
00830 $a_tpl->setCurrentBlock("block_row_image");
00831 $a_tpl->setVariable("ROW_IMG", $icon);
00832 $a_tpl->setVariable("ROW_ALT", $title);
00833 $a_tpl->parseCurrentBlock();
00834 }
00835 else
00836 {
00837 $a_tpl->setVariable("ROW_NBSP", " ");
00838 }
00839 $a_tpl->setCurrentBlock("container_standard_row");
00840 $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
00841 $rel_headers = ($a_related_header != "")
00842 ? "th_selected_items ".$a_related_header
00843 : "th_selected_items";
00844 $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
00845 $a_tpl->parseCurrentBlock();
00846 $a_tpl->touchBlock("container_row");
00847 }
00848
00849 function resetRowType()
00850 {
00851 $this->cur_row_type = "";
00852 }
00853
00860 function &newBlockTemplate()
00861 {
00862 $tpl = new ilTemplate ("tpl.pd_list_block.html", true, true);
00863 $this->cur_row_type = "";
00864 return $tpl;
00865 }
00866
00867
00868 function displaySystemMessages()
00869 {
00870
00871 $umail = new ilMail($_SESSION["AccountId"]);
00872 $smails = $umail->getMailsOfFolder(0);
00873
00874 if(count($smails))
00875 {
00876
00877 $counter = 1;
00878 foreach ($smails as $mail)
00879 {
00880
00881 require_once "classes/class.ilMailbox.php";
00882
00883 $mbox = new ilMailbox($_SESSION["AccountId"]);
00884 $inbox = $mbox->getInboxFolder();
00885
00886 $this->tpl->setCurrentBlock("tbl_system_msg_row");
00887 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow2' : 'tblrow1');
00888
00889
00890 $user = new ilObjUser($mail["sender_id"]);
00891
00892 if(!($fullname = $user->getFullname()))
00893 {
00894 $fullname = $this->lng->txt("unknown");
00895 }
00896
00897
00898 $this->tpl->setVariable("MAILCLASS", $mail["m_status"] == 'read' ? 'mailread' : 'mailunread');
00899 $this->tpl->setVariable("MAIL_FROM", $fullname);
00900 $this->tpl->setVariable("MAIL_SUBJ", $mail["m_subject"]);
00901 $this->tpl->setVariable("MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00902 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00903 $this->tpl->setVariable("MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00904 $this->tpl->parseCurrentBlock();
00905 }
00906 $this->tpl->setCurrentBlock("tbl_system_msg");
00907
00908 $this->tpl->setVariable("SYSTEM_MAILS",$this->lng->txt("mail_system"));
00909
00910 $this->tpl->setVariable("TXT_SENDER", $this->lng->txt("sender"));
00911 $this->tpl->setVariable("TXT_SUBJECT", $this->lng->txt("subject"));
00912 $this->tpl->setVariable("TXT_DATETIME",$this->lng->txt("date")."/".$this->lng->txt("time"));
00913 $this->tpl->parseCurrentBlock();
00914 }
00915 }
00916
00917
00918
00924 function displayMails()
00925 {
00926
00927
00928
00929 include_once "./include/inc.header.php";
00930 include_once "./include/inc.mail.php";
00931 include_once "classes/class.ilObjUser.php";
00932 include_once "classes/class.ilMailbox.php";
00933 include_once "classes/class.ilMail.php";
00934
00935
00936
00937 $umail = new ilMail($_SESSION["AccountId"]);
00938 $mbox = new ilMailBox($_SESSION["AccountId"]);
00939 $inbox = $mbox->getInboxFolder();
00940
00941
00942 $mail_data = $umail->getMailsOfFolder($inbox);
00943 $mail_counter = $umail->getMailCounterData();
00944 $unreadmails = 0;
00945
00946
00947 foreach ($mail_data as $mail)
00948 {
00949
00950 if($mail["m_status"]== 'unread')
00951 {
00952
00953
00954 $this->tpl->setCurrentBlock("tbl_mails");
00955 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow1' : 'tblrow2');
00956 $this->tpl->setVariable("NEW_MAIL",$this->lng->txt("email"));
00957
00958
00959 $user = new ilObjUser($mail["sender_id"]);
00960
00961 if(!($fullname = $user->getFullname()))
00962 {
00963 $fullname = $this->lng->txt("unknown");
00964 }
00965
00966
00967 $this->tpl->setCurrentBlock("tbl_mails");
00968
00969 $this->tpl->setVariable("NEW_TXT_SENDER", $this->lng->txt("sender"));
00970 $this->tpl->setVariable("NEW_TXT_SUBJECT", $this->lng->txt("subject"));
00971 $this->tpl->setVariable("NEW_TXT_DATE",$this->lng->txt("date")."/".$this->lng->txt("time"));
00972
00973
00974 $this->tpl->setCurrentBlock("tbl_mails_row");
00975 $this->tpl->setVariable("NEW_MAIL_FROM", $fullname);
00976 $this->tpl->setVariable("NEW_MAIL_FROM_LOGIN", $user->getLogin());
00977 $this->tpl->setVariable("NEW_MAILCLASS", $mail["status"] == 'read' ? 'mailread' : 'mailunread');
00978 $this->tpl->setVariable("NEW_MAIL_SUBJ", $mail["m_subject"]);
00979 $this->tpl->setVariable("NEW_MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00980 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00981 $this->tpl->setVariable("NEW_MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00982 $this->tpl->setVariable("IMG_SENDER", $user->getPersonalPicturePath("xxsmall"));
00983 $this->tpl->setVariable("ALT_SENDER", $user->getLogin());
00984 $this->tpl->parseCurrentBlock();
00985
00986 }
00987 }
00988 }
00989
00990
00994 function displayNotes()
00995 {
00996 global $ilias;
00997
00998 if ($ilias->account->getPref("show_notes") == "n")
00999 {
01000 return;
01001 }
01002
01003 include_once("Services/Notes/classes/class.ilNoteGUI.php");
01004 $note_gui = new ilNoteGUI(0,0,"");
01005 $note_gui->enableTargets();
01006 $html = $note_gui->getPDOverviewNoteListHTML();
01007 $this->tpl->setVariable("NOTES", $html);
01008 }
01009
01013 function displayUsersOnline()
01014 {
01015 global $ilias;
01016
01017 $users_online_pref = $ilias->account->getPref("show_users_online");
01018 if ($users_online_pref != "y" && $users_online_pref != "associated")
01019 {
01020
01021 return;
01022 }
01023
01024 $this->tpl->setVariable("TXT_USERS_ONLINE",$this->lng->txt("users_online"));
01025
01026 if ($users_online_pref == "associated")
01027 {
01028 $users = ilUtil::getAssociatedUsersOnline($ilias->account->getId());
01029 } else {
01030 $users = ilUtil::getUsersOnline();
01031 }
01032
01033 $num = 0;
01034
01035 foreach ($users as $user_id => $user)
01036 {
01037 if ($user_id != ANONYMOUS_USER_ID)
01038 {
01039 $num++;
01040 }
01041 else
01042 {
01043 $visitors = $user["num"];
01044 }
01045 }
01046
01047
01048 if (empty($visitors) || $users_online_pref == "associated")
01049 {
01050 $visitor_text = "";
01051 }
01052 elseif ($visitors == "1")
01053 {
01054 $visitor_text = "1 ".$this->lng->txt("visitor");
01055 }
01056 else
01057 {
01058 $visitor_text = $visitors." ".$this->lng->txt("visitors");
01059 }
01060
01061
01062
01063 $showdetails = $ilias->account->getPref('show_users_online_details') == 'y';
01064
01065
01066 if ($num > 0)
01067 {
01068 $user_kind = ($users_online_pref == "associated") ? "associated_user" : "registered_user";
01069 if ($num == 1)
01070 {
01071 $user_list = $num." ".$this->lng->txt($user_kind);
01072 }
01073
01074 else
01075 {
01076 $user_list = $num." ".$this->lng->txt($user_kind."s");
01077 }
01078
01079
01080 if ($showdetails)
01081 {
01082 $text = $this->lng->txt("hide_details");
01083 $cmd = "hideUsersOnlineDetails";
01084 }
01085 else
01086 {
01087 $text = $this->lng->txt("show_details");
01088 $cmd = "showUsersOnlineDetails";
01089 }
01090
01091
01092
01093 if (!empty($visitor_text))
01094 {
01095 $user_list .= " ".$this->lng->txt("and")." ".$visitor_text;
01096 }
01097
01098
01099 }
01100 else
01101 {
01102 $user_list = $visitor_text;
01103 }
01104
01105 $this->tpl->setVariable("USER_LIST",$user_list);
01106 $this->tpl->setVariable("LINK_USER_DETAILS",
01107 $this->ctrl->getLinkTarget($this, $cmd));
01108 $this->tpl->setVariable("TXT_USER_DETAILS", $text);
01109
01110
01111 if ($showdetails)
01112 {
01113 $z = 0;
01114
01115 foreach ($users as $user_id => $user)
01116 {
01117 if ($user_id != ANONYMOUS_USER_ID)
01118 {
01119 $rowCol = ilUtil::switchColor($z,"tblrow1","tblrow2");
01120 $login_time = ilFormat::dateDiff(ilFormat::datetime2unixTS($user["last_login"]),time());
01121
01122
01123 if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID and $_SESSION["AccountId"] != $user_id)
01124 {
01125 $this->tpl->setCurrentBlock("mailto_link");
01126
01127 $this->tpl->setVariable("TXT_MAIL",$this->lng->txt("mail"));
01128 $this->tpl->setVariable("USR_LOGIN",$user["login"]);
01129 $this->tpl->parseCurrentBlock();
01130 }
01131
01132
01133
01134 $user_obj = new ilObjUser($user_id);
01135 $q = "SELECT value FROM usr_pref WHERE usr_id='".$user_id."' AND keyword='public_profile' AND value='y'";
01136 $r = $this->ilias->db->query($q);
01137
01138
01139 include_once './chat/classes/class.ilChatServerConfig.php';
01140 if(ilChatServerConfig::_isActive())
01141 {
01142 if(!$this->__showActiveChatsOfUser($user_id))
01143 {
01144
01145 $this->__showChatInvitation($user_id);
01146 }
01147 }
01148
01149 if ($r->numRows())
01150 {
01151 $this->tpl->setCurrentBlock("profile_link");
01152
01153 $this->tpl->setVariable("TXT_VIEW",$this->lng->txt("profile"));
01154 $this->ctrl->setParameter($this, "user", $user_id);
01155 $this->tpl->setVariable("LINK_PROFILE",
01156 $this->ctrl->getLinkTarget($this, "showUserProfile"));
01157 $this->tpl->setVariable("USR_ID",$user_id);
01158 $this->tpl->parseCurrentBlock();
01159 }
01160
01161
01162 $this->tpl->setCurrentBlock("usr_image");
01163 $this->tpl->setVariable("USR_IMAGE",
01164 $user_obj->getPersonalPicturePath("xxsmall"));
01165 $this->tpl->setVariable("USR_ALT", $this->lng->txt("personal_picture"));
01166 $this->tpl->parseCurrentBlock();
01167
01168 $this->tpl->setCurrentBlock("tbl_users_row");
01169 $this->tpl->setVariable("ROWCOL",$rowCol);
01170 $this->tpl->setVariable("USR_LOGIN",$user["login"]);
01171 $this->tpl->setVariable("USR_FULLNAME",ilObjUser::setFullname($user["title"],$user["firstname"],$user["lastname"]));
01172 $this->tpl->setVariable("USR_LOGIN_TIME",$login_time);
01173
01174 $this->tpl->parseCurrentBlock();
01175
01176 $z++;
01177 }
01178 }
01179
01180 if ($z > 0)
01181 {
01182 $this->tpl->setCurrentBlock("tbl_users_header");
01183 $this->tpl->setVariable("TXT_USR",ucfirst($this->lng->txt("user")));
01184 $this->tpl->setVariable("TXT_USR_LOGIN_TIME",ucfirst($this->lng->txt("login_time")));
01185 $this->tpl->parseCurrentBlock();
01186 }
01187 }
01188
01189 $this->ctrl->clearParameters($this);
01190 }
01191
01192
01196 function displayBookmarks()
01197 {
01198 include_once("classes/class.ilBookmarkAdministrationGUI.php");
01199 $bookmark_gui = new ilBookmarkAdministrationGUI();
01200 $html = $bookmark_gui->getPDBookmarkListHTML();
01201 $this->tpl->setVariable("BOOKMARKS", $html);
01202 }
01203
01214 function multiarray_sort ($array, $key_sort)
01215 {
01216 if ($array) {
01217 $key_sorta = explode(";", $key_sort);
01218
01219 $multikeys = array_keys($array);
01220 $keys = array_keys($array[$multikeys[0]]);
01221
01222 for($m=0; $m < count($key_sorta); $m++) {
01223 $nkeys[$m] = trim($key_sorta[$m]);
01224 }
01225 $n += count($key_sorta);
01226
01227 for($i=0; $i < count($keys); $i++){
01228 if(!in_array($keys[$i], $key_sorta)) {
01229 $nkeys[$n] = $keys[$i];
01230 $n += "1";
01231 }
01232 }
01233
01234 for($u=0;$u<count($array); $u++) {
01235 $arr = $array[$multikeys[$u]];
01236 for($s=0; $s<count($nkeys); $s++) {
01237 $k = $nkeys[$s];
01238 $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
01239 }
01240 }
01241 sort($output);
01242 return $output;
01243 }
01244 }
01245
01249 function setTabs()
01250 {
01251 $this->tpl->addBlockFile("TABS", "tabs", "tpl.tabs.html");
01252
01253 $script_name = basename($_SERVER["SCRIPT_NAME"]);
01254
01255 $command = $_GET["cmd"] ? $_GET["cmd"] : "";
01256
01257 if (ereg("whois",$command) or $script_name == "profile.php")
01258 {
01259 $who_is_online = true;
01260 }
01261
01262
01263
01264
01265 $inc_type = (strtolower($_GET["baseClass"]) == "ilpersonaldesktopgui" &&
01266 (strtolower($_GET["cmdClass"]) == "ilpersonaldesktopgui" ||
01267 $_GET["cmdClass"] == ""))
01268 ? "tabactive"
01269 : "tabinactive";
01270 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTarget($this), $this->lng->txt("overview"));
01271
01272
01273 $inc_type = (strtolower($_GET["cmdClass"]) == "ilpersonalprofilegui")
01274 ? "tabactive"
01275 : "tabinactive";
01276 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPersonalProfileGUI"),
01277 $this->lng->txt("personal_profile"));
01278
01279 if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
01280 {
01281
01282 if ($this->ilias->getSetting("enable_calendar"))
01283 {
01284 $inc_type = ($script_name == "dateplaner.php")
01285 ? "tabactive"
01286 : "tabinactive";
01287 $inhalt1[] = array($inc_type,"dateplaner.php",$this->lng->txt("calendar"));
01288 }
01289
01290
01291 $inc_type = (strtolower($_GET["cmdClass"]) == "ilpdnotesgui" ||
01292 strtolower($_GET["cmdClass"]) == "ilnotegui")
01293 ? "tabactive"
01294 : "tabinactive";
01295 $inhalt1[] = array($inc_type,
01296 $this->ctrl->getLinkTargetByClass("ilpdnotesgui"),
01297 $this->lng->txt("private_notes"));
01298
01299
01300 $inc_type = (strtolower($_GET["cmdClass"]) == "ilbookmarkadministrationgui")
01301 ? "tabactive"
01302 : "tabinactive";
01303 $inhalt1[] = array($inc_type,
01304 $this->ctrl->getLinkTargetByClass("ilbookmarkadministrationgui"),
01305 $this->lng->txt("bookmarks"));
01306
01307 }
01308
01309
01310
01311 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
01312 if (ilObjUserTracking::_enabledLearningProgress())
01313 {
01314 $cmd_classes = array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui');
01315 $inc_type = in_array(strtolower($_GET['cmdClass']),$cmd_classes) ? 'tabactive' : 'tabinactive';
01316
01317 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"),
01318 $this->lng->txt("learning_progress"));
01319 }
01320
01321 include_once "./payment/classes/class.ilPaymentVendors.php";
01322 include_once "./payment/classes/class.ilPaymentTrustees.php";
01323 include_once "./payment/classes/class.ilPaymentShoppingCart.php";
01324 include_once "./payment/classes/class.ilPaymentBookings.php";
01325
01326 if(ilPaymentShoppingCart::_hasEntries($this->ilias->account->getId()) or
01327 ilPaymentBookings::_getCountBookingsByCustomer($this->ilias->account->getId()))
01328
01329 {
01330 $this->lng->loadLanguageModule('payment');
01331 $inhalt1[] = array('tabinactive',"./payment/payment.php", $this->lng->txt('paya_shopping_cart'));
01332 }
01333 if(ilPaymentVendors::_isVendor($this->ilias->account->getId()) or
01334 ilPaymentTrustees::_hasAccess($this->ilias->account->getId()))
01335 {
01336 $this->lng->loadLanguageModule('payment');
01337 $inhalt1[] = array('tabinactive',"./payment/payment_admin.php",$this->lng->txt('paya_header'));
01338 }
01339
01340 for ( $i=0; $i<sizeof($inhalt1); $i++)
01341 {
01342 if ($inhalt1[$i][1] != "")
01343 { $this->tpl->setCurrentBlock("tab");
01344 $this->tpl->setVariable("TAB_TYPE",$inhalt1[$i][0]);
01345 $this->tpl->setVariable("TAB_LINK",$inhalt1[$i][1]);
01346 $this->tpl->setVariable("TAB_TEXT",$inhalt1[$i][2]);
01347 $this->tpl->setVariable("TAB_TARGET",$inhalt1[$i][3]);
01348 $this->tpl->parseCurrentBlock();
01349 }
01350 }
01351
01352 $this->tpl->setCurrentBlock("tabs");
01353 $this->tpl->parseCurrentBlock();
01354 }
01355
01359 function jumpToProfile()
01360 {
01361 $this->ctrl->redirectByClass("ilpersonalprofilegui");
01362 }
01363
01367 function jumpToBookmarks()
01368 {
01369 $this->ctrl->redirectByClass("ilbookmarkadministrationgui");
01370 }
01371
01375 function jumpToNotes()
01376 {
01377 $this->ctrl->redirectByClass("ilpdnotesgui");
01378 }
01379
01383 function jumpToLP()
01384 {
01385 $this->ctrl->redirectByClass("illearningprogressgui");
01386 }
01387
01388
01389 function __showActiveChatsOfUser($a_usr_id)
01390 {
01391 global $rbacsystem;
01392
01393
01394 include_once './chat/classes/class.ilChatRoom.php';
01395
01396 $chat_id = ilChatRoom::_isActive($a_usr_id);
01397 foreach(ilObject::_getAllReferences($chat_id) as $ref_id)
01398 {
01399 if($rbacsystem->checkAccess('read',$ref_id))
01400 {
01401 $this->tpl->setCurrentBlock("chat_info");
01402 $this->tpl->setVariable("CHAT_ACTIVE_IN",$this->lng->txt('chat_active_in'));
01403 $this->tpl->setVariable("CHAT_LINK","chat/chat.php?ref_id=".$ref_id."&room_id=0");
01404 $this->tpl->setVariable("CHAT_TITLE",ilObject::_lookupTitle($chat_id));
01405 $this->tpl->parseCurrentBlock();
01406
01407 return true;
01408 }
01409 }
01410 return false;
01411 }
01412
01413 function __showChatInvitation($a_usr_id)
01414 {
01415 global $rbacsystem,$ilUser;
01416
01417 include_once './chat/classes/class.ilObjChat.php';
01418
01419 if($a_usr_id == $ilUser->getId())
01420 {
01421 return false;
01422 }
01423
01424 if($rbacsystem->checkAccess('read',ilObjChat::_getPublicChatRefId())
01425 and $rbacsystem->checkAccessOfUser($a_usr_id,'read',ilObjChat::_getPublicChatRefId()))
01426 {
01427 $this->tpl->setCurrentBlock("chat_link");
01428 $this->tpl->setVariable("TXT_CHAT_INVITE",$this->lng->txt('chat_invite'));
01429 $this->tpl->setVariable("CHAT_LINK",'chat/chat.php?ref_id='.ilObjChat::_getPublicChatRefId().
01430 '&usr_id='.$a_usr_id.'&cmd=invitePD');
01431 $this->tpl->parseCurrentBlock();
01432
01433 return true;
01434 }
01435 return false;
01436 }
01437 }
01438 ?>