ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPortfolioPageGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
5
19{
20 const EMBEDDED_NO_OUTPUT = -99;
21
22 protected $js_onload_code = array();
23 protected $additional = array();
24 protected $export_material = array("js"=>array(), "images"=>array(), "files"=>array());
25
26 protected static $initialized = 0;
27
31 function __construct($a_portfolio_id, $a_id = 0, $a_old_nr = 0, $a_enable_comments = true)
32 {
33 global $tpl;
34
35 $this->portfolio_id = (int)$a_portfolio_id;
36 $this->enable_comments = (bool)$a_enable_comments;
37
38 parent::__construct($this->getParentType(), $a_id, $a_old_nr);
39 $this->getPageObject()->setPortfolioId($this->portfolio_id);
40
41 // content style
42 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
43
44 $tpl->setCurrentBlock("SyntaxStyle");
45 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
47 $tpl->parseCurrentBlock();
48
49 $tpl->setCurrentBlock("ContentStyle");
50 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
52 $tpl->parseCurrentBlock();
53 }
54
55 function getParentType()
56 {
57 return "prtf";
58 }
59
60 protected function getPageContentUserId($a_user_id)
61 {
62 // user id from content-xml
63 return $a_user_id;
64 }
65
69 function &executeCommand()
70 {
71 global $ilCtrl, $ilUser;
72
73 $next_class = $this->ctrl->getNextClass($this);
74 $cmd = $this->ctrl->getCmd();
75
76 switch($next_class)
77 {
78 case "ilobjbloggui":
79 // #12879 - we need the wsp-id for the keywords
80 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
81 $wsp_tree = new ilWorkspaceTree($ilUser->getId());
82 $blog_obj_id = (int)$this->getPageObject()->getTitle();
83 $blog_node_id = $wsp_tree->lookupNodeId($blog_obj_id);
84
85 include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
86 $blog_gui = new ilObjBlogGUI($blog_node_id, ilObjBlogGUI::WORKSPACE_NODE_ID);
87 $blog_gui->disableNotes(!$this->enable_comments);
88 return $ilCtrl->forwardCommand($blog_gui);
89
90 case "ilcalendarmonthgui":
91 // booking action
92 if($cmd && $cmd != "preview")
93 {
94 include_once('./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
95 $month_gui = new ilCalendarMonthGUI(new ilDate());
96 return $ilCtrl->forwardCommand($month_gui);
97 }
98 // calendar month navigation
99 else
100 {
101 $ilCtrl->setParameter($this, "cmd", "preview");
103 }
104
105 case "ilpageobjectgui":
106 die("Deprecated. ilPortfolioPage gui forwarding to ilpageobject");
107 return;
108
109 default:
110 $this->setPresentationTitle($this->getPageObject()->getTitle());
111 return parent::executeCommand();
112 }
113 }
114
120 function showPage()
121 {
122 global $ilUser;
123
124 if(!$this->getPageObject())
125 {
126 return;
127 }
128
129 switch($this->getPageObject()->getType())
130 {
132 return $this->renderBlog($ilUser->getId(), (int)$this->getPageObject()->getTitle());
133
134 default:
135 $this->setTemplateOutput(false);
136 // $this->setPresentationTitle($this->getPageObject()->getTitle());
137 $output = parent::showPage();
138
139 return $output;
140 }
141 }
142
149 function getTabs($a_activate = "")
150 {
151 if(!$this->embedded)
152 {
153 parent::getTabs($a_activate);
154 }
155 }
156
162 function setEmbedded($a_value)
163 {
164 $this->embedded = (bool)$a_value;
165 }
166
172 function setAdditional($a_additional)
173 {
174 $this->additional = $a_additional;
175 }
176
182 function getAdditional()
183 {
184 return $this->additional;
185 }
186
188 {
190 }
191
192 function postOutputProcessing($a_output)
193 {
194 $parts = array(
195 "Profile" => array("0-9", "a-z", "0-9a-z_;\W"), // user, mode, fields
196 "Verification" => array("0-9", "a-z", "0-9"), // user, type, id
197 "Blog" => array("0-9", "0-9", "0-9;\W"), // user, blog id, posting ids
198 "BlogTeaser" => array("0-9", "0-9", "0-9;\W"), // user, blog id, posting ids
199 "Skills" => array("0-9", "0-9"), // user, skill id
200 "SkillsTeaser" => array("0-9", "0-9"), // user, skill id
201 "ConsultationHours" => array("0-9", "a-z", "0-9;\W"), // user, mode, group ids
202 "ConsultationHoursTeaser" => array("0-9", "a-z", "0-9;\W"), // user, mode, group ids
203 "MyCourses" => array("0-9", "a-z*"), // user, sort
204 "MyCoursesTeaser" => array("0-9", "a-z*") // user, sort
205 );
206
207 foreach($parts as $type => $def)
208 {
209 // #15732 - allow optional parts
210 $def_parts = array();
211 foreach($def as $part)
212 {
213 $is_opt = (substr($part, -1) == "*");
214 if(!$is_opt)
215 {
216 $def_parts[] = "#";
217 $end_marker = "+";
218 }
219 else
220 {
221 $def_parts[] = "#*";
222 $end_marker = "*";
223 $part = substr($part, 0, -1);
224 }
225 $def_parts[] = "([".$part."]".$end_marker.")";
226 }
227 $def = implode("", $def_parts);
228
229 if(preg_match_all(
230 "/".$this->pl_start.$type.$def.$this->pl_end."/",
231 $a_output, $blocks))
232 {
233 foreach($blocks[0] as $idx => $block)
234 {
235 switch($type)
236 {
237 case "Profile":
238 case "Blog":
239 case "BlogTeaser":
240 case "Skills":
241 case "SkillsTeaser":
242 case "ConsultationHours":
243 case "ConsultationHoursTeaser":
244 case "MyCourses":
245 case "MyCoursesTeaser":
246 $subs = null;
247 if(trim($blocks[3][$idx]))
248 {
249 foreach(explode(";", $blocks[3][$idx]) as $sub)
250 {
251 if(trim($sub))
252 {
253 $subs[] = trim($sub);
254 }
255 }
256 }
257 $snippet = $this->{"render".$type}($blocks[1][$idx],
258 $blocks[2][$idx], $subs);
259 break;
260
261 default:
262 $snippet = $this->{"render".$type}($blocks[1][$idx],
263 $blocks[2][$idx], $blocks[3][$idx]);
264 break;
265 }
266
267 $snippet = $this->renderPageElement($type, $snippet);
268 $a_output = str_replace($block, $snippet, $a_output);
269 }
270 }
271 }
272
273 return $a_output;
274 }
275
276 protected function renderPageElement($a_type, $a_html)
277 {
278 return trim($a_html);
279 }
280
281 protected function renderTeaser($a_type, $a_title, $a_options = null)
282 {
283 $options = "";
284 if($a_options)
285 {
286 $options = '<div class="il_Footer">'.$this->lng->txt("prtf_page_element_teaser_settings").
287 ": ".$a_options.'</div>';
288 }
289
290 return '<div style="margin:5px" class="ilBox"><h3>'.$a_title.'</h3>'.
291 '<div class="il_Description_no_margin">'.$this->lng->txt("prtf_page_element_teaser_".$a_type).'</div>'.
292 $options.'</div>';
293 }
294
295 protected function renderProfile($a_user_id, $a_type, array $a_fields = null)
296 {
297 global $ilCtrl;
298
299 $user_id = $this->getPageContentUserId($a_user_id);
300
301 if($this->getOutputMode() == "offline")
302 {
303 // profile picture is done in ilPortfolioHTMLExport
304
305 $this->export_material["js"][] = "http://maps.google.com/maps/api/js?sensor=false";
306 $this->export_material["js"][] = "./Services/Maps/js/ServiceGoogleMaps.js";
307 $this->export_material["js"][] = "./Services/Maps/js/OpenLayers.js";
308 $this->export_material["js"][] = "./Services/Maps/js/ServiceOpenLayers.js";
309 }
310
311 include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
312 $pub_profile = new ilPublicUserProfileGUI($user_id);
313 $pub_profile->setEmbedded(true, ($this->getOutputMode() == "offline"));
314
315 // full circle: additional was set in the original public user profile call
316 $pub_profile->setAdditional($this->getAdditional());
317
318 if($a_type == "manual" && sizeof($a_fields))
319 {
320 $prefs = array();
321 foreach($a_fields as $field)
322 {
323 $field = trim($field);
324 if($field)
325 {
326 $prefs["public_".$field] = "y";
327 }
328 }
329
330 $pub_profile->setCustomPrefs($prefs);
331 }
332
333 if($this->getOutputMode() != "offline")
334 {
335 return $ilCtrl->getHTML($pub_profile);
336 }
337 else
338 {
339 return $pub_profile->getEmbeddable();
340 }
341 }
342
343 protected function renderVerification($a_user_id, $a_type, $a_id)
344 {
345 global $objDefinition;
346
347 // not used
348 // $user_id = $this->getPageContentUserId($a_user_id);
349
350 $class = "ilObj".$objDefinition->getClassName($a_type)."GUI";
351 include_once $objDefinition->getLocation($a_type)."/class.".$class.".php";
352 $verification = new $class($a_id, ilObject2GUI::WORKSPACE_OBJECT_ID);
353
354 if($this->getOutputMode() != "offline")
355 {
356 // direct download link
357 $this->ctrl->setParameter($this, "dlid", $a_id);
358 $url = $this->ctrl->getLinkTarget($this, "dl".$a_type);
359 $this->ctrl->setParameter($this, "dlid", "");
360 }
361 else
362 {
363 $file = $verification->object->getFilePath();
364 $url = "files/".basename($file);
365
366 $this->export_material["files"][] = $file;
367 }
368
369 return $verification->render(true, $url);
370 }
371
372 protected function dltstv()
373 {
374 $id = $_GET["dlid"];
375 if($id)
376 {
377 include_once "Modules/Test/classes/class.ilObjTestVerificationGUI.php";
379 $verification->downloadFromPortfolioPage($this->getPageObject());
380 }
381 }
382
383 protected function dlexcv()
384 {
385 $id = $_GET["dlid"];
386 if($id)
387 {
388 include_once "Modules/Exercise/classes/class.ilObjExerciseVerificationGUI.php";
390 $verification->downloadFromPortfolioPage($this->getPageObject());
391 }
392 }
393
394 protected function dlcrsv()
395 {
396 $id = $_GET["dlid"];
397 if($id)
398 {
399 include_once "Modules/Course/classes/Verification/class.ilObjCourseVerificationGUI.php";
401 $verification->downloadFromPortfolioPage($this->getPageObject());
402 }
403 }
404
405 protected function dlscov()
406 {
407 $id = $_GET["dlid"];
408 if($id)
409 {
410 include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerificationGUI.php";
412 $verification->downloadFromPortfolioPage($this->getPageObject());
413 }
414 }
415
416 protected function renderBlog($a_user_id, $a_blog_id, array $a_posting_ids = null)
417 {
418 global $ilCtrl;
419
420 // not used
421 // $user_id = $this->getPageContentUserId($a_user_id);
422
423 // full blog (separate tab/page)
424 if(!$a_posting_ids)
425 {
426 include_once "Modules/Blog/classes/class.ilObjBlogGUI.php";
427 $blog = new ilObjBlogGUI($a_blog_id, ilObject2GUI::WORKSPACE_OBJECT_ID);
428 $blog->disableNotes(!$this->enable_comments);
429 $blog->setContentStyleSheet();
430
431 if($this->getOutputMode() != "offline")
432 {
433 return $ilCtrl->getHTML($blog);
434 }
435 else
436 {
437
438 }
439 }
440 // embedded postings
441 else
442 {
443 $html = array();
444
445 include_once "Modules/Blog/classes/class.ilObjBlog.php";
446 $html[] = ilObjBlog::_lookupTitle($a_blog_id);
447
448 include_once "Modules/Blog/classes/class.ilBlogPostingGUI.php";
449 foreach($a_posting_ids as $post)
450 {
451 $page = new ilBlogPostingGUI(0, null, $post);
452 if($this->getOutputMode() != "offline")
453 {
454 $page->setOutputMode(IL_PAGE_PREVIEW);
455 }
456 else
457 {
458 $page->setOutputMode("offline");
459 }
460 $html[] = $page->showPage();
461 }
462
463 return implode("\n", $html);
464 }
465 }
466
467 protected function renderBlogTeaser($a_user_id, $a_blog_id, array $a_posting_ids = null)
468 {
469 // not used
470 // $user_id = $this->getPageContentUserId($a_user_id);
471
472 $postings = "";
473 if($a_posting_ids)
474 {
475 $postings = array("<ul>");
476 include_once "Modules/Blog/classes/class.ilBlogPosting.php";
477 foreach($a_posting_ids as $post)
478 {
479 $post = new ilBlogPosting($post);
480 $postings[] = "<li>".$post->getTitle()." - ".
481 ilDatePresentation::formatDate($post->getCreated())."</li>";
482 }
483 $postings[] = "</ul>";
484 $postings = implode("\n", $postings);
485 }
486
487 return $this->renderTeaser("blog", $this->lng->txt("obj_blog").' "'.
488 ilObject::_lookupTitle($a_blog_id).'"', $postings);
489 }
490
491 protected function renderSkills($a_user_id, $a_skills_id)
492 {
493 if($this->getOutputMode() == "preview")
494 {
495 return $this->renderSkillsTeaser($a_user_id, $a_skills_id);
496 }
497
498 $user_id = $this->getPageContentUserId($a_user_id);
499
500 include_once "Services/Skill/classes/class.ilPersonalSkillsGUI.php";
501 $gui = new ilPersonalSkillsGUI();
502 if($this->getOutputMode() == "offline")
503 {
504 $gui->setOfflineMode("./files/");
505 }
506 $html = $gui->getSkillHTML($a_skills_id, $user_id);
507
508 if($this->getOutputMode() == "offline")
509 {
510 $js = $gui->getTooltipsJs();
511 if(sizeof($js))
512 {
513 $this->js_onload_code = array_merge($this->js_onload_code, $js);
514 }
515 }
516
517 return $html;
518 }
519
520 protected function renderSkillsTeaser($a_user_id, $a_skills_id)
521 {
522 // not used
523 // $user_id = $this->getPageContentUserId($a_user_id);
524
525 include_once "Services/Skill/classes/class.ilSkillTreeNode.php";
526
527 return $this->renderTeaser("skills", $this->lng->txt("skills").' "'.
528 ilSkillTreeNode::_lookupTitle($a_skills_id).'"');
529 }
530
531 protected function renderConsultationHoursTeaser($a_user_id, $a_mode, $a_group_ids)
532 {
533 // not used
534 // $user_id = $this->getPageContentUserId($a_user_id);
535
536 if($a_mode == "auto")
537 {
538 $mode = $this->lng->txt("cont_cach_mode_automatic");
539 $groups = null;
540 }
541 else
542 {
543 $mode = $this->lng->txt("cont_cach_mode_manual");
544
545 include_once "Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php";
546 $groups = array();
547 foreach($a_group_ids as $grp_id)
548 {
549 $groups[] = ilConsultationHourGroups::lookupTitle($grp_id);
550 }
551 $groups = " (".implode(", ", $groups).")";
552 }
553
554 $this->lng->loadLanguageModule("dateplaner");
555 return $this->renderTeaser("consultation_hours",
556 $this->lng->txt("app_consultation_hours"), $mode.$groups);
557 }
558
559 protected function renderConsultationHours($a_user_id, $a_mode, $a_group_ids)
560 {
561 global $ilUser;
562
563 if($this->getOutputMode() == "preview")
564 {
565 return $this->renderConsultationHoursTeaser($a_user_id, $a_mode, $a_group_ids);
566 }
567
568 if($this->getOutputMode() == "offline")
569 {
570 return;
571 }
572
573 $user_id = $this->getPageContentUserId($a_user_id);
574
575 // only if not owner
576 if($ilUser->getId() != $user_id)
577 {
578 $_GET["bkid"] = $user_id;
579 }
580
581 if($a_mode != "manual")
582 {
583 $a_group_ids = null;
584 }
585
586 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
587 ilCalendarCategories::_getInstance()->setCHUserId($user_id);
589
590 if(!$_REQUEST["seed"])
591 {
592 $seed = new ilDate(time(), IL_CAL_UNIX);
593 }
594 else
595 {
596 $seed = new ilDate($_REQUEST["seed"], IL_CAL_DATE);
597 }
598
599 include_once('./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
600 $month_gui = new ilCalendarMonthGUI($seed);
601
602 // custom schedule filter: handle booking group ids
603 include_once('./Services/Calendar/classes/class.ilCalendarScheduleFilterBookings.php');
604 $filter = new ilCalendarScheduleFilterBookings($user_id, $a_group_ids);
605 $month_gui->addScheduleFilter($filter);
606
607 $this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem','delos.css','Services/Calendar'));
608
609 $this->lng->loadLanguageModule("dateplaner");
610 return '<h3>'.$this->lng->txt("app_consultation_hours").'</h3>'.
611 $this->ctrl->getHTML($month_gui);
612 }
613
614 protected function isMyCoursesActive()
615 {
616 $prfa_set = new ilSetting("prfa");
617 return (bool)$prfa_set->get("mycrs", true);
618 }
619
620 protected function renderMyCoursesTeaser($a_user_id, $a_default_sorting)
621 {
622 // not used
623 // $user_id = $this->getPageContentUserId($a_user_id);
624
625 $title = $this->isMyCoursesActive()
626 ? "my_courses"
627 : "my_courses_inactive";
628
629 return $this->renderTeaser($title,
630 $this->lng->txt("prtf_page_element_my_courses_title"));
631 }
632
633 protected function renderMyCourses($a_user_id, $a_default_sorting)
634 {
635 global $ilAccess, $ilUser, $ilCtrl;
636
637 if($this->getOutputMode() == "preview")
638 {
639 return $this->renderMyCoursesTeaser($a_user_id, $a_default_sorting);
640 }
641
642 if(!$this->isMyCoursesActive())
643 {
644 return;
645 }
646
647 $img_path = null;
648 if($this->getOutputMode() == "offline")
649 {
650 $this->export_material["images"][] = "./templates/default/images/icon_crs.svg";
651 $this->export_material["images"][] = "./templates/default/images/icon_lobj.svg";
652 $this->export_material["images"][] = "./templates/default/images/scorm/complete.svg";
653 $this->export_material["images"][] = "./templates/default/images/scorm/not_attempted.svg";
654 $this->export_material["images"][] = "./templates/default/images/scorm/failed.svg";
655 $this->export_material["images"][] = "./templates/default/images/scorm/incomplete.svg";
656
657 $img_path = "images/";
658 }
659
660 $user_id = $this->getPageContentUserId($a_user_id);
661
662 // sorting pref
663 if($_POST["srt"] &&
664 in_array($_POST["srt"], array("alpha", "loc")))
665 {
666 $ilUser->writePref("prtf_mcrs_sort", $_POST["srt"]);
667 }
668 $sorting = $ilUser->getPref("prtf_mcrs_sort");
669 if(!$sorting)
670 {
671 $sorting = $a_default_sorting;
672 }
673
674 $data = $this->getCoursesOfUser($user_id, ($sorting == "loc"));
675 if(sizeof($data))
676 {
677 if($sorting != "loc")
678 {
679 $data = ilUtil::sortArray($data, "title", "ASC");
680 }
681 else
682 {
683 $data = ilUtil::sortArray($data, "path_sort", "ASC");
684 }
685
686 $tpl = new ilTemplate("tpl.pc_my_courses.html", true, true, "Modules/Portfolio");
687 $tpl->setVariable("TITLE", $this->lng->txt("prtf_page_element_my_courses_title"));
688 $tpl->setVariable("INFO", $this->lng->txt("prtf_page_element_my_courses_info")); // #14464
689
690 include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
691 $this->lng->loadLanguageModule("trac");
692 $this->lng->loadLanguageModule("crs");
693
694 include_once("./Services/Container/classes/class.ilContainerObjectiveGUI.php");
695 include_once("./Services/Link/classes/class.ilLink.php");
696
697 // sorting
698 $options = array(
699 "alpha" => $this->lng->txt("cont_mycourses_sortorder_alphabetical"),
700 "loc" => $this->lng->txt("cont_mycourses_sortorder_location")
701 );
702 $tpl->setVariable("SORT_SELECT", ilUtil::formSelect($sorting, "srt", $options, false, true, 0, "",
703 array("onchange"=>"form.submit()")));
704 $tpl->setVariable("SORT_FORM", $ilCtrl->getFormActionByClass("ilobjportfoliogui", "preview"));
705
706 $old_path = null;
707
708 foreach($data as $course)
709 {
710 if($sorting == "loc")
711 {
712 if($course["path"] != $old_path)
713 {
714 $tpl->setCurrentBlock("path_bl");
715 $tpl->setVariable("PATH", $course["path"]);
716 $tpl->parseCurrentBlock();
717
718 $old_path = $course["path"];
719 }
720 }
721
722 if(isset($course["lp_status"]))
723 {
724 $lp_icon = ilLearningProgressBaseGUI::_getImagePathForStatus($course["lp_status"]);
725 $lp_alt = ilLearningProgressBaseGUI::_getStatusText($course["lp_status"]);
726
727 if($img_path)
728 {
729 $lp_icon = $img_path.basename($lp_icon);
730 }
731
732 $tpl->setCurrentBlock("lp_bl");
733 $tpl->setVariable("LP_ICON_URL", $lp_icon);
734 $tpl->setVariable("LP_ICON_ALT", $lp_alt);
735 $tpl->parseCurrentBlock();
736 }
737
738 $do_links = false;
739 if($ilUser->getId() != ANONYMOUS_USER_ID)
740 {
741 $do_links = $ilAccess->checkAccessOfUser($ilUser->getId(), "read", "", $course["ref_id"], "crs") ||
742 ($ilAccess->checkAccessOfUser($ilUser->getId(), "visible", "", $course["ref_id"], "crs") &&
743 $ilAccess->checkAccessOfUser($ilUser->getId(), "join", "", $course["ref_id"], "crs"));
744 }
745
746 if(isset($course["objectives"]))
747 {
748 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
749 $loc_settings = ilLOSettings::getInstanceByObjId($course["obj_id"]);
750 $has_initial_test = (bool)$loc_settings->getInitialTest();
751
752 foreach($course["objectives"] as $objtv)
753 {
754 if($do_links)
755 {
756 $params = array("oobj"=>$objtv["id"]);
757 $url = ilLink::_getLink($course["ref_id"], "crs", $params);
758
759 // #15510
760 $url .= "#objtv_acc_".$objtv["id"];
761
762 $tpl->setCurrentBlock("objective_link_bl");
763
764 if(trim($objtv["desc"]))
765 {
766 $desc = nl2br($objtv["desc"]);
767 $tt_id = "objtvtt_".$objtv["id"]."_".((int)self::$initialized);
768
769 include_once "Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
770 ilToolTipGUI::addTooltip($tt_id, $desc, "", "bottom center", "top center", false);
771
772 $tpl->setVariable("OBJECTIVE_LINK_ID", $tt_id);
773 }
774
775 $tpl->setVariable("OBJECTIVE_LINK_URL", $url);
776 $tpl->setVariable("OBJECTIVE_LINK_TITLE", $objtv["title"]);
777 $tpl->parseCurrentBlock();
778 }
779 else
780 {
781 $tpl->setCurrentBlock("objective_nolink_bl");
782 $tpl->setVariable("OBJECTIVE_NOLINK_TITLE", $objtv["title"]);
783 $tpl->parseCurrentBlock();
784 }
785
786 $objtv_icon = ilUtil::getTypeIconPath("lobj", $objtv["id"]);
787 if($img_path)
788 {
789 $objtv_icon = $img_path.basename($objtv_icon);
790 }
791
792 $tpl->setCurrentBlock("objective_bl");
793 $tpl->setVariable("OBJTV_ICON_URL", $objtv_icon);
794 $tpl->setVariable("OBJTV_ICON_ALT", $this->lng->txt("crs_objectives"));
795
796 if($objtv["type"])
797 {
798 $tpl->setVariable("LP_OBJTV_PROGRESS",
799 ilContainerObjectiveGUI::buildObjectiveProgressBar($has_initial_test, $objtv["id"], $objtv, true, false, (int)self::$initialized));
800 }
801
802 $tpl->parseCurrentBlock();
803 }
804
805 $tpl->setCurrentBlock("objectives_bl");
806 $tpl->setVariable("OBJTV_LIST_CRS_ID", $course["obj_id"]);
807 $tpl->parseCurrentBlock();
808 }
809
810 // always check against current user
811 if($do_links)
812 {
813 $tpl->setCurrentBlock("course_link_bl");
814 $tpl->setVariable("COURSE_LINK_TITLE", $course["title"]);
815 $tpl->setVariable("COURSE_LINK_URL", ilLink::_getLink($course["ref_id"]));
816 $tpl->parseCurrentBlock();
817 }
818 else
819 {
820 $tpl->setCurrentBlock("course_nolink_bl");
821 $tpl->setVariable("COURSE_NOLINK_TITLE", $course["title"]);
822 $tpl->parseCurrentBlock();
823 }
824
825 $crs_icon = ilUtil::getTypeIconPath("crs", $course["obj_id"]);
826 if($img_path)
827 {
828 $crs_icon = $img_path.basename($crs_icon);
829 }
830
831 $tpl->setCurrentBlock("course_bl");
832
833 if(isset($course["objectives"]))
834 {
835 $tpl->setVariable("TOGGLE_CLASS", "ilPCMyCoursesToggle");
836 }
837 else
838 {
839 $tpl->setVariable("NO_TOGGLE", ' style="visibility:hidden;"');
840 }
841
842 $tpl->setVariable("CRS_ICON_URL", $crs_icon);
843 $tpl->setVariable("CRS_ICON_ALT", $this->lng->txt("obj_crs"));
844 $tpl->parseCurrentBlock();
845 }
846
847 // #15508
848 if(!self::$initialized)
849 {
850 $GLOBALS["tpl"]->addJavaScript("Modules/Portfolio/js/ilPortfolio.js");
851 $GLOBALS["tpl"]->addOnLoadCode("ilPortfolio.init()");
852 }
853 self::$initialized++;
854
855 return $tpl->get();
856 }
857 }
858
859 protected function getCoursesOfUser($a_user_id, $a_add_path = false)
860 {
861 global $tree;
862
863 // see ilPDSelectedItemsBlockGUI
864
865 include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
866 include_once 'Services/Membership/classes/class.ilParticipants.php';
867 $items = ilParticipants::_getMembershipByType($a_user_id, 'crs');
868
869 $repo_title = $tree->getNodeData(ROOT_FOLDER_ID);
870 $repo_title = $repo_title["title"];
871 if($repo_title == "ILIAS")
872 {
873 $repo_title = $this->lng->txt("repository");
874 }
875
876 $references = $lp_obj_refs = array();
877 foreach($items as $obj_id)
878 {
880 if(is_array($ref_id) && count($ref_id))
881 {
882 $ref_id = array_pop($ref_id);
883 if(!$tree->isDeleted($ref_id))
884 {
885 $visible = false;
886 $active = ilObjCourseAccess::_isActivated($obj_id, $visible, false);
887 if($active && $visible)
888 {
889 $references[$ref_id] = array(
890 'ref_id' => $ref_id,
891 'obj_id' => $obj_id,
892 'title' => ilObject::_lookupTitle($obj_id)
893 );
894
895 if($a_add_path)
896 {
897 $path = array();
898 foreach($tree->getPathFull($ref_id) as $item)
899 {
900 $path[] = $item["title"];
901 }
902 // top level comes first
903 if(sizeof($path) == 2)
904 {
905 $path[0] = 0;
906 }
907 else
908 {
909 $path[0] = 1;
910 }
911 $references[$ref_id]["path_sort"] = implode("__", $path);
912 array_shift($path);
913 array_pop($path);
914 if(!sizeof($path))
915 {
916 array_unshift($path, $repo_title);
917 }
918 $references[$ref_id]["path"] = implode(" &rsaquo; ", $path);
919 }
920
921 $lp_obj_refs[$obj_id] = $ref_id;
922 }
923 }
924 }
925 }
926
927 // get lp data for valid courses
928
929 if(sizeof($lp_obj_refs))
930 {
931 // listing the objectives should NOT depend on any LP status / setting
932 include_once 'Modules/Course/classes/class.ilObjCourse.php';
933 foreach($lp_obj_refs as $obj_id => $ref_id)
934 {
935 // only if set in DB (default mode is not relevant
937 {
938 $references[$ref_id]["objectives"] = $this->parseObjectives($obj_id, $a_user_id);
939 }
940 }
941
942 // LP must be active, personal and not anonymized
943 include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
947 {
948 // see ilLPProgressTableGUI
949 include_once "Services/Tracking/classes/class.ilTrQuery.php";
950 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
951 $lp_data = ilTrQuery::getObjectsStatusForUser($a_user_id, $lp_obj_refs);
952 foreach($lp_data as $item)
953 {
954 $ref_id = $item["ref_ids"];
955 $references[$ref_id]["lp_status"] = $item["status"];
956 }
957 }
958 }
959
960 return $references;
961 }
962
963 protected function parseObjectives($a_obj_id, $a_user_id)
964 {
965 $res = array();
966
967 // we need the collection for the correct order
968 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
969 include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfObjectives.php";
971 $coll_objtv = $coll_objtv->getItems();
972 if($coll_objtv)
973 {
974 // #13373
975 $lo_results = $this->parseLOUserResults($a_obj_id, $a_user_id);
976
977 include_once "Modules/Course/classes/Objectives/class.ilLOTestAssignments.php";
978 $lo_ass = ilLOTestAssignments::getInstance($a_obj_id);
979
980 $tmp = array();
981
982 include_once "Modules/Course/classes/class.ilCourseObjective.php";
983 foreach($coll_objtv as $objective_id)
984 {
985 $title = ilCourseObjective::lookupObjectiveTitle($objective_id, true);
986
987 $tmp[$objective_id] = array(
988 "id" => $objective_id,
989 "title" => $title["title"],
990 "desc" => $title["description"],
991 "itest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL),
992 "qtest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED)
993 );
994
995 if(array_key_exists($objective_id, $lo_results))
996 {
997 $lo_result = $lo_results[$objective_id];
998 $tmp[$objective_id]["user_id"] = $lo_result["user_id"];
999 $tmp[$objective_id]["result_perc"] = $lo_result["result_perc"];
1000 $tmp[$objective_id]["limit_perc"] = $lo_result["limit_perc"];
1001 $tmp[$objective_id]["status"] = $lo_result["status"];
1002 $tmp[$objective_id]["type"] = $lo_result["type"];
1003 $tmp[$objective_id]["initial"] = $lo_result["initial"];
1004 }
1005 }
1006
1007 // order
1008 foreach($coll_objtv as $objtv_id)
1009 {
1010 $res[] = $tmp[$objtv_id];
1011 }
1012 }
1013
1014 return $res;
1015 }
1016
1017 // see ilContainerObjectiveGUI::parseLOUserResults()
1018 protected function parseLOUserResults($a_course_obj_id, $a_user_id)
1019 {
1020 $res = array();
1021
1022 include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
1023 $lur = new ilLOUserResults($a_course_obj_id, $a_user_id);
1024 foreach($lur->getCourseResultsForUserPresentation() as $objective_id => $types)
1025 {
1026 // show either initial or qualified for objective
1027 if(isset($types[ilLOUserResults::TYPE_INITIAL]))
1028 {
1029 $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
1030 }
1031
1032 // qualified test has priority
1033 if(isset($types[ilLOUserResults::TYPE_QUALIFIED]))
1034 {
1037 $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL];
1038 }
1039 else
1040 {
1043 }
1044
1045 $result["initial_status"] = $initial_status;
1046
1047 $res[$objective_id] = $result;
1048 }
1049
1050 return $res;
1051 }
1052
1053 public function getExportMaterial()
1054 {
1056 }
1057}
1058
1059?>
$result
print $file
$_GET["client_id"]
const IL_CRS_VIEW_OBJECTIVE
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_PAGE_PREVIEW
Class ilBlogPosting GUI class.
Class ilBlogPosting.
static _getInstance($a_usr_id=0)
get singleton instance
Calendar schedule filter for consultation hour bookings.
static lookupTitle($a_group_id)
Lookup group title.
static buildObjectiveProgressBar($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode=false, $a_sub=false, $a_tt_suffix=null)
Render progressbar(s) for given objective and result data.
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
static formatDate(ilDateTime $date)
Format a date @access public.
Class for single dates.
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
_getImagePathForStatus($a_status)
Get image path for status.
_getStatusText($a_status, $a_lng=null)
Get status alt text.
Class ilObjBlogGUI.
static _isActivated($a_obj_id, &$a_visible_flag=null, $a_mind_member_view=true)
Is activated?
GUI class for course verification.
GUI class for exercise verification.
GUI class for scorm verification.
getContentStylePath($a_style_id)
get content style path
getSyntaxStylePath()
get syntax style path
GUI class for test verification.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Class ilPageObjectGUI.
setPresentationTitle($a_title="")
getPageObject()
Get Page Object.
setTemplateOutput($a_output=true)
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
Personal skills GUI class.
Portfolio page gui class.
setEmbedded($a_value)
Set embedded mode: will suppress tabs.
getCoursesOfUser($a_user_id, $a_add_path=false)
parseLOUserResults($a_course_obj_id, $a_user_id)
renderTeaser($a_type, $a_title, $a_options=null)
getParentType()
Get parent type.
renderPageElement($a_type, $a_html)
renderProfile($a_user_id, $a_type, array $a_fields=null)
renderConsultationHours($a_user_id, $a_mode, $a_group_ids)
renderSkillsTeaser($a_user_id, $a_skills_id)
getTabs($a_activate="")
Set all tabs.
renderBlog($a_user_id, $a_blog_id, array $a_posting_ids=null)
renderBlogTeaser($a_user_id, $a_blog_id, array $a_posting_ids=null)
renderVerification($a_user_id, $a_type, $a_id)
postOutputProcessing($a_output)
Finalizing output processing.
getAdditional()
Get Additonal Information.
renderConsultationHoursTeaser($a_user_id, $a_mode, $a_group_ids)
__construct($a_portfolio_id, $a_id=0, $a_old_nr=0, $a_enable_comments=true)
Constructor.
parseObjectives($a_obj_id, $a_user_id)
renderMyCoursesTeaser($a_user_id, $a_default_sorting)
& executeCommand()
execute command
renderMyCourses($a_user_id, $a_default_sorting)
renderSkills($a_user_id, $a_skills_id)
setAdditional($a_additional)
Set Additonal Information.
GUI class for public user profile presentation.
ILIAS Setting Class.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
special template class to simplify handling of ITX/PEAR
getObjectsStatusForUser($a_user_id, array $obj_refs)
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
Tree handler for personal workspace.
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
$data
$js
$params
Definition: example_049.php:96
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
$ref_id
Definition: sahs_server.php:39
$url
Definition: shib_logout.php:72
$path
Definition: index.php:22
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15