ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPDSelectedItemsBlockGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("Services/Block/classes/class.ilBlockGUI.php");
6 include_once './Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
7 
18 {
21 
22  static $block_type = "pditems";
23 
25  private $allowed_views = array();
26 
30  public function __construct()
31  {
32  global $ilCtrl, $lng, $ilUser;
33 
35 
36  $lng->loadLanguageModule('pd');
37  $lng->loadLanguageModule('cntr'); // #14158
38 
39  $this->setEnableNumInfo(false);
40  $this->setLimit(99999);
41 // $this->setColSpan(2);
42  $this->setAvailableDetailLevels(3, 1);
43 // $this->setBigMode(true);
44  $this->lng = $lng;
45  $this->allow_moving = false;
46 
47  $this->determineViewSettings();
48  }
49 
53  public function fillDetailRow()
54  {
58  global $ilCtrl;
59 
60  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
62  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', '');
63  }
64 
68  public function addToDeskObject()
69  {
70  global $ilCtrl, $lng;
71 
72  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
74  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
75  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
76  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
77  }
78 
82  public function removeFromDeskObject()
83  {
84  global $ilCtrl, $lng;
85 
86  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
88  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
89  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
90  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
91  }
92 
96  public function changeView()
97  {
101  global $ilCtrl;
102 
103  if(in_array((int)$_GET['view'], $this->allowed_views))
104  {
105  $view = (int)$_GET['view'];
106  }
107  else
108  {
109  reset($this->allowed_views);
110  $view = (int)current($this->allowed_views);
111  }
112 
113  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $view);
114  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
115  }
116 
120  protected function determineViewSettings()
121  {
126  global $ilSetting, $ilCtrl;
127 
128  $this->allowed_views = array();
129 
130  // determine view
131  if($ilSetting->get('disable_my_offers') == 1 &&
132  $ilSetting->get('disable_my_memberships') == 1)
133  {
134  // if both views are disabled set default view (should not occur but we should prevent it)
135  $ilSetting->set('personal_items_default_view', self::VIEW_SELECTED_ITEMS);
136  $this->allowed_views[] = self::VIEW_SELECTED_ITEMS;
137  }
138  // both views are enabled, get default view
139  else if($ilSetting->get('disable_my_offers') == 0 &&
140  $ilSetting->get('disable_my_memberships') == 0)
141  {
142  $this->allowed_views[] = self::VIEW_SELECTED_ITEMS;
143  $this->allowed_views[] = self::VIEW_MY_MEMBERSHIPS;
144  }
145  else if($ilSetting->get('disable_my_offers') == 0 &&
146  $ilSetting->get('disable_my_memberships') == 1)
147  {
148  $this->allowed_views[] = self::VIEW_SELECTED_ITEMS;
149  }
150  else
151  {
152  $this->allowed_views[] = self::VIEW_MY_MEMBERSHIPS;
153  }
154 
155  $this->view = (int)$_GET['view'];
156  if(!in_array((int)$this->view, $this->allowed_views))
157  {
158  $_GET['view'] = $this->view = (int)$ilSetting->get('personal_items_default_view');
159  }
160 
161  $ilCtrl->saveParameter($this, 'view');
162  }
163 
169  static function getBlockType()
170  {
171  return self::$block_type;
172  }
173 
174  public static function getScreenMode()
175  {
176  $cmd = $_GET["cmd"];
177  if($cmd == "post")
178  {
179  $cmd = $_POST["cmd"];
180  $cmd = array_shift(array_keys($cmd));
181  }
182 
183  switch($cmd)
184  {
185  case "confirmRemove":
186  case "manage":
187  return IL_SCREEN_FULL;
188 
189  default:
190  return IL_SCREEN_SIDE;
191  }
192  }
193 
199  static function isRepositoryObject()
200  {
201  return false;
202  }
203 
204 
205  function getHTML()
206  {
207  global $ilCtrl, $ilSetting, $tpl, $lng, $ilHelp, $ilDB;
208 
209  $ilDB->useSlave(true);
210 
211  // workaround to show details row
212  $this->setData(array("dummy"));
213 
214  include_once "Services/Object/classes/class.ilObjectListGUI.php";
215  ilObjectListGUI::prepareJSLinks("",
216  $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
217  $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
218 
219  switch((int)$this->view)
220  {
221  case self::VIEW_MY_MEMBERSHIPS:
222  $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "crs_grp");
223  if ($ilSetting->get('disable_my_offers') == 0)
224  {
225  $tpl->setTitle($lng->txt("my_courses_groups"));
226  }
227  $this->setTitle($this->lng->txt('pd_my_memberships'));
228  $this->setContent($this->getMembershipItemsBlockHTML());
229  break;
230 
231  case self::VIEW_SELECTED_ITEMS:
232  default:
233  $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "sel_items");
234  if(!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views))
235  {
236  $this->setTitle($this->lng->txt('selected_items'));
237  }
238  else
239  {
240  $this->setTitle($this->lng->txt('pd_my_offers'));
241  }
242 
243  $this->setContent($this->getSelectedItemsBlockHTML());
244  break;
245  }
246 
247  if ($this->getContent() == "")
248  {
249  $this->setEnableDetailRow(false);
250  }
251  $ilCtrl->clearParametersByClass("ilpersonaldesktopgui");
252  $ilCtrl->clearParameters($this);
253 
254  $ilDB->useSlave(false);
255 
256  return parent::getHTML();
257  }
258 
262  function &executeCommand()
263  {
264  global $ilCtrl;
265 
266  $next_class = $ilCtrl->getNextClass();
267  $cmd = $ilCtrl->getCmd("getHTML");
268 
269  switch($next_class)
270  {
271  case "ilcommonactiondispatchergui":
272  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
274  $ilCtrl->forwardCommand($gui);
275  break;
276 
277  default:
278  if(method_exists($this, $cmd))
279  {
280  return $this->$cmd();
281  }
282  else
283  {
284  $cmd .= 'Object';
285  return $this->$cmd();
286  }
287  }
288  }
289 
290  function getContent()
291  {
292  return $this->content;
293  }
294 
295  function setContent($a_content)
296  {
297  $this->content = $a_content;
298  }
299 
303  function fillDataSection()
304  {
305  global $ilUser;
306 
307  if ($this->getContent() != "")
308  {
309  $this->tpl->setVariable("BLOCK_ROW", $this->getContent());
310  }
311  else
312  {
313  $this->setDataSection($this->getIntroduction());
314  }
315  }
316 
317 
321  function fillFooter()
322  {
323  global $ilCtrl, $lng, $ilUser;
324 
325  $this->setFooterLinks();
326  $this->fillFooterLinks();
327  $this->tpl->setVariable("FCOLSPAN", $this->getColSpan());
328  if ($this->tpl->blockExists("block_footer"))
329  {
330  $this->tpl->setCurrentBlock("block_footer");
331  $this->tpl->parseCurrentBlock();
332  }
333  }
334 
338  function setFooterLinks()
339  {
340  global $ilUser, $ilCtrl, $lng;
341 
342  if ($this->getContent() == "")
343  {
344  $this->setEnableNumInfo(false);
345  return "";
346  }
347 
348  if ($this->manage)
349  {
350  return;
351  }
352 
353  // by type
354 // if ($ilUser->getPref("pd_order_items") == 'location')
355 // {
356  $this->addFooterLink( $lng->txt("by_type"),
357  $ilCtrl->getLinkTarget($this, "orderPDItemsByType"),
358  $ilCtrl->getLinkTarget($this, "orderPDItemsByType", "", true),
359  "block_".$this->getBlockType()."_".$this->block_id,
360  false, false, ($ilUser->getPref("pd_order_items") != 'location')
361  );
362 // }
363 // else
364 // {
365 // $this->addFooterLink($lng->txt("by_type"));
366 // }
367 
368 // // by location
369 // if ($ilUser->getPref("pd_order_items") == 'location')
370 // {
371 // $this->addFooterLink($lng->txt("by_location"));
372 // }
373 // else
374 // {
375  $this->addFooterLink( $lng->txt("by_location"),
376  $ilCtrl->getLinkTarget($this, "orderPDItemsByLocation"),
377  $ilCtrl->getLinkTarget($this, "orderPDItemsByLocation", "", true),
378  "block_".$this->getBlockType()."_".$this->block_id,
379  false, false, ($ilUser->getPref("pd_order_items") == 'location')
380  );
381 // }
382 
383  $this->addFooterLink(($this->view == self::VIEW_SELECTED_ITEMS) ?
384  $lng->txt("pd_remove_multiple") :
385  $lng->txt("pd_unsubscribe_multiple_memberships"),
386  $ilCtrl->getLinkTarget($this, "manage"),
387  null,
388  "block_".$this->getBlockType()."_".$this->block_id
389  );
390  }
391 
398  protected function getObjectsByMembership($types = array())
399  {
400  global $tree, $ilUser, $ilObjDataCache;
401 
402  include_once 'Services/Membership/classes/class.ilParticipants.php';
403  $items = array();
404 
405  if(is_array($types) && count($types))
406  {
407  foreach($types as $type)
408  {
409  switch($type)
410  {
411  case 'grp':
412  $items = array_merge(ilParticipants::_getMembershipByType($ilUser->getId(), 'grp'), $items);
413  break;
414  case 'crs':
415  $items = array_merge(ilParticipants::_getMembershipByType($ilUser->getId(), 'crs'), $items);
416  break;
417  default:
418  break;
419  }
420  }
421  }
422  else
423  {
424  $crs_mbs = ilParticipants::_getMembershipByType($ilUser->getId(), 'crs');
425  $grp_mbs = ilParticipants::_getMembershipByType($ilUser->getId(), 'grp');
426  $items = array_merge($crs_mbs, $grp_mbs);
427  }
428 
429  $references = array();
430  foreach($items as $key => $obj_id)
431  {
432  $item_references = ilObject::_getAllReferences($obj_id);
433  foreach($item_references as $ref_id)
434  {
435  if($tree->isInTree($ref_id))
436  {
437  $title = $ilObjDataCache->lookupTitle($obj_id);
438  $type = $ilObjDataCache->lookupType($obj_id);
439 
440  $parent_ref_id = $tree->getParentId($ref_id);
441  $par_left = $tree->getLeftValue($parent_ref_id);
442  $par_left = sprintf("%010d", $par_left);
443 
444  $references[$par_left . $title . $ref_id] = array(
445  'ref_id' => $ref_id,
446  'obj_id' => $obj_id,
447  'type' => $type,
448  'title' => $title,
449  'description' => $ilObjDataCache->lookupDescription($obj_id),
450  'parent_ref' => $parent_ref_id
451  );
452  }
453  }
454  }
455  ksort($references);
456  return is_array($references) ? $references : array();
457  }
458 
466  {
467  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $rbacreview;
468 
469  $output = false;
470  $items = $this->getObjectsByMembership();
471  $item_html = array();
472  if(count($items) > 0)
473  {
474  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
476  foreach($items as $item)
477  {
478  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
479  }
480  $preloader->preload();
481  unset($preloader);
482 
483  reset($items);
484  foreach($items as $item)
485  {
486  //echo "1";
487  // get list gui class for each object type
488  if ($cur_obj_type != $item["type"])
489  {
490  $item_list_gui =& $this->getItemListGUI($item["type"]);
491  if(!$item_list_gui)
492  {
493  continue;
494  }
495 
496  // notes, comment currently do not work properly
497  $item_list_gui->enableNotes(false);
498  $item_list_gui->enableComments(false);
499  $item_list_gui->enableTags(false);
500 
501  $item_list_gui->enableIcon(true);
502  $item_list_gui->enableDelete(false);
503  $item_list_gui->enableCut(false);
504  $item_list_gui->enableCopy(false);
505  $item_list_gui->enablePayment(false);
506  $item_list_gui->enableLink(false);
507  $item_list_gui->enableInfoScreen(true);
508  if ($ilSetting->get('disable_my_offers') == 1)
509  {
510  $item_list_gui->enableSubscribe(false);
511  }
512  else
513  {
514  $item_list_gui->enableSubscribe(true);
515  }
516  $item_list_gui->setContainerObject($this);
517  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
518  {
519  //echo "3";
520  $item_list_gui->enableDescription(false);
521  $item_list_gui->enableProperties(false);
522  $item_list_gui->enablePreconditions(false);
523  }
524  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
525  {
526  $item_list_gui->enableCommands(true, true);
527  }
528  }
529  // render item row
530  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
531 
532  if (is_object($item_list_gui))
533  {
534  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
535 
536  // #15232
537  if($this->manage)
538  {
539  if(!$rbacsystem->checkAccess("leave", $item["ref_id"]))
540  {
541  $item_list_gui->enableCheckbox(false);
542  }
543  else
544  {
545  $item_list_gui->enableCheckbox(true);
546  }
547  }
548 
549  $html = $item_list_gui->getListItemHTML($item["ref_id"],
550  $item["obj_id"], $item["title"], $item["description"]);
551  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
552  if ($html != "")
553  {
554  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
555  $item_html[] = array(
556  "html" => $html,
557  "item_ref_id" => $item["ref_id"],
558  "item_obj_id" => $item["obj_id"],
559  "parent_ref" => $item["parent_ref"],
560  "type" => $item["type"],
561  'item_icon_image_type' => $item_list_gui->getIconImageType()
562  );
563  // END WebDAV: Use $item_list_gui to determine icon image type
564  }
565  }
566  }
567 
568  // output block for resource type
569  if (count($item_html) > 0)
570  {
571  $cur_parent_ref = 0;
572 
573  // content row
574  foreach($item_html as $item)
575  {
576  // add a parent header row for each new parent
577  if ($cur_parent_ref != $item["parent_ref"])
578  {
579  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
580  {
581  $this->addParentRow($tpl, $item["parent_ref"], false);
582  }
583  else
584  {
585  $this->addParentRow($tpl, $item["parent_ref"]);
586  }
587  $this->resetRowType();
588  $cur_parent_ref = $item["parent_ref"];
589  }
590 
591  // BEGIN WebDAV: Use $item_list_gui to determine icon image type.
592  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
593  $item['item_icon_image_type'],
594  "th_".$cur_parent_ref);
595  // END WebDAV: Use $item_list_gui to determine icon image type.
596  $output = true;
597  }
598  }
599  }
600 
601  return $output;
602  }
603 
611  {
612  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache;
613 
614  $output = false;
615 
616  $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
617  array("cat", "crs", "grp", "fold"));
618 
619  $types = array();
620  foreach($objtype_groups as $grp => $grpdata)
621  {
622  $types[] = array(
623  "grp" => $grp,
624  "title" => $this->lng->txt("objs_".$grp),
625  "types" => $grpdata["objs"]);
626  }
627 
628  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
629 
630  foreach ($types as $t)
631  {
632  $type = $t["types"];
633  $title = $t["title"];
634  $grp = $t["grp"];
635 
636  $items = $this->getObjectsByMembership($type);
637 
638  if (count($items) > 0)
639  {
641  foreach($items as $item)
642  {
643  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
644  }
645  $preloader->preload();
646  unset($preloader);
647 
648  reset($items);
649 
650 
651  $item_html = array();
652 
653  if ($this->getCurrentDetailLevel() == 3)
654  {
655  $rel_header = "th_".$grp;
656  }
657 
658  $tstCount = 0;
659  $unsetCount = 0;
660  $progressCount = 0;
661  $unsetFlag = 0;
662  $progressFlag = 0;
663  $completedFlag = 0;
664  if (strcmp($a_type, "tst") == 0) {
665  $items = $this->multiarray_sort($items, "used_tries; title");
666  foreach ($items as $tst_item) {
667  if (!isset($tst_item["used_tries"])) {
668  $unsetCount++;
669  }
670  elseif ($tst_item["used_tries"] == 0) {
671  $progressCount++;
672  }
673  }
674  }
675 
676  foreach($items as $item)
677  {
678  // get list gui class for each object type
679  if ($cur_obj_type != $item["type"])
680  {
681  $class = $objDefinition->getClassName($item["type"]);
682  $location = $objDefinition->getLocation($item["type"]);
683  $full_class = "ilObj".$class."ListGUI";
684  include_once($location."/class.".$full_class.".php");
685  $item_list_gui = new $full_class();
686 
687  // notes, comment currently do not work properly
688  $item_list_gui->enableNotes(false);
689  $item_list_gui->enableComments(false);
690  $item_list_gui->enableTags(false);
691 
692  $item_list_gui->enableIcon(true);
693  $item_list_gui->enableDelete(false);
694  $item_list_gui->enableCut(false);
695  $item_list_gui->enableCopy(false);
696  $item_list_gui->enablePayment(false);
697  $item_list_gui->enableLink(false);
698  $item_list_gui->enableInfoScreen(true);
699  if ($ilSetting->get('disable_my_offers') == 1)
700  {
701  $item_list_gui->enableSubscribe(false);
702  }
703  else
704  {
705  $item_list_gui->enableSubscribe(true);
706  }
707 
708  $item_list_gui->setContainerObject($this);
709  if ($this->manage)
710  {
711  $item_list_gui->enableCheckbox(true);
712  }
713  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
714  {
715  $item_list_gui->enableDescription(false);
716  $item_list_gui->enableProperties(false);
717  $item_list_gui->enablePreconditions(false);
718  $item_list_gui->enableNoticeProperties(false);
719  }
720  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
721  {
722  $item_list_gui->enableCommands(true, true);
723  }
724  }
725  // render item row
726  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
727 
728  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
729 
730  // #15232
731  if($this->manage)
732  {
733  if(!$rbacsystem->checkAccess("leave", $item["ref_id"]))
734  {
735  $item_list_gui->enableCheckbox(false);
736  }
737  else
738  {
739  $item_list_gui->enableCheckbox(true);
740  }
741  }
742 
743  $html = $item_list_gui->getListItemHTML($item["ref_id"],
744  $item["obj_id"], $item["title"], $item["description"]);
745  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
746  if ($html != "")
747  {
748  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
749  $item_html[] = array(
750  "html" => $html,
751  "item_ref_id" => $item["ref_id"],
752  "item_obj_id" => $item["obj_id"],
753  'item_icon_image_type' => (method_exists($item_list_gui, 'getIconImageType')) ?
754  $item_list_gui->getIconImageType() :
755  $item['type']
756  );
757  // END WebDAV: Use $item_list_gui to determine icon image type
758  }
759  }
760 
761  // output block for resource type
762  if (count($item_html) > 0)
763  {
764  // add a header for each resource type
765  if ($this->getCurrentDetailLevel() == 3)
766  {
767  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
768  {
769  $this->addHeaderRow($tpl, $grp, false);
770  }
771  else
772  {
773  $this->addHeaderRow($tpl, $grp);
774  }
775  $this->resetRowType();
776  }
777 
778  // content row
779  foreach($item_html as $item)
780  {
781  if ($this->getCurrentDetailLevel() < 3 ||
782  $ilSetting->get("icon_position_in_lists") == "item_rows")
783  {
784  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
785  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
786  $item['item_icon_image_type'],
787  $rel_header);
788  // END WebDAV: Use $item_list_gui to determine icon image type
789  }
790  else
791  {
792  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], "", $rel_header);
793  }
794  $output = true;
795  }
796  }
797  }
798  }
799 
800  return $output;
801  }
802 
809  public function getMembershipItemsBlockHTML()
810  {
811  global $ilUser;
812 
813  $tpl = $this->newBlockTemplate();
814 
815  switch($ilUser->getPref('pd_order_items'))
816  {
817  case 'location':
819  break;
820 
821  default:
823  break;
824  }
825 
826  return $tpl->get();
827  }
828 
833  {
834  global $ilUser, $rbacsystem, $objDefinition, $ilBench;
835 
836  $tpl =& $this->newBlockTemplate();
837 
838  switch ($ilUser->getPref("pd_order_items"))
839  {
840  case "location":
842  break;
843 
844  default:
845  $ok = $this->getSelectedItemsPerType($tpl);
846  break;
847  }
848 
849  if($this->manage)
850  {
851  // #11355 - see ContainerContentGUI::renderSelectAllBlock()
852  $tpl->setCurrentBlock("select_all_row");
853  $tpl->setVariable("CHECKBOXNAME", "ilToolbarSelectAll");
854  $tpl->setVariable("SEL_ALL_PARENT", "ilToolbar");
855  $tpl->setVariable("SEL_ALL_CB_NAME", "id");
856  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
857  $tpl->parseCurrentBlock();
858  }
859 
860  return $tpl->get();
861  }
862 
867  {
868  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree, $ilCtrl;
869 
870  $items = $ilUser->getDesktopItems();
871  if (count($items) > 0)
872  {
873  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
875  foreach($items as $item)
876  {
877  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
878  }
879  $preloader->preload();
880  unset($preloader);
881 
882  reset($items);
883  }
884 
885  $output = false;
886 
887  $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
888  array("cat", "crs", "grp", "fold"));
889 
890  $types = array();
891  foreach($objtype_groups as $grp => $grpdata)
892  {
893  $types[] = array(
894  "grp" => $grp,
895  "title" => $this->lng->txt("objs_".$grp),
896  "types" => $grpdata["objs"]);
897  }
898 
899  foreach ($types as $t)
900  {
901 
902  $type = $t["types"];
903  $title = $t["title"];
904  $grp = $t["grp"];
905 
906  $items = $ilUser->getDesktopItems($type);
907  $item_html = array();
908 
909  if ($this->getCurrentDetailLevel() == 3)
910  {
911  $rel_header = "th_".$grp;
912  }
913 
914  if (count($items) > 0)
915  {
916  $tstCount = 0;
917  $unsetCount = 0;
918  $progressCount = 0;
919  $unsetFlag = 0;
920  $progressFlag = 0;
921  $completedFlag = 0;
922  if (strcmp($a_type, "tst") == 0) {
923  $items = $this->multiarray_sort($items, "used_tries; title");
924  foreach ($items as $tst_item) {
925  if (!isset($tst_item["used_tries"])) {
926  $unsetCount++;
927  }
928  elseif ($tst_item["used_tries"] == 0) {
929  $progressCount++;
930  }
931  }
932  }
933 
934  foreach($items as $item)
935  {
936  // get list gui class for each object type
937  if ($cur_obj_type != $item["type"])
938  {
939  $class = $objDefinition->getClassName($item["type"]);
940  $location = $objDefinition->getLocation($item["type"]);
941  $full_class = "ilObj".$class."ListGUI";
942  include_once($location."/class.".$full_class.".php");
943  $item_list_gui = new $full_class();
944 
945  // notes, comment currently do not work properly
946  $item_list_gui->enableNotes(false);
947  $item_list_gui->enableComments(false);
948  $item_list_gui->enableTags(false);
949 
950  $item_list_gui->enableIcon(true);
951  $item_list_gui->enableDelete(false);
952  $item_list_gui->enableCut(false);
953  $item_list_gui->enableCopy(false);
954  $item_list_gui->enablePayment(false);
955  $item_list_gui->enableLink(false);
956  $item_list_gui->enableInfoScreen(true);
957  $item_list_gui->setContainerObject($this);
958 
959  if ($this->manage)
960  {
961  $item_list_gui->enableCheckbox(true);
962  }
963 
964  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
965  {
966  $item_list_gui->enableDescription(false);
967  $item_list_gui->enableProperties(false);
968  $item_list_gui->enablePreconditions(false);
969  $item_list_gui->enableNoticeProperties(false);
970  }
971  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
972  {
973  $item_list_gui->enableCommands(true, true);
974  }
975  }
976  // render item row
977  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
978 
979  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
980 
981  $html = $item_list_gui->getListItemHTML($item["ref_id"],
982  $item["obj_id"], $item["title"], $item["description"]);
983  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
984  if ($html != "")
985  {
986  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
987  $item_html[] = array(
988  "html" => $html,
989  "item_ref_id" => $item["ref_id"],
990  "item_obj_id" => $item["obj_id"],
991  'item_icon_image_type' => (method_exists($item_list_gui, 'getIconImageType')) ?
992  $item_list_gui->getIconImageType() :
993  $item['type']
994  );
995  // END WebDAV: Use $item_list_gui to determine icon image type
996  }
997  }
998 
999  // output block for resource type
1000  if (count($item_html) > 0)
1001  {
1002  // add a header for each resource type
1003  if ($this->getCurrentDetailLevel() == 3)
1004  {
1005  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
1006  {
1007  $this->addHeaderRow($tpl, $grp, false);
1008  }
1009  else
1010  {
1011  $this->addHeaderRow($tpl, $grp);
1012  }
1013  $this->resetRowType();
1014  }
1015 
1016  // content row
1017  foreach($item_html as $item)
1018  {
1019  if ($this->getCurrentDetailLevel() < 3 ||
1020  $ilSetting->get("icon_position_in_lists") == "item_rows")
1021  {
1022  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
1023  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
1024  $item['item_icon_image_type'],
1025  $rel_header);
1026  // END WebDAV: Use $item_list_gui to determine icon image type
1027  }
1028  else
1029  {
1030  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], "", $rel_header);
1031  }
1032  $output = true;
1033  }
1034  }
1035  }
1036  }
1037 
1038  return $output;
1039  }
1040 
1045  {
1046  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree;
1047 
1048  $output = false;
1049 
1050  $items = $ilUser->getDesktopItems();
1051  $item_html = array();
1052  $cur_obj_type = "";
1053 
1054  if (count($items) > 0)
1055  {
1056  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
1058  foreach($items as $item)
1059  {
1060  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
1061  }
1062  $preloader->preload();
1063  unset($preloader);
1064 
1065  reset($items);
1066  foreach($items as $item)
1067  {
1068  //echo "1";
1069  // get list gui class for each object type
1070  if ($cur_obj_type != $item["type"])
1071  {
1072  $item_list_gui =& $this->getItemListGUI($item["type"]);
1073  if(!$item_list_gui)
1074  {
1075  continue;
1076  }
1077 
1078  // notes, comment currently do not work properly
1079  $item_list_gui->enableNotes(false);
1080  $item_list_gui->enableComments(false);
1081  $item_list_gui->enableTags(false);
1082 
1083  $item_list_gui->enableIcon(true);
1084  $item_list_gui->enableDelete(false);
1085  $item_list_gui->enableCut(false);
1086  $item_list_gui->enableCopy(false);
1087  $item_list_gui->enablePayment(false);
1088  $item_list_gui->enableLink(false);
1089  $item_list_gui->enableInfoScreen(true);
1090  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
1091  {
1092  //echo "3";
1093  $item_list_gui->enableDescription(false);
1094  $item_list_gui->enableProperties(false);
1095  $item_list_gui->enablePreconditions(false);
1096  }
1097  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
1098  {
1099  $item_list_gui->enableCommands(true, true);
1100  }
1101  }
1102  // render item row
1103  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
1104 
1105  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
1106 
1107  $item_list_gui->setContainerObject($this);
1108  $html = $item_list_gui->getListItemHTML($item["ref_id"],
1109  $item["obj_id"], $item["title"], $item["description"]);
1110  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
1111  if ($html != "")
1112  {
1113  $item_html[] = array(
1114  "html" => $html,
1115  "item_ref_id" => $item["ref_id"],
1116  "item_obj_id" => $item["obj_id"],
1117  "parent_ref" => $item["parent_ref"],
1118  "type" => $item["type"],
1119  'item_icon_image_type' => $item_list_gui->getIconImageType()
1120  );
1121  }
1122  }
1123 
1124  // output block for resource type
1125  if (count($item_html) > 0)
1126  {
1127  $cur_parent_ref = 0;
1128 
1129  // content row
1130  foreach($item_html as $item)
1131  {
1132  // add a parent header row for each new parent
1133  if ($cur_parent_ref != $item["parent_ref"])
1134  {
1135  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
1136  {
1137  $this->addParentRow($tpl, $item["parent_ref"], false);
1138  }
1139  else
1140  {
1141  $this->addParentRow($tpl, $item["parent_ref"]);
1142  }
1143  $this->resetRowType();
1144  $cur_parent_ref = $item["parent_ref"];
1145  }
1146 
1147  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
1148  $item['item_icon_image_type'],
1149  "th_".$cur_parent_ref);
1150  $output = true;
1151  }
1152  }
1153  }
1154 
1155  return $output;
1156  }
1157 
1158  function resetRowType()
1159  {
1160  $this->cur_row_type = "";
1161  }
1162 
1169  function &newBlockTemplate()
1170  {
1171  $tpl = new ilTemplate("tpl.pd_list_block.html", true, true, "Services/PersonalDesktop");
1172  $this->cur_row_type = "";
1173  return $tpl;
1174  }
1175 
1179  function &getItemListGUI($a_type)
1180  {
1181  global $objDefinition;
1182  //echo "<br>+$a_type+";
1183  if (!isset($this->item_list_guis[$a_type]))
1184  {
1185  $class = $objDefinition->getClassName($a_type);
1186  // Fixed problem with deactivated plugins and existing repo. object plugin objects on the user's desktop
1187  if(!$class)
1188  {
1189  return NULL;
1190  }
1191  // Fixed problem with deactivated plugins and existing repo. object plugin objects on the user's desktop
1192  $location = $objDefinition->getLocation($a_type);
1193  if(!$location)
1194  {
1195  return NULL;
1196  }
1197 
1198  $full_class = "ilObj".$class."ListGUI";
1199  //echo "<br>-".$location."/class.".$full_class.".php"."-";
1200  include_once($location."/class.".$full_class.".php");
1201  $item_list_gui = new $full_class();
1202  $this->item_list_guis[$a_type] =& $item_list_gui;
1203  }
1204  else
1205  {
1206  $item_list_gui =& $this->item_list_guis[$a_type];
1207  }
1208 
1209  if ($this->manage)
1210  {
1211  $item_list_gui->enableCheckbox(true);
1212  }
1213 
1214 
1215  return $item_list_gui;
1216  }
1217 
1225  function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
1226  {
1227  global $objDefinition;
1228 
1229  $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
1230  if (!$objDefinition->isPlugin($a_type))
1231  {
1232  $title = $this->lng->txt("objs_".$a_type);
1233  }
1234  else
1235  {
1236  include_once("./Services/Component/classes/class.ilPlugin.php");
1237  $title =
1238  ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type);
1239 
1240  }
1241  $header_id = "th_".$a_type;
1242 
1243  if ($a_show_image)
1244  {
1245  $a_tpl->setCurrentBlock("container_header_row_image");
1246  $a_tpl->setVariable("HEADER_IMG", $icon);
1247  $a_tpl->setVariable("HEADER_ALT", $title);
1248  }
1249  else
1250  {
1251  $a_tpl->setCurrentBlock("container_header_row");
1252  }
1253 
1254  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1255  $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id);
1256  $a_tpl->parseCurrentBlock();
1257  $a_tpl->touchBlock("container_row");
1258  }
1259 
1267  function addParentRow(&$a_tpl, $a_ref_id, $a_show_image = true)
1268  {
1269  global $tree, $ilSetting;
1270 
1271  $par_id = ilObject::_lookupObjId($a_ref_id);
1272  $type = ilObject::_lookupType($par_id);
1273  if (!in_array($type, array("lm", "dbk", "sahs", "htlm")))
1274  {
1275  $icon = ilUtil::getImagePath("icon_".$type.".svg");
1276  }
1277  else
1278  {
1279  $icon = ilUtil::getImagePath("icon_lm.svg");
1280  }
1281 
1282  // custom icon
1283  if ($ilSetting->get("custom_icons") &&
1284  in_array($type, array("cat","grp","crs", "root")))
1285  {
1286  require_once("./Services/Container/classes/class.ilContainer.php");
1287  if (($path = ilContainer::_lookupIconPath($par_id, "small")) != "")
1288  {
1289  $icon = $path;
1290  }
1291  }
1292 
1293  if ($tree->getRootId() != $par_id)
1294  {
1295  $title = ilObject::_lookupTitle($par_id);
1296  }
1297  else
1298  {
1299  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1300  $title = $nd["title"];
1301  if ($title == "ILIAS")
1302  {
1303  $title = $this->lng->txt("repository");
1304  }
1305  }
1306 
1307 /*
1308  $item_list_gui =& $this->getItemListGUI($type);
1309 
1310  $item_list_gui->enableIcon(false);
1311  $item_list_gui->enableDelete(false);
1312  $item_list_gui->enableCut(false);
1313  $item_list_gui->enablePayment(false);
1314  $item_list_gui->enableLink(false);
1315  $item_list_gui->enableDescription(false);
1316  $item_list_gui->enableProperties(false);
1317  $item_list_gui->enablePreconditions(false);
1318  $item_list_gui->enablePath(true);
1319  $item_list_gui->enableCommands(false);
1320  $html = $item_list_gui->getListItemHTML($a_ref_id,
1321  $par_id, $title, "");
1322 
1323  if ($a_show_image)
1324  {
1325  $a_tpl->setCurrentBlock("container_header_row_image");
1326  $a_tpl->setVariable("HEADER_IMG", $icon);
1327  $a_tpl->setVariable("HEADER_ALT", $title);
1328  }
1329 */
1330 // else
1331 // {
1332  $a_tpl->setCurrentBlock("container_header_row");
1333 // }
1334 
1335  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1336 /* $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $html);
1337  $a_tpl->setVariable("BLOCK_HEADER_ID", "th_".$a_ref_id);*/
1338  $a_tpl->parseCurrentBlock();
1339  $a_tpl->touchBlock("container_row");
1340  }
1341 
1349  function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
1350  $a_image_type = "", $a_related_header = "")
1351  {
1352  global $ilSetting;
1353 
1354  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1355  ? "row_type_2"
1356  : "row_type_1";
1357  $a_tpl->touchBlock($this->cur_row_type);
1358 
1359  if ($a_image_type != "")
1360  {
1361  if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs")))
1362  {
1363  $icon = ilUtil::getImagePath("icon_".$a_image_type.".svg");
1364  $title = $this->lng->txt("obj_".$a_image_type);
1365  }
1366  else
1367  {
1368  $icon = ilUtil::getImagePath("icon_lm.svg");
1369  $title = $this->lng->txt("learning_resource");
1370  }
1371 
1372  // custom icon
1373  if ($ilSetting->get("custom_icons") &&
1374  in_array($a_image_type, array("cat","grp","crs")))
1375  {
1376  require_once("./Services/Container/classes/class.ilContainer.php");
1377  if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
1378  {
1379  $icon = $path;
1380  }
1381  }
1382 
1383  $a_tpl->setCurrentBlock("block_row_image");
1384  $a_tpl->setVariable("ROW_IMG", $icon);
1385  $a_tpl->setVariable("ROW_ALT", $title);
1386  $a_tpl->parseCurrentBlock();
1387  }
1388  else
1389  {
1390  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1391  }
1392  $a_tpl->setCurrentBlock("container_standard_row");
1393  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
1394  $rel_headers = ($a_related_header != "")
1395  ? "th_selected_items ".$a_related_header
1396  : "th_selected_items";
1397  $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
1398  $a_tpl->parseCurrentBlock();
1399  $a_tpl->touchBlock("container_row");
1400  }
1401 
1405  function getIntroduction()
1406  {
1407  global $ilUser, $lng, $ilCtrl, $tree;
1408 
1409  switch((int)$this->view)
1410  {
1411  case self::VIEW_MY_MEMBERSHIPS:
1412  $tpl = new ilTemplate('tpl.pd_my_memberships_intro.html', true, true, 'Services/PersonalDesktop');
1413  $tpl->setVariable('IMG_PD_LARGE', ilObject::_getIcon("", "big", "pd"));
1414  $tpl->setVariable('TXT_WELCOME', $lng->txt('pd_my_memberships_intro'));
1415  $tpl->setVariable('TXT_INTRO_1', $lng->txt('pd_my_memberships_intro2'));
1416  break;
1417 
1418  case self::VIEW_SELECTED_ITEMS:
1419  default:
1420  // get repository link
1421  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1422  $title = $nd["title"];
1423  if ($title == "ILIAS")
1424  {
1425  $title = $lng->txt("repository");
1426  }
1427 
1428  $tpl = new ilTemplate("tpl.pd_intro.html", true, true, "Services/PersonalDesktop");
1429  $tpl->setVariable('IMG_PD_LARGE', ilObject::_getIcon("", "big", "pd"));
1430  $tpl->setVariable("TXT_WELCOME", $lng->txt("pdesk_intro"));
1431  $tpl->setVariable("TXT_INTRO_1", sprintf($lng->txt("pdesk_intro2"), $lng->txt("to_desktop")));
1432  include_once("./Services/Link/classes/class.ilLink.php");
1433  $tpl->setVariable("TXT_INTRO_2", sprintf($lng->txt("pdesk_intro3"),
1434  '<a href="'.ilLink::_getStaticLink(1,'root',true).'">'.$title.'</a>'));
1435  $tpl->setVariable("TXT_INTRO_3", $lng->txt("pdesk_intro4"));
1436  break;
1437  }
1438 
1439  return $tpl->get();
1440  }
1441 
1446  {
1447  global $ilUser, $ilCtrl;
1448 
1449  $ilUser->writePref("pd_order_items", "location");
1450 
1451  if ($ilCtrl->isAsynch())
1452  {
1453  echo $this->getHTML();
1454  exit;
1455  }
1456  else
1457  {
1458  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1459  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1460  }
1461  }
1462 
1467  {
1468  global $ilUser, $ilCtrl;
1469 
1470  $ilUser->writePref("pd_order_items", "type");
1471 
1472  if ($ilCtrl->isAsynch())
1473  {
1474  echo $this->getHTML();
1475  exit;
1476  }
1477  else
1478  {
1479  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1480  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1481  }
1482  }
1483 
1484  function manageObject()
1485  {
1486  global $ilUser, $objDefinition, $ilCtrl, $lng;
1487 
1488  $objects = array();
1489 
1490  $this->manage = true;
1491  $this->setAvailableDetailLevels(1, 1);
1492 
1493  $top_tb = new ilToolbarGUI();
1494  $top_tb->setFormAction($ilCtrl->getFormAction($this));
1495  $top_tb->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), $lng->txt("actions"));
1496  if($this->view == self::VIEW_SELECTED_ITEMS)
1497  {
1498  $top_tb->addFormButton($lng->txt("remove"), "confirmRemove");
1499  }
1500  else
1501  {
1502  $top_tb->addFormButton($lng->txt("pd_unsubscribe_memberships"), "confirmRemove");
1503  }
1504  $top_tb->addSeparator();
1505  $top_tb->addFormButton($lng->txt("cancel"), "getHTML");
1506  $top_tb->setCloseFormTag(false);
1507 
1508  $bot_tb = new ilToolbarGUI();
1509  $bot_tb->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), $lng->txt("actions"));
1510  if($this->view == self::VIEW_SELECTED_ITEMS)
1511  {
1512  $bot_tb->addFormButton($lng->txt("remove"), "confirmRemove");
1513  }
1514  else
1515  {
1516  $bot_tb->addFormButton($lng->txt("pd_unsubscribe_memberships"), "confirmRemove");
1517  }
1518  $bot_tb->addSeparator();
1519  $bot_tb->addFormButton($lng->txt("cancel"), "getHTML");
1520  $bot_tb->setOpenFormTag(false);
1521 
1522  return $top_tb->getHTML().$this->getHTML().$bot_tb->getHTML();
1523  }
1524 
1525  public function confirmRemoveObject()
1526  {
1527  global $ilCtrl;
1528 
1529  $ilCtrl->setParameter($this, 'view', $this->view);
1530  if(!sizeof($_POST["id"]))
1531  {
1532  ilUtil::sendFailure($this->lng->txt("select_one"), true);
1533  $ilCtrl->redirect($this, "manage");
1534  }
1535 
1536  if($this->view == self::VIEW_SELECTED_ITEMS)
1537  {
1538  $question = $this->lng->txt("pd_info_delete_sure_remove");
1539  $cmd = "confirmedRemove";
1540  }
1541  else
1542  {
1543  $question = $this->lng->txt("pd_info_delete_sure_unsubscribe");
1544  $cmd = "confirmedUnsubscribe";
1545  }
1546 
1547  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1548  $cgui = new ilConfirmationGUI();
1549  $cgui->setHeaderText($question);
1550 
1551  $cgui->setFormAction($ilCtrl->getFormAction($this));
1552  $cgui->setCancel($this->lng->txt("cancel"), "manage");
1553  $cgui->setConfirm($this->lng->txt("confirm"), $cmd);
1554 
1555  foreach ($_POST["id"] as $ref_id)
1556  {
1557  $obj_id = ilObject::_lookupObjectId($ref_id);
1558  $title = ilObject::_lookupTitle($obj_id);
1559  $type = ilObject::_lookupType($obj_id);
1560 
1561  $cgui->addItem("ref_id[]", $ref_id, $title,
1562  ilObject::_getIcon($obj_id, "small", $type),
1563  $this->lng->txt("icon")." ".$this->lng->txt("obj_".$type));
1564  }
1565 
1566  return $cgui->getHTML();
1567  }
1568 
1569  public function confirmedRemove()
1570  {
1571  global $ilCtrl, $ilUser;
1572 
1573  if(!sizeof($_POST["ref_id"]))
1574  {
1575  $ilCtrl->redirect($this, "manage");
1576  }
1577 
1578  foreach($_POST["ref_id"] as $ref_id)
1579  {
1580  $type = ilObject::_lookupType($ref_id, true);
1581  ilObjUser::_dropDesktopItem($ilUser->getId(), $ref_id, $type);
1582  }
1583 
1584  // #12909
1585  ilUtil::sendSuccess($this->lng->txt("pd_remove_multi_confirm"), true);
1586  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1587  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1588  }
1589 
1590  public function confirmedUnsubscribe()
1591  {
1592  global $ilCtrl, $ilAccess, $ilUser;
1593 
1594  if(!sizeof($_POST["ref_id"]))
1595  {
1596  $ilCtrl->redirect($this, "manage");
1597  }
1598 
1599  foreach($_POST["ref_id"] as $ref_id)
1600  {
1601  if($ilAccess->checkAccess("leave", "", $ref_id))
1602  {
1603  switch(ilObject::_lookupType($ref_id, true))
1604  {
1605  case "crs":
1606  // see ilObjCourseGUI:performUnsubscribeObject()
1607  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
1608  $members = new ilCourseParticipants(ilObject::_lookupObjId($ref_id));
1609  $members->delete($ilUser->getId());
1610 
1611  $members->sendUnsubscribeNotificationToAdmins($ilUser->getId());
1612  $members->sendNotification(
1613  $members->NOTIFY_UNSUBSCRIBE,
1614  $ilUser->getId()
1615  );
1616  break;
1617 
1618  case "grp":
1619  // see ilObjGroupGUI:performUnsubscribeObject()
1620  include_once "Modules/Group/classes/class.ilGroupParticipants.php";
1621  $members = new ilGroupParticipants(ilObject::_lookupObjId($ref_id));
1622  $members->delete($ilUser->getId());
1623 
1624  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1625  $members->sendNotification(
1627  $ilUser->getId()
1628  );
1629  $members->sendNotification(
1631  $ilUser->getId()
1632  );
1633  break;
1634 
1635  default:
1636  // do nothing
1637  continue;
1638  }
1639 
1640  include_once './Modules/Forum/classes/class.ilForumNotification.php';
1641  ilForumNotification::checkForumsExistsDelete($ref_id, $ilUser->getId());
1642  }
1643  }
1644 
1645 
1646  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1647  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1648  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1649  }
1650 }
1651 
1652 ?>