ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLPTableBaseGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once './Services/Search/classes/class.ilSearchSettings.php';
6 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
7 
17 {
18  protected $filter; // array
19  protected $anonymized; // [bool]
20 
21  public function __construct($a_parent_obj, $a_parent_cmd = "", $a_template_context = "")
22  {
23  parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
24 
25  // country names
26  $this->lng->loadLanguageModule("meta");
27 
28  include_once("./Services/Object/classes/class.ilObjectLP.php");
29 
30  $this->anonymized = (bool) !ilObjUserTracking::_enabledUserRelatedData();
31  if (!$this->anonymized && $this->obj_id) {
32  include_once "Services/Object/classes/class.ilObjectLP.php";
33  $olp = ilObjectLP::getInstance($this->obj_id);
34  $this->anonymized = $olp->isAnonymized();
35  }
36  }
37 
38  public function executeCommand()
39  {
40  global $ilCtrl, $lng;
41 
42  $this->determineSelectedFilters();
43 
44  if (!$ilCtrl->getNextClass($this)) {
45  $to_hide = false;
46 
47  switch ($ilCtrl->getCmd()) {
48  case "applyFilter":
49  $this->resetOffset();
50  $this->writeFilterToSession();
51  break;
52 
53  case "resetFilter":
54  $this->resetOffset();
55  $this->resetFilter();
56  break;
57 
58  case "hideSelected":
59  $to_hide = $_POST["item_id"];
60  break;
61 
62  case "hide":
63  $to_hide = array((int) $_GET["hide"]);
64  break;
65 
66  case "mailselectedusers":
67  if (!sizeof($_POST["uid"])) {
68  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
69  } else {
70  $this->sendMail($_POST["uid"], $this->parent_obj, $this->parent_cmd);
71  }
72  break;
73 
74  case 'addToClipboard':
75  if (!sizeof($_POST['uid'])) {
76  ilUtil::sendFailure($lng->txt('no_checkbox'), true);
77  } else {
78  $this->addToClipboard();
79  }
80  break;
81 
82  // page selector
83  default:
84  $this->determineOffsetAndOrder();
85  $this->storeNavParameter();
86  break;
87  }
88 
89  if ($to_hide) {
90  $obj = $this->getFilterItemByPostVar("hide");
91  $value = array_unique(array_merge((array) $obj->getValue(), $to_hide));
92  $obj->setValue($value);
93  $obj->writeToSession();
94  }
95 
96  if (isset($_REQUEST["tbltplcrt"])) {
97  $ilCtrl->setParameter($this->parent_obj, "tbltplcrt", $_REQUEST["tbltplcrt"]);
98  }
99  if (isset($_REQUEST["tbltpldel"])) {
100  $ilCtrl->setParameter($this->parent_obj, "tbltpldel", $_REQUEST["tbltpldel"]);
101  }
102 
103  $ilCtrl->redirect($this->parent_obj, $this->parent_cmd);
104  } else {
105  // e.g. repository selector
106  return parent::executeCommand();
107  }
108  }
109 
110  protected function sendMail(array $a_user_ids, $a_parent_obj, $a_parent_cmd)
111  {
112  // see ilObjCourseGUI::sendMailToSelectedUsersObject()
113 
114  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
115 
116  $rcps = array();
117  foreach ($a_user_ids as $usr_id) {
118  $rcps[] = ilObjUser::_lookupLogin($usr_id);
119  }
120 
121  $template = array();
122  $sig = null;
123 
124  // repository-object-specific
125  $ref_id = (int) $_REQUEST["ref_id"];
126  if ($ref_id) {
128  $tmpl_id = $obj_lp->getMailTemplateId();
129 
130  if ($tmpl_id) {
131  $template = array(
132  ilMailFormCall::CONTEXT_KEY => $tmpl_id,
133  'ref_id' => $ref_id,
134  'ts' => time()
135  );
136  } else {
137  include_once './Services/Link/classes/class.ilLink.php';
138  $sig = ilLink::_getLink($ref_id);
139  $sig = rawurlencode(base64_encode($sig));
140  }
141  }
142 
145  $a_parent_obj,
146  $a_parent_cmd,
147  array(),
148  array(
149  'type' => 'new',
150  'rcp_to' => implode(',', $rcps),
151  'sig' => $sig
152  ),
153  $template
154  )
155  );
156  }
157 
167  protected function searchObjects(array $filter, $permission, array $preset_obj_ids = null, $a_check_lp_activation = true)
168  {
169  global $ilObjDataCache;
170 
171  include_once './Services/Search/classes/class.ilQueryParser.php';
172 
173  $query_parser = new ilQueryParser($filter["query"]);
174  $query_parser->setMinWordLength(0);
175  $query_parser->setCombination(QP_COMBINATION_AND);
176  $query_parser->parse();
177  if (!$query_parser->validate()) {
178  ilLoggerFactory::getLogger('trac')->notice($query_parser->getMessage());
179  // echo $query_parser->getMessage();
180  return false;
181  }
182 
183  if ($filter["type"] == "lres") {
184  $filter["type"] = array('lm','sahs','htlm');
185  } else {
186  $filter["type"] = array($filter["type"]);
187  }
188 
189  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
190  $object_search = new ilLikeObjectSearch($query_parser);
191  $object_search->setFilter($filter["type"]);
192  if ($preset_obj_ids) {
193  $object_search->setIdFilter($preset_obj_ids);
194  }
195  $res =&$object_search->performSearch();
196 
197  if ($permission) {
198  $res->setRequiredPermission($permission);
199  }
200 
201  $res->setMaxHits(1000);
202 
203  if ($a_check_lp_activation) {
204  $res->addObserver($this, "searchFilterListener");
205  }
206 
207  if (!$this->filter["area"]) {
208  $res->filter(ROOT_FOLDER_ID, false);
209  } else {
210  $res->filter($this->filter["area"], false);
211  }
212 
213  $objects = array();
214  foreach ($res->getResults() as $obj_data) {
215  $objects[$obj_data['obj_id']][] = $obj_data['ref_id'];
216  }
217 
218  // Check if search max hits is reached
219  if ($res->isLimitReached()) {
220  $this->lng->loadLanguageModule("search");
221  ilUtil::sendFailure(sprintf($this->lng->txt("search_limit_reached"), 1000));
222  }
223 
224  return $objects ? $objects : array();
225  }
226 
232  public function searchFilterListener($a_ref_id, $a_data)
233  {
234  if (is_array($this->filter["hide"]) && in_array($a_data["obj_id"], $this->filter["hide"])) {
235  return false;
236  }
237  $olp = ilObjectLP::getInstance($a_data["obj_id"]);
238  if (get_class($olp) != "ilObjectLP" && // #13654 - LP could be unsupported
239  !$olp->isActive()) {
240  return false;
241  }
242  return true;
243  }
244 
250  public function initBaseFilter($a_split_learning_resources = false, $a_include_no_status_filter = true)
251  {
252  global $lng, $ilObjDataCache;
253 
254  $this->setDisableFilterHiding(true);
255 
256  // object type selection
257  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
258  $si = new ilSelectInputGUI($this->lng->txt("obj_type"), "type");
259  $si->setOptions($this->getPossibleTypes($a_split_learning_resources));
260  $this->addFilterItem($si);
261  $si->readFromSession();
262  if (!$si->getValue()) {
263  $si->setValue("crs");
264  }
265  $this->filter["type"] = $si->getValue();
266 
267  // hidden items
268  include_once("./Services/Form/classes/class.ilMultiSelectInputGUI.php");
269  $msi = new ilMultiSelectInputGUI($lng->txt("trac_filter_hidden"), "hide");
270  $this->addFilterItem($msi);
271  $msi->readFromSession();
272  $this->filter["hide"] = $msi->getValue();
273  if ($this->filter["hide"]) {
274  // create options from current value
275  $types = $this->getCurrentFilter(true);
276  $type = $types["type"];
277  $options = array();
278  if ($type == 'lres') {
279  $type = array('lm','sahs','htlm');
280  } else {
281  $type = array($type);
282  }
283  foreach ($this->filter["hide"] as $obj_id) {
284  if (in_array($ilObjDataCache->lookupType($obj_id), $type)) {
285  $options[$obj_id] = $ilObjDataCache->lookupTitle($obj_id);
286  }
287  }
288  $msi->setOptions($options);
289  }
290 
291  // title/description
292  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
293  $ti = new ilTextInputGUI($lng->txt("trac_title_description"), "query");
294  $ti->setMaxLength(64);
295  $ti->setSize(20);
296  $this->addFilterItem($ti);
297  $ti->readFromSession();
298  $this->filter["query"] = $ti->getValue();
299 
300  // repository area selection
301  include_once("./Services/Form/classes/class.ilRepositorySelectorInputGUI.php");
302  $rs = new ilRepositorySelectorInputGUI($lng->txt("trac_filter_area"), "area");
303  $rs->setSelectText($lng->txt("trac_select_area"));
304  $this->addFilterItem($rs);
305  $rs->readFromSession();
306  $this->filter["area"] = $rs->getValue();
307 
308  // hide "not started yet"
309  if ($a_include_no_status_filter) {
310  include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
311  $cb = new ilCheckboxInputGUI($lng->txt("trac_filter_has_status"), "status");
312  $this->addFilterItem($cb);
313  $cb->readFromSession();
314  $this->filter["status"] = $cb->getChecked();
315  }
316  }
317 
324  protected function buildPath($ref_ids)
325  {
326  global $tree, $ilCtrl;
327 
328  include_once './Services/Link/classes/class.ilLink.php';
329 
330  if (!count($ref_ids)) {
331  return false;
332  }
333  foreach ($ref_ids as $ref_id) {
334  $path = "...";
335  $counter = 0;
336  $path_full = $tree->getPathFull($ref_id);
337  foreach ($path_full as $data) {
338  if (++$counter < (count($path_full)-1)) {
339  continue;
340  }
341  $path .= " &raquo; ";
342  if ($ref_id != $data['ref_id']) {
343  $path .= $data['title'];
344  } else {
345  $path .= ('<a target="_top" href="' .
346  ilLink::_getLink($data['ref_id'], $data['type']) . '">' .
347  $data['title'] . '</a>');
348  }
349  }
350 
351  $result[$ref_id] = $path;
352  }
353  return $result;
354  }
355 
363  protected function getPossibleTypes($a_split_learning_resources = false, $a_include_digilib = false, $a_allow_undefined_lp = false)
364  {
365  global $lng, $ilPluginAdmin;
366 
367  $options = array();
368 
369  if ($a_split_learning_resources) {
370  $options['lm'] = $lng->txt('objs_lm');
371  $options['sahs'] = $lng->txt('objs_sahs');
372  $options['htlm'] = $lng->txt('objs_htlm');
373  } else {
374  $options['lres'] = $lng->txt('learning_resources');
375  }
376 
377  $options['crs'] = $lng->txt('objs_crs');
378  $options['grp'] = $lng->txt('objs_grp');
379  $options['exc'] = $lng->txt('objs_exc');
380  $options['file'] = $lng->txt('objs_file');
381  $options['mcst'] = $lng->txt('objs_mcst');
382  $options['svy'] = $lng->txt('objs_svy');
383  $options['tst'] = $lng->txt('objs_tst');
384  $options['prg'] = $lng->txt('objs_prg');
385  $options['iass'] = $lng->txt('objs_iass');
386 
387  if ($a_allow_undefined_lp) {
388  $options["webr"] = $lng->txt("objs_webr");
389  $options["wiki"] = $lng->txt("objs_wiki");
390  $options["blog"] = $lng->txt("objs_blog");
391  $options["prtf"] = $lng->txt("objs_prtf");
392  $options["prtt"] = $lng->txt("objs_prtt");
393  }
394 
395  // repository plugins (currently only active)
396  include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
397  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
398  foreach ($pl_names as $pl) {
399  $pl_id = $ilPluginAdmin->getId(IL_COMP_SERVICE, "Repository", "robj", $pl);
401  $options[$pl_id] = ilObjectPlugin::lookupTxtById($pl_id, "objs_" . $pl_id);
402  }
403  }
404 
405  asort($options);
406  return $options;
407  }
408 
409  protected function parseValue($id, $value, $type)
410  {
411  global $lng;
412 
413  // get rid of aggregation
414  $pos = strrpos($id, "_");
415  if ($pos !== false) {
416  $function = strtoupper(substr($id, $pos+1));
417  if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT"))) {
418  $id = substr($id, 0, $pos);
419  }
420  }
421 
422  if (trim($value) == "" && $id != "status") {
423  if ($id == "title" &&
424  get_class($this) != "ilTrObjectUsersPropsTableGUI" &&
425  get_class($this) != "ilTrMatrixTableGUI") {
426  return "--" . $lng->txt("none") . "--";
427  }
428  return " ";
429  }
430 
431  switch ($id) {
432  case "first_access":
433  case "create_date":
434  case 'status_changed':
436  break;
437 
438  case "last_access":
440  break;
441 
442  case "birthday":
443  $value = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATE));
444  break;
445 
446  case "spent_seconds":
448  $value = "-";
449  } else {
450  $value = ilDatePresentation::secondsToString($value, ($value < 3600 ? true : false)); // #14858
451  }
452  break;
453 
454  case "percentage":
455  if (false /* $this->isPercentageAvailable() */) {
456  $value = "-";
457  } else {
458  $value = $value . "%";
459  }
460  break;
461 
462  case "mark":
464  $value = "-";
465  }
466  break;
467 
468  case "gender":
469  $value = $lng->txt("gender_" . $value);
470  break;
471 
472  case "status":
473  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
476  $value = ilUtil::img($path, $text);
477  break;
478 
479  case "language":
480  $lng->loadLanguageModule("meta");
481  $value = $lng->txt("meta_l_" . $value);
482  break;
483 
484  case "sel_country":
485  $value = $lng->txt("meta_c_" . $value);
486  break;
487  }
488 
489  return $value;
490  }
491 
492  public function getCurrentFilter($as_query = false)
493  {
494  $result = array();
495  foreach ((array) $this->filter as $id => $value) {
496  $item = $this->getFilterItemByPostVar($id);
497  switch ($id) {
498  case "title":
499  case "country":
500  case "gender":
501  case "city":
502  case "language":
503  case "login":
504  case "firstname":
505  case "lastname":
506  case "mark":
507  case "u_comment":
508  case "institution":
509  case "department":
510  case "title":
511  case "street":
512  case "zipcode":
513  case "email":
514  case "matriculation":
515  case "sel_country":
516  case "query":
517  case "type":
518  case "area":
519  if ($value) {
520  $result[$id] = $value;
521  }
522  break;
523 
524  case "status":
525  if ($value !== false) {
526  $result[$id] = $value;
527  }
528  break;
529 
530  case "user_total":
531  case "read_count":
532  case "percentage":
533  case "hide":
534  case "spent_seconds":
535  if (is_array($value) && implode("", $value)) {
536  $result[$id] = $value;
537  }
538  break;
539 
540  case "registration":
541  case "create_date":
542  case "first_access":
543  case "last_access":
544  case 'status_changed':
545  if ($value) {
546  if ($value["from"]) {
547  $result[$id]["from"] = $value["from"]->get(IL_CAL_DATETIME);
548  }
549  if ($value["to"]) {
550  $result[$id]["to"] = $value["to"]->get(IL_CAL_DATETIME);
551  }
552  }
553  break;
554 
555  case "birthday":
556  if ($value) {
557  if ($value["from"]) {
558  $result[$id]["from"] = $value["from"]->get(IL_CAL_DATETIME);
559  $result[$id]["from"] = substr($result[$id]["from"], 0, -8) . "00:00:00";
560  }
561  if ($value["to"]) {
562  $result[$id]["to"] = $value["to"]->get(IL_CAL_DATETIME);
563  $result[$id]["to"] = substr($result[$id]["to"], 0, -8) . "23:59:59";
564  }
565  }
566  break;
567  }
568  }
569 
570  return $result;
571  }
572 
573  protected function isPercentageAvailable($a_obj_id)
574  {
575  // :TODO:
576  $olp = ilObjectLP::getInstance($a_obj_id);
577  $mode = $olp->getCurrentMode();
578  if (in_array($mode, array(ilLPObjSettings::LP_MODE_TLT,
583  return true;
584  }
585  return false;
586  }
587 
588  protected function parseTitle($a_obj_id, $action, $a_user_id = false)
589  {
590  global $lng, $ilObjDataCache, $ilUser;
591 
592  $user = "";
593  if ($a_user_id) {
594  if ($a_user_id != $ilUser->getId()) {
595  $a_user = ilObjectFactory::getInstanceByObjId($a_user_id);
596  } else {
597  $a_user = $ilUser;
598  }
599  $user .= ", " . $a_user->getFullName(); // " [".$a_user->getLogin()."]";
600  }
601 
602  if ($a_obj_id != ROOT_FOLDER_ID) {
603  $this->setTitle($lng->txt($action) . ": " . $ilObjDataCache->lookupTitle($a_obj_id) . $user);
604 
605  $olp = ilObjectLP::getInstance($a_obj_id);
606  $this->setDescription($this->lng->txt('trac_mode') . ": " . $olp->getModeText($olp->getCurrentMode()));
607  } else {
608  $this->setTitle($lng->txt($action));
609  }
610  }
611 
617  protected function getExportMeta()
618  {
619  global $lng, $ilObjDataCache, $ilUser, $ilClientIniFile;
620 
621  /* see spec
622  Name of installation
623  Name of the course
624  Permalink to course
625  Owner of course object
626  Date of report generation
627  Reporting period
628  Name of person who generated the report.
629  */
630 
632  include_once './Services/Link/classes/class.ilLink.php';
633 
634  $data = array();
635  $data[$lng->txt("trac_name_of_installation")] = $ilClientIniFile->readVariable('client', 'name');
636 
637  if ($this->obj_id) {
638  $data[$lng->txt("trac_object_name")] = $ilObjDataCache->lookupTitle($this->obj_id);
639  if ($this->ref_id) {
640  $data[$lng->txt("trac_object_link")] = ilLink::_getLink($this->ref_id, ilObject::_lookupType($this->obj_id));
641  }
642  $data[$lng->txt("trac_object_owner")] = ilObjUser::_lookupFullname(ilObject::_lookupOwner($this->obj_id));
643  }
644 
645  $data[$lng->txt("trac_report_date")] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX));
646  $data[$lng->txt("trac_report_owner")] = $ilUser->getFullName();
647 
648  return $data;
649  }
650 
651  protected function fillMetaExcel(ilExcel $a_excel, &$a_row)
652  {
653  foreach ($this->getExportMeta() as $caption => $value) {
654  $a_excel->setCell($a_row, 0, $caption);
655  $a_excel->setCell($a_row, 1, $value);
656  $a_row++;
657  }
658  $a_row++;
659  }
660 
661  protected function fillMetaCSV($a_csv)
662  {
663  foreach ($this->getExportMeta() as $caption => $value) {
664  $a_csv->addColumn(strip_tags($caption));
665  $a_csv->addColumn(strip_tags($value));
666  $a_csv->addRow();
667  }
668  $a_csv->addRow();
669  }
670 
671  protected function showTimingsWarning($a_ref_id, $a_user_id)
672  {
673  $timing_cache = ilTimingCache::getInstanceByRefId($a_ref_id);
674  if ($timing_cache->isWarningRequired($a_user_id)) {
675  $timings = ilTimingCache::_getTimings($a_ref_id);
676  if ($timings['item']['changeable'] && $timings['user'][$a_user_id]['end']) {
677  $end = $timings['user'][$a_user_id]['end'];
678  } elseif ($timings['item']['suggestion_end']) {
679  $end = $timings['item']['suggestion_end'];
680  } else {
681  $end = true;
682  }
683  return $end;
684  }
685  }
686 
687  protected function formatSeconds($seconds, $a_shorten_zero = false)
688  {
689  $seconds = ((int) $seconds > 0) ? $seconds : 0;
690  if ($a_shorten_zero && !$seconds) {
691  return "-";
692  }
693 
694  $hours = floor($seconds / 3600);
695  $rest = $seconds % 3600;
696 
697  $minutes = floor($rest / 60);
698  $rest = $rest % 60;
699 
700  if ($rest) {
701  $minutes++;
702  }
703 
704  return sprintf("%dh%02dm", $hours, $minutes);
705  }
706 
707  protected function anonymizeValue($a_value, $a_force_number = false)
708  {
709  // currently inactive
710  return $a_value;
711 
712  if (is_numeric($a_value)) {
713  $threshold = 3;
714  $a_value = (int) $a_value;
715  if ($a_value <= $threshold) {
716  if (!$a_force_number) {
717  return "0-" . $threshold;
718  } else {
719  return $threshold;
720  }
721  }
722  }
723  return $a_value;
724  }
725 
726  protected function buildValueScale($a_max_value, $a_anonymize = false, $a_format_seconds = false)
727  {
728  $step = 0;
729  if ($a_max_value) {
730  $step = $a_max_value / 10;
731  $base = ceil(log($step, 10));
732  $fac = ceil($step / pow(10, ($base - 1)));
733  $step = pow(10, $base - 1) * $fac;
734  }
735  if ($step <= 1) {
736  $step = 1;
737  }
738  $ticks = range(0, $a_max_value+$step, $step);
739 
740  $value_ticks = array(0 => 0);
741  foreach ($ticks as $tick) {
742  $value = $tvalue = $tick;
743  if ($a_anonymize) {
744  $value = $this->anonymizeValue($value, true);
745  $tvalue = $this->anonymizeValue($tvalue);
746  }
747  if ($a_format_seconds) {
748  $tvalue = $this->formatSeconds($value);
749  }
750  $value_ticks[$value] = $tvalue;
751  }
752 
753  return $value_ticks;
754  }
755 
756  protected function getMonthsFilter($a_short = false)
757  {
758  global $lng;
759 
760  $options = array();
761  for ($loop = 0; $loop < 10; $loop++) {
762  $year = date("Y")-$loop;
763  $options[$year] = $year;
764  for ($loop2 = 12; $loop2 > 0; $loop2--) {
765  $month = str_pad($loop2, 2, "0", STR_PAD_LEFT);
766  if ($year . $month <= date("Ym")) {
767  if (!$a_short) {
768  $caption = $year . " / " . $lng->txt("month_" . $month . "_long");
769  } else {
770  $caption = $year . "/" . $month;
771  }
772  $options[$year . "-" . $month] = $caption;
773  }
774  }
775  }
776  return $options;
777  }
778 
779  protected function getMonthsYear($a_year = null, $a_short = false)
780  {
781  global $lng;
782 
783  if (!$a_year) {
784  $a_year = date("Y");
785  }
786 
787  $all = array();
788  for ($loop = 1; $loop<13; $loop++) {
789  $month = str_pad($loop, 2, "0", STR_PAD_LEFT);
790  if ($a_year . "-" . $month <= date("Y-m")) {
791  if (!$a_short) {
792  $caption = $lng->txt("month_" . $month . "_long");
793  } else {
794  $caption = $lng->txt("month_" . $month . "_short");
795  }
796  $all[$a_year . "-" . $month] = $caption;
797  }
798  }
799  return $all;
800  }
801 
802  protected function getSelectableUserColumns($a_in_course = false, $a_in_group = false)
803  {
804  global $lng, $ilSetting;
805 
806  $cols = $privacy_fields = array();
807 
808  include_once("./Services/User/classes/class.ilUserProfile.php");
809  $up = new ilUserProfile();
810  $up->skipGroup("preferences");
811  $up->skipGroup("settings");
812  $up->skipGroup("interests");
813  $ufs = $up->getStandardFields();
814 
815  // default fields
816  $cols["login"] = array(
817  "txt" => $lng->txt("login"),
818  "default" => true);
819 
820  if (!$this->anonymized) {
821  $cols["firstname"] = array(
822  "txt" => $lng->txt("firstname"),
823  "default" => true);
824  $cols["lastname"] = array(
825  "txt" => $lng->txt("lastname"),
826  "default" => true);
827  }
828 
829  // show only if extended data was activated in lp settings
830  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
831  $tracking = new ilObjUserTracking();
832  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) {
833  $cols["first_access"] = array(
834  "txt" => $lng->txt("trac_first_access"),
835  "default" => true);
836  $cols["last_access"] = array(
837  "txt" => $lng->txt("trac_last_access"),
838  "default" => true);
839  }
840  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) {
841  $cols["read_count"] = array(
842  "txt" => $lng->txt("trac_read_count"),
843  "default" => true);
844  }
845  if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS) &&
846  ilObjectLP::supportsSpentSeconds($this->type)) {
847  $cols["spent_seconds"] = array(
848  "txt" => $lng->txt("trac_spent_seconds"),
849  "default" => true);
850  }
851 
852  if ($this->isPercentageAvailable($this->obj_id)) {
853  $cols["percentage"] = array(
854  "txt" => $lng->txt("trac_percentage"),
855  "default" => true);
856  }
857 
858  // do not show status if learning progress is deactivated
859  $olp = ilObjectLP::getInstance($this->obj_id);
860  if ($olp->isActive()) {
861  $cols["status"] = array(
862  "txt" => $lng->txt("trac_status"),
863  "default" => true);
864 
865  $cols['status_changed'] = array(
866  'txt' => $lng->txt('trac_status_changed'),
867  'default' => false);
868  }
869 
870  if (ilObjectLP::supportsMark($this->type)) {
871  $cols["mark"] = array(
872  "txt" => $lng->txt("trac_mark"),
873  "default" => true);
874  }
875 
876  $cols["u_comment"] = array(
877  "txt" => $lng->txt("trac_comment"),
878  "default" => false);
879 
880  $cols["create_date"] = array(
881  "txt" => $lng->txt("create_date"),
882  "default" => false);
883  $cols["language"] = array(
884  "txt" => $lng->txt("language"),
885  "default" => false);
886 
887  // add user data only if object is [part of] course
888  if (!$this->anonymized &&
889  ($a_in_course || $a_in_group)) {
890  // only show if export permission is granted
891  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
892  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->ref_id)) {
893  // other user profile fields
894  foreach ($ufs as $f => $fd) {
895  if (!isset($cols[$f]) && $f != "username" && !$fd["lists_hide"]) {
896  if ($a_in_course &&
897  !($fd["course_export_fix_value"] || $ilSetting->get("usr_settings_course_export_" . $f))) {
898  continue;
899  }
900  if ($a_in_group &&
901  !($fd["group_export_fix_value"] || $ilSetting->get("usr_settings_group_export_" . $f))) {
902  continue;
903  }
904 
905  $cols[$f] = array(
906  "txt" => $lng->txt($f),
907  "default" => false);
908 
909  $privacy_fields[] = $f;
910  }
911  }
912 
913  // additional defined user data fields
914  include_once './Services/User/classes/class.ilUserDefinedFields.php';
915  $user_defined_fields = ilUserDefinedFields::_getInstance();
916  if ($a_in_course) {
917  $user_defined_fields = $user_defined_fields->getCourseExportableFields();
918  } else {
919  $user_defined_fields = $user_defined_fields->getGroupExportableFields();
920  }
921  foreach ($user_defined_fields as $definition) {
922  if ($definition["field_type"] != UDF_TYPE_WYSIWYG) {
923  $f = "udf_" . $definition["field_id"];
924  $cols[$f] = array(
925  "txt" => $definition["field_name"],
926  "default" => false);
927 
928  $privacy_fields[] = $f;
929  }
930  }
931  }
932  }
933 
934  return array($cols, $privacy_fields);
935  }
936 
940  protected function addToClipboard()
941  {
942  $users = (array) $_POST['uid'];
943  include_once './Services/User/classes/class.ilUserClipboard.php';
944  $clip = ilUserClipboard::getInstance($GLOBALS['ilUser']->getId());
945  $clip->add($users);
946  $clip->save();
947 
948  $GLOBALS['lng']->loadLanguageModule('user');
949  ilUtil::sendSuccess($this->lng->txt('clipboard_user_added'), true);
950  }
951 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupLogin($a_user_id)
lookup login
anonymizeValue($a_value, $a_force_number=false)
setDescription($a_val)
Set description.
buildPath($ref_ids)
Build path with deep-link.
getSelectableUserColumns($a_in_course=false, $a_in_group=false)
$rest
Definition: goto.php:46
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
const IL_CAL_DATETIME
static _getInstance()
Get instance.
static lookupTxtById($plugin_id, $lang_var)
static getInstance($a_usr_id)
Get singelton instance.
This class represents a selection list property in a property form.
$result
static _getImagePathForStatus($a_status)
Get image path for status.
$template
$action
$type
$_GET["client_id"]
static _lookupFullname($a_user_id)
Lookup Full Name.
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
getMonthsYear($a_year=null, $a_short=false)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
$end
Definition: saml1-acs.php:18
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
searchObjects(array $filter, $permission, array $preset_obj_ids=null, $a_check_lp_activation=true)
Search objects that match current filters.
resetOffset($a_in_determination=false)
Reset offset.
if(!array_key_exists('StateId', $_REQUEST)) $id
getFilterItemByPostVar($a_post_var)
Class ilUserProfile.
This class represents a checkbox property in a property form.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static setUseRelativeDates($a_status)
set use relative dates
parseTitle($a_obj_id, $action, $a_user_id=false)
getPossibleTypes($a_split_learning_resources=false, $a_include_digilib=false, $a_allow_undefined_lp=false)
Get possible subtypes.
const IL_CAL_UNIX
parseValue($id, $value, $type)
Resolve range
addToClipboard()
Add selected users to clipboard.
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
initBaseFilter($a_split_learning_resources=false, $a_include_no_status_filter=true)
Init filter.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
$counter
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
This class represents a multi selection list property in a property form.
Class ilTable2GUI.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
Class for single dates.
foreach($_POST as $key=> $value) $res
TableGUI class for learning progress.
getExportMeta()
Build export meta data.
This class represents a repository selector in a property form.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
buildValueScale($a_max_value, $a_anonymize=false, $a_format_seconds=false)
$text
Definition: errorreport.php:18
This class represents a text property in a property form.
Date and time handling
$ilUser
Definition: imgupload.php:18
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
static _lookupOwner($a_id)
lookup object owner
setMaxLength($a_maxlength)
Set Max Length.
searchFilterListener($a_ref_id, $a_data)
Listener for SearchResultFilter Checks wheather the object is hidden and mode is not LP_MODE_DEACTIVA...
fillMetaExcel(ilExcel $a_excel, &$a_row)
const UDF_TYPE_WYSIWYG
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 _lookupType($a_id, $a_reference=false)
lookup object type
$users
Definition: authpage.php:44
static getInstanceByRefId($ref_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const CONTEXT_KEY
Session parameter for the context.
writeFilterToSession()
Write filter values to session.
static supportsMark($a_obj_type)
sendMail(array $a_user_ids, $a_parent_obj, $a_parent_cmd)
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
determineSelectedFilters()
Determine selected filters.
const IL_CAL_DATE
static supportsSpentSeconds($a_obj_type)
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
getMonthsFilter($a_short=false)
global $ilSetting
Definition: privfeed.php:17
formatSeconds($seconds, $a_shorten_zero=false)
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
showTimingsWarning($a_ref_id, $a_user_id)
$function
Definition: cas.php:28
static getLogger($a_component_id)
Get component logger.
const QP_COMBINATION_AND
static _getInstance()
Get instance of ilPrivacySettings.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
getId()
Get element id.
getCurrentFilter($as_query=false)
static redirect($a_script)
static getInstance($a_obj_id)
$cols
Definition: xhr_table.php:11
$_POST["username"]
resetFilter()
Reset filter.
const IL_COMP_SERVICE
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
static & _getTimings($a_ref_id)