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