00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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 $types = array(
00051 array("title" => $this->lng->txt("objs_cat"),
00052 "types" => "cat"),
00053 array("title" => $this->lng->txt("objs_fold"),
00054 "types" => "fold"),
00055 array("title" => $this->lng->txt("objs_crs"),
00056 "types" => "crs"),
00057 array("title" => $this->lng->txt("objs_grp"),
00058 "types" => "grp"),
00059 array("title" => $this->lng->txt("objs_chat"),
00060 "types" => "chat"),
00061 array("title" => $this->lng->txt("objs_frm"),
00062 "types" => "frm"),
00063 array("title" => $this->lng->txt("learning_objects"),
00064 "types" => array("lm", "htlm", "sahs", "dbk")),
00065 array("title" => $this->lng->txt("objs_glo"),
00066 "types" => "glo"),
00067 array("title" => $this->lng->txt("objs_file"),
00068 "types" => "file"),
00069 array("title" => $this->lng->txt("objs_webr"),
00070 "types" => "webr"),
00071 array("title" => $this->lng->txt("objs_exc"),
00072 "types" => "exc"),
00073 array("title" => $this->lng->txt("objs_tst"),
00074 "types" => "tst"),
00075 array("title" => $this->lng->txt("objs_svy"),
00076 "types" => "svy"),
00077 array("title" => $this->lng->txt("objs_mep"),
00078 "types" => "mep"),
00079 array("title" => $this->lng->txt("objs_qpl"),
00080 "types" => "qpl"),
00081 array("title" => $this->lng->txt("objs_spl"),
00082 "types" => "spl"),
00083
00084 array("title" => $this->lng->txt("objs_icrs"),
00085
00086 "types" => "icrs"),
00087
00088 array("title" => $this->lng->txt("objs_icla"),
00089
00090 "types" => "icla")
00091 );
00092 $html = "";
00093 foreach($types as $type)
00094 {
00095 $html.= $this->getSelectedItemBlockHTML($type["title"], $type["types"]);
00096 }
00097 if ($html != "")
00098 {
00099 $this->tpl->setCurrentBlock("selected_items");
00100 $this->tpl->setVariable("TXT_SELECTED_ITEMS", $this->lng->txt("selected_items"));
00101 $this->tpl->setVariable("SELECTED_ITEMS", $html);
00102 $this->tpl->parseCurrentBlock();
00103 }
00104 }
00105
00106
00110 function getSelectedItemBlockHTML($a_title, $a_type)
00111 {
00112 include_once './classes/class.ilRepositoryExplorer.php';
00113
00114 global $rbacsystem;
00115
00116 $items = $this->ilias->account->getDesktopItems($a_type);
00117
00118
00119
00120 $showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
00121
00122 if (count($items) > 0)
00123 {
00124 $tstCount = 0;
00125 $unsetCount = 0;
00126 $progressCount = 0;
00127 $unsetFlag = 0;
00128 $progressFlag = 0;
00129 $completedFlag = 0;
00130 if (strcmp($a_type, "tst") == 0) {
00131 $items = $this->multiarray_sort($items, "used_tries; title");
00132 foreach ($items as $tst_item) {
00133 if (!isset($tst_item["used_tries"])) {
00134 $unsetCount++;
00135 }
00136 elseif ($tst_item["used_tries"] == 0) {
00137 $progressCount++;
00138 }
00139 }
00140 }
00141
00142 $tpl = new ilTemplate("tpl.usr_pd_selected_item_block.html", true, true);
00143 $tpl->setVariable("TXT_BLOCK_HEADER", $a_title);
00144 $img_type = (is_array($a_type))
00145 ? $a_type[0]
00146 : $a_type;
00147
00148 $tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_".$img_type.".gif"));
00149 $this->lng->loadLanguageModule("assessment");
00150 $this->lng->loadLanguageModule("survey");
00151 $this->lng->loadLanguageModule("crs");
00152 foreach($items as $item)
00153 {
00154 if (strcmp($a_type, "tst")==0) {
00155 $tpl->setCurrentBlock("tbl_tstheader");
00156 if (($tstCount < $unsetCount)&&($unsetFlag==0)) {
00157 $tpl->setVariable("TXT_TST_TITLE", $this->lng->txt("tst_status_not_entered"));
00158 $unsetFlag++;
00159 }
00160 elseif (($tstCount < ($unsetCount+$progressCount))&&($progressFlag==0)) {
00161 $tpl->setVariable("TXT_TST_TITLE", $this->lng->txt("tst_status_progress"));
00162 $progressFlag++;
00163 }
00164 elseif (($tstCount >= ($unsetCount+$progressCount))&&($completedFlag==0)) {
00165 $tpl->setVariable("TXT_TST_TITLE", $this->lng->txt("tst_status_completed_more_tries_possible"));
00166 $completedFlag++;
00167 }
00168 $tstCount++;
00169 $tpl->parseCurrentBlock();
00170 }
00171 if (strcmp($a_type, "svy")==0) {
00172 if ($item["finished"] === 0)
00173 {
00174 $tpl->setCurrentBlock("finished");
00175 $tpl->setVariable("TXT_FINISHED", $this->lng->txt("not_finished"));
00176 $tpl->parseCurrentBlock();
00177 }
00178 else if ($item["finished"] === 1)
00179 {
00180 $tpl->setCurrentBlock("finished");
00181 $tpl->setVariable("TXT_FINISHED", $this->lng->txt("finished"));
00182 $tpl->parseCurrentBlock();
00183 }
00184 else
00185 {
00186 $tpl->setCurrentBlock("finished");
00187 $tpl->setVariable("TXT_FINISHED", $this->lng->txt("not_started"));
00188 $tpl->parseCurrentBlock();
00189 }
00190 }
00191
00192
00193 if ($item["continue_link"] != "" &&
00194 $rbacsystem->checkAccess("read", $item["id"]))
00195 {
00196 $tpl->setCurrentBlock("continue_link");
00197 $tpl->setVariable("LINK_CONTINUE", $item["continue_link"]);
00198
00199 if ($showViewInFrameset)
00200 {
00201 $tpl->setVariable("TARGET_CONTINUE", "bottom");
00202 }
00203 else
00204 {
00205 $tpl->setVariable("TARGET_CONTINUE", $item["target"]);
00206 }
00207
00208 $tpl->setVariable("TXT_CONTINUE", $this->lng->txt("continue_work"));
00209 $tpl->setVariable("IMG_CONTINUE", ilUtil::getImagePath("nav_arr_R.gif"));
00210 $tpl->parseCurrentBlock();
00211 }
00212 else
00213 {
00214 $tpl->setVariable("CONTINUE", " ");
00215 }
00216
00217
00218 if ($item["edit_link"] != "" and
00219 $rbacsystem->checkAccess("write", $item["id"]))
00220 {
00221 $tpl->setCurrentBlock("edit_link");
00222 $tpl->setVariable("LINK_EDIT", $item["edit_link"]);
00223 $tpl->setVariable("TARGET_EDIT", "bottom");
00224 $tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00225 $tpl->setVariable("IMG_EDIT", ilUtil::getImagePath("icon_pencil.gif"));
00226 $tpl->parseCurrentBlock();
00227 }
00228 else
00229 {
00230 $tpl->setVariable("EDIT", " ");
00231 }
00232
00233
00234 $tpl->setCurrentBlock("drop_link");
00235 $tpl->setVariable("TYPE", $item["type"]);
00236 $tpl->setVariable("ID", $item["id"]);
00237 $tpl->setVariable("TXT_DROP", $this->lng->txt("drop"));
00238 $tpl->setVariable("IMG_DROP", ilUtil::getImagePath("delete.gif"));
00239 $tpl->parseCurrentBlock();
00240
00241
00242 if ($item["description"] != "")
00243 {
00244 $tpl->setCurrentBlock("description");
00245 $tpl->setVariable("TXT_ITEM_DESCRIPTION", $item["description"]);
00246 $tpl->parseCurrentBlock();
00247 }
00248
00249 if($a_type == 'crs')
00250 {
00251 $tmp_course =& ilObjectFactory::getInstanceByRefId($item['id']);
00252 $tmp_course->initCourseMemberObject();
00253 $id = ilObject::_lookupObjId($item['id']);
00254
00255 if($tmp_course->members_obj->isBlocked($this->ilias->account->getId()))
00256 {
00257 $tpl->setCurrentBlock("crs_status");
00258 $tpl->setVariable("STATUS",$this->lng->txt("crs_status_blocked"));
00259 $tpl->parseCurrentBlock();
00260 }
00261 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($id);
00262
00263 if(!$conditions_ok and 0)
00264 {
00265 foreach(ilConditionHandler::_getConditionsOfTarget($id) as $condition)
00266 {
00267 if(ilConditionHandler::_checkCondition($id))
00268 {
00269 continue;
00270 }
00271 $trigger_obj =& ilObjectFactory::getInstanceByRefId($condition['trigger_ref_id']);
00272
00273 if(ilRepositoryExplorer::isClickable($trigger_obj->getType(),$trigger_obj->getRefId(),$trigger_obj->getId()))
00274 {
00275 $tpl->setCurrentBlock("pre_link");
00276 $tpl->setVariable("PRECONDITION_LINK",
00277 ilRepositoryExplorer::buildLinkTarget($trigger_obj->getRefId(),$trigger_obj->getType()));
00278 $tpl->setVariable("PRECONDITION_NAME",$trigger_obj->getTitle());
00279 $tpl->parseCurrentBlock();
00280 }
00281 else
00282 {
00283 $tpl->setCurrentBlock("pre_no_link");
00284 $tpl->setVariable("PRECONDITION_NO_TITLE",$trigger_obj->getTitle());
00285 $tpl->parseCurrentBlock();
00286 }
00287 }
00288 $tpl->setCurrentBlock("crs_preconditions");
00289 $tpl->setVariable("TXT_PRECONDITIONS",$this->lng->txt('condition_precondition'));
00290 $tpl->parseCurrentBlock();
00291 }
00292
00293
00294 }
00295
00296 if($a_type == 'frm')
00297 {
00298 global $ilUser;
00299
00300 $frm_obj = ilObjectFactory::getInstanceByRefId($item['id']);
00301 $this->lng->loadLanguageModule('forum');
00302
00303 $num_unread = $frm_obj->getCountUnread($ilUser->getId());
00304 $num_new = $frm_obj->getCountNew($ilUser->getId());
00305
00306 if($num_unread)
00307 {
00308 $tpl->setCurrentBlock("frm_info");
00309
00310 $art_1 = $num_unread == 1 ? $this->lng->txt('frm_article') : $this->lng->txt('forums_articles');
00311 $art_2 = $num_new == 1 ? $this->lng->txt('frm_article') : $this->lng->txt('forums_articles');
00312
00313
00314 $text = $num_unread.' '.$art_1.' '.$this->lng->txt('unread_lowercase').
00315 ', '.$num_new.' '.$art_2.' '.$this->lng->txt('new_lowercase');
00316
00317 $tpl->setVariable("TXT_FRM_INFO",$text);
00318 $tpl->parseCurrentBlock();
00319 }
00320 }
00321
00322
00323 if($a_type != 'crs' or ilRepositoryExplorer::isClickable($a_type,$item['id'],ilObject::_lookupObjId($item['id'])))
00324 {
00325 $tpl->setCurrentBlock("show_link");
00326 $tpl->setVariable("TXT_ITEM_TITLE", $item["title"]);
00327 $tpl->setVariable("LINK_SHOW", $item["link"]);
00328 if ($showViewInFrameset)
00329 {
00330 $tpl->setVariable("TARGET_SHOW", "bottom");
00331 }
00332 else
00333 {
00334 $tpl->setVariable("TARGET_SHOW", $item["target"]);
00335 }
00336 $tpl->parseCurrentBlock();
00337 }
00338 else
00339 {
00340 $tpl->setCurrentBlock("no_link");
00341 $tpl->setVariable("TXT_NO_LINK_TITLE",$item['title']);
00342 $tpl->parseCurrentBlock();
00343 }
00344
00345 $tpl->setCurrentBlock("block_row");
00346 $tpl->setVariable("ROWCOL","tblrow".(($i++ % 2)+1));
00347 $tpl->parseCurrentBlock();
00348
00349 }
00350 return $tpl->get();
00351 }
00352
00353 return "";
00354 }
00355
00356 function displaySystemMessages()
00357 {
00358
00359 $umail = new ilMail($_SESSION["AccountId"]);
00360 $smails = $umail->getMailsOfFolder(0);
00361
00362 if(count($smails))
00363 {
00364
00365 $counter = 1;
00366 foreach ($smails as $mail)
00367 {
00368
00369 require_once "classes/class.ilMailbox.php";
00370
00371 $mbox = new ilMailbox($_SESSION["AccountId"]);
00372 $inbox = $mbox->getInboxFolder();
00373
00374 $this->tpl->setCurrentBlock("tbl_system_msg_row");
00375 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow1' : 'tblrow2');
00376
00377
00378 $user = new ilObjUser($mail["sender_id"]);
00379
00380 if(!($fullname = $user->getFullname()))
00381 {
00382 $fullname = $this->lng->txt("unknown");
00383 }
00384
00385
00386 $this->tpl->setVariable("MAILCLASS", $mail["m_status"] == 'read' ? 'mailread' : 'mailunread');
00387 $this->tpl->setVariable("MAIL_FROM", $fullname);
00388 $this->tpl->setVariable("MAIL_SUBJ", $mail["m_subject"]);
00389 $this->tpl->setVariable("MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00390 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00391 $this->tpl->setVariable("MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00392 $this->tpl->parseCurrentBlock();
00393 }
00394 $this->tpl->setCurrentBlock("tbl_system_msg");
00395
00396 $this->tpl->setVariable("SYSTEM_MAILS",$this->lng->txt("mail_system"));
00397
00398 $this->tpl->setVariable("TXT_SENDER", $this->lng->txt("sender"));
00399 $this->tpl->setVariable("TXT_SUBJECT", $this->lng->txt("subject"));
00400 $this->tpl->setVariable("TXT_DATETIME",$this->lng->txt("date")."/".$this->lng->txt("time"));
00401 $this->tpl->parseCurrentBlock();
00402 }
00403 }
00404
00405
00406
00412 function displayMails()
00413 {
00414
00415
00416
00417 include_once "./include/inc.header.php";
00418 include_once "./include/inc.mail.php";
00419 include_once "classes/class.ilObjUser.php";
00420 include_once "classes/class.ilMailbox.php";
00421 include_once "classes/class.ilMail.php";
00422
00423
00424
00425 $umail = new ilMail($_SESSION["AccountId"]);
00426 $mbox = new ilMailBox($_SESSION["AccountId"]);
00427 $inbox = $mbox->getInboxFolder();
00428
00429
00430 $mail_data = $umail->getMailsOfFolder($inbox);
00431 $mail_counter = $umail->getMailCounterData();
00432 $unreadmails = 0;
00433
00434
00435 foreach ($mail_data as $mail)
00436 {
00437
00438 if($mail["m_status"]== 'unread')
00439 {
00440
00441
00442 $this->tpl->setCurrentBlock("tbl_mails");
00443 $this->tpl->setVariable("ROWCOL",++$counter%2 ? 'tblrow1' : 'tblrow2');
00444 $this->tpl->setVariable("NEW_MAIL",$this->lng->txt("email"));
00445
00446
00447 $user = new ilObjUser($mail["sender_id"]);
00448
00449 if(!($fullname = $user->getFullname()))
00450 {
00451 $fullname = $this->lng->txt("unknown");
00452 }
00453
00454
00455 $this->tpl->setCurrentBlock("tbl_mails");
00456
00457 $this->tpl->setVariable("NEW_TXT_SENDER", $this->lng->txt("sender"));
00458 $this->tpl->setVariable("NEW_TXT_SUBJECT", $this->lng->txt("subject"));
00459 $this->tpl->setVariable("NEW_TXT_DATE",$this->lng->txt("date")."/".$this->lng->txt("time"));
00460
00461
00462 $this->tpl->setCurrentBlock("tbl_mails_row");
00463 $this->tpl->setVariable("NEW_MAIL_FROM", $fullname);
00464 $this->tpl->setVariable("NEW_MAILCLASS", $mail["status"] == 'read' ? 'mailread' : 'mailunread');
00465 $this->tpl->setVariable("NEW_MAIL_SUBJ", $mail["m_subject"]);
00466 $this->tpl->setVariable("NEW_MAIL_DATE", ilFormat::formatDate($mail["send_time"]));
00467 $target_name = htmlentities(urlencode("mail_read.php?mobj_id=".$inbox."&mail_id=".$mail["mail_id"]));
00468 $this->tpl->setVariable("NEW_MAIL_LINK_READ", "mail_frameset.php?target=".$target_name);
00469 $this->tpl->parseCurrentBlock();
00470
00471 }
00472 }
00473 }
00474
00475
00476
00477
00481 function displayUsersOnline()
00482 {
00483 global $ilUser;
00484
00485 if ($ilUser->getPref("show_users_online") != "y")
00486 {
00487 return;
00488 }
00489
00490 $this->tpl->setVariable("TXT_USERS_ONLINE",$this->lng->txt("users_online"));
00491
00492 $users = ilUtil::getUsersOnline();
00493
00494 $num = 0;
00495
00496 foreach ($users as $user_id => $user)
00497 {
00498 if ($user_id != ANONYMOUS_USER_ID)
00499 {
00500 $num++;
00501 }
00502 else
00503 {
00504 $guests = $user["num"];
00505 }
00506 }
00507
00508
00509 if (empty($guests))
00510 {
00511 $guest_text = "";
00512 }
00513 elseif ($guests == "1")
00514 {
00515 $guest_text = "1 ".$this->lng->txt("guest");
00516 }
00517 else
00518 {
00519 $guest_text = $guests." ".$this->lng->txt("guests");
00520 }
00521
00522
00523 if ($num > 0)
00524 {
00525 if ($num == 1)
00526 {
00527 $user_list = $num." ".$this->lng->txt("registered_user");
00528 }
00529 else
00530 {
00531 $user_list = $num." ".$this->lng->txt("registered_users");
00532 }
00533
00534
00535 if ($_GET["cmd"] == "whoisdetail")
00536 {
00537 $text = $this->lng->txt("hide_details");
00538 $cmd = "hidedetails";
00539 }
00540 else
00541 {
00542 $text = $this->lng->txt("show_details");
00543 $cmd = "whoisdetail";
00544 }
00545
00546 $user_details_link = " <span style=\"font-weight:lighter\">[</span><a class=\"std\" href=\"usr_personaldesktop.php?cmd=".$cmd."\">".$text."</a><span style=\"font-weight:lighter\">]</span>";
00547
00548 if (!empty($guest_text))
00549 {
00550 $user_list .= " ".$this->lng->txt("and")." ".$guest_text;
00551 }
00552
00553 $user_list .= $user_details_link;
00554 }
00555 else
00556 {
00557 $user_list = $guest_text;
00558 }
00559
00560 $this->tpl->setVariable("USER_LIST",$user_list);
00561
00562
00563 if ($_GET["cmd"] == "whoisdetail")
00564 {
00565 $z = 0;
00566
00567 foreach ($users as $user_id => $user)
00568 {
00569 if ($user_id != ANONYMOUS_USER_ID)
00570 {
00571 $rowCol = ilUtil::switchColor($z,"tblrow2","tblrow1");
00572 $login_time = ilFormat::dateDiff(ilFormat::datetime2unixTS($user["last_login"]),time());
00573
00574
00575 if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID and $_SESSION["AccountId"] != $user_id)
00576 {
00577 $this->tpl->setCurrentBlock("mailto_link");
00578 $this->tpl->setVariable("IMG_MAIL", ilUtil::getImagePath("icon_pencil_b.gif", false));
00579 $this->tpl->setVariable("ALT_TXT_MAIL",$this->lng->txt("mail"));
00580 $this->tpl->setVariable("USR_LOGIN",$user["login"]);
00581 $this->tpl->parseCurrentBlock();
00582 }
00583
00584
00585
00586 $user_obj = new ilObjUser($user_id);
00587 $q = "SELECT value FROM usr_pref WHERE usr_id='".$user_id."' AND keyword='public_profile' AND value='y'";
00588 $r = $this->ilias->db->query($q);
00589
00590 if ($r->numRows())
00591 {
00592 $this->tpl->setCurrentBlock("profile_link");
00593 $this->tpl->setVariable("IMG_VIEW", ilUtil::getImagePath("enlarge.gif", false));
00594 $this->tpl->setVariable("ALT_TXT_VIEW",$this->lng->txt("view"));
00595 $this->tpl->setVariable("USR_ID",$user_id);
00596 $this->tpl->parseCurrentBlock();
00597 }
00598
00599
00600 $webspace_dir = ilUtil::getWebspaceDir();
00601 $image_dir = $webspace_dir."/usr_images";
00602 $xxthumb_file = $image_dir."/usr_".$user_obj->getID()."_xxsmall.jpg";
00603 if ($user_obj->getPref("public_upload") == "y" &&
00604 $user_obj->getPref("public_profile") == "y" &&
00605 @is_file($xxthumb_file))
00606 {
00607 $this->tpl->setCurrentBlock("usr_image");
00608 $this->tpl->setVariable("USR_IMAGE", $xxthumb_file."?t=".rand(1, 99999));
00609 $this->tpl->parseCurrentBlock();
00610 }
00611 else
00612 {
00613 $this->tpl->setVariable("NO_IMAGE", " ");
00614 }
00615
00616 $this->tpl->setCurrentBlock("tbl_users_row");
00617 $this->tpl->setVariable("ROWCOL",$rowCol);
00618 $this->tpl->setVariable("USR_LOGIN",$user["login"]);
00619 $this->tpl->setVariable("USR_FULLNAME",ilObjUser::setFullname($user["title"],$user["firstname"],$user["lastname"]));
00620 $this->tpl->setVariable("USR_LOGIN_TIME",$login_time);
00621
00622 $this->tpl->parseCurrentBlock();
00623
00624 $z++;
00625 }
00626 }
00627
00628 if ($z > 0)
00629 {
00630 $this->tpl->setCurrentBlock("tbl_users_header");
00631 $this->tpl->setVariable("TXT_USR_LOGIN",ucfirst($this->lng->txt("username")));
00632 $this->tpl->setVariable("TXT_USR_FULLNAME",ucfirst($this->lng->txt("fullname")));
00633 $this->tpl->setVariable("TXT_USR_LOGIN_TIME",ucfirst($this->lng->txt("login_time")));
00634 $this->tpl->parseCurrentBlock();
00635 }
00636 }
00637 }
00638
00639
00643 function displayBookmarks()
00644 {
00645 include_once("classes/class.ilBookmarkFolder.php");
00646 if (!empty($_GET["curBMFolder"]))
00647 {
00648 $_SESSION["ilCurBMFolder"] = $_GET["curBMFolder"];
00649 }
00650 $bm_items = ilBookmarkFolder::getObjects($_SESSION["ilCurBMFolder"]);
00651
00652 if(ilBookmarkFolder::isRootFolder($_SESSION['ilCurBMFolder']) or !$_SESSION['ilCurBMFolder'])
00653 {
00654 $colspan = 2;
00655 }
00656
00657 $i = 0;
00658 if (!ilBookmarkFolder::isRootFolder($_SESSION["ilCurBMFolder"])
00659 && !empty($_SESSION["ilCurBMFolder"]))
00660 {
00661 $i++;
00662 $this->tpl->setCurrentBlock("tbl_bm_row");
00663 $this->tpl->setVariable("ROWCOL","tblrow".(($i % 2)+1));
00664 $this->tpl->setVariable("BM_TITLE", "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
00665 ilUtil::getImagePath("icon_cat.gif")."\"> "."..");
00666 $this->tpl->setVariable("BM_LINK", "usr_personaldesktop.php?curBMFolder=".
00667 ilBookmarkFolder::getRootFolder());
00668 $this->tpl->setVariable("BM_TARGET", "");
00669 $this->tpl->parseCurrentBlock();
00670 }
00671
00672 foreach ($bm_items as $bm_item)
00673 {
00674 $i++;
00675
00676 $this->tpl->setCurrentBlock("tbl_bm_row");
00677 $this->tpl->setVariable("ROWCOL","tblrow".(($i % 2)+1));
00678 $this->tpl->setVariable("BM_LINK", "target URL");
00679
00680 switch ($bm_item["type"])
00681 {
00682 case "bmf":
00683 $this->tpl->setVariable("BM_TITLE", "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
00684 ilUtil::getImagePath("icon_cat.gif")."\"> ".$bm_item["title"]);
00685 $this->tpl->setVariable("BM_LINK", "usr_personaldesktop.php?curBMFolder=".$bm_item["obj_id"]);
00686 $this->tpl->setVariable("BM_TARGET", "");
00687 break;
00688
00689 case "bm":
00690 $this->tpl->setVariable("BM_TITLE", "<img border=\"0\" vspace=\"0\" align=\"left\" src=\"".
00691 ilUtil::getImagePath("icon_bm.gif")."\"> ".$bm_item["title"]);
00692 $this->tpl->setVariable("BM_LINK", $bm_item["target"]);
00693 $this->tpl->setVariable("BM_TARGET", "_blank");
00694 break;
00695 }
00696
00697 $this->tpl->parseCurrentBlock();
00698 }
00699
00700 if ($i == 0)
00701 {
00702 $this->tpl->setCurrentBlock("tbl_no_bm");
00703 $this->tpl->setVariable("ROWCOL","tblrow".(($i % 2)+1));
00704 $this->tpl->setVariable("TXT_NO_BM", $this->lng->txt("no_bm_in_personal_list"));
00705 $this->tpl->parseCurrentBlock();
00706 }
00707
00708 $this->tpl->setCurrentBlock("tbl_bm");
00709 $this->tpl->setVariable("TXT_BM_HEADER",$this->lng->txt("my_bms"));
00710 $this->tpl->setVariable("TXT_BM_TITLE",$this->lng->txt("title"));
00711 $this->tpl->parseCurrentBlock();
00712 }
00713
00724 function multiarray_sort ($array, $key_sort)
00725 {
00726 if ($array) {
00727 $key_sorta = explode(";", $key_sort);
00728
00729 $multikeys = array_keys($array);
00730 $keys = array_keys($array[$multikeys[0]]);
00731
00732 for($m=0; $m < count($key_sorta); $m++) {
00733 $nkeys[$m] = trim($key_sorta[$m]);
00734 }
00735 $n += count($key_sorta);
00736
00737 for($i=0; $i < count($keys); $i++){
00738 if(!in_array($keys[$i], $key_sorta)) {
00739 $nkeys[$n] = $keys[$i];
00740 $n += "1";
00741 }
00742 }
00743
00744 for($u=0;$u<count($array); $u++) {
00745 $arr = $array[$multikeys[$u]];
00746 for($s=0; $s<count($nkeys); $s++) {
00747 $k = $nkeys[$s];
00748 $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
00749 }
00750 }
00751 sort($output);
00752 return $output;
00753 }
00754 }
00755 }
00756 ?>