• Main Page
  • Related Pages
  • 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-2001 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 
00025 
00026 class ilPersonalDesktopGUI
00027 {
00028     var $tpl;
00029     var $lng;
00030     var $ilias;
00031 
00032 
00033 
00034     function ilPersonalDesktopGUI()
00035     {
00036         global $ilias, $tpl, $lng, $rbacsystem;
00037 
00038 
00039         $this->tpl =& $tpl;
00040         $this->lng =& $lng;
00041         $this->ilias =& $ilias;
00042     }
00043 
00044 
00048         function displaySelectedItems()
00049         {
00050                         
00051                 $html = "";
00052                 
00053                 $html.= $this->getSelectedItemsBlockHTML();
00054                 
00055                 if ($html != "")
00056                 {
00057                         $this->tpl->setCurrentBlock("selected_items");
00058                         $this->tpl->setVariable("SELECTED_ITEMS", $html);
00059                         $this->tpl->parseCurrentBlock();
00060                 }
00061         }
00062 
00063 
00067         function getSelectedItemsBlockHTML()
00068         {
00069                 global $ilUser;
00070                 
00071                 include_once './classes/class.ilRepositoryExplorer.php';
00072 
00073                 global $rbacsystem, $objDefinition, $ilBench;
00074                 
00075                 $output = false;
00076                 $types = array(
00077                         array("title" => $this->lng->txt("objs_cat"), "types" => "cat"),
00078                         array("title" => $this->lng->txt("objs_fold"), "types" => "fold"),
00079                         array("title" => $this->lng->txt("objs_crs"), "types" => "crs"),
00080                         array("title" => $this->lng->txt("objs_grp"), "types" => "grp"),
00081                         array("title" => $this->lng->txt("objs_chat"), "types" => "chat"),
00082                         array("title" => $this->lng->txt("objs_frm"), "types" => "frm"),
00083                         array("title" => $this->lng->txt("learning_resources"),"types" => array("lm", "htlm", "sahs", "dbk")),
00084                         array("title" => $this->lng->txt("objs_glo"), "types" => "glo"),
00085                         array("title" => $this->lng->txt("objs_file"), "types" => "file"),
00086                         array("title" => $this->lng->txt("objs_webr"), "types" => "webr"),
00087                         array("title" => $this->lng->txt("objs_exc"), "types" => "exc"),
00088                         array("title" => $this->lng->txt("objs_tst"), "types" => "tst"),
00089                         array("title" => $this->lng->txt("objs_svy"), "types" => "svy"),
00090                         array("title" => $this->lng->txt("objs_mep"), "types" => "mep"),
00091                         array("title" => $this->lng->txt("objs_qpl"), "types" => "qpl"),
00092                         array("title" => $this->lng->txt("objs_spl"), "types" => "spl"),
00093                         array("title" => $this->lng->txt("objs_icrs"), "types" => "icrs"),
00094                         array("title" => $this->lng->txt("objs_icla"), "types" => "icla")
00095                 );
00096                 
00097                 //$html = "";
00098                 
00099                 $tpl =& $this->newBlockTemplate();
00100                 
00101                 foreach ($types as $type)
00102                 {
00103                         $type = $type["types"];
00104                         $title = $type["title"];
00105                         
00106                         $items = $this->ilias->account->getDesktopItems($type);
00107                         $item_html = array();
00108 
00109                         if (count($items) > 0)
00110                         {
00111                                 $tstCount = 0;
00112                                 $unsetCount = 0;
00113                                 $progressCount = 0;
00114                                 $unsetFlag = 0;
00115                                 $progressFlag = 0;
00116                                 $completedFlag = 0;
00117                                 if (strcmp($a_type, "tst") == 0) {
00118                                         $items = $this->multiarray_sort($items, "used_tries; title");
00119                                         foreach ($items as $tst_item) {
00120                                                 if (!isset($tst_item["used_tries"])) {
00121                                                         $unsetCount++;
00122                                                 }
00123                                                 elseif ($tst_item["used_tries"] == 0) {
00124                                                         $progressCount++;
00125                                                 }
00126                                         }
00127                                 }
00128                         
00129                                 /*
00130                                 $tpl = new ilTemplate("tpl.usr_pd_selected_item_block.html", true, true);
00131                                 $tpl->setVariable("TXT_BLOCK_HEADER", $a_title);
00132                                 $img_type  = (is_array($a_type))
00133                                         ? $a_type[0]
00134                                         : $a_type;*/
00135         
00136                                 //$tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_".$img_type.".gif"));
00137                                 
00138                                 //$this->lng->loadLanguageModule("assessment");
00139                                 //$this->lng->loadLanguageModule("survey");
00140                                 //$this->lng->loadLanguageModule("crs");
00141                                 foreach($items as $item)
00142                                 {
00143                                         // special test handling
00144                                         /*
00145                                         if (strcmp($a_type, "tst")==0) {
00146                                                 
00147                                                 $tpl->setCurrentBlock("tbl_tstheader");
00148                                                 if (($tstCount < $unsetCount)&&($unsetFlag==0)) {
00149                                                         $tpl->setVariable("TXT_TST_TITLE", $this->lng->txt("tst_status_not_entered"));
00150                                                         $unsetFlag++;
00151                                                 }
00152                                                 elseif (($tstCount < ($unsetCount+$progressCount))&&($progressFlag==0)) {
00153                                                         $tpl->setVariable("TXT_TST_TITLE", $this->lng->txt("tst_status_progress"));
00154                                                         $progressFlag++;
00155                                                 }
00156                                                 elseif (($tstCount >= ($unsetCount+$progressCount))&&($completedFlag==0)) {
00157                                                         $tpl->setVariable("TXT_TST_TITLE", $this->lng->txt("tst_status_completed_more_tries_possible"));
00158                                                         $completedFlag++;
00159                                                 }
00160                                                 $tstCount++;
00161                                                 $tpl->parseCurrentBlock();
00162                                         }*/
00163                                         
00164                                         // get list gui class for each object type
00165                                         if ($cur_obj_type != $item["type"])
00166                                         {
00167                                                 $class = $objDefinition->getClassName($item["type"]);
00168                                                 $location = $objDefinition->getLocation($item["type"]);
00169                                                 $full_class = "ilObj".$class."ListGUI";
00170                                                 include_once($location."/class.".$full_class.".php");
00171                                                 $item_list_gui = new $full_class();
00172                                                 $item_list_gui->enableDelete(false);
00173                                                 $item_list_gui->enableCut(false);
00174                                                 $item_list_gui->enablePayment(false);
00175                                                 $item_list_gui->enableLink(false);
00176                                                 if ($ilUser->getPref("pd_selected_items_details") != "y")
00177                                                 {
00178                                                         $item_list_gui->enableDescription(false);
00179                                                         $item_list_gui->enableProperties(false);
00180                                                         $item_list_gui->enablePreconditions(false);
00181                                                 }
00182                                         }
00183                                         // render item row
00184                                         $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
00185         
00186                                         $html = $item_list_gui->getListItemHTML($item["ref_id"],
00187                                                 $item["obj_id"], $item["title"], $item["description"]);
00188                                         $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
00189                                         if ($html != "")
00190                                         {
00191                                                 $item_html[] = array("html" => $html, "item_id" => $item["ref_id"]);
00192 
00193                                                 /*
00194                                                 $tpl->setVariable("ITEM_HTML", $html);
00195                                                 $tpl->setCurrentBlock("block_row");
00196                                                 $tpl->setVariable("ROWCOL","tblrow".(($i++ % 2)+1));
00197                                                 $tpl->parseCurrentBlock();
00198                                                 */
00199                                         }
00200                                 }
00201 
00202                                 // output block for resource type
00203                                 if (count($item_html) > 0)
00204                                 {
00205                                         // add a header for each resource type
00206                                         if ($ilUser->getPref("pd_selected_items_details") == "y")
00207                                         {
00208                                                 $this->addHeaderRow($tpl, $type);
00209                                                 $this->resetRowType();
00210                                         }
00211 
00212                                         // content row
00213                                         foreach($item_html as $item)
00214                                         {
00215                                                 if ($ilUser->getPref("pd_selected_items_details") != "y")
00216                                                 {
00217                                                         $this->addStandardRow($tpl, $item["html"], $item["item_id"], $type);
00218                                                 }
00219                                                 else
00220                                                 {
00221                                                         $this->addStandardRow($tpl, $item["html"], $item["item_id"]);
00222                                                 }
00223                                                 $output = true;
00224                                         }
00225                                 }
00226                         }
00227                 }
00228                 
00229                 if ($output)
00230                 {
00231                         $tpl->setCurrentBlock("pd_header_row");
00232                         $tpl->setVariable("PD_BLOCK_HEADER_CONTENT", $this->lng->txt("selected_items"));
00233                         if ($ilUser->getPref("pd_selected_items_details") == "y")
00234                         {
00235                                 $tpl->setVariable("TXT_SEL_ITEMS_MODE", $this->lng->txt("hide_details"));
00236                                 $tpl->setVariable("LINK_SEL_ITEMS_MODE", "usr_personaldesktop.php?cmd=hideSelectedItemsDetails");
00237                         }
00238                         else
00239                         {
00240                                 $tpl->setVariable("TXT_SEL_ITEMS_MODE", $this->lng->txt("show_details"));
00241                                 $tpl->setVariable("LINK_SEL_ITEMS_MODE", "usr_personaldesktop.php?cmd=showSelectedItemsDetails");
00242                         }
00243                         $tpl->parseCurrentBlock();
00244                 }
00245                 
00246                 return $tpl->get();
00247     }
00248         
00256         function addHeaderRow(&$a_tpl, $a_type)
00257         {
00258                 if (!is_array($a_type))
00259                 {
00260                         $icon = ilUtil::getImagePath("icon_".$a_type.".gif");
00261                         $title = $this->lng->txt("objs_".$a_type);
00262                 }
00263                 else
00264                 {
00265                         $icon = ilUtil::getImagePath("icon_lm.gif");
00266                         $title = $this->lng->txt("learning_resources");
00267                 }
00268                 $a_tpl->setCurrentBlock("container_header_row");
00269                 $a_tpl->setVariable("HEADER_IMG", $icon);
00270                 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
00271                 $a_tpl->parseCurrentBlock();
00272                 $a_tpl->touchBlock("container_row");
00273         }
00274 
00282         function addStandardRow(&$a_tpl, $a_html, $a_item_id = "", $a_image_type = "")
00283         {
00284                 $this->cur_row_type = ($this->cur_row_type == "row_type_1")
00285                         ? "row_type_2"
00286                         : "row_type_1";
00287                 $a_tpl->touchBlock($this->cur_row_type);
00288                 
00289                 if ($a_image_type != "")
00290                 {
00291                         if (!is_array($a_image_type))
00292                         {
00293                                 $icon = ilUtil::getImagePath("icon_".$a_image_type.".gif");
00294                                 $title = $this->lng->txt("objs_".$a_image_type);
00295                         }
00296                         else
00297                         {
00298                                 $icon = ilUtil::getImagePath("icon_lm.gif");
00299                                 $title = $this->lng->txt("learning_resources");
00300                         }
00301 
00302                         $a_tpl->setCurrentBlock("block_row_image");
00303                         $a_tpl->setVariable("ROW_IMG", $icon);
00304                         $a_tpl->parseCurrentBlock();
00305                 }
00306                 else
00307                 {
00308                         $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
00309                 }
00310                 $a_tpl->setCurrentBlock("container_standard_row");
00311                 $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
00312                 $a_tpl->parseCurrentBlock();
00313                 $a_tpl->touchBlock("container_row");
00314         }
00315 
00316         function resetRowType()
00317         {
00318                 $this->cur_row_type = "";
00319         }
00320         
00327         function &newBlockTemplate()
00328         {
00329                 $tpl = new ilTemplate ("tpl.pd_list_block.html", true, true);
00330                 $this->cur_row_type = "";
00331                 return $tpl;
00332         }
00333 
00334 
00335     function displaySystemMessages()
00336     {
00337         // SYSTEM MAILS
00338         $umail = new ilMail($_SESSION["AccountId"]);
00339         $smails = $umail->getMailsOfFolder(0);
00340 
00341         if(count($smails))
00342         {
00343             // output mails
00344             $counter = 1;
00345             foreach ($smails as $mail)
00346             {
00347                 // GET INBOX FOLDER FOR LINK_READ
00348                 require_once "classes/class.ilMailbox.php";
00349 
00350                 $mbox = new ilMailbox($_SESSION["AccountId"]);
00351                 $inbox = $mbox->getInboxFolder();
00352 
00353                 $this->tpl->setCurrentBlock("tbl_system_msg_row");
00354                 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow1' : 'tblrow2');
00355 
00356                 // GET SENDER NAME
00357                 $user = new ilObjUser($mail["sender_id"]);
00358 
00359                 if(!($fullname = $user->getFullname()))
00360                 {
00361                     $fullname = $this->lng->txt("unknown");
00362                 }
00363 
00364                 //new mail or read mail?
00365                 $this->tpl->setVariable("MAILCLASS", $mail["m_status"] == 'read' ? 'mailread' : 'mailunread');
00366                 $this->tpl->setVariable("MAIL_FROM", $fullname);
00367                 $this->tpl->setVariable("MAIL_SUBJ", $mail["m_subject"]);
00368                 $this->tpl->setVariable("MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00369                 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00370                 $this->tpl->setVariable("MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00371                 $this->tpl->parseCurrentBlock();
00372             }
00373             $this->tpl->setCurrentBlock("tbl_system_msg");
00374             //headline
00375             $this->tpl->setVariable("SYSTEM_MAILS",$this->lng->txt("mail_system"));
00376             //columns headlines
00377             $this->tpl->setVariable("TXT_SENDER", $this->lng->txt("sender"));
00378             $this->tpl->setVariable("TXT_SUBJECT", $this->lng->txt("subject"));
00379             $this->tpl->setVariable("TXT_DATETIME",$this->lng->txt("date")."/".$this->lng->txt("time"));
00380             $this->tpl->parseCurrentBlock();
00381         }
00382     }
00383 
00384 
00385 
00391         function displayMails()
00392         {
00393 
00394                 // MAILS
00395                 // GET INBOX FOLDER FOR LINK_READ
00396                 include_once "./include/inc.header.php";
00397                 include_once "./include/inc.mail.php";
00398                 include_once "classes/class.ilObjUser.php";
00399                 include_once "classes/class.ilMailbox.php";
00400                 include_once "classes/class.ilMail.php";
00401 
00402 
00403                 // BEGIN MAILS
00404                 $umail = new ilMail($_SESSION["AccountId"]);
00405                 $mbox = new ilMailBox($_SESSION["AccountId"]);
00406                 $inbox = $mbox->getInboxFolder();
00407 
00408                 //SHOW MAILS FOR EVERY USER
00409                 $mail_data = $umail->getMailsOfFolder($inbox);
00410                 $mail_counter = $umail->getMailCounterData();
00411                 $unreadmails = 0;
00412                 
00413 
00414                 foreach ($mail_data as $mail)
00415                 {
00416                         //ONLY NEW MAILS WOULD BE ON THE PERONAL DESKTOP
00417                         if($mail["m_status"]== 'unread')
00418                         {
00419                                 //echo $mail["m_status"];
00420                                 
00421                                 $this->tpl->setCurrentBlock("tbl_mails");
00422                                 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow1' : 'tblrow2');
00423                                 $this->tpl->setVariable("NEW_MAIL",$this->lng->txt("email"));
00424 
00425                                 // GET SENDER NAME
00426                                 $user = new ilObjUser($mail["sender_id"]);
00427 
00428                                 if(!($fullname = $user->getFullname()))
00429                                 {
00430                                         $fullname = $this->lng->txt("unknown");
00431                                 }
00432 
00433 
00434                                 $this->tpl->setCurrentBlock("tbl_mails");
00435                                 //columns headlines
00436                                 $this->tpl->setVariable("NEW_TXT_SENDER", $this->lng->txt("sender"));
00437                                 $this->tpl->setVariable("NEW_TXT_SUBJECT", $this->lng->txt("subject"));
00438                                 $this->tpl->setVariable("NEW_TXT_DATE",$this->lng->txt("date")."/".$this->lng->txt("time"));
00439 
00440 
00441                                 $this->tpl->setCurrentBlock("tbl_mails_row");
00442                                 $this->tpl->setVariable("NEW_MAIL_FROM", $fullname);
00443                                 $this->tpl->setVariable("NEW_MAILCLASS", $mail["status"] == 'read' ? 'mailread' : 'mailunread');
00444                                 $this->tpl->setVariable("NEW_MAIL_SUBJ", $mail["m_subject"]);
00445                                 $this->tpl->setVariable("NEW_MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00446                                 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00447                                 $this->tpl->setVariable("NEW_MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00448                                 $this->tpl->parseCurrentBlock();
00449 
00450                         }
00451                 }
00452         }
00453 
00454 
00455 
00456 
00460     function displayUsersOnline()
00461     {
00462         global $ilias;
00463 
00464                 $users_online_pref = $ilias->account->getPref("show_users_online");
00465         if ($users_online_pref != "y" && $users_online_pref != "associated")
00466         {
00467 
00468             return;
00469         }
00470 
00471         $this->tpl->setVariable("TXT_USERS_ONLINE",$this->lng->txt("users_online"));
00472 
00473         if ($users_online_pref == "associated")
00474                 {
00475                         $users = ilUtil::getAssociatedUsersOnline($ilias->account->getId());
00476                 } else {
00477                         $users = ilUtil::getUsersOnline();
00478                 }
00479 
00480         $num = 0;
00481 
00482         foreach ($users as $user_id => $user)
00483         {
00484             if ($user_id != ANONYMOUS_USER_ID)
00485             {
00486                 $num++;
00487             }
00488             else
00489             {
00490                 $visitors = $user["num"];
00491             }
00492         }
00493 
00494         // parse visitors text
00495         if (empty($visitors) || $users_online_pref == "associated")
00496         {
00497             $visitor_text = "";
00498         }
00499         elseif ($visitors == "1")
00500         {
00501             $visitor_text = "1 ".$this->lng->txt("visitor");
00502         }
00503         else
00504         {
00505             $visitor_text = $visitors." ".$this->lng->txt("visitors");
00506         }
00507 
00508                 // determine whether the user want's to see details of the active users
00509                 // and remember user preferences, in case the user has changed them.
00510                 $showdetails = false;
00511                 if ($_GET['cmd'] == 'whoisdetail')
00512                 {
00513                         $ilias->account->writePref('show_users_online_details','y');
00514                         $showdetails = true;
00515                 }
00516                 else if ($_GET['cmd'] == 'hidedetails')
00517                 {
00518                         $ilias->account->writePref('show_users_online_details','n');
00519                         $showdetails = false;
00520                 } 
00521                 else
00522                 {
00523                         $showdetails = $ilias->account->getPref('show_users_online_details') == 'y';
00524                 }
00525 
00526 
00527                 // parse registered users text
00528                 if ($num > 0)
00529                 {
00530                         $user_kind = ($users_online_pref == "associated") ? "associated_user" : "registered_user";
00531                         if ($num == 1)
00532                         {
00533                                 $user_list = $num." ".$this->lng->txt($user_kind);
00534                         }
00535 
00536                         else
00537                         {
00538                                 $user_list = $num." ".$this->lng->txt($user_kind."s");
00539                         }
00540 
00541                         // add details link
00542                         if ($showdetails)
00543                         {
00544                                 $text = $this->lng->txt("hide_details");
00545                                 $cmd = "hidedetails";
00546                         }
00547                         else
00548                         {
00549                                 $text = $this->lng->txt("show_details");
00550                                 $cmd = "whoisdetail";
00551                         }
00552 
00553                         //$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>";
00554 
00555                         if (!empty($visitor_text))
00556                         {
00557                                 $user_list .= " ".$this->lng->txt("and")." ".$visitor_text;
00558                         }
00559 
00560                         //$user_list .= $user_details_link;
00561                 }
00562                 else
00563                 {
00564                         $user_list = $visitor_text;
00565                 }
00566 
00567                 $this->tpl->setVariable("USER_LIST",$user_list);
00568                 $this->tpl->setVariable("LINK_USER_DETAILS", "usr_personaldesktop.php?cmd=".$cmd);
00569                 $this->tpl->setVariable("TXT_USER_DETAILS", $text);
00570 
00571         // display details of users online
00572         if ($showdetails)
00573         {
00574             $z = 0;
00575 
00576             foreach ($users as $user_id => $user)
00577             {
00578                 if ($user_id != ANONYMOUS_USER_ID)
00579                 {
00580                     $rowCol = ilUtil::switchColor($z,"tblrow1","tblrow2");
00581                     $login_time = ilFormat::dateDiff(ilFormat::datetime2unixTS($user["last_login"]),time());
00582 
00583                     // hide mail-to icon for anonymous users
00584                     if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID and $_SESSION["AccountId"] != $user_id)
00585                     {
00586                         $this->tpl->setCurrentBlock("mailto_link");
00587                         //$this->tpl->setVariable("IMG_MAIL", ilUtil::getImagePath("icon_pencil_b.gif", false));
00588                         $this->tpl->setVariable("TXT_MAIL",$this->lng->txt("mail"));
00589                         $this->tpl->setVariable("USR_LOGIN",$user["login"]);
00590                         $this->tpl->parseCurrentBlock();
00591                     }
00592 
00593                     // check for profile
00594                     // todo: use user class!
00595                     $user_obj = new ilObjUser($user_id);
00596                     $q = "SELECT value FROM usr_pref WHERE usr_id='".$user_id."' AND keyword='public_profile' AND value='y'";
00597                     $r = $this->ilias->db->query($q);
00598 
00599                     if ($r->numRows())
00600                     {
00601                         $this->tpl->setCurrentBlock("profile_link");
00602                         //$this->tpl->setVariable("IMG_VIEW", ilUtil::getImagePath("enlarge.gif", false));
00603                         $this->tpl->setVariable("TXT_VIEW",$this->lng->txt("profile"));
00604                         $this->tpl->setVariable("USR_ID",$user_id);
00605                         $this->tpl->parseCurrentBlock();
00606                     }
00607 
00608                     // user image
00609                     $webspace_dir = ilUtil::getWebspaceDir();
00610                     $image_dir = $webspace_dir."/usr_images";
00611                     $xxthumb_file = $image_dir."/usr_".$user_obj->getID()."_xxsmall.jpg";
00612                     if ($user_obj->getPref("public_upload") == "y" &&
00613                         $user_obj->getPref("public_profile") == "y" &&
00614                         @is_file($xxthumb_file))
00615                     {
00616                         $this->tpl->setCurrentBlock("usr_image");
00617                         $this->tpl->setVariable("USR_IMAGE", $xxthumb_file."?t=".rand(1, 99999));
00618                         $this->tpl->parseCurrentBlock();
00619                     }
00620                     else
00621                     {
00622                         $this->tpl->setCurrentBlock("usr_image");
00623                         $this->tpl->setVariable("USR_IMAGE", ilUtil::getImagePath("no_photo_xxsmall.jpg"));
00624                         $this->tpl->parseCurrentBlock();
00625                     }
00626 
00627                     $this->tpl->setCurrentBlock("tbl_users_row");
00628                     $this->tpl->setVariable("ROWCOL",$rowCol);
00629                     $this->tpl->setVariable("USR_LOGIN",$user["login"]);
00630                     $this->tpl->setVariable("USR_FULLNAME",ilObjUser::setFullname($user["title"],$user["firstname"],$user["lastname"]));
00631                     $this->tpl->setVariable("USR_LOGIN_TIME",$login_time);
00632 
00633                     $this->tpl->parseCurrentBlock();
00634 
00635                     $z++;
00636                 }
00637             }
00638 
00639             if ($z > 0)
00640             {
00641                 $this->tpl->setCurrentBlock("tbl_users_header");
00642                 $this->tpl->setVariable("TXT_USR",ucfirst($this->lng->txt("user")));
00643                 $this->tpl->setVariable("TXT_USR_LOGIN_TIME",ucfirst($this->lng->txt("login_time")));
00644                 $this->tpl->parseCurrentBlock();
00645             }
00646         }
00647     }
00648 
00649 
00653     function displayBookmarks()
00654     {
00655         include_once("classes/class.ilBookmarkFolder.php");
00656         if (!empty($_GET["curBMFolder"]))
00657         {
00658             $_SESSION["ilCurBMFolder"] = $_GET["curBMFolder"];
00659         }
00660         $bm_items = ilBookmarkFolder::getObjects($_SESSION["ilCurBMFolder"]);
00661 
00662                 if(ilBookmarkFolder::isRootFolder($_SESSION['ilCurBMFolder']) or !$_SESSION['ilCurBMFolder'])
00663                 {
00664                         $colspan = 2;
00665                 }
00666  
00667                 $i = 0;
00668         if (!ilBookmarkFolder::isRootFolder($_SESSION["ilCurBMFolder"])
00669             && !empty($_SESSION["ilCurBMFolder"]))
00670         {
00671             $i++;
00672             $this->tpl->setCurrentBlock("tbl_bm_row");
00673                         $rowcol = ($rowcol == "tblrow1") ? "tblrow2" : "tblrow1";
00674             $this->tpl->setVariable("ROWCOL", $rowcol);
00675                         $this->tpl->setVariable("IMG_BM", ilUtil::getImagePath("icon_cat.gif"));
00676                         $this->tpl->setVariable("BM_TITLE", "..");
00677             $this->tpl->setVariable("BM_LINK", "usr_personaldesktop.php?curBMFolder=".
00678                                 ilBookmarkFolder::_getParentId($_SESSION["ilCurBMFolder"]));
00679             $this->tpl->setVariable("BM_TARGET", "");
00680             $this->tpl->parseCurrentBlock();
00681         }
00682 
00683         foreach ($bm_items as $bm_item)
00684         {
00685             $i++;
00686 
00687                         $this->tpl->setCurrentBlock("tbl_bm_row");
00688                         $rowcol = ($rowcol == "tblrow1") ? "tblrow2" : "tblrow1";
00689             $this->tpl->setVariable("ROWCOL", $rowcol);
00690 
00691             switch ($bm_item["type"])
00692             {
00693                 case "bmf":
00694                                         $this->tpl->setVariable("IMG_BM", ilUtil::getImagePath("icon_cat.gif"));
00695                                         $this->tpl->setVariable("BM_TITLE", $bm_item["title"]);
00696                     $this->tpl->setVariable("BM_LINK", "usr_personaldesktop.php?curBMFolder=".$bm_item["obj_id"]);
00697                     $this->tpl->setVariable("BM_TARGET", "");
00698                     break;
00699 
00700                 case "bm":
00701                                         $this->tpl->setVariable("IMG_BM", ilUtil::getImagePath("icon_bm.gif"));
00702                                         $this->tpl->setVariable("BM_TITLE", $bm_item["title"]);
00703                     $this->tpl->setVariable("BM_LINK", $bm_item["target"]);
00704                     $this->tpl->setVariable("BM_TARGET", "_blank");
00705                     break;
00706             }
00707 
00708             $this->tpl->parseCurrentBlock();
00709         }
00710 
00711         if ($i == 0)
00712         {
00713             $this->tpl->setCurrentBlock("tbl_no_bm");
00714             $this->tpl->setVariable("ROWCOL","tblrow".(($i % 2)+1));
00715             $this->tpl->setVariable("TXT_NO_BM", $this->lng->txt("no_bm_in_personal_list"));
00716             $this->tpl->parseCurrentBlock();
00717         }
00718 
00719         $this->tpl->setCurrentBlock("tbl_bm");
00720         $this->tpl->setVariable("TXT_BM_HEADER",$this->lng->txt("my_bms"));
00721         $this->tpl->parseCurrentBlock();
00722     }
00723 
00734     function multiarray_sort ($array, $key_sort)
00735     {
00736         if ($array) {
00737             $key_sorta = explode(";", $key_sort);
00738 
00739             $multikeys = array_keys($array);
00740             $keys = array_keys($array[$multikeys[0]]);
00741 
00742             for($m=0; $m < count($key_sorta); $m++) {
00743                 $nkeys[$m] = trim($key_sorta[$m]);
00744             }
00745             $n += count($key_sorta);
00746 
00747             for($i=0; $i < count($keys); $i++){
00748                 if(!in_array($keys[$i], $key_sorta)) {
00749                     $nkeys[$n] = $keys[$i];
00750                     $n += "1";
00751                 }
00752             }
00753 
00754             for($u=0;$u<count($array); $u++) {
00755                 $arr = $array[$multikeys[$u]];
00756                 for($s=0; $s<count($nkeys); $s++) {
00757                     $k = $nkeys[$s];
00758                     $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
00759                 }
00760             }
00761             sort($output);
00762             return $output;
00763         }
00764     }
00765 }
00766 ?>

Generated on Fri Dec 13 2013 10:18:28 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1