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 './Services/User/classes/class.ilObjUser.php';
00025 include_once "Services/Mail/classes/class.ilMail.php";
00026
00027
00039 class ilPersonalDesktopGUI
00040 {
00041 var $tpl;
00042 var $lng;
00043 var $ilias;
00044
00045 var $cmdClass = '';
00046
00050 function ilPersonalDesktopGUI()
00051 {
00052 global $ilias, $tpl, $lng, $rbacsystem, $ilCtrl, $ilMainMenu, $ilUser, $tree;
00053
00054
00055 $this->tpl =& $tpl;
00056 $this->lng =& $lng;
00057 $this->ilias =& $ilias;
00058 $this->ctrl =& $ilCtrl;
00059
00060 $ilCtrl->setContext($ilUser->getId(),
00061 "user");
00062
00063 $ilMainMenu->setActive("desktop");
00064 $this->lng->loadLanguageModule("pdesk");
00065
00066
00067 if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
00068 {
00069 $this->ilias->raiseError($this->lng->txt("msg_not_available_for_anon"),$this->ilias->error_obj->MESSAGE);
00070 }
00071 $this->cmdClass = $_GET['cmdClass'];
00072
00073 $tree->useCache(true);
00074 }
00075
00079 function &executeCommand()
00080 {
00081 global $ilUser, $ilSetting;
00082
00083 $next_class = $this->ctrl->getNextClass();
00084 $this->ctrl->setReturn($this, "show");
00085
00086
00087 if ($ilUser->getProfileIncomplete() && $next_class != "ilpersonalprofilegui")
00088 {
00089 $this->ctrl->redirectByClass("ilpersonalprofilegui");
00090 }
00091
00092
00093 if($_GET['PDHistory'])
00094 {
00095 $next_class = $this->__loadNextClass();
00096 }
00097 $this->__storeLastClass($next_class);
00098
00099 switch($next_class)
00100 {
00101
00102 case "ilfeedbackgui":
00103 $this->getStandardTemplates();
00104 $this->setTabs();
00105 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00106 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00107 $this->lng->txt("personal_desktop"));
00108
00109 include_once("Services/Feedback/classes/class.ilFeedbackGUI.php");
00110 $feedback_gui = new ilFeedbackGUI();
00111 $ret =& $this->ctrl->forwardCommand($feedback_gui);
00112 break;
00113
00114 case "ilbookmarkadministrationgui":
00115 if ($ilSetting->get('disable_bookmarks'))
00116 {
00117 ilUtil::sendInfo($this->lng->txt('permission_denied'), true);
00118 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
00119 return;
00120 }
00121
00122 include_once("./Services/PersonalDesktop/classes/class.ilBookmarkAdministrationGUI.php");
00123 $bookmark_gui = new ilBookmarkAdministrationGUI();
00124 if ($bookmark_gui->getMode() == 'tree') {
00125 $this->getTreeModeTemplates();
00126 } else {
00127 $this->getStandardTemplates();
00128 }
00129 $this->setTabs();
00130 $ret =& $this->ctrl->forwardCommand($bookmark_gui);
00131 break;
00132
00133
00134 case "ilpersonalprofilegui":
00135 $this->getStandardTemplates();
00136 $this->setTabs();
00137 include_once("./Services/User/classes/class.ilPersonalProfileGUI.php");
00138 $profile_gui = new ilPersonalProfileGUI();
00139 $ret =& $this->ctrl->forwardCommand($profile_gui);
00140 break;
00141
00142
00143 case "ilobjusergui":
00144 include_once('./Services/User/classes/class.ilObjUserGUI.php');
00145 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
00146 $ret =& $this->ctrl->forwardCommand($user_gui);
00147 break;
00148
00149
00150 case "ilpdnotesgui":
00151 if ($ilSetting->get('disable_notes'))
00152 {
00153 ilUtil::sendInfo($this->lng->txt('permission_denied'), true);
00154 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
00155 return;
00156 }
00157
00158 $this->getStandardTemplates();
00159 $this->setTabs();
00160 include_once("classes/class.ilPDNotesGUI.php");
00161 $pd_notes_gui = new ilPDNotesGUI();
00162 $ret =& $this->ctrl->forwardCommand($pd_notes_gui);
00163 break;
00164
00165
00166 case "ilpdnewsgui":
00167 $this->getStandardTemplates();
00168 $this->setTabs();
00169 include_once("./Services/News/classes/class.ilPDNewsGUI.php");
00170 $pd_news_gui = new ilPDNewsGUI();
00171 $ret =& $this->ctrl->forwardCommand($pd_news_gui);
00172 break;
00173
00174 case "illearningprogressgui":
00175 $this->getStandardTemplates();
00176 $this->setTabs();
00177 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00178 $new_gui =& new ilLearningProgressGUI(LP_MODE_PERSONAL_DESKTOP,0);
00179 $ret =& $this->ctrl->forwardCommand($new_gui);
00180 break;
00181
00182
00183 case "ilpaymentgui":
00184 $this->showShoppingCart();
00185 break;
00186
00187 case "ilpaymentadmingui":
00188 $this->getStandardTemplates();
00189 $this->setTabs();
00190 include_once("./payment/classes/class.ilPaymentAdminGUI.php");
00191 $pa =& new ilPaymentAdminGUI($ilUser);
00192 $ret =& $this->ctrl->forwardCommand($pa);
00193 $this->tpl->show();
00194 break;
00195
00196 case "ilcolumngui":
00197 $this->getStandardTemplates();
00198 $this->setTabs();
00199 include_once("./Services/Block/classes/class.ilColumnGUI.php");
00200 $column_gui = new ilColumnGUI("pd");
00201 $this->initColumn($column_gui);
00202 $this->show();
00203 break;
00204
00205 default:
00206 $this->getStandardTemplates();
00207 $this->setTabs();
00208 $cmd = $this->ctrl->getCmd("show");
00209 $this->$cmd();
00210 break;
00211 }
00212 return true;
00213 }
00214
00215 function showShoppingCart()
00216 {
00217 global $ilUser;
00218 $this->getStandardTemplates();
00219 $this->setTabs();
00220 include_once("./payment/classes/class.ilPaymentGUI.php");
00221 $pa =& new ilPaymentGUI($ilUser);
00222 $ret =& $this->ctrl->forwardCommand($pa);
00223 $this->tpl->show();
00224 return true;
00225 }
00226
00230 function getStandardTemplates()
00231 {
00232
00233 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00234 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00235 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00236 }
00237
00241 function getTreeModeTemplates()
00242 {
00243
00244
00245 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00246 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00247 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00248 }
00249
00253 function show()
00254 {
00255
00256 $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true);
00257 $this->tpl->getStandardTemplate();
00258
00259
00260 ilUtil::sendInfo();
00261
00262
00263 ilUtil::infoPanel();
00264
00265 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00266 $this->lng->txt("personal_desktop"));
00267 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00268 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00269
00270 $this->tpl->setContent($this->getCenterColumnHTML());
00271 $this->tpl->setRightContent($this->getRightColumnHTML());
00272 $this->tpl->setLeftContent($this->getLeftColumnHTML());
00273 $this->tpl->show();
00274 }
00275
00276
00280 function getCenterColumnHTML()
00281 {
00282 global $ilCtrl;
00283
00284 include_once("Services/Block/classes/class.ilColumnGUI.php");
00285 $column_gui = new ilColumnGUI("pd", IL_COL_CENTER);
00286 $this->initColumn($column_gui);
00287
00288 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
00289 $column_gui->getCmdSide() == IL_COL_CENTER)
00290 {
00291 $html = $ilCtrl->forwardCommand($column_gui);
00292 }
00293 else
00294 {
00295 if (!$ilCtrl->isAsynch())
00296 {
00297 if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
00298 {
00299
00300 if ($column_gui->getCmdSide() == IL_COL_RIGHT)
00301 {
00302 $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
00303 $this->initColumn($column_gui);
00304 $html = $ilCtrl->forwardCommand($column_gui);
00305 }
00306
00307 if ($column_gui->getCmdSide() == IL_COL_LEFT)
00308 {
00309 $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
00310 $this->initColumn($column_gui);
00311 $html = $ilCtrl->forwardCommand($column_gui);
00312 }
00313 }
00314 else
00315 {
00316 $html = $ilCtrl->getHTML($column_gui);
00317 }
00318 }
00319 }
00320 return $html;
00321 }
00322
00326 function getRightColumnHTML()
00327 {
00328 global $ilUser, $lng, $ilCtrl;
00329
00330 include_once("Services/Block/classes/class.ilColumnGUI.php");
00331 $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
00332 $this->initColumn($column_gui);
00333
00334 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
00335 $column_gui->getCmdSide() == IL_COL_RIGHT &&
00336 $column_gui->getScreenMode() == IL_SCREEN_SIDE)
00337 {
00338 $html = $ilCtrl->forwardCommand($column_gui);
00339 }
00340 else
00341 {
00342 if (!$ilCtrl->isAsynch())
00343 {
00344 $html = $ilCtrl->getHTML($column_gui);
00345 }
00346 }
00347
00348 return $html;
00349 }
00350
00354 function getLeftColumnHTML()
00355 {
00356 global $ilUser, $lng, $ilCtrl;
00357
00358 include_once("Services/Block/classes/class.ilColumnGUI.php");
00359 $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
00360 $this->initColumn($column_gui);
00361
00362 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
00363 $column_gui->getCmdSide() == IL_COL_LEFT &&
00364 $column_gui->getScreenMode() == IL_SCREEN_SIDE)
00365 {
00366 $html = $ilCtrl->forwardCommand($column_gui);
00367 }
00368 else
00369 {
00370 if (!$ilCtrl->isAsynch())
00371 {
00372 $html = $ilCtrl->getHTML($column_gui);
00373 }
00374 }
00375
00376 return $html;
00377 }
00378
00379 function prepareContentView()
00380 {
00381
00382 $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true);
00383 $this->tpl->getStandardTemplate();
00384
00385
00386 ilUtil::sendInfo();
00387
00388
00389 ilUtil::infoPanel();
00390
00391 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00392 $this->lng->txt("personal_desktop"));
00393 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00394 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00395 }
00396
00400 function dropItem()
00401 {
00402 global $ilUser;
00403
00404 $ilUser->dropDesktopItem($_GET["item_ref_id"], $_GET["type"]);
00405 $this->show();
00406 }
00407
00411 function removeMember()
00412 {
00413 global $err_msg;
00414 if (strlen($err_msg) > 0)
00415 {
00416 $this->ilias->raiseError($this->lng->txt($err_msg),$this->ilias->error_obj->MESSAGE);
00417 }
00418 $this->show();
00419 }
00420
00424 function displaySystemMessages()
00425 {
00426 include_once("Services/Mail/classes/class.ilPDSysMessageBlockGUI.php");
00427 $sys_block = new ilPDSysMessageBlockGUI("ilpersonaldesktopgui", "show");
00428 return $sys_block->getHTML();
00429 }
00430
00431
00435 function displayFeedback()
00436 {
00437 include_once("./Services/Feedback/classes/class.ilPDFeedbackBlockGUI.php");
00438 $fb_block = new ilPDFeedbackBlockGUI("ilpersonaldesktopgui", "show");
00439 return $fb_block->getHTML();
00440
00441 include_once('Services/Feedback/classes/class.ilFeedbackGUI.php');
00442 $feedback_gui = new ilFeedbackGUI();
00443 return $feedback_gui->getPDFeedbackListHTML();
00444 }
00445
00456 function multiarray_sort ($array, $key_sort)
00457 {
00458 if ($array) {
00459 $key_sorta = explode(";", $key_sort);
00460
00461 $multikeys = array_keys($array);
00462 $keys = array_keys($array[$multikeys[0]]);
00463
00464 for($m=0; $m < count($key_sorta); $m++) {
00465 $nkeys[$m] = trim($key_sorta[$m]);
00466 }
00467 $n += count($key_sorta);
00468
00469 for($i=0; $i < count($keys); $i++){
00470 if(!in_array($keys[$i], $key_sorta)) {
00471 $nkeys[$n] = $keys[$i];
00472 $n += "1";
00473 }
00474 }
00475
00476 for($u=0;$u<count($array); $u++) {
00477 $arr = $array[$multikeys[$u]];
00478 for($s=0; $s<count($nkeys); $s++) {
00479 $k = $nkeys[$s];
00480 $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
00481 }
00482 }
00483 sort($output);
00484 return $output;
00485 }
00486 }
00487
00491 function setTabs()
00492 {
00493 global $ilCtrl, $ilSetting;
00494
00495 $this->tpl->addBlockFile("TABS", "tabs", "tpl.tabs.html");
00496
00497 $script_name = basename($_SERVER["SCRIPT_NAME"]);
00498
00499 $command = $_GET["cmd"] ? $_GET["cmd"] : "";
00500
00501 if (ereg("whois",$command) or $script_name == "profile.php")
00502 {
00503 $who_is_online = true;
00504 }
00505
00506
00507
00508
00509 $inc_type = (strtolower($_GET["baseClass"]) == "ilpersonaldesktopgui" &&
00510 (strtolower($this->cmdClass) == "ilpersonaldesktopgui" ||
00511 $this->cmdClass == "" || (strtolower($this->cmdClass)) == "ilfeedbackgui"
00512 || $ilCtrl->getNextClass() == "ilcolumngui"))
00513 ? "tabactive"
00514 : "tabinactive";
00515 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTarget($this), $this->lng->txt("overview"));
00516
00517
00518 $inc_type = (strtolower($this->cmdClass) == "ilpersonalprofilegui")
00519 ? "tabactive"
00520 : "tabinactive";
00521 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPersonalProfileGUI"),
00522 $this->lng->txt("personal_profile"));
00523
00524 if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
00525 {
00526
00527 if ($ilSetting->get("block_activated_news"))
00528 {
00529 $inc_type = ($ilCtrl->getNextClass() == "ilpdnewsgui")
00530 ? "tabactive"
00531 : "tabinactive";
00532
00533 $inhalt1[] = array($inc_type,
00534 $this->ctrl->getLinkTargetByClass("ilpdnewsgui"),
00535 $this->lng->txt("news"));
00536 }
00537
00538
00539 if ($this->ilias->getSetting("enable_calendar"))
00540 {
00541 $inc_type = ($script_name == "dateplaner.php")
00542 ? "tabactive"
00543 : "tabinactive";
00544 $inhalt1[] = array($inc_type,"dateplaner.php",$this->lng->txt("calendar"));
00545 }
00546
00547
00548 if (!$this->ilias->getSetting("disable_notes"))
00549 {
00550 $inc_type = (strtolower($this->cmdClass) == "ilpdnotesgui" ||
00551 strtolower($this->cmdClass) == "ilnotegui")
00552 ? "tabactive"
00553 : "tabinactive";
00554 $inhalt1[] = array($inc_type,
00555 $this->ctrl->getLinkTargetByClass("ilpdnotesgui"),
00556 $this->lng->txt("private_notes"));
00557 }
00558
00559
00560 if (!$this->ilias->getSetting("disable_bookmarks"))
00561 {
00562 $inc_type = (strtolower($this->cmdClass) == "ilbookmarkadministrationgui")
00563 ? "tabactive"
00564 : "tabinactive";
00565 $inhalt1[] = array($inc_type,
00566 $this->ctrl->getLinkTargetByClass("ilbookmarkadministrationgui"),
00567 $this->lng->txt("bookmarks"));
00568 }
00569 }
00570
00571
00572
00573 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
00574 if (ilObjUserTracking::_enabledLearningProgress())
00575 {
00576 $cmd_classes = array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui');
00577 $inc_type = in_array(strtolower($this->cmdClass),$cmd_classes) ? 'tabactive' : 'tabinactive';
00578
00579 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"),
00580 $this->lng->txt("learning_progress"));
00581 }
00582
00583 include_once "./payment/classes/class.ilPaymentVendors.php";
00584 include_once "./payment/classes/class.ilPaymentTrustees.php";
00585 include_once "./payment/classes/class.ilPaymentShoppingCart.php";
00586 include_once "./payment/classes/class.ilPaymentBookings.php";
00587
00588 if(ilPaymentShoppingCart::_hasEntries($this->ilias->account->getId()) or
00589 ilPaymentBookings::_getCountBookingsByCustomer($this->ilias->account->getId()))
00590 {
00591 $this->lng->loadLanguageModule('payment');
00592
00593 $cmd_classes = array('ilpaymentgui','ilpaymentshoppingcartgui','ilpaymentbuyedobjectsgui');
00594 $inc_type = in_array(strtolower($this->cmdClass),$cmd_classes) ? 'tabactive' : 'tabinactive';
00595
00596 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPaymentGUI"),
00597 $this->lng->txt("paya_shopping_cart"));
00598 }
00599 if(ilPaymentVendors::_isVendor($this->ilias->account->getId()) or
00600 ilPaymentTrustees::_hasAccess($this->ilias->account->getId()))
00601 {
00602 $this->lng->loadLanguageModule('payment');
00603
00604 $cmd_classes = array('ilpaymentstatisticgui','ilpaymentobjectgui','ilpaymenttrusteegui','ilpaymentadmingui');
00605 $inc_type = in_array(strtolower($this->cmdClass),$cmd_classes) ? 'tabactive' : 'tabinactive';
00606
00607 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPaymentAdminGUI"),
00608 $this->lng->txt("paya_header"));
00609 }
00610
00611 for ( $i=0; $i<sizeof($inhalt1); $i++)
00612 {
00613 if ($inhalt1[$i][1] != "")
00614 { $this->tpl->setCurrentBlock("tab");
00615 $this->tpl->setVariable("TAB_TYPE",$inhalt1[$i][0]);
00616 $this->tpl->setVariable("TAB_LINK",$inhalt1[$i][1]);
00617 $this->tpl->setVariable("TAB_TEXT",$inhalt1[$i][2]);
00618 $this->tpl->setVariable("TAB_TARGET",$inhalt1[$i][3]);
00619 $this->tpl->parseCurrentBlock();
00620 }
00621 }
00622
00623 $this->tpl->setCurrentBlock("tabs");
00624 $this->tpl->parseCurrentBlock();
00625 }
00626
00630 function jumpToProfile()
00631 {
00632 $this->ctrl->redirectByClass("ilpersonalprofilegui");
00633 }
00634
00638 function jumpToBookmarks()
00639 {
00640 if ($this->ilias->getSetting("disable_bookmarks"))
00641 {
00642 ilUtil::sendInfo($this->lng->txt('permission_denied'), true);
00643 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
00644 return;
00645 }
00646
00647 $this->ctrl->redirectByClass("ilbookmarkadministrationgui");
00648 }
00649
00653 function jumpToNotes()
00654 {
00655 if ($this->ilias->getSetting('disable_notes'))
00656 {
00657 ilUtil::sendInfo($this->lng->txt('permission_denied'), true);
00658 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
00659 return;
00660 }
00661
00662 $this->ctrl->redirectByClass("ilpdnotesgui");
00663 }
00664
00668 function jumpToNews()
00669 {
00670 $this->ctrl->redirectByClass("ilpdnewsgui");
00671 }
00672
00676 function jumpToLP()
00677 {
00678 $this->ctrl->redirectByClass("illearningprogressgui");
00679 }
00680
00681 function __loadNextClass()
00682 {
00683 $stored_classes = array('ilpersonaldesktopgui',
00684 'ilpersonalprofilegui',
00685 'ilpdnotesgui',
00686 'ilbookmarkadministrationgui',
00687 'illearningprogressgui',
00688 'ilpaymentadmingui');
00689
00690 if(isset($_SESSION['il_pd_history']) and in_array($_SESSION['il_pd_history'],$stored_classes))
00691 {
00692 return $_SESSION['il_pd_history'];
00693 }
00694 else
00695 {
00696 $this->ctrl->getNextClass($this);
00697 }
00698 }
00699 function __storeLastClass($a_class)
00700 {
00701 $_SESSION['il_pd_history'] = $a_class;
00702 $this->cmdClass = $a_class;
00703 }
00704
00708 function showUserProfile()
00709 {
00710 global $lng, $ilCtrl;
00711
00712 $this->prepareContentView();
00713
00714 include_once('./Services/User/classes/class.ilObjUserGUI.php');
00715 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
00716
00717 include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
00718 $content_block = new ilPDContentBlockGUI("ilpersonaldesktopgui", "show");
00719 $content_block->setContent($user_gui->getPublicProfile("", false, true));
00720 $content_block->setTitle($lng->txt("profile_of")." ".
00721 $user_gui->object->getLogin());
00722 $content_block->setColSpan(2);
00723 $content_block->setImage(ilUtil::getImagePath("icon_usr.gif"));
00724 $content_block->addHeaderCommand($ilCtrl->getLinkTarget($this, "show"),
00725 $lng->txt("close"), true);
00726
00727 $this->tpl->setContent($content_block->getHTML());
00728 $this->tpl->setRightContent($this->getRightColumnHTML());
00729 $this->tpl->setLeftContent($this->getLeftColumnHTML());
00730
00731 $this->tpl->show();
00732 }
00733
00737 function initColumn($a_column_gui)
00738 {
00739 $pd_set = new ilSetting("pd");
00740 if ($pd_set->get("enable_block_moving"))
00741 {
00742 $a_column_gui->setEnableMovement(true);
00743 }
00744 }
00745
00746 }
00747 ?>