• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilPersonalDesktopGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003 +-----------------------------------------------------------------------------+
00004 | ILIAS open source                                                           |
00005 +-----------------------------------------------------------------------------+
00006 | Copyright (c) 1998-2005 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 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         var $cmdClass = '';
00047 
00051         function ilPersonalDesktopGUI()
00052         {
00053                 global $ilias, $tpl, $lng, $rbacsystem, $ilCtrl, $ilMainMenu;
00054                 
00055                 
00056                 $this->tpl =& $tpl;
00057                 $this->lng =& $lng;
00058                 $this->ilias =& $ilias;
00059                 $this->ctrl =& $ilCtrl;
00060                 
00061                 $ilMainMenu->setActive("desktop");
00062                 
00063                 // catch hack attempts
00064                 if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
00065                 {
00066                         $this->ilias->raiseError($this->lng->txt("msg_not_available_for_anon"),$this->ilias->error_obj->MESSAGE);
00067                 }
00068                 $this->cmdClass = $_GET['cmdClass'];
00069         }
00070         
00074         function &executeCommand()
00075         {
00076                 global $ilUser;
00077 
00078                 $next_class = $this->ctrl->getNextClass();
00079                 $this->ctrl->setReturn($this, "show");
00080                 
00081                 // check whether personal profile of user is incomplete
00082                 if ($ilUser->getProfileIncomplete() && $next_class != "ilpersonalprofilegui")
00083                 {
00084                         $this->ctrl->redirectByClass("ilpersonalprofilegui");
00085                 }
00086                 
00087                 // read last active subsection
00088                 if($_GET['PDHistory'])
00089                 {
00090                         $next_class = $this->__loadNextClass();
00091                 }
00092                 $this->__storeLastClass($next_class);
00093 
00094                 switch($next_class)
00095                 {
00096                         //Feedback
00097                         case "ilfeedbackgui":
00098                                 $this->getStandardTemplates();
00099                                 $this->setTabs();
00100                                 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00101                                 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00102                                         $this->lng->txt("personal_desktop"));
00103 
00104                                 include_once("Services/Feedback/classes/class.ilFeedbackGUI.php");
00105                                 $feedback_gui = new ilFeedbackGUI();
00106                                 $ret =& $this->ctrl->forwardCommand($feedback_gui);
00107                                 break;
00108                                 // bookmarks
00109                         case "ilbookmarkadministrationgui":
00110                                 include_once("classes/class.ilBookmarkAdministrationGUI.php");
00111                                 $bookmark_gui = new ilBookmarkAdministrationGUI();
00112                                 if ($bookmark_gui->getMode() == 'tree') {
00113                                         $this->getTreeModeTemplates();
00114                                 } else {
00115                                         $this->getStandardTemplates();
00116                                 }
00117                                 $this->setTabs();
00118                                 $ret =& $this->ctrl->forwardCommand($bookmark_gui);
00119                                 break;
00120                         
00121                                 // profile
00122                         case "ilpersonalprofilegui":
00123                                 $this->getStandardTemplates();
00124                                 $this->setTabs();
00125                                 include_once("classes/class.ilPersonalProfileGUI.php");
00126                                 $profile_gui = new ilPersonalProfileGUI();
00127                                 $ret =& $this->ctrl->forwardCommand($profile_gui);
00128                                 break;
00129                         
00130                                 // profile
00131                         case "ilobjusergui":
00132                                 include_once("classes/class.ilObjUserGUI.php");
00133                                 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
00134                                 $ret =& $this->ctrl->forwardCommand($user_gui);
00135                                 break;
00136                         
00137                                 // pd notes
00138                         case "ilpdnotesgui":
00139                                 $this->getStandardTemplates();
00140                                 $this->setTabs();
00141                                 include_once("classes/class.ilPDNotesGUI.php");
00142                                 $pd_notes_gui = new ilPDNotesGUI();
00143                                 $ret =& $this->ctrl->forwardCommand($pd_notes_gui);
00144                                 break;
00145                         
00146                         case "illearningprogressgui":
00147                                 $this->getStandardTemplates();
00148                                 $this->setTabs();
00149                         
00150                                 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00151                         
00152                                 $new_gui =& new ilLearningProgressGUI(LP_MODE_PERSONAL_DESKTOP,0);
00153                                 $ret =& $this->ctrl->forwardCommand($new_gui);
00154                         
00155                                 break;
00156                         
00157                                 // payment
00158                         case "ilpaymentgui":
00159                                 $this->showShoppingCart();
00160                                 break;
00161 
00162                         case "ilpaymentadmingui":
00163                                 $this->getStandardTemplates();
00164                                 $this->setTabs();
00165                                 include_once("./payment/classes/class.ilPaymentAdminGUI.php");
00166                                 $pa =& new ilPaymentAdminGUI($ilUser);
00167                                 $ret =& $this->ctrl->forwardCommand($pa);
00168                                 $this->tpl->show();
00169                                 break;
00170 
00171                         default:
00172                                 $this->getStandardTemplates();
00173                                 $this->setTabs();
00174                                 $cmd = $this->ctrl->getCmd("show");
00175                                 $this->$cmd();
00176                                 break;
00177                 }
00178                 return true;
00179         }
00180         
00181         function showShoppingCart()
00182         {
00183                 global $ilUser;
00184                 $this->getStandardTemplates();
00185                 $this->setTabs();
00186                 include_once("./payment/classes/class.ilPaymentGUI.php");
00187                 $pa =& new ilPaymentGUI($ilUser);
00188                 $ret =& $this->ctrl->forwardCommand($pa);
00189                 $this->tpl->show();
00190                 return true;
00191         }
00192 
00196         function getStandardTemplates()
00197         {
00198                 // add template for content
00199                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00200                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00201                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00202         }
00203         
00207         function getTreeModeTemplates()
00208         {
00209                 // add template for content
00210                 //$this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_tree_content.html");
00211                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00212                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00213                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00214         }
00215         
00219         function show()
00220         {
00221                 // add template for content
00222                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_personaldesktop.html");
00223                 
00224                 // set locator
00225                 /*
00226                 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00227                 $this->tpl->touchBlock("locator_separator");
00228                 $this->tpl->touchBlock("locator_item");
00229                 $this->tpl->setCurrentBlock("locator_item");
00230                 $this->tpl->setVariable("ITEM", $this->lng->txt("overview"));
00231                 $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this));
00232                 $this->tpl->parseCurrentBlock();
00233                 */
00234                 
00235                 // catch feedback message
00236                 sendInfo();
00237                 
00238                 // display infopanel if something happened
00239                 infoPanel();
00240                 
00241                 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00242                 $this->lng->txt("personal_desktop"));
00243                 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00244                 
00245                 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00246                 
00247                 // output
00248                 $this->displaySelectedItems();
00249                 $this->displaySystemMessages();
00250                 $this->displayMails();
00251                 $this->displayNotes();
00252                 $this->displayUsersOnline();
00253                 $this->displayBookmarks();
00254                 $this->displayFeedback();
00255                 $this->tpl->show();
00256         }
00257         
00258         
00262         function showUserProfile()
00263         {
00264                 // add template for content
00265                 //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_personaldesktop.html");
00266                 
00267                 // set locator
00268                 /*
00269                 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00270                 $this->tpl->setCurrentBlock("locator_item");
00271                 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00272                 $this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTarget($this));
00273                 $this->tpl->parseCurrentBlock();
00274                 */
00275                 
00276                 // catch feedback message
00277                 sendInfo();
00278                 
00279                 // display infopanel if something happened
00280                 infoPanel();
00281                 
00282                 $this->tpl->setCurrentBlock("header_image");
00283                 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_pd_b.gif"));
00284                 $this->tpl->parseCurrentBlock();
00285                 $this->tpl->setCurrentBlock("adm_content");
00286                 $this->tpl->setVariable("HEADER", $this->lng->txt("personal_desktop"));
00287                 
00288                 include_once("classes/class.ilObjUserGUI.php");
00289                 $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
00290                 $this->tpl->setVariable("ADM_CONTENT", $user_gui->getPublicProfile());
00291                 
00292                 $this->tpl->show();
00293         }
00294         
00298         function dropItem()
00299         {
00300                 global $ilUser;
00301                 
00302                 $ilUser->dropDesktopItem($_GET["item_ref_id"], $_GET["type"]);
00303                 $this->show();
00304         }
00305         
00309         function removeMember()
00310         {
00311                 global $err_msg;
00312                 if (strlen($err_msg) > 0)
00313                 {
00314                         $this->ilias->raiseError($this->lng->txt($err_msg),$this->ilias->error_obj->MESSAGE);
00315                 }
00316                 $this->show();
00317         }
00318         
00322         function showSelectedItemsDetails()
00323         {
00324                 global $ilUser;
00325                 
00326                 $ilUser->writePref("pd_selected_items_details", "y");
00327                 $this->show();
00328         }
00329         
00333         function hideSelectedItemsDetails()
00334         {
00335                 global $ilUser;
00336                 
00337                 $ilUser->writePref("pd_selected_items_details", "n");
00338                 $this->show();
00339         }
00340         
00341         
00345         function showUsersOnlineDetails()
00346         {
00347                 global $ilUser;
00348                 
00349                 $ilUser->writePref('show_users_online_details','y');
00350                 $this->show();
00351         }
00352         
00356         function hideUsersOnlineDetails()
00357         {
00358                 global $ilUser;
00359                 
00360                 $ilUser->writePref('show_users_online_details','n');
00361                 $this->show();
00362         }
00363         
00367         function showPDNotesDetails()
00368         {
00369                 global $ilUser;
00370                 
00371                 $ilUser->writePref('show_pd_notes_details','y');
00372                 $this->show();
00373         }
00374         
00378         function hidePDNotesDetails()
00379         {
00380                 global $ilUser;
00381                 
00382                 $ilUser->writePref('show_pd_notes_details','n');
00383                 $this->show();
00384         }
00385         
00389         function orderPDItemsByLocation()
00390         {
00391                 global $ilUser;
00392                 
00393                 $ilUser->writePref("pd_order_items", "location");
00394                 $this->show();
00395         }
00396         
00400         function orderPDItemsByType()
00401         {
00402                 global $ilUser;
00403                 
00404                 $ilUser->writePref("pd_order_items", "type");
00405                 $this->show();
00406         }
00407         
00408         
00412         function displaySelectedItems()
00413         {
00414                 
00415                 $html = "";
00416                 
00417                 $html.= $this->getSelectedItemsBlockHTML();
00418                 
00419                 if ($html != "")
00420                 {
00421                         $this->tpl->setCurrentBlock("selected_items");
00422                         $this->tpl->setVariable("SELECTED_ITEMS", $html);
00423                         $this->tpl->parseCurrentBlock();
00424                 }
00425                 $this->ctrl->clearParameters($this);
00426         }
00427         
00428         
00432         function getSelectedItemsBlockHTML()
00433         {
00434                 global $ilUser, $rbacsystem, $objDefinition, $ilBench;
00435                 
00436                 $tpl =& $this->newBlockTemplate();
00437                 
00438                 switch ($ilUser->getPref("pd_order_items"))
00439                 {
00440                         case "location":
00441                         $ok = $this->getSelectedItemsPerLocation($tpl);
00442                         break;
00443                         
00444                         default:
00445                         $ok = $this->getSelectedItemsPerType($tpl);
00446                         break;
00447                 }
00448                 
00449                 
00450                 if ($ok)
00451                 {
00452                         $tpl->setCurrentBlock("pd_header_row");
00453                         $tpl->setVariable("PD_BLOCK_HEADER_CONTENT", $this->lng->txt("selected_items"));
00454                         $tpl->setVariable("PD_BLOCK_HEADER_ID", "th_selected_items");
00455                         if ($ilUser->getPref("pd_selected_items_details") == "y")
00456                         {
00457                                 $tpl->setVariable("TXT_SEL_ITEMS_MODE", $this->lng->txt("hide_details"));
00458                                 $tpl->setVariable("LINK_SEL_ITEMS_MODE", $this->ctrl->getLinkTarget($this, "hideSelectedItemsDetails"));
00459                         }
00460                         else
00461                         {
00462                                 $tpl->setVariable("TXT_SEL_ITEMS_MODE", $this->lng->txt("show_details"));
00463                                 $tpl->setVariable("LINK_SEL_ITEMS_MODE", $this->ctrl->getLinkTarget($this, "showSelectedItemsDetails"));
00464                         }
00465                         $tpl->parseCurrentBlock();
00466                         
00467                         // sort by type
00468                         $tpl->setCurrentBlock("footer_link");
00469                         $tpl->setVariable("HREF_FOOT_LINK", $this->ctrl->getLinkTarget($this, "orderPDItemsByType"));
00470                         $tpl->setVariable("TXT_FOOT_LINK", $this->lng->txt("by_type"));
00471                         $tpl->parseCurrentBlock();
00472                         $tpl->touchBlock("footer_item");
00473                         
00474                         $tpl->touchBlock("footer_separator");
00475                         $tpl->touchBlock("footer_item");
00476                         
00477                         // sort by location
00478                         $tpl->setCurrentBlock("footer_link");
00479                         $tpl->setVariable("HREF_FOOT_LINK", $this->ctrl->getLinkTarget($this, "orderPDItemsByLocation"));
00480                         $tpl->setVariable("TXT_FOOT_LINK", $this->lng->txt("by_location"));
00481                         $tpl->parseCurrentBlock();
00482                         $tpl->touchBlock("footer_item");
00483                         
00484                         $tpl->setCurrentBlock("block_footer");
00485                         $tpl->parseCurrentBlock();
00486                 }
00487                 
00488                 return $tpl->get();
00489         }
00490         
00494         function getSelectedItemsPerType(&$tpl)
00495         {
00496                 global $ilUser, $rbacsystem, $objDefinition, $ilBench;
00497                 
00498                 $output = false;
00499                 $types = array(
00500                 array("title" => $this->lng->txt("objs_cat"), "types" => "cat"),
00501                 array("title" => $this->lng->txt("objs_fold"), "types" => "fold"),
00502                 array("title" => $this->lng->txt("objs_crs"), "types" => "crs"),
00503                 array("title" => $this->lng->txt("objs_grp"), "types" => "grp"),
00504                 array("title" => $this->lng->txt("objs_chat"), "types" => "chat"),
00505                 array("title" => $this->lng->txt("objs_frm"), "types" => "frm"),
00506                 array("title" => $this->lng->txt("learning_resources"),"types" => array("lm", "htlm", "sahs", "dbk")),
00507                 array("title" => $this->lng->txt("objs_glo"), "types" => "glo"),
00508                 array("title" => $this->lng->txt("objs_file"), "types" => "file"),
00509                 array("title" => $this->lng->txt("objs_webr"), "types" => "webr"),
00510                 array("title" => $this->lng->txt("objs_exc"), "types" => "exc"),
00511                 array("title" => $this->lng->txt("objs_tst"), "types" => "tst"),
00512                 array("title" => $this->lng->txt("objs_svy"), "types" => "svy"),
00513                 array("title" => $this->lng->txt("objs_mep"), "types" => "mep"),
00514                 array("title" => $this->lng->txt("objs_qpl"), "types" => "qpl"),
00515                 array("title" => $this->lng->txt("objs_spl"), "types" => "spl"),
00516                 array("title" => $this->lng->txt("objs_icrs"), "types" => "icrs"),
00517                 array("title" => $this->lng->txt("objs_icla"), "types" => "icla")
00518                 );
00519                 
00520                 foreach ($types as $type)
00521                 {
00522                         $type = $type["types"];
00523                         $title = $type["title"];
00524                         
00525                         $items = $this->ilias->account->getDesktopItems($type);
00526                         $item_html = array();
00527                         
00528                         if ($ilUser->getPref("pd_selected_items_details") != "n")
00529                         {
00530                                 $rel_header = (is_array($type))
00531                                 ? "th_lres"
00532                                 : "th_".$type;
00533                         }
00534                         
00535                         if (count($items) > 0)
00536                         {
00537                                 $tstCount = 0;
00538                                 $unsetCount = 0;
00539                                 $progressCount = 0;
00540                                 $unsetFlag = 0;
00541                                 $progressFlag = 0;
00542                                 $completedFlag = 0;
00543                                 if (strcmp($a_type, "tst") == 0) {
00544                                         $items = $this->multiarray_sort($items, "used_tries; title");
00545                                         foreach ($items as $tst_item) {
00546                                                 if (!isset($tst_item["used_tries"])) {
00547                                                         $unsetCount++;
00548                                                 }
00549                                                 elseif ($tst_item["used_tries"] == 0) {
00550                                                         $progressCount++;
00551                                                 }
00552                                         }
00553                                 }
00554                                 
00555                                 foreach($items as $item)
00556                                 {
00557                                         // get list gui class for each object type
00558                                         if ($cur_obj_type != $item["type"])
00559                                         {
00560                                                 $class = $objDefinition->getClassName($item["type"]);
00561                                                 $location = $objDefinition->getLocation($item["type"]);
00562                                                 $full_class = "ilObj".$class."ListGUI";
00563                                                 include_once($location."/class.".$full_class.".php");
00564                                                 $item_list_gui = new $full_class();
00565                                                 $item_list_gui->enableDelete(false);
00566                                                 $item_list_gui->enableCut(false);
00567                                                 $item_list_gui->enablePayment(false);
00568                                                 $item_list_gui->enableLink(false);
00569                                                 $item_list_gui->enableInfoScreen(false);
00570                                                 if ($ilUser->getPref("pd_selected_items_details") != "y")
00571                                                 {
00572                                                         $item_list_gui->enableDescription(false);
00573                                                         $item_list_gui->enableProperties(false);
00574                                                         $item_list_gui->enablePreconditions(false);
00575                                                 }
00576                                         }
00577                                         // render item row
00578                                         $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
00579                                         
00580                                         $html = $item_list_gui->getListItemHTML($item["ref_id"],
00581                                         $item["obj_id"], $item["title"], $item["description"]);
00582                                         $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
00583                                         if ($html != "")
00584                                         {
00585                                                 $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"],
00586                                                 "item_obj_id" => $item["obj_id"]);
00587                                         }
00588                                 }
00589                                 
00590                                 // output block for resource type
00591                                 if (count($item_html) > 0)
00592                                 {
00593                                         // add a header for each resource type
00594                                         if ($ilUser->getPref("pd_selected_items_details") == "y")
00595                                         {
00596                                                 if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00597                                                 {
00598                                                         $this->addHeaderRow($tpl, $type, false);
00599                                                 }
00600                                                 else
00601                                                 {
00602                                                         $this->addHeaderRow($tpl, $type);
00603                                                 }
00604                                                 $this->resetRowType();
00605                                         }
00606                                         
00607                                         // content row
00608                                         foreach($item_html as $item)
00609                                         {
00610                                                 if ($ilUser->getPref("pd_selected_items_details") != "y" ||
00611                                                 $this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00612                                                 {
00613                                                         $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $type, $rel_header);
00614                                                 }
00615                                                 else
00616                                                 {
00617                                                         $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], "", $rel_header);
00618                                                 }
00619                                                 $output = true;
00620                                         }
00621                                 }
00622                         }
00623                 }
00624                 
00625                 return $output;
00626         }
00627         
00631         function getSelectedItemsPerLocation(&$tpl)
00632         {
00633                 global $ilUser, $rbacsystem, $objDefinition, $ilBench;
00634                 
00635                 $output = false;
00636                 
00637                 $items = $this->ilias->account->getDesktopItems();
00638                 $item_html = array();
00639                 
00640                 if (count($items) > 0)
00641                 {
00642                         foreach($items as $item)
00643                         {
00644                                 //echo "1";
00645                                 // get list gui class for each object type
00646                                 if ($cur_obj_type != $item["type"])
00647                                 {
00648                                         $item_list_gui =& $this->getItemListGUI($item["type"]);
00649                                         
00650                                         $item_list_gui->enableDelete(false);
00651                                         $item_list_gui->enableCut(false);
00652                                         $item_list_gui->enablePayment(false);
00653                                         $item_list_gui->enableLink(false);
00654                                         $item_list_gui->enableInfoScreen(false);
00655                                         if ($ilUser->getPref("pd_selected_items_details") != "y")
00656                                         {
00657                                                 //echo "3";
00658                                                 $item_list_gui->enableDescription(false);
00659                                                 $item_list_gui->enableProperties(false);
00660                                                 $item_list_gui->enablePreconditions(false);
00661                                         }
00662                                 }
00663                                 // render item row
00664                                 $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
00665                                 
00666                                 $html = $item_list_gui->getListItemHTML($item["ref_id"],
00667                                 $item["obj_id"], $item["title"], $item["description"]);
00668                                 $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
00669                                 if ($html != "")
00670                                 {
00671                                         $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"],
00672                                         "item_obj_id" => $item["obj_id"], "parent_ref" => $item["parent_ref"],
00673                                         "type" => $item["type"]);
00674                                 }
00675                         }
00676                         
00677                         // output block for resource type
00678                         if (count($item_html) > 0)
00679                         {
00680                                 $cur_parent_ref = 0;
00681                                 
00682                                 // content row
00683                                 foreach($item_html as $item)
00684                                 {
00685                                         // add a parent header row for each new parent
00686                                         if ($cur_parent_ref != $item["parent_ref"])
00687                                         {
00688                                                 if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00689                                                 {
00690                                                         $this->addParentRow($tpl, $item["parent_ref"], false);
00691                                                 }
00692                                                 else
00693                                                 {
00694                                                         $this->addParentRow($tpl, $item["parent_ref"]);
00695                                                 }
00696                                                 $this->resetRowType();
00697                                                 $cur_parent_ref = $item["parent_ref"];
00698                                         }
00699                                         
00700                                         //if ($ilUser->getPref("pd_selected_items_details") != "y" ||
00701                                         //      $this->ilias->getSetting("icon_position_in_lists") == "item_rows")
00702                                         //{
00703                                                 $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $item["type"],
00704                                                 "th_".$cur_parent_ref);
00705                                         //}
00706                                         //else
00707                                         //{
00708                                                 //      $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"]);
00709                                         //}
00710                                         $output = true;
00711                                 }
00712                         }
00713                 }
00714                 
00715                 return $output;
00716         }
00717         
00721         function &getItemListGUI($a_type)
00722         {
00723                 global $objDefinition;
00724                 //echo "<br>+$a_type+";
00725                 if (!is_object($this->item_list_guis[$a_type]))
00726                 {
00727                         $class = $objDefinition->getClassName($a_type);
00728                         $location = $objDefinition->getLocation($a_type);
00729                         $full_class = "ilObj".$class."ListGUI";
00730                         //echo "<br>-".$location."/class.".$full_class.".php"."-";
00731                         include_once($location."/class.".$full_class.".php");
00732                         $item_list_gui = new $full_class();
00733                         $this->item_list_guis[$a_type] =& $item_list_gui;
00734                 }
00735                 else
00736                 {
00737                         $item_list_gui =& $this->item_list_guis[$a_type];
00738                 }
00739                 return $item_list_gui;
00740         }
00741         
00749         function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
00750         {
00751                 if (!is_array($a_type))
00752                 {
00753                         $icon = ilUtil::getImagePath("icon_".$a_type.".gif");
00754                         $title = $this->lng->txt("objs_".$a_type);
00755                         $header_id = "th_".$a_type;
00756                 }
00757                 else
00758                 {
00759                         $icon = ilUtil::getImagePath("icon_lm.gif");
00760                         $title = $this->lng->txt("learning_resources");
00761                         $header_id = "th_lres";
00762                 }
00763                 if ($a_show_image)
00764                 {
00765                         $a_tpl->setCurrentBlock("container_header_row_image");
00766                         $a_tpl->setVariable("HEADER_IMG", $icon);
00767                         $a_tpl->setVariable("HEADER_ALT", $title);
00768                 }
00769                 else
00770                 {
00771                         $a_tpl->setCurrentBlock("container_header_row");
00772                 }
00773                 
00774                 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
00775                 $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id);
00776                 $a_tpl->parseCurrentBlock();
00777                 $a_tpl->touchBlock("container_row");
00778         }
00779         
00787         function addParentRow(&$a_tpl, $a_ref_id, $a_show_image = true)
00788         {
00789                 global $tree;
00790                 
00791                 $par_id = ilObject::_lookupObjId($a_ref_id);
00792                 $type = ilObject::_lookupType($par_id);
00793                 if (!in_array($type, array("lm", "dbk", "sahs", "htlm")))
00794                 {
00795                         $icon = ilUtil::getImagePath("icon_".$type.".gif");
00796                 }
00797                 else
00798                 {
00799                         $icon = ilUtil::getImagePath("icon_lm.gif");
00800                 }
00801                 
00802                 // custom icon
00803                 if ($this->ilias->getSetting("custom_icons") &&
00804                 in_array($type, array("cat","grp","crs")))
00805                 {
00806                         require_once("classes/class.ilContainer.php");
00807                         if (($path = ilContainer::_lookupIconPath($par_id, "small")) != "")
00808                         {
00809                                 $icon = $path;
00810                         }
00811                 }
00812                 
00813                 if ($tree->getRootId() != $par_id)
00814                 {
00815                         $title = ilObject::_lookupTitle($par_id);
00816                 }
00817                 else
00818                 {
00819                         $title = $this->lng->txt("repository");
00820                 }
00821                 
00822                 $item_list_gui =& $this->getItemListGUI($type);
00823                 
00824                 $item_list_gui->enableDelete(false);
00825                 $item_list_gui->enableCut(false);
00826                 $item_list_gui->enablePayment(false);
00827                 $item_list_gui->enableLink(false);
00828                 $item_list_gui->enableDescription(false);
00829                 $item_list_gui->enableProperties(false);
00830                 $item_list_gui->enablePreconditions(false);
00831                 $item_list_gui->enablePath(true);
00832                 $item_list_gui->enableCommands(false);
00833                 $html = $item_list_gui->getListItemHTML($a_ref_id,
00834                 $par_id, $title, "");
00835                 
00836                 if ($a_show_image)
00837                 {
00838                         $a_tpl->setCurrentBlock("container_header_row_image");
00839                         $a_tpl->setVariable("HEADER_IMG", $icon);
00840                         $a_tpl->setVariable("HEADER_ALT", $title);
00841                 }
00842                 else
00843                 {
00844                         $a_tpl->setCurrentBlock("container_header_row");
00845                 }
00846                 
00847                 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $html);
00848                 $a_tpl->setVariable("BLOCK_HEADER_ID", "th_".$a_ref_id);
00849                 $a_tpl->parseCurrentBlock();
00850                 $a_tpl->touchBlock("container_row");
00851         }
00852         
00860         function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
00861         $a_image_type = "", $a_related_header = "")
00862         {
00863                 $this->cur_row_type = ($this->cur_row_type == "row_type_1")
00864                 ? "row_type_2"
00865                 : "row_type_1";
00866                 $a_tpl->touchBlock($this->cur_row_type);
00867                 
00868                 if ($a_image_type != "")
00869                 {
00870                         if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs")))
00871                         {
00872                                 $icon = ilUtil::getImagePath("icon_".$a_image_type.".gif");
00873                                 $title = $this->lng->txt("obj_".$a_image_type);
00874                         }
00875                         else
00876                         {
00877                                 $icon = ilUtil::getImagePath("icon_lm.gif");
00878                                 $title = $this->lng->txt("learning_resource");
00879                         }
00880                         
00881                         // custom icon
00882                         if ($this->ilias->getSetting("custom_icons") &&
00883                         in_array($a_image_type, array("cat","grp","crs")))
00884                         {
00885                                 require_once("classes/class.ilContainer.php");
00886                                 if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
00887                                 {
00888                                         $icon = $path;
00889                                 }
00890                         }
00891                         
00892                         $a_tpl->setCurrentBlock("block_row_image");
00893                         $a_tpl->setVariable("ROW_IMG", $icon);
00894                         $a_tpl->setVariable("ROW_ALT", $title);
00895                         $a_tpl->parseCurrentBlock();
00896                 }
00897                 else
00898                 {
00899                         $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
00900                 }
00901                 $a_tpl->setCurrentBlock("container_standard_row");
00902                 $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
00903                 $rel_headers = ($a_related_header != "")
00904                 ? "th_selected_items ".$a_related_header
00905                 : "th_selected_items";
00906                 $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
00907                 $a_tpl->parseCurrentBlock();
00908                 $a_tpl->touchBlock("container_row");
00909         }
00910         
00911         function resetRowType()
00912         {
00913                 $this->cur_row_type = "";
00914         }
00915         
00922         function &newBlockTemplate()
00923         {
00924                 $tpl = new ilTemplate ("tpl.pd_list_block.html", true, true);
00925                 $this->cur_row_type = "";
00926                 return $tpl;
00927         }
00928         
00929         
00930         function displaySystemMessages()
00931         {
00932                 // SYSTEM MAILS
00933                 $umail = new ilMail($_SESSION["AccountId"]);
00934                 $smails = $umail->getMailsOfFolder(0);
00935                 
00936                 if(count($smails))
00937                 {
00938                         // output mails
00939                         $counter = 1;
00940                         foreach ($smails as $mail)
00941                         {
00942                                 // GET INBOX FOLDER FOR LINK_READ
00943                                 require_once "classes/class.ilMailbox.php";
00944                                 
00945                                 $mbox = new ilMailbox($_SESSION["AccountId"]);
00946                                 $inbox = $mbox->getInboxFolder();
00947                                 
00948                                 $this->tpl->setCurrentBlock("tbl_system_msg_row");
00949                                 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow2' : 'tblrow1');
00950                                 
00951                                 // GET SENDER NAME
00952                                 $user = new ilObjUser($mail["sender_id"]);
00953                                 
00954                                 if(!($fullname = $user->getFullname()))
00955                                 {
00956                                         $fullname = $this->lng->txt("unknown");
00957                                 }
00958                                 
00959                                 //new mail or read mail?
00960                                 $this->tpl->setVariable("MAILCLASS", $mail["m_status"] == 'read' ? 'mailread' : 'mailunread');
00961                                 $this->tpl->setVariable("MAIL_FROM", $fullname);
00962                                 $this->tpl->setVariable("MAIL_SUBJ", $mail["m_subject"]);
00963                                 $this->tpl->setVariable("MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00964                                 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00965                                 $this->tpl->setVariable("MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00966                                 $this->tpl->parseCurrentBlock();
00967                         }
00968                         $this->tpl->setCurrentBlock("tbl_system_msg");
00969                         //headline
00970                         $this->tpl->setVariable("SYSTEM_MAILS",$this->lng->txt("mail_system"));
00971                         //columns headlines
00972                         $this->tpl->setVariable("TXT_SENDER", $this->lng->txt("sender"));
00973                         $this->tpl->setVariable("TXT_SUBJECT", $this->lng->txt("subject"));
00974                         $this->tpl->setVariable("TXT_DATETIME",$this->lng->txt("date")."/".$this->lng->txt("time"));
00975                         $this->tpl->parseCurrentBlock();
00976                 }
00977         }
00978         
00979         
00980         
00986         function displayMails()
00987         {
00988                 
00989                 // MAILS
00990                 // GET INBOX FOLDER FOR LINK_READ
00991                 include_once "./include/inc.header.php";
00992                 include_once "./include/inc.mail.php";
00993                 include_once "classes/class.ilObjUser.php";
00994                 include_once "classes/class.ilMailbox.php";
00995                 include_once "classes/class.ilMail.php";
00996                 
00997                 
00998                 // BEGIN MAILS
00999                 $umail = new ilMail($_SESSION["AccountId"]);
01000                 $mbox = new ilMailBox($_SESSION["AccountId"]);
01001                 $inbox = $mbox->getInboxFolder();
01002                 
01003                 //SHOW MAILS FOR EVERY USER
01004                 $mail_data = $umail->getMailsOfFolder($inbox);
01005                 $mail_counter = $umail->getMailCounterData();
01006                 $unreadmails = 0;
01007                 
01008                 
01009                 foreach ($mail_data as $mail)
01010                 {
01011                         //ONLY NEW MAILS WOULD BE ON THE PERONAL DESKTOP
01012                         if($mail["m_status"]== 'unread')
01013                         {
01014                                 //echo $mail["m_status"];
01015                                 
01016                                 $this->tpl->setCurrentBlock("tbl_mails");
01017                                 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow1' : 'tblrow2');
01018                                 $this->tpl->setVariable("NEW_MAIL",$this->lng->txt("email"));
01019                                 
01020                                 // GET SENDER NAME
01021                                 $user = new ilObjUser($mail["sender_id"]);
01022                                 
01023                                 if(!($fullname = $user->getFullname()))
01024                                 {
01025                                         $fullname = $this->lng->txt("unknown");
01026                                 }
01027                                 
01028                                 
01029                                 $this->tpl->setCurrentBlock("tbl_mails");
01030                                 //columns headlines
01031                                 $this->tpl->setVariable("NEW_TXT_SENDER", $this->lng->txt("sender"));
01032                                 $this->tpl->setVariable("NEW_TXT_SUBJECT", $this->lng->txt("subject"));
01033                                 $this->tpl->setVariable("NEW_TXT_DATE",$this->lng->txt("date")."/".$this->lng->txt("time"));
01034                                 
01035                                 
01036                                 $this->tpl->setCurrentBlock("tbl_mails_row");
01037                                 $this->tpl->setVariable("NEW_MAIL_FROM", $fullname);
01038                                 $this->tpl->setVariable("NEW_MAIL_FROM_LOGIN", $user->getLogin());
01039                                 //$this->tpl->setVariable("NEW_MAILCLASS", $mail["status"] == 'read' ? 'mailread' : 'mailunread');
01040                                 $this->tpl->setVariable("NEW_MAIL_SUBJ", $mail["m_subject"]);
01041                                 $this->tpl->setVariable("NEW_MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
01042                                 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
01043                                 $this->tpl->setVariable("NEW_MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
01044                                 $this->tpl->setVariable("IMG_SENDER", $user->getPersonalPicturePath("xxsmall"));
01045                                 $this->tpl->setVariable("ALT_SENDER", $user->getLogin());
01046                                 $this->tpl->parseCurrentBlock();
01047                                 
01048                         }
01049                 }
01050         }
01051         
01052         
01056         function displayNotes()
01057         {
01058                 global $ilias;
01059                 
01060                 if ($ilias->account->getPref("show_notes") == "n")
01061                 {
01062                         return;
01063                 }
01064                 //$users_notes = $ilias->account->getPref("show_notes");
01065                 include_once("Services/Notes/classes/class.ilNoteGUI.php");
01066                 $note_gui = new ilNoteGUI(0,0,"");
01067                 $note_gui->enableTargets();
01068                 $html = $note_gui->getPDOverviewNoteListHTML();
01069                 $this->tpl->setVariable("NOTES", $html);
01070         }
01071         
01075         function displayUsersOnline()
01076         {
01077                 global $ilias, $ilUser,$rbacsystem;
01078                 
01079                 $users_online_pref = $ilias->account->getPref("show_users_online");
01080                 if ($users_online_pref != "y" && $users_online_pref != "associated")
01081                 {
01082                         
01083                         return;
01084                 }
01085                 
01086                 $this->tpl->setVariable("TXT_USERS_ONLINE",$this->lng->txt("users_online"));
01087                 
01088                 if ($users_online_pref == "associated")
01089                 {
01090                         $users = ilUtil::getAssociatedUsersOnline($ilias->account->getId());
01091                 } else {
01092                         $users = ilUtil::getUsersOnline();
01093                 }
01094                 $num = 0;
01095                 
01096                 $users[$ilUser->getId()] =
01097                         array("user_id" => $ilUser->getId(),
01098                                 "firstname" => $ilUser->getFirstname(),
01099                                 "lastname" => $ilUser->getLastname(),
01100                                 "title" => $ilUser->getUTitle(),
01101                                 "login" => $ilUser->getLogin());
01102 
01103                 foreach ($users as $user_id => $user)
01104                 {
01105                         if ($user_id != ANONYMOUS_USER_ID)
01106                         {
01107                                 $num++;
01108                         }
01109                         else
01110                         {
01111                                 $visitors = $user["num"];
01112                         }
01113                 }
01114                 
01115                 // parse visitors text
01116                 if (empty($visitors) || $users_online_pref == "associated")
01117                 {
01118                         $visitor_text = "";
01119                 }
01120                 elseif ($visitors == "1")
01121                 {
01122                         $visitor_text = "1 ".$this->lng->txt("visitor");
01123                 }
01124                 else
01125                 {
01126                         $visitor_text = $visitors." ".$this->lng->txt("visitors");
01127                 }
01128                 
01129                 // determine whether the user want's to see details of the active users
01130                 // and remember user preferences, in case the user has changed them.
01131                 $showdetails = $ilias->account->getPref('show_users_online_details') == 'y';
01132                 
01133                 // parse registered users text
01134                 if ($num > 0)
01135                 {
01136                         $user_kind = ($users_online_pref == "associated") ? "associated_user" : "registered_user";
01137                         if ($num == 1)
01138                         {
01139                                 $user_list = $num." ".$this->lng->txt($user_kind);
01140                         }
01141                         
01142                         else
01143                         {
01144                                 $user_list = $num." ".$this->lng->txt($user_kind."s");
01145                         }
01146                         
01147                         // add details link
01148                         if ($showdetails)
01149                         {
01150                                 $text = $this->lng->txt("hide_details");
01151                                 $cmd = "hideUsersOnlineDetails";
01152                         }
01153                         else
01154                         {
01155                                 $text = $this->lng->txt("show_details");
01156                                 $cmd = "showUsersOnlineDetails";
01157                         }
01158                         
01159                         //$user_details_link = "&nbsp;&nbsp;<span style=\"font-weight:lighter\">[</span><a class=\"std\" href=\"usr_personaldesktop.php?cmd=".$cmd."\">".$text."</a><span style=\"font-weight:lighter\">]</span>";
01160                         
01161                         if (!empty($visitor_text))
01162                         {
01163                                 $user_list .= " ".$this->lng->txt("and")." ".$visitor_text;
01164                         }
01165                         
01166                         //$user_list .= $user_details_link;
01167                 }
01168                 else
01169                 {
01170                         $user_list = $visitor_text;
01171                 }
01172                 
01173                 $this->tpl->setVariable("USER_LIST",$user_list);
01174                 $this->tpl->setVariable("LINK_USER_DETAILS",
01175                 $this->ctrl->getLinkTarget($this, $cmd));
01176                 $this->tpl->setVariable("TXT_USER_DETAILS", $text);
01177 
01178                 // get mail settings id
01179                 include_once 'classes/class.ilMail.php';
01180                 $mail = new ilMail($ilUser->getId());
01181                 $mail_settings_id = $mail->getMailObjectReferenceId();
01182                 
01183                 // display details of users online
01184                 if ($showdetails)
01185                 {
01186                         $z = 0;
01187                         
01188                         foreach ($users as $user_id => $user)
01189                         {
01190                                 if ($user_id != ANONYMOUS_USER_ID)
01191                                 {
01192                                         $rowCol = ilUtil::switchColor($z,"tblrow1","tblrow2");
01193                                         //$login_time = ilFormat::dateDiff(ilFormat::datetime2unixTS($user["last_login"]),time());
01194                                         
01195                                         // hide mail-to icon for anonymous users
01196                                         if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID and $_SESSION["AccountId"] != $user_id)
01197                                         {
01198                                                 // No mail for users that do have permissions to use the mail system
01199                                                 if($rbacsystem->checkAccess('mail_visible',$mail_settings_id) and
01200                                                    $rbacsystem->checkAccessOfUser($user_id,'mail_visible',$mail_settings_id))
01201                                                 {
01202                                                         $this->tpl->setCurrentBlock("mailto_link");
01203                                                         $this->tpl->setVariable("TXT_MAIL",$this->lng->txt("mail"));
01204                                                         $this->tpl->setVariable("MAIL_USR_LOGIN",$user["login"]);
01205                                                         $this->tpl->parseCurrentBlock();
01206                                                 }
01207                                         }
01208                                         
01209                                         // check for profile
01210                                         // todo: use user class!
01211                                         $user_obj = new ilObjUser($user_id);
01212                                         $q = "SELECT value FROM usr_pref WHERE usr_id='".$user_id."' AND keyword='public_profile' AND value='y'";
01213                                         $r = $this->ilias->db->query($q);
01214                                         
01215                                         
01216                                         include_once './chat/classes/class.ilChatServerConfig.php';
01217                                         if(ilChatServerConfig::_isActive())
01218                                         {
01219                                                 if(!$this->__showActiveChatsOfUser($user_id))
01220                                                 {
01221                                                         // Show invite to chat
01222                                                         $this->__showChatInvitation($user_id);
01223                                                 }
01224                                         }
01225                                         
01226                                         if ($r->numRows())
01227                                         {
01228                                                 $this->tpl->setCurrentBlock("profile_link");
01229                                                 //$this->tpl->setVariable("IMG_VIEW", ilUtil::getImagePath("enlarge.gif", false));
01230                                                 $this->tpl->setVariable("TXT_VIEW",$this->lng->txt("profile"));
01231                                                 $this->ctrl->setParameter($this, "user", $user_id);
01232                                                 $this->tpl->setVariable("LINK_PROFILE",
01233                                                 $this->ctrl->getLinkTarget($this, "showUserProfile"));
01234                                                 $this->tpl->setVariable("USR_ID",$user_id);
01235                                                 $this->tpl->parseCurrentBlock();
01236                                         }
01237                                         
01238                                         // user image
01239                                         $this->tpl->setCurrentBlock("usr_image");
01240                                         $this->tpl->setVariable("USR_IMAGE",
01241                                         $user_obj->getPersonalPicturePath("xxsmall"));
01242                                         $this->tpl->setVariable("USR_ALT", $this->lng->txt("personal_picture"));
01243                                         $this->tpl->parseCurrentBlock();
01244                                         
01245                                         $this->tpl->setCurrentBlock("tbl_users_row");
01246                                         $this->tpl->setVariable("ROWCOL",$rowCol);
01247                                         $this->tpl->setVariable("USR_LOGIN",$user["login"]);
01248                                         $this->tpl->setVariable("USR_FULLNAME",ilObjUser::setFullname($user["title"],$user["firstname"],$user["lastname"]));
01249                                         //$this->tpl->setVariable("USR_LOGIN_TIME",$login_time);
01250                                         
01251                                         $this->tpl->parseCurrentBlock();
01252                                         
01253                                         $z++;
01254                                 }
01255                         }
01256                         
01257 /*
01258                         if ($z > 0)
01259                         {
01260                                 $this->tpl->setCurrentBlock("tbl_users_header");
01261                                 $this->tpl->setVariable("TXT_USR",ucfirst($this->lng->txt("user")));
01262                                 $this->tpl->setVariable("TXT_USR_LOGIN_TIME",ucfirst($this->lng->txt("login_time")));
01263                                 $this->tpl->parseCurrentBlock();
01264                         }
01265 */
01266                 }
01267                 
01268                 $this->ctrl->clearParameters($this);
01269         }
01270         
01271         
01275         function displayBookmarks()
01276         {
01277                 include_once("classes/class.ilBookmarkAdministrationGUI.php");
01278                 $bookmark_gui = new ilBookmarkAdministrationGUI();
01279                 $html = $bookmark_gui->getPDBookmarkListHTML();
01280                 $this->tpl->setVariable("BOOKMARKS", $html);
01281         }
01285         function displayFeedback(){
01286                 include_once('Services/Feedback/classes/class.ilFeedbackGUI.php');
01287                 $feedback_gui = new ilFeedbackGUI();
01288                 $html = $feedback_gui->getPDFeedbackListHTML();
01289                 $this->tpl->setVariable('FEEDBACK', $html);
01290         }
01291         
01302         function multiarray_sort ($array, $key_sort)
01303         {
01304                 if ($array) {
01305                         $key_sorta = explode(";", $key_sort);
01306                         
01307                         $multikeys = array_keys($array);
01308                         $keys = array_keys($array[$multikeys[0]]);
01309                         
01310                         for($m=0; $m < count($key_sorta); $m++) {
01311                                 $nkeys[$m] = trim($key_sorta[$m]);
01312                         }
01313                         $n += count($key_sorta);
01314                         
01315                         for($i=0; $i < count($keys); $i++){
01316                                 if(!in_array($keys[$i], $key_sorta)) {
01317                                         $nkeys[$n] = $keys[$i];
01318                                         $n += "1";
01319                                 }
01320                         }
01321                         
01322                         for($u=0;$u<count($array); $u++) {
01323                                 $arr = $array[$multikeys[$u]];
01324                                 for($s=0; $s<count($nkeys); $s++) {
01325                                         $k = $nkeys[$s];
01326                                         $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
01327                                 }
01328                         }
01329                         sort($output);
01330                         return $output;
01331                 }
01332         }
01333         
01337         function setTabs()
01338         {
01339                 $this->tpl->addBlockFile("TABS", "tabs", "tpl.tabs.html");
01340                 
01341                 $script_name = basename($_SERVER["SCRIPT_NAME"]);
01342                 
01343                 $command = $_GET["cmd"] ? $_GET["cmd"] : "";
01344                 
01345                 if (ereg("whois",$command) or $script_name == "profile.php")
01346                 {
01347                         $who_is_online = true;
01348                 }
01349                 
01350                 // to do: use ilTabsGUI here!
01351                 
01352                 // personal desktop home
01353                 $inc_type = (strtolower($_GET["baseClass"]) == "ilpersonaldesktopgui" &&
01354                 (strtolower($this->cmdClass) == "ilpersonaldesktopgui" ||
01355                 $this->cmdClass == "" || (strtolower($this->cmdClass)) == "ilfeedbackgui"))
01356                 ? "tabactive"
01357                 : "tabinactive";
01358                 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTarget($this), $this->lng->txt("overview"));
01359                 
01360                 // user profile
01361                 $inc_type = (strtolower($this->cmdClass) == "ilpersonalprofilegui")
01362                 ? "tabactive"
01363                 : "tabinactive";
01364                 $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPersonalProfileGUI"),
01365                 $this->lng->txt("personal_profile"));
01366                 
01367                 if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
01368                 {
01369                         // user calendar
01370                         if ($this->ilias->getSetting("enable_calendar"))
01371                         {
01372                                 $inc_type = ($script_name == "dateplaner.php")
01373                                 ? "tabactive"
01374                                 : "tabinactive";
01375                                 $inhalt1[] = array($inc_type,"dateplaner.php",$this->lng->txt("calendar"));
01376                         }
01377                         
01378                         // private notes
01379                         $inc_type = (strtolower($this->cmdClass) == "ilpdnotesgui" ||
01380                         strtolower($this->cmdClass) == "ilnotegui")
01381                         ? "tabactive"
01382                         : "tabinactive";
01383                         $inhalt1[] = array($inc_type,
01384                         $this->ctrl->getLinkTargetByClass("ilpdnotesgui"),
01385                         $this->lng->txt("private_notes"));
01386                         
01387                         // user bookmarks
01388                         $inc_type = (strtolower($this->cmdClass) == "ilbookmarkadministrationgui")
01389                         ? "tabactive"
01390                         : "tabinactive";
01391                         $inhalt1[] = array($inc_type,
01392                         $this->ctrl->getLinkTargetByClass("ilbookmarkadministrationgui"),
01393                         $this->lng->txt("bookmarks"));
01394                         
01395                 }
01396                 
01397                 // Tracking
01398                 
01399                 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
01400                 if (ilObjUserTracking::_enabledLearningProgress())
01401                 {
01402                         $cmd_classes = array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui');
01403                         $inc_type = in_array(strtolower($this->cmdClass),$cmd_classes) ? 'tabactive' : 'tabinactive';
01404                         
01405                         $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"),
01406                         $this->lng->txt("learning_progress"));
01407                 }
01408                 
01409                 include_once "./payment/classes/class.ilPaymentVendors.php";
01410                 include_once "./payment/classes/class.ilPaymentTrustees.php";
01411                 include_once "./payment/classes/class.ilPaymentShoppingCart.php";
01412                 include_once "./payment/classes/class.ilPaymentBookings.php";
01413                 
01414                 if(ilPaymentShoppingCart::_hasEntries($this->ilias->account->getId()) or
01415                 ilPaymentBookings::_getCountBookingsByCustomer($this->ilias->account->getId()))
01416                 {
01417                         $this->lng->loadLanguageModule('payment');
01418 
01419                         $cmd_classes = array('ilpaymentgui','ilpaymentshoppingcartgui','ilpaymentbuyedobjectsgui');
01420                         $inc_type = in_array(strtolower($this->cmdClass),$cmd_classes) ? 'tabactive' : 'tabinactive';
01421 
01422                         $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPaymentGUI"),
01423                         $this->lng->txt("paya_shopping_cart"));
01424                 }
01425                 if(ilPaymentVendors::_isVendor($this->ilias->account->getId()) or
01426                 ilPaymentTrustees::_hasAccess($this->ilias->account->getId()))
01427                 {
01428                         $this->lng->loadLanguageModule('payment');
01429 
01430                         $cmd_classes = array('ilpaymentstatisticgui','ilpaymentobjectgui','ilpaymenttrusteegui','ilpaymentadmingui');
01431                         $inc_type = in_array(strtolower($this->cmdClass),$cmd_classes) ? 'tabactive' : 'tabinactive';
01432 
01433                         $inhalt1[] = array($inc_type, $this->ctrl->getLinkTargetByClass("ilPaymentAdminGUI"),
01434                         $this->lng->txt("paya_header"));
01435                 }
01436                 
01437                 for ( $i=0; $i<sizeof($inhalt1); $i++)
01438                 {
01439                         if ($inhalt1[$i][1] != "")
01440                         {       $this->tpl->setCurrentBlock("tab");
01441                                 $this->tpl->setVariable("TAB_TYPE",$inhalt1[$i][0]);
01442                                 $this->tpl->setVariable("TAB_LINK",$inhalt1[$i][1]);
01443                                 $this->tpl->setVariable("TAB_TEXT",$inhalt1[$i][2]);
01444                                 $this->tpl->setVariable("TAB_TARGET",$inhalt1[$i][3]);
01445                                 $this->tpl->parseCurrentBlock();
01446                         }
01447                 }
01448                 
01449                 $this->tpl->setCurrentBlock("tabs");
01450                 $this->tpl->parseCurrentBlock();
01451         }
01452         
01456         function jumpToProfile()
01457         {
01458                 $this->ctrl->redirectByClass("ilpersonalprofilegui");
01459         }
01460         
01464         function jumpToBookmarks()
01465         {
01466                 $this->ctrl->redirectByClass("ilbookmarkadministrationgui");
01467         }
01468         
01472         function jumpToNotes()
01473         {
01474                 $this->ctrl->redirectByClass("ilpdnotesgui");
01475         }
01476         
01480         function jumpToLP()
01481         {
01482                 $this->ctrl->redirectByClass("illearningprogressgui");
01483         }
01484         
01485         
01486         function __showActiveChatsOfUser($a_usr_id)
01487         {
01488                 global $rbacsystem;
01489                 
01490                 // show chat info
01491                 include_once './chat/classes/class.ilChatRoom.php';
01492                 
01493                 $chat_id = ilChatRoom::_isActive($a_usr_id);
01494                 foreach(ilObject::_getAllReferences($chat_id) as $ref_id)
01495                 {
01496                         if($rbacsystem->checkAccess('read',$ref_id))
01497                         {
01498                                 $this->tpl->setCurrentBlock("chat_info");
01499                                 $this->tpl->setVariable("CHAT_ACTIVE_IN",$this->lng->txt('chat_active_in'));
01500                                 $this->tpl->setVariable("CHAT_LINK","chat/chat.php?ref_id=".$ref_id."&room_id=0");
01501                                 $this->tpl->setVariable("CHAT_TITLE",ilObject::_lookupTitle($chat_id));
01502                                 $this->tpl->parseCurrentBlock();
01503                                 
01504                                 return true;
01505                         }
01506                 }
01507                 return false;
01508         }
01509         
01510         function __showChatInvitation($a_usr_id)
01511         {
01512                 global $rbacsystem,$ilUser;
01513                 
01514                 include_once './chat/classes/class.ilObjChat.php';
01515                 
01516                 if($a_usr_id == $ilUser->getId())
01517                 {
01518                         return false;
01519                 }
01520                 
01521                 if($rbacsystem->checkAccess('read',ilObjChat::_getPublicChatRefId())
01522                 and $rbacsystem->checkAccessOfUser($a_usr_id,'read',ilObjChat::_getPublicChatRefId()))
01523                 {
01524                         $this->tpl->setCurrentBlock("chat_link");
01525                         $this->tpl->setVariable("TXT_CHAT_INVITE",$this->lng->txt('chat_invite'));
01526                         $this->tpl->setVariable("CHAT_LINK",'chat/chat.php?ref_id='.ilObjChat::_getPublicChatRefId().
01527                         '&usr_id='.$a_usr_id.'&cmd=invitePD');
01528                         $this->tpl->parseCurrentBlock();
01529                         
01530                         return true;
01531                 }
01532                 return false;
01533         }
01534 
01535         function __loadNextClass()
01536         {
01537                 $stored_classes = array('ilpersonaldesktopgui',
01538                                                                 'ilpersonalprofilegui',
01539                                                                 'ilpdnotesgui',
01540                                                                 'ilbookmarkadministrationgui',
01541                                                                 'illearningprogressgui',
01542                                                                 'ilpaymentadmingui');
01543 
01544                 if(isset($_SESSION['il_pd_history']) and in_array($_SESSION['il_pd_history'],$stored_classes))
01545                 {
01546                         return $_SESSION['il_pd_history'];
01547                 }
01548                 else
01549                 {
01550                         $this->ctrl->getNextClass($this);
01551                 }
01552         }
01553         function __storeLastClass($a_class)
01554         {
01555                 $_SESSION['il_pd_history'] = $a_class;
01556                 $this->cmdClass = $a_class;
01557         }
01558 }
01559 ?>

Generated on Fri Dec 13 2013 13:52:08 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1