ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilInfoScreenGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
19{
23 protected $tabs_gui;
24
28 protected $rbacsystem;
29
33 protected $tpl;
34
38 protected $access;
39
43 protected $user;
44
48 protected $tree;
49
53 protected $settings;
54
55 public $lng;
56 public $ctrl;
58 public $top_buttons = array();
59 public $top_formbuttons = array();
60 public $hiddenelements = array();
61 public $table_class = "il_InfoScreen";
62 public $open_form_tag = true;
63 public $close_form_tag = true;
64
69
76 public function __construct($a_gui_object)
77 {
78 global $DIC;
79
80 $this->rbacsystem = $DIC->rbac()->system();
81 $this->tpl = $DIC["tpl"];
82 $this->access = $DIC->access();
83 $this->user = $DIC->user();
84 $this->tree = $DIC->repositoryTree();
85 $this->settings = $DIC->settings();
86 $ilCtrl = $DIC->ctrl();
87 $lng = $DIC->language();
88 $ilTabs = $DIC->tabs();
89
90 $this->ctrl = $ilCtrl;
91 $this->lng = $lng;
92 $this->tabs_gui = $ilTabs;
93 $this->gui_object = $a_gui_object;
94 $this->sec_nr = 0;
95 $this->private_notes_enabled = false;
96 $this->news_enabled = false;
97 $this->feedback_enabled = false;
98 $this->learning_progress_enabled = false;
99 $this->form_action = "";
100 $this->top_formbuttons = array();
101 $this->hiddenelements = array();
102 }
103
107 public function executeCommand()
108 {
111 $ilAccess = $this->access;
112
113 $next_class = $this->ctrl->getNextClass($this);
114
115 $cmd = $this->ctrl->getCmd("showSummary");
116 $this->ctrl->setReturn($this, "showSummary");
117
118 $this->setTabs();
119
120 switch ($next_class) {
121 case "ilnotegui":
122 $this->showSummary(); // forwards command
123 break;
124
125 case "ilcolumngui":
126 $this->showSummary();
127 break;
128
129 case "ilpublicuserprofilegui":
130 include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
131 $user_profile = new ilPublicUserProfileGUI($_GET["user_id"]);
132 $user_profile->setBackUrl($this->ctrl->getLinkTarget($this, "showSummary"));
133 $html = $this->ctrl->forwardCommand($user_profile);
134 $tpl->setContent($html);
135 break;
136
137 case "ilcommonactiondispatchergui":
138 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
140 $this->ctrl->forwardCommand($gui);
141 break;
142
143 default:
144 return $this->$cmd();
145 break;
146 }
147 return true;
148 }
149
155 public function setTableClass($a_val)
156 {
157 $this->table_class = $a_val;
158 }
159
165 public function getTableClass()
166 {
167 return $this->table_class;
168 }
169
173 public function enablePrivateNotes($a_enable = true)
174 {
175 $this->private_notes_enabled = $a_enable;
176 }
177
181 public function enableLearningProgress($a_enable = true)
182 {
183 $this->learning_progress_enabled = $a_enable;
184 }
185
186
190 public function enableFeedback($a_enable = true)
191 {
192 $this->feedback_enabled = $a_enable;
193 }
194
198 public function enableNews($a_enable = true)
199 {
200 $this->news_enabled = $a_enable;
201 }
202
206 public function enableNewsEditing($a_enable = true)
207 {
208 $this->news_editing = $a_enable;
209 }
210
218 public function setBlockProperty($a_block_type, $a_property, $a_value)
219 {
220 $this->block_property[$a_block_type][$a_property] = $a_value;
221 }
222
223 public function getAllBlockProperties()
224 {
225 return $this->block_property;
226 }
227
231 public function addSection($a_title)
232 {
233 $this->sec_nr++;
234 $this->section[$this->sec_nr]["title"] = $a_title;
235 $this->section[$this->sec_nr]["hidden"] = (bool) $this->hidden;
236 }
237
241 public function setFormAction($a_form_action)
242 {
243 $this->form_action = $a_form_action;
244 }
245
249 public function removeFormAction()
250 {
251 $this->form_action = "";
252 }
253
261 public function addProperty($a_name, $a_value, $a_link = "")
262 {
263 $this->section[$this->sec_nr]["properties"][] =
264 array("name" => $a_name, "value" => $a_value,
265 "link" => $a_link);
266 }
267
271 public function addPropertyCheckbox($a_name, $a_checkbox_name, $a_checkbox_value, $a_checkbox_label = "", $a_checkbox_checked = false)
272 {
273 $checkbox = "<input type=\"checkbox\" name=\"$a_checkbox_name\" value=\"$a_checkbox_value\" id=\"$a_checkbox_name$a_checkbox_value\"";
274 if ($a_checkbox_checked) {
275 $checkbox .= " checked=\"checked\"";
276 }
277 $checkbox .= " />";
278 if (strlen($a_checkbox_label)) {
279 $checkbox .= "&nbsp;<label for=\"$a_checkbox_name$a_checkbox_value\">$a_checkbox_label</label>";
280 }
281 $this->section[$this->sec_nr]["properties"][] =
282 array("name" => $a_name, "value" => $checkbox);
283 }
284
288 public function addPropertyTextinput($a_name, $a_input_name, $a_input_value = "", $a_input_size = "", $direct_button_command = "", $direct_button_label = "", $direct_button_primary = false)
289 {
290 $input = "<span class=\"form-inline\"><input class=\"form-control\" type=\"text\" name=\"$a_input_name\" id=\"$a_input_name\"";
291 if (strlen($a_input_value)) {
292 $input .= " value=\"" . ilUtil::prepareFormOutput($a_input_value) . "\"";
293 }
294 if (strlen($a_input_size)) {
295 $input .= " size=\"" . $a_input_size . "\"";
296 }
297 $input .= " />";
298 if (strlen($direct_button_command) && strlen($direct_button_label)) {
299 $css = "";
300 if ($direct_button_primary) {
301 $css = " btn-primary";
302 }
303 $input .= " <input type=\"submit\" class=\"btn btn-default" . $css . "\" name=\"cmd[$direct_button_command]\" value=\"$direct_button_label\" />";
304 }
305 $input .= "</span>";
306 $this->section[$this->sec_nr]["properties"][] =
307 array("name" => "<label for=\"$a_input_name\">$a_name</label>", "value" => $input);
308 }
309
313 public function addButton($a_title, $a_link, $a_frame = "", $a_position = "top", $a_primary = false)
314 {
315 if ($a_position == "top") {
316 $this->top_buttons[] =
317 array("title" => $a_title,"link" => $a_link,"target" => $a_frame,"primary" => $a_primary);
318 }
319 }
320
325 public function addFormButton($a_command, $a_title, $a_position = "top")
326 {
327 if ($a_position == "top") {
328 array_push(
329 $this->top_formbuttons,
330 array("command" => $a_command, "title" => $a_title)
331 );
332 }
333 }
334
335 public function addHiddenElement($a_name, $a_value)
336 {
337 array_push($this->hiddenelements, array("name" => $a_name, "value" => $a_value));
338 }
339
343 public function addMetaDataSections($a_rep_obj_id, $a_obj_id, $a_type)
344 {
346
347 $lng->loadLanguageModule("meta");
348
349 include_once("./Services/MetaData/classes/class.ilMD.php");
350 $md = new ilMD($a_rep_obj_id, $a_obj_id, $a_type);
351
352 if ($md_gen = $md->getGeneral()) {
353 // get first descrption
354 // The description is shown on the top of the page.
355 // Thus it is not necessary to show it again.
356 foreach ($md_gen->getDescriptionIds() as $id) {
357 $md_des = $md_gen->getDescription($id);
358 $description = $md_des->getDescription();
359 break;
360 }
361
362 // get language(s)
363 $langs = array();
364 foreach ($ids = $md_gen->getLanguageIds() as $id) {
365 $md_lan = $md_gen->getLanguage($id);
366 if ($md_lan->getLanguageCode() != "") {
367 $langs[] = $lng->txt("meta_l_" . $md_lan->getLanguageCode());
368 }
369 }
370 $langs = implode($langs, ", ");
371
372 // keywords
373 $keywords = array();
374 foreach ($ids = $md_gen->getKeywordIds() as $id) {
375 $md_key = $md_gen->getKeyword($id);
376 $keywords[] = $md_key->getKeyword();
377 }
378 $keywords = implode($keywords, ", ");
379 }
380
381 // authors
382 if (is_object($lifecycle = $md->getLifecycle())) {
383 $sep = $author = "";
384 foreach (($ids = $lifecycle->getContributeIds()) as $con_id) {
385 $md_con = $lifecycle->getContribute($con_id);
386 if ($md_con->getRole() == "Author") {
387 foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
388 $md_ent = $md_con->getEntity($ent_id);
389 $author = $author . $sep . $md_ent->getEntity();
390 $sep = ", ";
391 }
392 }
393 }
394 }
395
396 // copyright
397 $copyright = "";
398 if (is_object($rights = $md->getRights())) {
399 include_once('Services/MetaData/classes/class.ilMDUtils.php');
400 $copyright = ilMDUtils::_parseCopyright($rights->getDescription());
401 }
402
403 // learning time
404 #if(is_object($educational = $md->getEducational()))
405 #{
406 # $learning_time = $educational->getTypicalLearningTime();
407 #}
408 $learning_time = "";
409 if (is_object($educational = $md->getEducational())) {
410 if ($seconds = $educational->getTypicalLearningTimeSeconds()) {
411 $learning_time = ilDatePresentation::secondsToString($seconds);
412 }
413 }
414
415
416 // output
417
418 // description
419 if ($description != "") {
420 $this->addSection($lng->txt("description"));
421 $this->addProperty("", nl2br($description));
422 }
423
424 // general section
425 $this->addSection($lng->txt("meta_general"));
426 if ($langs != "") { // language
427 $this->addProperty(
428 $lng->txt("language"),
429 $langs
430 );
431 }
432 if ($keywords != "") { // keywords
433 $this->addProperty(
434 $lng->txt("keywords"),
435 $keywords
436 );
437 }
438 if ($author != "") { // author
439 $this->addProperty(
440 $lng->txt("author"),
441 $author
442 );
443 }
444 if ($copyright != "") { // copyright
445 $this->addProperty(
446 $lng->txt("meta_copyright"),
447 $copyright
448 );
449 }
450 if ($learning_time != "") { // typical learning time
451 $this->addProperty(
452 $lng->txt("meta_typical_learning_time"),
453 $learning_time
454 );
455 }
456 }
457
461 public function addObjectSections()
462 {
466 $ilAccess = $this->access;
468
469 $this->addSection($lng->txt("additional_info"));
470 $a_obj = $this->gui_object->object;
471
472 // links to the object
473 if (is_object($a_obj)) {
474 // permanent link
475 $type = $a_obj->getType();
476 $ref_id = $a_obj->getRefId();
477
478 if ($ref_id) {
479 include_once 'Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
480 if (ilECSServerSettings::getInstance()->activeServerExists()) {
481 $this->addProperty(
482 $lng->txt("object_id"),
483 $a_obj->getId()
484 );
485 }
486
487 include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
488 $pm = new ilPermanentLinkGUI($type, $ref_id);
489 $pm->setIncludePermanentLinkText(false);
490 $pm->setAlignCenter(false);
491 $this->addProperty(
492 $lng->txt("perma_link"),
493 $pm->getHTML(),
494 ""
495 );
496
497 // bookmarks
498
499 // links to resource
500 if ($ilAccess->checkAccess("write", "", $ref_id) ||
501 $ilAccess->checkAccess("edit_permissions", "", $ref_id)) {
502 $obj_id = $a_obj->getId();
503 $rs = ilObject::_getAllReferences($obj_id);
504 $refs = array();
505 foreach ($rs as $r) {
506 if ($tree->isInTree($r)) {
507 $refs[] = $r;
508 }
509 }
510 if (count($refs) > 1) {
511 $links = $sep = "";
512 foreach ($refs as $r) {
513 $cont_loc = new ilLocatorGUI();
514 $cont_loc->addContextItems($r, true);
515 $links.= $sep . $cont_loc->getHTML();
516 $sep = "<br />";
517 }
518
519 $this->addProperty(
520 $lng->txt("res_links"),
521 '<div class="small">' . $links . '</div>'
522 );
523 }
524 }
525 }
526 }
527
528
529 // creation date
530 $this->addProperty(
531 $lng->txt("create_date"),
532 ilDatePresentation::formatDate(new ilDateTime($a_obj->getCreateDate(), IL_CAL_DATETIME))
533 );
534
535 // owner
536 if ($ilUser->getId() != ANONYMOUS_USER_ID and $a_obj->getOwner()) {
537 include_once './Services/Object/classes/class.ilObjectFactory.php';
538 include_once './Services/User/classes/class.ilObjUser.php';
539
540 if (ilObjUser::userExists(array($a_obj->getOwner()))) {
541 $ownerObj = ilObjectFactory::getInstanceByObjId($a_obj->getOwner(), false);
542 } else {
543 $ownerObj = ilObjectFactory::getInstanceByObjId(6, false);
544 }
545
546 if (!is_object($ownerObj) || $ownerObj->getType() != "usr") { // root user deleted
547 $this->addProperty($lng->txt("owner"), $lng->txt("no_owner"));
548 } elseif ($ownerObj->hasPublicProfile()) {
549 $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $ownerObj->getId());
550 $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName(), $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
551 } else {
552 $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName());
553 }
554 }
555
556 // disk usage
557 require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
558 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
560 $size = $a_obj->getDiskUsage();
561 if ($size !== null) {
562 $this->addProperty($lng->txt("disk_usage"), ilUtil::formatSize($size, 'long'));
563 }
564 }
565 // change event
566 require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
568 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
569 $readEvents = ilChangeEvent::_lookupReadEvents($a_obj->getId());
570 $count_users = 0;
571 $count_members = 0;
572 $count_user_reads = 0;
573 $count_anonymous_reads = 0;
574 foreach ($readEvents as $evt) {
575 if ($evt['usr_id'] == ANONYMOUS_USER_ID) {
576 $count_anonymous_reads += $evt['read_count'];
577 } else {
578 $count_user_reads += $evt['read_count'];
579 $count_users++;
580 /* to do: if ($evt['user_id'] is member of $this->getRefId())
581 {
582 $count_members++;
583 }*/
584 }
585 }
586 if ($count_anonymous_reads > 0) {
587 $this->addProperty($this->lng->txt("readcount_anonymous_users"), $count_anonymous_reads);
588 }
589 if ($count_user_reads > 0) {
590 $this->addProperty($this->lng->txt("readcount_users"), $count_user_reads);
591 }
592 if ($count_users > 0) {
593 $this->addProperty($this->lng->txt("accesscount_registered_users"), $count_users);
594 }
595 }
596 }
597 // END ChangeEvent: Display change event info
598
599 // WebDAV: Display locking information
600 require_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
602 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
603 require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
604 $davLocks = new ilDAVLocks();
605
606 // Show lock info
607 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
608 $locks =&$davLocks->getLocksOnObjectObj($a_obj->getId());
609 if (count($locks) > 0) {
610 $lockUser = new ilObjUser($locks[0]['ilias_owner']);
611 $this->addProperty(
612 $this->lng->txt("in_use_by"),
613 $lockUser->getPublicName(),
614 "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI'
615 );
616 }
617 }
618 }
619 }
620 }
621 // END ChangeEvent: Display standard object info
625 public function showSummary()
626 {
628 $ilAccess = $this->access;
629
630 $tpl->setContent($this->getCenterColumnHTML());
631 $tpl->setRightContent($this->getRightColumnHTML());
632 }
633
634
638 public function getCenterColumnHTML()
639 {
641
642 include_once("Services/Block/classes/class.ilColumnGUI.php");
643 $column_gui = new ilColumnGUI("info", IL_COL_CENTER);
644 $this->setColumnSettings($column_gui);
645
646 if (!$ilCtrl->isAsynch()) {
647 if ($column_gui->getScreenMode() != IL_SCREEN_SIDE) {
648 // right column wants center
649 if ($column_gui->getCmdSide() == IL_COL_RIGHT) {
650 $column_gui = new ilColumnGUI("info", IL_COL_RIGHT);
651 $this->setColumnSettings($column_gui);
652 $html = $ilCtrl->forwardCommand($column_gui);
653 }
654 // left column wants center
655 if ($column_gui->getCmdSide() == IL_COL_LEFT) {
656 $column_gui = new ilColumnGUI("info", IL_COL_LEFT);
657 $this->setColumnSettings($column_gui);
658 $html = $ilCtrl->forwardCommand($column_gui);
659 }
660 } else {
661 $html = $this->getHTML();
662 }
663 }
664
665 return $html;
666 }
667
671 public function getRightColumnHTML()
672 {
676
677 include_once("Services/Block/classes/class.ilColumnGUI.php");
678 $column_gui = new ilColumnGUI("info", IL_COL_RIGHT);
679 $this->setColumnSettings($column_gui);
680
681 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
682 $column_gui->getCmdSide() == IL_COL_RIGHT &&
683 $column_gui->getScreenMode() == IL_SCREEN_SIDE) {
684 $html = $ilCtrl->forwardCommand($column_gui);
685 } else {
686 if (!$ilCtrl->isAsynch()) {
687 if ($this->news_enabled) {
688 $html = $ilCtrl->getHTML($column_gui);
689 }
690 }
691 }
692
693 return $html;
694 }
695
699 public function setColumnSettings($column_gui)
700 {
702 $ilAccess = $this->access;
703
704 $column_gui->setEnableEdit($this->news_editing);
705 $column_gui->setRepositoryMode(true);
706 $column_gui->setAllBlockProperties($this->getAllBlockProperties());
707 }
708
709 public function setOpenFormTag($a_val)
710 {
711 $this->open_form_tag = $a_val;
712 }
713
714 public function setCloseFormTag($a_val)
715 {
716 $this->close_form_tag = $a_val;
717 }
718
722 public function getHTML()
723 {
727 $ilAccess = $this->access;
730
731 $tpl = new ilTemplate("tpl.infoscreen.html", true, true, "Services/InfoScreen");
732
733 // other class handles form action (@todo: this is not implemented/tested)
734 if ($this->form_action == "") {
735 $this->setFormAction($ilCtrl->getFormAction($this));
736 }
737
738 require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
740
741 if ($this->hidden) {
742 $tpl->touchBlock("hidden_js");
743 if ($this->show_hidden_toggle) {
744 $this->addButton($lng->txt("show_hidden_sections"), "JavaScript:toggleSections(this, '" . $lng->txt("show_hidden_sections") . "', '" . $lng->txt("hide_visible_sections") . "');");
745 }
746 }
747
748
749 // DEPRECATED - use ilToolbarGUI
750
751 // add top buttons
752 if (count($this->top_buttons) > 0) {
753 $tpl->addBlockfile("TOP_BUTTONS", "top_buttons", "tpl.buttons.html");
754
755 foreach ($this->top_buttons as $button) {
756 // view button
757 $tpl->setCurrentBlock("btn_cell");
758 $tpl->setVariable("BTN_LINK", $button["link"]);
759 $tpl->setVariable("BTN_TARGET", $button["target"]);
760 $tpl->setVariable("BTN_TXT", $button["title"]);
761 if ($button["primary"]) {
762 $tpl->setVariable("BTN_CLASS", " btn-primary");
763 }
764 $tpl->parseCurrentBlock();
765 }
766 }
767
768 // add top formbuttons
769 if ((count($this->top_formbuttons) > 0) && (strlen($this->form_action) > 0)) {
770 $tpl->addBlockfile("TOP_FORMBUTTONS", "top_submitbuttons", "tpl.submitbuttons.html", "Services/InfoScreen");
771
772 foreach ($this->top_formbuttons as $button) {
773 // view button
774 $tpl->setCurrentBlock("btn_submit_cell");
775 $tpl->setVariable("BTN_COMMAND", $button["command"]);
776 $tpl->setVariable("BTN_NAME", $button["title"]);
777 $tpl->parseCurrentBlock();
778 }
779 }
780
781 // add form action
782 if (strlen($this->form_action) > 0) {
783 if ($this->open_form_tag) {
784 $tpl->setCurrentBlock("formtop");
785 $tpl->setVariable("FORMACTION", $this->form_action);
786 $tpl->parseCurrentBlock();
787 }
788
789 if ($this->close_form_tag) {
790 $tpl->touchBlock("formbottom");
791 }
792 }
793
794 if (count($this->hiddenelements)) {
795 foreach ($this->hiddenelements as $hidden) {
796 $tpl->setCurrentBlock("hidden_element");
797 $tpl->setVariable("HIDDEN_NAME", $hidden["name"]);
798 $tpl->setVariable("HIDDEN_VALUE", $hidden["value"]);
799 $tpl->parseCurrentBlock();
800 }
801 }
802
803
804 // learning progress
805 if ($this->learning_progress_enabled and $html = $this->showLearningProgress($tpl)) {
806 $tpl->setCurrentBlock("learning_progress");
807 $tpl->setVariable("LP_TABLE", $html);
808 $tpl->parseCurrentBlock();
809 }
810
811 // notes section
812 if ($this->private_notes_enabled && !$ilSetting->get('disable_notes')) {
813 $html = $this->showNotesSection();
814 $tpl->setCurrentBlock("notes");
815 $tpl->setVariable("NOTES", $html);
816 $tpl->parseCurrentBlock();
817 }
818
819 // tagging
820 if (is_object($this->gui_object->object)) {
821 $tags_set = new ilSetting("tags");
822 if ($tags_set->get("enable") && $ilUser->getId() != ANONYMOUS_USER_ID) {
823 $this->addTagging();
824 }
825 }
826
827 if (is_object($this->gui_object->object)) {
828 $this->addObjectSections();
829 }
830
831 // render all sections
832 for ($i = 1; $i <= $this->sec_nr; $i++) {
833 if (is_array($this->section[$i]["properties"])) {
834 // section properties
835 foreach ($this->section[$i]["properties"] as $property) {
836 if ($property["name"] != "") {
837 if ($property["link"] == "") {
838 $tpl->setCurrentBlock("pv");
839 $tpl->setVariable("TXT_PROPERTY_VALUE", $property["value"]);
840 $tpl->parseCurrentBlock();
841 } else {
842 $tpl->setCurrentBlock("lpv");
843 $tpl->setVariable("TXT_PROPERTY_LVALUE", $property["value"]);
844 $tpl->setVariable("LINK_PROPERTY_VALUE", $property["link"]);
845 $tpl->parseCurrentBlock();
846 }
847 $tpl->setCurrentBlock("property_row");
848 $tpl->setVariable("TXT_PROPERTY", $property["name"]);
849 $tpl->parseCurrentBlock();
850 } else {
851 $tpl->setCurrentBlock("property_full_row");
852 $tpl->setVariable("TXT_PROPERTY_FULL_VALUE", $property["value"]);
853 $tpl->parseCurrentBlock();
854 }
855 }
856
857 // section header
858 if ($this->section[$i]["hidden"]) {
859 $tpl->setVariable("SECTION_HIDDEN", " style=\"display:none;\"");
860 $tpl->setVariable("SECTION_ID", "hidable_" . $i);
861 } else {
862 $tpl->setVariable("SECTION_ID", $i);
863 }
864 $tpl->setVariable("TCLASS", $this->getTableClass());
865 $tpl->setVariable("TXT_SECTION", $this->section[$i]["title"]);
866 $tpl->touchBlock("row");
867 }
868 }
869
870 return $tpl->get();
871 }
872
873 public function showLearningProgress($a_tpl)
874 {
877
878 if (!$rbacsystem->checkAccess('read', $this->gui_object->object->getRefId())) {
879 return false;
880 }
881 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
882 return false;
883 }
884
885 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
886 if (!ilObjUserTracking::_enabledLearningProgress() and $ilUser->getId() != ANONYMOUS_USER_ID) {
887 return false;
888 }
889
890 include_once './Services/Object/classes/class.ilObjectLP.php';
891 $olp = ilObjectLP::getInstance($this->gui_object->object->getId());
892 if ($olp->getCurrentMode() != ilLPObjSettings::LP_MODE_MANUAL) {
893 return false;
894 }
895
896 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
897
898 $this->lng->loadLanguageModule('trac');
899
900 // section header
901 // $a_tpl->setCurrentBlock("header_row");
902 $a_tpl->setVariable(
903 "TXT_SECTION",
904 $this->lng->txt('learning_progress')
905 );
906 $a_tpl->parseCurrentBlock();
907 // $a_tpl->touchBlock("row");
908
909 // status
910 $i_tpl = new ilTemplate("tpl.lp_edit_manual_info_page.html", true, true, "Services/Tracking");
911 $i_tpl->setVariable("INFO_EDITED", $this->lng->txt("trac_info_edited"));
912 $i_tpl->setVariable("SELECT_STATUS", ilUtil::formSelect(
914 $ilUser->getId(),
915 $this->gui_object->object->getId()
916 ),
917 'lp_edit',
918 array(0 => $this->lng->txt('trac_not_completed'),
919 1 => $this->lng->txt('trac_completed')),
920 false,
921 true
922 ));
923 $i_tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
924 $a_tpl->setCurrentBlock("pv");
925 $a_tpl->setVariable("TXT_PROPERTY_VALUE", $i_tpl->get());
926 $a_tpl->parseCurrentBlock();
927 $a_tpl->setCurrentBlock("property_row");
928 $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_status'));
929 $a_tpl->parseCurrentBlock();
930 // $a_tpl->touchBlock("row");
931
932
933 // More infos for lm's
934 if ($this->gui_object->object->getType() == 'lm' ||
935 $this->gui_object->object->getType() == 'htlm') {
936 $a_tpl->setCurrentBlock("pv");
937
938 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
939 $progress = ilLearningProgress::_getProgress($ilUser->getId(), $this->gui_object->object->getId());
940 if ($progress['access_time']) {
941 $a_tpl->setVariable(
942 "TXT_PROPERTY_VALUE",
943 ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_UNIX))
944 );
945 } else {
946 $a_tpl->setVariable(
947 "TXT_PROPERTY_VALUE",
948 $this->lng->txt('trac_not_accessed')
949 );
950 }
951
952 $a_tpl->parseCurrentBlock();
953 $a_tpl->setCurrentBlock("property_row");
954 $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_last_access'));
955 $a_tpl->parseCurrentBlock();
956 // $a_tpl->touchBlock("row");
957
958 // tags of all users
959 $a_tpl->setCurrentBlock("pv");
960 $a_tpl->setVariable(
961 "TXT_PROPERTY_VALUE",
962 (int) $progress['visits']
963 );
964 $a_tpl->parseCurrentBlock();
965 $a_tpl->setCurrentBlock("property_row");
966 $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_visits'));
967 $a_tpl->parseCurrentBlock();
968 // $a_tpl->touchBlock("row");
969
970
971 if ($this->gui_object->object->getType() == 'lm') {
972 // tags of all users
973 $a_tpl->setCurrentBlock("pv");
974 $a_tpl->setVariable(
975 "TXT_PROPERTY_VALUE",
976 ilDatePresentation::secondsToString($progress['spent_seconds'])
977 );
978 $a_tpl->parseCurrentBlock();
979 $a_tpl->setCurrentBlock("property_row");
980 $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_spent_time'));
981 $a_tpl->parseCurrentBlock();
982 // $a_tpl->touchBlock("row");
983 }
984 }
985
986 // #10493
987 $a_tpl->touchBlock("row");
988 }
989
990 public function saveProgress()
991 {
993
994 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
995
996 $lp_marks = new ilLPMarks($this->gui_object->object->getId(), $ilUser->getId());
997 $lp_marks->setCompleted((bool) $_POST['lp_edit']);
998 $lp_marks->update();
999
1000 require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
1001 ilLPStatusWrapper::_updateStatus($this->gui_object->object->getId(), $ilUser->getId());
1002
1003 $this->lng->loadLanguageModule('trac');
1004 ilUtil::sendSuccess($this->lng->txt('trac_updated_status'), true);
1005 $this->ctrl->redirect($this, ""); // #14993
1006
1007 // $this->showSummary();
1008 }
1009
1010
1014 public function showNotesSection()
1015 {
1016 $ilAccess = $this->access;
1018
1019 $next_class = $this->ctrl->getNextClass($this);
1020 include_once("Services/Notes/classes/class.ilNoteGUI.php");
1021 $notes_gui = new ilNoteGUI(
1022 $this->gui_object->object->getId(),
1023 0,
1024 $this->gui_object->object->getType()
1025 );
1026
1027 // global switch
1028 if ($ilSetting->get("disable_comments")) {
1029 $notes_gui->enablePublicNotes(false);
1030 } else {
1031 $ref_id = $this->gui_object->object->getRefId();
1032 $has_write = $ilAccess->checkAccess("write", "", $ref_id);
1033
1034 if ($has_write && $ilSetting->get("comments_del_tutor", 1)) {
1035 $notes_gui->enablePublicNotesDeletion(true);
1036 }
1037
1038 /* should probably be discussed further
1039 for now this will only work properly with comments settings
1040 (see ilNoteGUI constructor)
1041 */
1042 if ($has_write ||
1043 $ilAccess->checkAccess("edit_permissions", "", $ref_id)) {
1044 $notes_gui->enableCommentsSettings();
1045 }
1046 }
1047
1048 /* moved to action menu
1049 $notes_gui->enablePrivateNotes();
1050 */
1051
1052 if ($next_class == "ilnotegui") {
1053 $html = $this->ctrl->forwardCommand($notes_gui);
1054 } else {
1055 $html = $notes_gui->getNotesHTML();
1056 }
1057
1058 return $html;
1059 }
1060
1068 public function showLDAPRoleGroupMappingInfo($a_section = '')
1069 {
1070 if (strlen($a_section)) {
1071 $this->addSection($a_section);
1072 }
1073 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
1074 $ldap_mapping = ilLDAPRoleGroupMapping::_getInstance();
1075 if ($infos = $ldap_mapping->getInfoStrings($this->gui_object->object->getId())) {
1076 $info_combined = '<div style="color:green;">';
1077 $counter = 0;
1078 foreach ($infos as $info_string) {
1079 if ($counter++) {
1080 $info_combined .= '<br />';
1081 }
1082 $info_combined .= $info_string;
1083 }
1084 $info_combined .= '</div>';
1085 $this->addProperty($this->lng->txt('applications'), $info_combined);
1086 }
1087 return true;
1088 }
1089
1090 public function setTabs()
1091 {
1092 $tpl = $this->tpl;
1093
1094 $this->getTabs($this->tabs_gui);
1095 }
1096
1100 public function getTabs(&$tabs_gui)
1101 {
1104 $ilAccess = $this->access;
1105
1106 $next_class = $this->ctrl->getNextClass($this);
1107 $force_active = ($next_class == "ilnotegui")
1108 ? true
1109 : false;
1110
1111 $tabs_gui->addSubTabTarget(
1112 'summary',
1113 $this->ctrl->getLinkTarget($this, "showSummary"),
1114 array("showSummary", ""),
1115 get_class($this),
1116 "",
1117 $force_active
1118 );
1119 }
1120
1121
1125 public function addTagging()
1126 {
1127 $lng = $this->lng;
1129
1130 $lng->loadLanguageModule("tagging");
1131 $tags_set = new ilSetting("tags");
1132
1133 include_once("Services/Tagging/classes/class.ilTaggingGUI.php");
1134 $tagging_gui = new ilTaggingGUI();
1135 $tagging_gui->setObject(
1136 $this->gui_object->object->getId(),
1137 $this->gui_object->object->getType()
1138 );
1139
1140 $this->addSection($lng->txt("tagging_tags"));
1141
1142 if ($tags_set->get("enable_all_users")) {
1143 $this->addProperty(
1144 $lng->txt("tagging_all_users"),
1145 $tagging_gui->getAllUserTagsForObjectHTML()
1146 );
1147 }
1148
1149 $this->addProperty(
1150 $lng->txt("tagging_my_tags"),
1151 $tagging_gui->getTaggingInputHTML()
1152 );
1153 }
1154
1155 public function saveTags()
1156 {
1157 include_once("Services/Tagging/classes/class.ilTaggingGUI.php");
1158 $tagging_gui = new ilTaggingGUI();
1159 $tagging_gui->setObject(
1160 $this->gui_object->object->getId(),
1161 $this->gui_object->object->getType()
1162 );
1163 $tagging_gui->saveInput();
1164
1165 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
1166 $this->ctrl->redirect($this, ""); // #14993
1167
1168 // return $this->showSummary();
1169 }
1170
1171 public function hideFurtherSections($a_add_toggle = true)
1172 {
1173 $this->hidden = true;
1174 $this->show_hidden_toggle = (bool) $a_add_toggle;
1175 }
1176
1177 public function getHiddenToggleButton()
1178 {
1179 $lng = $this->lng;
1180
1181 return "<a onClick=\"toggleSections(this, '" . $lng->txt("show_hidden_sections") . "', '" . $lng->txt("hide_visible_sections") . "'); return false;\" href=\"#\">" . $lng->txt("show_hidden_sections") . "</a>";
1182 }
1183}
user()
Definition: user.php:4
$size
Definition: RandomTest.php:84
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SCREEN_SIDE
const IL_COL_RIGHT
const IL_COL_CENTER
const IL_COL_LEFT
const IL_CAL_UNIX
const IL_CAL_DATETIME
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object which happened after the last time the user caught ...
static _isActive()
Returns true, if change event tracking is active.
Column user interface class.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static getInstance()
Get singleton instance.
Class ilInfoScreenGUI.
showLDAPRoleGroupMappingInfo($a_section='')
show LDAP role group mapping info
__construct($a_gui_object)
Constructor.
removeFormAction()
remove form action
addObjectSections()
add standard object section
getRightColumnHTML()
Display right column.
setFormAction($a_form_action)
set a form action
enableNewsEditing($a_enable=true)
enable news editing
addButton($a_title, $a_link, $a_frame="", $a_position="top", $a_primary=false)
add a property to current section
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
addPropertyTextinput($a_name, $a_input_name, $a_input_value="", $a_input_size="", $direct_button_command="", $direct_button_label="", $direct_button_primary=false)
add a property to current section
executeCommand()
execute command
$form_action
a form action parameter.
showSummary()
show summary page
getCenterColumnHTML()
Display center column.
hideFurtherSections($a_add_toggle=true)
enableFeedback($a_enable=true)
enable feedback
setTableClass($a_val)
Set table class.
addHiddenElement($a_name, $a_value)
enablePrivateNotes($a_enable=true)
enable notes
getTabs(&$tabs_gui)
get tabs
enableLearningProgress($a_enable=true)
enable learning progress
showNotesSection()
show notes section
addFormButton($a_command, $a_title, $a_position="top")
add a form button to the info screen the form buttons are only valid if a form action is set
setColumnSettings($column_gui)
Set column settings.
addPropertyCheckbox($a_name, $a_checkbox_name, $a_checkbox_value, $a_checkbox_label="", $a_checkbox_checked=false)
add a property to current section
enableNews($a_enable=true)
enable news
addProperty($a_name, $a_value, $a_link="")
add a property to current section
getTableClass()
Get table class.
addMetaDataSections($a_rep_obj_id, $a_obj_id, $a_type)
add standard meta data sections
addSection($a_title)
add a new section
static _getInstance()
Get singleton instance of this class.
static _hasCompleted($a_usr_id, $a_obj_id)
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getProgress($a_user_id, $a_obj_id)
locator handling class
static _parseCopyright($a_copyright)
Parse copyright.
Notes GUI class.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static userExists($a_usr_ids=array())
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance($a_obj_id)
static _getAllReferences($a_id)
get all reference ids of object
Class for permanent links.
GUI class for public user profile presentation.
ILIAS Setting Class.
Class ilTaggingGUI.
special template class to simplify handling of ITX/PEAR
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
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 prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$counter
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79
if(!array_key_exists('StateId', $_REQUEST)) $id
$links
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
$type
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92