ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
8 
19 {
23 
24  static $block_type = "pditems";
25 
26  private $view = self::VIEW_SELECTED_ITEMS;
27  private $allowed_views = array();
28 
32  public function __construct()
33  {
34  global $ilCtrl, $lng, $ilUser;
35 
36  parent::__construct();
37 
38  $lng->loadLanguageModule('pd');
39  $lng->loadLanguageModule('cntr'); // #14158
40 
41  $this->setEnableNumInfo(false);
42  $this->setLimit(99999);
43 // $this->setColSpan(2);
44  $this->setAvailableDetailLevels(3, 1);
45 // $this->setBigMode(true);
46  $this->lng = $lng;
47  $this->allow_moving = false;
48 
49  $this->determineViewSettings();
50  }
51 
55  public function fillDetailRow()
56  {
60  global $ilCtrl;
61 
62 // $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
63  parent::fillDetailRow();
64 // $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', '');
65  }
66 
70  public function addToDeskObject()
71  {
72  global $ilCtrl, $lng;
73 
74  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
76  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
77  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
78  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
79  }
80 
84  public function removeFromDeskObject()
85  {
86  global $ilCtrl, $lng;
87 
88  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
90  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
91  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
92  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
93  }
94 
98  public function changeView()
99  {
103  global $ilCtrl;
104 
105  if(in_array((int)$_GET['view'], $this->allowed_views))
106  {
107  $view = (int)$_GET['view'];
108  }
109  else
110  {
111  reset($this->allowed_views);
112  $view = (int)current($this->allowed_views);
113  }
114 
115  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $view);
116  $ilCtrl->redirectByClass('ilpersonaldesktopgui', 'show');
117  }
118 
122  protected function determineViewSettings()
123  {
128  global $ilSetting, $ilCtrl;
129 
130  $this->allowed_views = array(self::VIEW_MY_STUDYPROGRAMME);
131 
132  // determine view
133  if($ilSetting->get('disable_my_offers') == 1 &&
134  $ilSetting->get('disable_my_memberships') == 1)
135  {
136  // if both views are disabled set default view (should not occur but we should prevent it)
137  $ilSetting->set('personal_items_default_view', self::VIEW_SELECTED_ITEMS);
138  $this->allowed_views[] = self::VIEW_SELECTED_ITEMS;
139  }
140  // both views are enabled, get default view
141  else if($ilSetting->get('disable_my_offers') == 0 &&
142  $ilSetting->get('disable_my_memberships') == 0)
143  {
144  $this->allowed_views[] = self::VIEW_SELECTED_ITEMS;
145  $this->allowed_views[] = self::VIEW_MY_MEMBERSHIPS;
146  }
147  else if($ilSetting->get('disable_my_offers') == 0 &&
148  $ilSetting->get('disable_my_memberships') == 1)
149  {
150  $this->allowed_views[] = self::VIEW_SELECTED_ITEMS;
151  }
152  else
153  {
154  $this->allowed_views[] = self::VIEW_MY_MEMBERSHIPS;
155  }
156 
157  $this->view = (int)$_GET['view'];
158  if(!in_array((int)$this->view, $this->allowed_views))
159  {
160  $_GET['view'] = $this->view = (int)$ilSetting->get('personal_items_default_view');
161  }
162 
163  $ilCtrl->saveParameter($this, 'view');
164  }
165 
171  static function getBlockType()
172  {
173  return self::$block_type;
174  }
175 
176  public static function getScreenMode()
177  {
178  $cmd = $_GET["cmd"];
179  if($cmd == "post")
180  {
181  $cmd = $_POST["cmd"];
182  $cmd = array_shift(array_keys($cmd));
183  }
184 
185  switch($cmd)
186  {
187  case "confirmRemove":
188  case "manage":
189  return IL_SCREEN_FULL;
190 
191  default:
192  return IL_SCREEN_SIDE;
193  }
194  }
195 
201  static function isRepositoryObject()
202  {
203  return false;
204  }
205 
206 
207  function getHTML()
208  {
209  global $ilCtrl, $ilSetting, $tpl, $lng, $ilHelp, $ilDB;
210 
211  $ilDB->useSlave(true);
212 
213  // workaround to show details row
214  $this->setData(array("dummy"));
215 
216  include_once "Services/Object/classes/class.ilObjectListGUI.php";
217  ilObjectListGUI::prepareJSLinks("",
218  $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
219  $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
220 
221  switch((int)$this->view)
222  {
223  case self::VIEW_MY_MEMBERSHIPS:
224  $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "crs_grp");
225  if ($ilSetting->get('disable_my_offers') == 0)
226  {
227  $tpl->setTitle($lng->txt("my_courses_groups"));
228  }
229  $this->setTitle($this->lng->txt('pd_my_memberships'));
230  $this->setContent($this->getMembershipItemsBlockHTML());
231  break;
232 
233  case self::VIEW_SELECTED_ITEMS:
234  default:
235  $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "sel_items");
236  if(!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views))
237  {
238  $this->setTitle($this->lng->txt('selected_items'));
239  }
240  else
241  {
242  $this->setTitle($this->lng->txt('pd_my_offers'));
243  }
244 
245  $this->setContent($this->getSelectedItemsBlockHTML());
246  break;
247  }
248 
249  if ($this->getContent() == "")
250  {
251  $this->setEnableDetailRow(false);
252  }
253 // $ilCtrl->clearParametersByClass("ilpersonaldesktopgui");
254  $ilCtrl->clearParameters($this);
255 
256  $ilDB->useSlave(false);
257 
258  return parent::getHTML();
259  }
260 
261  // Overwritten from ilBlockGUI as there seems to be no other possibility to
262  // not show Commands in the HEADER(!!!!) of a block in the VIEW_MY_STUDYPROGRAMME
263  // case... Sigh.
264  function getFooterLinks()
265  {
266  if((int)$this->view == self::VIEW_MY_STUDYPROGRAMME) {
267  return array();
268  }
269  return parent::getFooterLinks();
270  }
271 
275  function executeCommand()
276  {
277  global $ilCtrl;
278 
279  $next_class = $ilCtrl->getNextClass();
280  $cmd = $ilCtrl->getCmd("getHTML");
281 
282  switch($next_class)
283  {
284  case "ilcommonactiondispatchergui":
285  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
287  $ilCtrl->forwardCommand($gui);
288  break;
289 
290  default:
291  if(method_exists($this, $cmd))
292  {
293  return $this->$cmd();
294  }
295  else
296  {
297  $cmd .= 'Object';
298  return $this->$cmd();
299  }
300  }
301  }
302 
303  function getContent()
304  {
305  return $this->content;
306  }
307 
309  {
310  $this->content = $a_content;
311  }
312 
316  function fillDataSection()
317  {
318  global $ilUser;
319 
320  if ($this->getContent() != "")
321  {
322  $this->tpl->setVariable("BLOCK_ROW", $this->getContent());
323  }
324  else
325  {
326  $this->setDataSection($this->getIntroduction());
327  }
328  }
329 
330 
334  function fillFooter()
335  {
336  global $ilCtrl, $lng, $ilUser;
337 
338  $this->setFooterLinks();
339  $this->fillFooterLinks();
340  $this->tpl->setVariable("FCOLSPAN", $this->getColSpan());
341  if ($this->tpl->blockExists("block_footer"))
342  {
343  $this->tpl->setCurrentBlock("block_footer");
344  $this->tpl->parseCurrentBlock();
345  }
346  }
347 
351  function setFooterLinks()
352  {
353  global $ilUser, $ilCtrl, $lng;
354 
355  if ($this->getContent() == "")
356  {
357  $this->setEnableNumInfo(false);
358  return "";
359  }
360 
361  if ($this->manage)
362  {
363  return;
364  }
365 
366  // by type
367 // if ($ilUser->getPref("pd_order_items") == 'location')
368 // {
369  $this->addFooterLink( $lng->txt("by_type"),
370  $ilCtrl->getLinkTarget($this, "orderPDItemsByType"),
371  $ilCtrl->getLinkTarget($this, "orderPDItemsByType", "", true),
372  "block_".$this->getBlockType()."_".$this->block_id,
373  false, false, ($ilUser->getPref("pd_order_items") != 'location')
374  );
375 // }
376 // else
377 // {
378 // $this->addFooterLink($lng->txt("by_type"));
379 // }
380 
381 // // by location
382 // if ($ilUser->getPref("pd_order_items") == 'location')
383 // {
384 // $this->addFooterLink($lng->txt("by_location"));
385 // }
386 // else
387 // {
388  $this->addFooterLink( $lng->txt("by_location"),
389  $ilCtrl->getLinkTarget($this, "orderPDItemsByLocation"),
390  $ilCtrl->getLinkTarget($this, "orderPDItemsByLocation", "", true),
391  "block_".$this->getBlockType()."_".$this->block_id,
392  false, false, ($ilUser->getPref("pd_order_items") == 'location')
393  );
394 // }
395 
396  $this->addFooterLink(($this->view == self::VIEW_SELECTED_ITEMS) ?
397  $lng->txt("pd_remove_multiple") :
398  $lng->txt("pd_unsubscribe_multiple_memberships"),
399  $ilCtrl->getLinkTarget($this, "manage"),
400  null,
401  "block_".$this->getBlockType()."_".$this->block_id
402  );
403  }
404 
411  protected function getObjectsByMembership($types = array())
412  {
413  global $tree, $ilUser, $ilObjDataCache;
414 
415  include_once 'Services/Membership/classes/class.ilParticipants.php';
416  $items = array();
417 
418  if(is_array($types) && count($types))
419  {
420  foreach($types as $type)
421  {
422  switch($type)
423  {
424  case 'grp':
425  $items = array_merge(ilParticipants::_getMembershipByType($ilUser->getId(), 'grp'), $items);
426  break;
427  case 'crs':
428  $items = array_merge(ilParticipants::_getMembershipByType($ilUser->getId(), 'crs'), $items);
429  break;
430  default:
431  break;
432  }
433  }
434  }
435  else
436  {
437  $crs_mbs = ilParticipants::_getMembershipByType($ilUser->getId(), 'crs');
438  $grp_mbs = ilParticipants::_getMembershipByType($ilUser->getId(), 'grp');
439  $items = array_merge($crs_mbs, $grp_mbs);
440  }
441 
442  $references = array();
443  foreach($items as $key => $obj_id)
444  {
445  $item_references = ilObject::_getAllReferences($obj_id);
446  foreach($item_references as $ref_id)
447  {
448  if($tree->isInTree($ref_id))
449  {
450  $title = $ilObjDataCache->lookupTitle($obj_id);
451  $type = $ilObjDataCache->lookupType($obj_id);
452 
453  $parent_ref_id = $tree->getParentId($ref_id);
454  $par_left = $tree->getLeftValue($parent_ref_id);
455  $par_left = sprintf("%010d", $par_left);
456 
457  $references[$par_left . $title . $ref_id] = array(
458  'ref_id' => $ref_id,
459  'obj_id' => $obj_id,
460  'type' => $type,
461  'title' => $title,
462  'description' => $ilObjDataCache->lookupDescription($obj_id),
463  'parent_ref' => $parent_ref_id
464  );
465  }
466  }
467  }
468  ksort($references);
469  return is_array($references) ? $references : array();
470  }
471 
479  {
480  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $rbacreview;
481 
482  $output = false;
483  $items = $this->getObjectsByMembership();
484  $item_html = array();
485  if(count($items) > 0)
486  {
487  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
489  foreach($items as $item)
490  {
491  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
492  }
493  $preloader->preload();
494  unset($preloader);
495 
496  reset($items);
497  foreach($items as $item)
498  {
499  //echo "1";
500  // get list gui class for each object type
501  if ($cur_obj_type != $item["type"])
502  {
503  $item_list_gui = $this->getItemListGUI($item["type"]);
504  if(!$item_list_gui)
505  {
506  continue;
507  }
508 
509  // notes, comment currently do not work properly
510  $item_list_gui->enableNotes(false);
511  $item_list_gui->enableComments(false);
512  $item_list_gui->enableTags(false);
513 
514  $item_list_gui->enableIcon(true);
515  $item_list_gui->enableDelete(false);
516  $item_list_gui->enableCut(false);
517  $item_list_gui->enableCopy(false);
518  $item_list_gui->enableLink(false);
519  $item_list_gui->enableInfoScreen(true);
520  if ($ilSetting->get('disable_my_offers') == 1)
521  {
522  $item_list_gui->enableSubscribe(false);
523  }
524  else
525  {
526  $item_list_gui->enableSubscribe(true);
527  }
528  $item_list_gui->setContainerObject($this);
529  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
530  {
531  //echo "3";
532  $item_list_gui->enableDescription(false);
533  $item_list_gui->enableProperties(false);
534  $item_list_gui->enablePreconditions(false);
535  }
536  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
537  {
538  $item_list_gui->enableCommands(true, true);
539  }
540  }
541  // render item row
542  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
543 
544  if (is_object($item_list_gui))
545  {
546  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
547 
548  // #15232
549  if($this->manage)
550  {
551  if(!$rbacsystem->checkAccess("leave", $item["ref_id"]))
552  {
553  $item_list_gui->enableCheckbox(false);
554  }
555  else
556  {
557  $item_list_gui->enableCheckbox(true);
558  }
559  }
560 
561  $html = $item_list_gui->getListItemHTML($item["ref_id"],
562  $item["obj_id"], $item["title"], $item["description"]);
563  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
564  if ($html != "")
565  {
566  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
567  $item_html[] = array(
568  "html" => $html,
569  "item_ref_id" => $item["ref_id"],
570  "item_obj_id" => $item["obj_id"],
571  "parent_ref" => $item["parent_ref"],
572  "type" => $item["type"],
573  'item_icon_image_type' => $item_list_gui->getIconImageType()
574  );
575  // END WebDAV: Use $item_list_gui to determine icon image type
576  }
577  }
578  }
579 
580  // output block for resource type
581  if (count($item_html) > 0)
582  {
583  $cur_parent_ref = 0;
584 
585  // content row
586  foreach($item_html as $item)
587  {
588  // add a parent header row for each new parent
589  if ($cur_parent_ref != $item["parent_ref"])
590  {
591  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
592  {
593  $this->addParentRow($tpl, $item["parent_ref"], false);
594  }
595  else
596  {
597  $this->addParentRow($tpl, $item["parent_ref"]);
598  }
599  $this->resetRowType();
600  $cur_parent_ref = $item["parent_ref"];
601  }
602 
603  // BEGIN WebDAV: Use $item_list_gui to determine icon image type.
604  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
605  $item['item_icon_image_type'],
606  "th_".$cur_parent_ref);
607  // END WebDAV: Use $item_list_gui to determine icon image type.
608  $output = true;
609  }
610  }
611  }
612 
613  return $output;
614  }
615 
623  {
624  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache;
625 
626  $output = false;
627 
628  $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
629  array("cat", "crs", "grp", "fold"));
630 
631  $types = array();
632  foreach($objtype_groups as $grp => $grpdata)
633  {
634  $types[] = array(
635  "grp" => $grp,
636  "title" => $this->lng->txt("objs_".$grp),
637  "types" => $grpdata["objs"]);
638  }
639 
640  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
641 
642  foreach ($types as $t)
643  {
644  $type = $t["types"];
645  $title = $t["title"];
646  $grp = $t["grp"];
647 
648  $items = $this->getObjectsByMembership($type);
649 
650  if (count($items) > 0)
651  {
653  foreach($items as $item)
654  {
655  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
656  }
657  $preloader->preload();
658  unset($preloader);
659 
660  reset($items);
661 
662 
663  $item_html = array();
664 
665  if ($this->getCurrentDetailLevel() == 3)
666  {
667  $rel_header = "th_".$grp;
668  }
669 
670  $tstCount = 0;
671  $unsetCount = 0;
672  $progressCount = 0;
673  $unsetFlag = 0;
674  $progressFlag = 0;
675  $completedFlag = 0;
676  if (strcmp($a_type, "tst") == 0) {
677  $items = $this->multiarray_sort($items, "used_tries; title");
678  foreach ($items as $tst_item) {
679  if (!isset($tst_item["used_tries"])) {
680  $unsetCount++;
681  }
682  elseif ($tst_item["used_tries"] == 0) {
683  $progressCount++;
684  }
685  }
686  }
687 
688  foreach($items as $item)
689  {
690  // get list gui class for each object type
691  if ($cur_obj_type != $item["type"])
692  {
693  $class = $objDefinition->getClassName($item["type"]);
694  $location = $objDefinition->getLocation($item["type"]);
695  $full_class = "ilObj".$class."ListGUI";
696  include_once($location."/class.".$full_class.".php");
697  $item_list_gui = new $full_class();
698 
699  // notes, comment currently do not work properly
700  $item_list_gui->enableNotes(false);
701  $item_list_gui->enableComments(false);
702  $item_list_gui->enableTags(false);
703 
704  $item_list_gui->enableIcon(true);
705  $item_list_gui->enableDelete(false);
706  $item_list_gui->enableCut(false);
707  $item_list_gui->enableCopy(false);
708  $item_list_gui->enableLink(false);
709  $item_list_gui->enableInfoScreen(true);
710  if ($ilSetting->get('disable_my_offers') == 1)
711  {
712  $item_list_gui->enableSubscribe(false);
713  }
714  else
715  {
716  $item_list_gui->enableSubscribe(true);
717  }
718 
719  $item_list_gui->setContainerObject($this);
720  if ($this->manage)
721  {
722  $item_list_gui->enableCheckbox(true);
723  }
724  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
725  {
726  $item_list_gui->enableDescription(false);
727  $item_list_gui->enableProperties(false);
728  $item_list_gui->enablePreconditions(false);
729  $item_list_gui->enableNoticeProperties(false);
730  }
731  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
732  {
733  $item_list_gui->enableCommands(true, true);
734  }
735  }
736  // render item row
737  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
738 
739  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
740 
741  // #15232
742  if($this->manage)
743  {
744  if(!$rbacsystem->checkAccess("leave", $item["ref_id"]))
745  {
746  $item_list_gui->enableCheckbox(false);
747  }
748  else
749  {
750  $item_list_gui->enableCheckbox(true);
751  }
752  }
753 
754  $html = $item_list_gui->getListItemHTML($item["ref_id"],
755  $item["obj_id"], $item["title"], $item["description"]);
756  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
757  if ($html != "")
758  {
759  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
760  $item_html[] = array(
761  "html" => $html,
762  "item_ref_id" => $item["ref_id"],
763  "item_obj_id" => $item["obj_id"],
764  'item_icon_image_type' => (method_exists($item_list_gui, 'getIconImageType')) ?
765  $item_list_gui->getIconImageType() :
766  $item['type']
767  );
768  // END WebDAV: Use $item_list_gui to determine icon image type
769  }
770  }
771 
772  // output block for resource type
773  if (count($item_html) > 0)
774  {
775  // add a header for each resource type
776  if ($this->getCurrentDetailLevel() == 3)
777  {
778  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
779  {
780  $this->addHeaderRow($tpl, $grp, false);
781  }
782  else
783  {
784  $this->addHeaderRow($tpl, $grp);
785  }
786  $this->resetRowType();
787  }
788 
789  // content row
790  foreach($item_html as $item)
791  {
792  if ($this->getCurrentDetailLevel() < 3 ||
793  $ilSetting->get("icon_position_in_lists") == "item_rows")
794  {
795  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
796  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
797  $item['item_icon_image_type'],
798  $rel_header);
799  // END WebDAV: Use $item_list_gui to determine icon image type
800  }
801  else
802  {
803  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], "", $rel_header);
804  }
805  $output = true;
806  }
807  }
808  }
809  }
810 
811  return $output;
812  }
813 
820  public function getMembershipItemsBlockHTML()
821  {
822  global $ilUser;
823 
824  $tpl = $this->newBlockTemplate();
825 
826  switch($ilUser->getPref('pd_order_items'))
827  {
828  case 'location':
830  break;
831 
832  default:
834  break;
835  }
836 
837  return $tpl->get();
838  }
839 
844  {
845  global $ilUser, $rbacsystem, $objDefinition, $ilBench;
846 
847  $tpl = $this->newBlockTemplate();
848 
849  switch ($ilUser->getPref("pd_order_items"))
850  {
851  case "location":
853  break;
854 
855  default:
856  $ok = $this->getSelectedItemsPerType($tpl);
857  break;
858  }
859 
860  if($this->manage)
861  {
862  // #11355 - see ContainerContentGUI::renderSelectAllBlock()
863  $tpl->setCurrentBlock("select_all_row");
864  $tpl->setVariable("CHECKBOXNAME", "ilToolbarSelectAll");
865  $tpl->setVariable("SEL_ALL_PARENT", "ilToolbar");
866  $tpl->setVariable("SEL_ALL_CB_NAME", "id");
867  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
868  $tpl->parseCurrentBlock();
869  }
870 
871  return $tpl->get();
872  }
873 
878  {
879  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree, $ilCtrl;
880 
881  $items = $ilUser->getDesktopItems();
882  if (count($items) > 0)
883  {
884  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
886  foreach($items as $item)
887  {
888  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
889  }
890  $preloader->preload();
891  unset($preloader);
892 
893  reset($items);
894  }
895 
896  $output = false;
897 
898  $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
899  array("cat", "crs", "grp", "fold"));
900 
901  $types = array();
902  foreach($objtype_groups as $grp => $grpdata)
903  {
904  $types[] = array(
905  "grp" => $grp,
906  "title" => $this->lng->txt("objs_".$grp),
907  "types" => $grpdata["objs"]);
908  }
909 
910  foreach ($types as $t)
911  {
912 
913  $type = $t["types"];
914  $title = $t["title"];
915  $grp = $t["grp"];
916 
917  $items = $ilUser->getDesktopItems($type);
918  $item_html = array();
919 
920  if ($this->getCurrentDetailLevel() == 3)
921  {
922  $rel_header = "th_".$grp;
923  }
924 
925  if (count($items) > 0)
926  {
927  $tstCount = 0;
928  $unsetCount = 0;
929  $progressCount = 0;
930  $unsetFlag = 0;
931  $progressFlag = 0;
932  $completedFlag = 0;
933  if (strcmp($a_type, "tst") == 0) {
934  $items = $this->multiarray_sort($items, "used_tries; title");
935  foreach ($items as $tst_item) {
936  if (!isset($tst_item["used_tries"])) {
937  $unsetCount++;
938  }
939  elseif ($tst_item["used_tries"] == 0) {
940  $progressCount++;
941  }
942  }
943  }
944 
945  foreach($items as $item)
946  {
947  // get list gui class for each object type
948  if ($cur_obj_type != $item["type"])
949  {
950  $class = $objDefinition->getClassName($item["type"]);
951  $location = $objDefinition->getLocation($item["type"]);
952  $full_class = "ilObj".$class."ListGUI";
953  include_once($location."/class.".$full_class.".php");
954  $item_list_gui = new $full_class();
955 
956  // notes, comment currently do not work properly
957  $item_list_gui->enableNotes(false);
958  $item_list_gui->enableComments(false);
959  $item_list_gui->enableTags(false);
960 
961  $item_list_gui->enableIcon(true);
962  $item_list_gui->enableDelete(false);
963  $item_list_gui->enableCut(false);
964  $item_list_gui->enableCopy(false);
965  $item_list_gui->enableLink(false);
966  $item_list_gui->enableInfoScreen(true);
967  $item_list_gui->setContainerObject($this);
968 
969  if ($this->manage)
970  {
971  $item_list_gui->enableCheckbox(true);
972  }
973 
974  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
975  {
976  $item_list_gui->enableDescription(false);
977  $item_list_gui->enableProperties(false);
978  $item_list_gui->enablePreconditions(false);
979  $item_list_gui->enableNoticeProperties(false);
980  }
981  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
982  {
983  $item_list_gui->enableCommands(true, true);
984  }
985  }
986  // render item row
987  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
988 
989  include_once './Services/Object/classes/class.ilObjectActivation.php';
990  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
991 
992  $html = $item_list_gui->getListItemHTML($item["ref_id"],
993  $item["obj_id"], $item["title"], $item["description"]);
994  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
995  if ($html != "")
996  {
997  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
998  $item_html[] = array(
999  "html" => $html,
1000  "item_ref_id" => $item["ref_id"],
1001  "item_obj_id" => $item["obj_id"],
1002  'item_icon_image_type' => (method_exists($item_list_gui, 'getIconImageType')) ?
1003  $item_list_gui->getIconImageType() :
1004  $item['type']
1005  );
1006  // END WebDAV: Use $item_list_gui to determine icon image type
1007  }
1008  }
1009 
1010  // output block for resource type
1011  if (count($item_html) > 0)
1012  {
1013  // add a header for each resource type
1014  if ($this->getCurrentDetailLevel() == 3)
1015  {
1016  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
1017  {
1018  $this->addHeaderRow($tpl, $grp, false);
1019  }
1020  else
1021  {
1022  $this->addHeaderRow($tpl, $grp);
1023  }
1024  $this->resetRowType();
1025  }
1026 
1027  // content row
1028  foreach($item_html as $item)
1029  {
1030  if ($this->getCurrentDetailLevel() < 3 ||
1031  $ilSetting->get("icon_position_in_lists") == "item_rows")
1032  {
1033  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
1034  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
1035  $item['item_icon_image_type'],
1036  $rel_header);
1037  // END WebDAV: Use $item_list_gui to determine icon image type
1038  }
1039  else
1040  {
1041  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], "", $rel_header);
1042  }
1043  $output = true;
1044  }
1045  }
1046  }
1047  }
1048 
1049  return $output;
1050  }
1051 
1056  {
1057  global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree;
1058 
1059  $output = false;
1060 
1061  $items = $ilUser->getDesktopItems();
1062  $item_html = array();
1063  $cur_obj_type = "";
1064 
1065  if (count($items) > 0)
1066  {
1067  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
1069  foreach($items as $item)
1070  {
1071  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
1072  }
1073  $preloader->preload();
1074  unset($preloader);
1075 
1076  reset($items);
1077  foreach($items as $item)
1078  {
1079  //echo "1";
1080  // get list gui class for each object type
1081  if ($cur_obj_type != $item["type"])
1082  {
1083  $item_list_gui = $this->getItemListGUI($item["type"]);
1084  if(!$item_list_gui)
1085  {
1086  continue;
1087  }
1088 
1089  // notes, comment currently do not work properly
1090  $item_list_gui->enableNotes(false);
1091  $item_list_gui->enableComments(false);
1092  $item_list_gui->enableTags(false);
1093 
1094  $item_list_gui->enableIcon(true);
1095  $item_list_gui->enableDelete(false);
1096  $item_list_gui->enableCut(false);
1097  $item_list_gui->enableCopy(false);
1098  $item_list_gui->enableLink(false);
1099  $item_list_gui->enableInfoScreen(true);
1100  if ($this->getCurrentDetailLevel() < 3 || $this->manage)
1101  {
1102  //echo "3";
1103  $item_list_gui->enableDescription(false);
1104  $item_list_gui->enableProperties(false);
1105  $item_list_gui->enablePreconditions(false);
1106  }
1107  if ($this->getCurrentDetailLevel() < 2 || $this->manage)
1108  {
1109  $item_list_gui->enableCommands(true, true);
1110  }
1111  }
1112  // render item row
1113  $ilBench->start("ilPersonalDesktopGUI", "getListHTML");
1114 
1115  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item);
1116 
1117  $item_list_gui->setContainerObject($this);
1118  $html = $item_list_gui->getListItemHTML($item["ref_id"],
1119  $item["obj_id"], $item["title"], $item["description"]);
1120  $ilBench->stop("ilPersonalDesktopGUI", "getListHTML");
1121  if ($html != "")
1122  {
1123  $item_html[] = array(
1124  "html" => $html,
1125  "item_ref_id" => $item["ref_id"],
1126  "item_obj_id" => $item["obj_id"],
1127  "parent_ref" => $item["parent_ref"],
1128  "type" => $item["type"],
1129  'item_icon_image_type' => $item_list_gui->getIconImageType()
1130  );
1131  }
1132  }
1133 
1134  // output block for resource type
1135  if (count($item_html) > 0)
1136  {
1137  $cur_parent_ref = 0;
1138 
1139  // content row
1140  foreach($item_html as $item)
1141  {
1142  // add a parent header row for each new parent
1143  if ($cur_parent_ref != $item["parent_ref"])
1144  {
1145  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
1146  {
1147  $this->addParentRow($tpl, $item["parent_ref"], false);
1148  }
1149  else
1150  {
1151  $this->addParentRow($tpl, $item["parent_ref"]);
1152  }
1153  $this->resetRowType();
1154  $cur_parent_ref = $item["parent_ref"];
1155  }
1156 
1157  $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"],
1158  $item['item_icon_image_type'],
1159  "th_".$cur_parent_ref);
1160  $output = true;
1161  }
1162  }
1163  }
1164 
1165  return $output;
1166  }
1167 
1168  function resetRowType()
1169  {
1170  $this->cur_row_type = "";
1171  }
1172 
1179  function &newBlockTemplate()
1180  {
1181  $tpl = new ilTemplate("tpl.pd_list_block.html", true, true, "Services/PersonalDesktop");
1182  $this->cur_row_type = "";
1183  return $tpl;
1184  }
1185 
1190  {
1191  global $objDefinition;
1192  //echo "<br>+$a_type+";
1193  if (!isset($this->item_list_guis[$a_type]))
1194  {
1195  $class = $objDefinition->getClassName($a_type);
1196  // Fixed problem with deactivated plugins and existing repo. object plugin objects on the user's desktop
1197  if(!$class)
1198  {
1199  return NULL;
1200  }
1201  // Fixed problem with deactivated plugins and existing repo. object plugin objects on the user's desktop
1202  $location = $objDefinition->getLocation($a_type);
1203  if(!$location)
1204  {
1205  return NULL;
1206  }
1207 
1208  $full_class = "ilObj".$class."ListGUI";
1209  //echo "<br>-".$location."/class.".$full_class.".php"."-";
1210  include_once($location."/class.".$full_class.".php");
1211  $item_list_gui = new $full_class();
1212  $this->item_list_guis[$a_type] = $item_list_gui;
1213  }
1214  else
1215  {
1216  $item_list_gui = $this->item_list_guis[$a_type];
1217  }
1218 
1219  if ($this->manage)
1220  {
1221  $item_list_gui->enableCheckbox(true);
1222  }
1223 
1224 
1225  return $item_list_gui;
1226  }
1227 
1235  function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true)
1236  {
1237  global $objDefinition;
1238 
1239  $icon = ilUtil::getImagePath("icon_".$a_type.".svg");
1240  if (!$objDefinition->isPlugin($a_type))
1241  {
1242  $title = $this->lng->txt("objs_".$a_type);
1243  }
1244  else
1245  {
1246  include_once("./Services/Component/classes/class.ilPlugin.php");
1247  $title =
1249 
1250  }
1251  $header_id = "th_".$a_type;
1252 
1253  if ($a_show_image)
1254  {
1255  $a_tpl->setCurrentBlock("container_header_row_image");
1256  $a_tpl->setVariable("HEADER_IMG", $icon);
1257  $a_tpl->setVariable("HEADER_ALT", $title);
1258  }
1259  else
1260  {
1261  $a_tpl->setCurrentBlock("container_header_row");
1262  }
1263 
1264  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1265  $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id);
1266  $a_tpl->parseCurrentBlock();
1267  $a_tpl->touchBlock("container_row");
1268  }
1269 
1277  function addParentRow(&$a_tpl, $a_ref_id, $a_show_image = true)
1278  {
1279  global $tree, $ilSetting;
1280 
1281  $par_id = ilObject::_lookupObjId($a_ref_id);
1282  $type = ilObject::_lookupType($par_id);
1283  if (!in_array($type, array("lm", "sahs", "htlm")))
1284  {
1285  $icon = ilUtil::getImagePath("icon_".$type.".svg");
1286  }
1287  else
1288  {
1289  $icon = ilUtil::getImagePath("icon_lm.svg");
1290  }
1291 
1292  // custom icon
1293  if ($ilSetting->get("custom_icons") &&
1294  in_array($type, array("cat","grp","crs", "root")))
1295  {
1296  require_once("./Services/Container/classes/class.ilContainer.php");
1297  if (($path = ilContainer::_lookupIconPath($par_id, "small")) != "")
1298  {
1299  $icon = $path;
1300  }
1301  }
1302 
1303  if ($tree->getRootId() != $par_id)
1304  {
1305  $title = ilObject::_lookupTitle($par_id);
1306  }
1307  else
1308  {
1309  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1310  $title = $nd["title"];
1311  if ($title == "ILIAS")
1312  {
1313  $title = $this->lng->txt("repository");
1314  }
1315  }
1316 
1317 /*
1318  $item_list_gui = $this->getItemListGUI($type);
1319 
1320  $item_list_gui->enableIcon(false);
1321  $item_list_gui->enableDelete(false);
1322  $item_list_gui->enableCut(false);
1323  $item_list_gui->enableLink(false);
1324  $item_list_gui->enableDescription(false);
1325  $item_list_gui->enableProperties(false);
1326  $item_list_gui->enablePreconditions(false);
1327  $item_list_gui->enablePath(true);
1328  $item_list_gui->enableCommands(false);
1329  $html = $item_list_gui->getListItemHTML($a_ref_id,
1330  $par_id, $title, "");
1331 
1332  if ($a_show_image)
1333  {
1334  $a_tpl->setCurrentBlock("container_header_row_image");
1335  $a_tpl->setVariable("HEADER_IMG", $icon);
1336  $a_tpl->setVariable("HEADER_ALT", $title);
1337  }
1338 */
1339 // else
1340 // {
1341  $a_tpl->setCurrentBlock("container_header_row");
1342 // }
1343 
1344  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
1345 /* $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $html);
1346  $a_tpl->setVariable("BLOCK_HEADER_ID", "th_".$a_ref_id);*/
1347  $a_tpl->parseCurrentBlock();
1348  $a_tpl->touchBlock("container_row");
1349  }
1350 
1358  function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "",
1359  $a_image_type = "", $a_related_header = "")
1360  {
1361  global $ilSetting;
1362 
1363  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
1364  ? "row_type_2"
1365  : "row_type_1";
1366  $a_tpl->touchBlock($this->cur_row_type);
1367 
1368  if ($a_image_type != "")
1369  {
1370  if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "htlm", "sahs")))
1371  {
1372  $icon = ilUtil::getImagePath("icon_".$a_image_type.".svg");
1373  $title = $this->lng->txt("obj_".$a_image_type);
1374  }
1375  else
1376  {
1377  $icon = ilUtil::getImagePath("icon_lm.svg");
1378  $title = $this->lng->txt("learning_resource");
1379  }
1380 
1381  // custom icon
1382  if ($ilSetting->get("custom_icons") &&
1383  in_array($a_image_type, array("cat","grp","crs")))
1384  {
1385  require_once("./Services/Container/classes/class.ilContainer.php");
1386  if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
1387  {
1388  $icon = $path;
1389  }
1390  }
1391 
1392  $a_tpl->setCurrentBlock("block_row_image");
1393  $a_tpl->setVariable("ROW_IMG", $icon);
1394  $a_tpl->setVariable("ROW_ALT", $title);
1395  $a_tpl->parseCurrentBlock();
1396  }
1397  else
1398  {
1399  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
1400  }
1401  $a_tpl->setCurrentBlock("container_standard_row");
1402  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
1403  $rel_headers = ($a_related_header != "")
1404  ? "th_selected_items ".$a_related_header
1405  : "th_selected_items";
1406  $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
1407  $a_tpl->parseCurrentBlock();
1408  $a_tpl->touchBlock("container_row");
1409  }
1410 
1414  function getIntroduction()
1415  {
1416  global $ilUser, $lng, $ilCtrl, $tree;
1417 
1418  switch((int)$this->view)
1419  {
1420  case self::VIEW_MY_MEMBERSHIPS:
1421  $tpl = new ilTemplate('tpl.pd_my_memberships_intro.html', true, true, 'Services/PersonalDesktop');
1422  $tpl->setVariable('IMG_PD_LARGE', ilObject::_getIcon("", "big", "pd"));
1423  $tpl->setVariable('TXT_WELCOME', $lng->txt('pd_my_memberships_intro'));
1424  $tpl->setVariable('TXT_INTRO_1', $lng->txt('pd_my_memberships_intro2'));
1425  break;
1426 
1427  case self::VIEW_SELECTED_ITEMS:
1428  default:
1429  // get repository link
1430  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1431  $title = $nd["title"];
1432  if ($title == "ILIAS")
1433  {
1434  $title = $lng->txt("repository");
1435  }
1436 
1437  $tpl = new ilTemplate("tpl.pd_intro.html", true, true, "Services/PersonalDesktop");
1438  $tpl->setVariable('IMG_PD_LARGE', ilObject::_getIcon("", "big", "pd"));
1439  $tpl->setVariable("TXT_WELCOME", $lng->txt("pdesk_intro"));
1440  $tpl->setVariable("TXT_INTRO_1", sprintf($lng->txt("pdesk_intro2"), $lng->txt("to_desktop")));
1441  include_once("./Services/Link/classes/class.ilLink.php");
1442  $tpl->setVariable("TXT_INTRO_2", sprintf($lng->txt("pdesk_intro3"),
1443  '<a href="'.ilLink::_getStaticLink(1,'root',true).'">'.$title.'</a>'));
1444  $tpl->setVariable("TXT_INTRO_3", $lng->txt("pdesk_intro4"));
1445  break;
1446  }
1447 
1448  return $tpl->get();
1449  }
1450 
1455  {
1456  global $ilUser, $ilCtrl;
1457 
1458  $ilUser->writePref("pd_order_items", "location");
1459 
1460  if ($ilCtrl->isAsynch())
1461  {
1462  echo $this->getHTML();
1463  exit;
1464  }
1465  else
1466  {
1467  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1468  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1469  }
1470  }
1471 
1476  {
1477  global $ilUser, $ilCtrl;
1478 
1479  $ilUser->writePref("pd_order_items", "type");
1480 
1481  if ($ilCtrl->isAsynch())
1482  {
1483  echo $this->getHTML();
1484  exit;
1485  }
1486  else
1487  {
1488  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1489  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1490  }
1491  }
1492 
1493  function manageObject()
1494  {
1495  global $ilUser, $objDefinition, $ilCtrl, $lng;
1496 
1497  $objects = array();
1498 
1499  $this->manage = true;
1500  $this->setAvailableDetailLevels(1, 1);
1501 
1502  $top_tb = new ilToolbarGUI();
1503  $top_tb->setFormAction($ilCtrl->getFormAction($this));
1504  $top_tb->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), $lng->txt("actions"));
1505 
1506  $button = ilSubmitButton::getInstance();
1507  if($this->view == self::VIEW_SELECTED_ITEMS)
1508  {
1509  $button->setCaption("remove");
1510  }
1511  else
1512  {
1513  $button->setCaption("pd_unsubscribe_memberships");
1514  }
1515  $button->setCommand("confirmRemove");
1516  $top_tb->addStickyItem($button);
1517 
1518  $button2 = ilSubmitButton::getInstance();
1519  $button2->setCaption("cancel");
1520  $button2->setCommand("getHTML");
1521  $top_tb->addStickyItem($button2);
1522 
1523  $top_tb->setCloseFormTag(false);
1524 
1525  $bot_tb = new ilToolbarGUI();
1526  $bot_tb->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), $lng->txt("actions"));
1527  $bot_tb->addStickyItem($button);
1528  $bot_tb->addStickyItem($button2);
1529  $bot_tb->setOpenFormTag(false);
1530 
1531  return $top_tb->getHTML().$this->getHTML().$bot_tb->getHTML();
1532  }
1533 
1534  public function confirmRemoveObject()
1535  {
1536  global $ilCtrl;
1537 
1538  $ilCtrl->setParameter($this, 'view', $this->view);
1539  if(!sizeof($_POST["id"]))
1540  {
1541  ilUtil::sendFailure($this->lng->txt("select_one"), true);
1542  $ilCtrl->redirect($this, "manage");
1543  }
1544 
1545  if($this->view == self::VIEW_SELECTED_ITEMS)
1546  {
1547  $question = $this->lng->txt("pd_info_delete_sure_remove");
1548  $cmd = "confirmedRemove";
1549  }
1550  else
1551  {
1552  $question = $this->lng->txt("pd_info_delete_sure_unsubscribe");
1553  $cmd = "confirmedUnsubscribe";
1554  }
1555 
1556  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1557  $cgui = new ilConfirmationGUI();
1558  $cgui->setHeaderText($question);
1559 
1560  $cgui->setFormAction($ilCtrl->getFormAction($this));
1561  $cgui->setCancel($this->lng->txt("cancel"), "manage");
1562  $cgui->setConfirm($this->lng->txt("confirm"), $cmd);
1563 
1564  foreach ($_POST["id"] as $ref_id)
1565  {
1566  $obj_id = ilObject::_lookupObjectId($ref_id);
1567  $title = ilObject::_lookupTitle($obj_id);
1568  $type = ilObject::_lookupType($obj_id);
1569 
1570  $cgui->addItem("ref_id[]", $ref_id, $title,
1571  ilObject::_getIcon($obj_id, "small", $type),
1572  $this->lng->txt("icon")." ".$this->lng->txt("obj_".$type));
1573  }
1574 
1575  return $cgui->getHTML();
1576  }
1577 
1578  public function confirmedRemove()
1579  {
1580  global $ilCtrl, $ilUser;
1581 
1582  if(!sizeof($_POST["ref_id"]))
1583  {
1584  $ilCtrl->redirect($this, "manage");
1585  }
1586 
1587  foreach($_POST["ref_id"] as $ref_id)
1588  {
1589  $type = ilObject::_lookupType($ref_id, true);
1590  ilObjUser::_dropDesktopItem($ilUser->getId(), $ref_id, $type);
1591  }
1592 
1593  // #12909
1594  ilUtil::sendSuccess($this->lng->txt("pd_remove_multi_confirm"), true);
1595  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1596  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1597  }
1598 
1599  public function confirmedUnsubscribe()
1600  {
1601  global $ilCtrl, $ilAccess, $ilUser;
1602 
1603  if(!sizeof($_POST["ref_id"]))
1604  {
1605  $ilCtrl->redirect($this, "manage");
1606  }
1607 
1608  foreach($_POST["ref_id"] as $ref_id)
1609  {
1610  if($ilAccess->checkAccess("leave", "", $ref_id))
1611  {
1612  switch(ilObject::_lookupType($ref_id, true))
1613  {
1614  case "crs":
1615  // see ilObjCourseGUI:performUnsubscribeObject()
1616  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
1617  $members = new ilCourseParticipants(ilObject::_lookupObjId($ref_id));
1618  $members->delete($ilUser->getId());
1619 
1620  $members->sendUnsubscribeNotificationToAdmins($ilUser->getId());
1621  $members->sendNotification(
1622  $members->NOTIFY_UNSUBSCRIBE,
1623  $ilUser->getId()
1624  );
1625  break;
1626 
1627  case "grp":
1628  // see ilObjGroupGUI:performUnsubscribeObject()
1629  include_once "Modules/Group/classes/class.ilGroupParticipants.php";
1630  $members = new ilGroupParticipants(ilObject::_lookupObjId($ref_id));
1631  $members->delete($ilUser->getId());
1632 
1633  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1634  $members->sendNotification(
1636  $ilUser->getId()
1637  );
1638  $members->sendNotification(
1640  $ilUser->getId()
1641  );
1642  break;
1643 
1644  default:
1645  // do nothing
1646  continue;
1647  }
1648 
1649  include_once './Modules/Forum/classes/class.ilForumNotification.php';
1650  ilForumNotification::checkForumsExistsDelete($ref_id, $ilUser->getId());
1651  }
1652  }
1653 
1654 
1655  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1656  $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
1657  $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
1658  }
1659 }
1660 
1661 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
$path
Definition: aliased.php:25
getSelectedItemsBlockHTML()
get selected item block
static lookupTxtById($plugin_id, $lang_var)
addFooterLink($a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
Add a footer text/link.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
$_GET["client_id"]
$location
Definition: buildRTE.php:44
getMembershipItemsPerType($tpl)
Generates the block html string by type ordering.
getObjectsByMembership($types=array())
Gets all objects the current user is member of.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
$cmd
Definition: sahs_server.php:35
getSelectedItemsPerType(&$tpl)
get selected items per type
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
static _lookupTitle($a_id)
lookup object title
addParentRow(&$a_tpl, $a_ref_id, $a_show_image=true)
adds a header row to a block template
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static addToDesktop()
Add desktop item public.
addStandardRow(&$a_tpl, $a_html, $a_item_ref_id="", $a_item_obj_id="", $a_image_type="", $a_related_header="")
adds a standard row to a block template
static _getAllReferences($a_id)
get all reference ids of object
global $tpl
Definition: ilias.php:8
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupIconPath($a_id, $a_size="big")
lookup icon path
orderPDItemsByLocation()
order desktop items by location
global $ilCtrl
Definition: ilias.php:18
fillDetailRow()
Fill Detail Setting Row.
Preloader for object list GUIs.
$a_type
Definition: workflow.php:93
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
const IL_SCREEN_FULL
$nd
Definition: error.php:11
setTitle($a_title)
Set Title.
$a_content
Definition: workflow.php:94
getSelectedItemsPerLocation(&$tpl)
get selected items per type
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setData($a_data)
Set Data.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
orderPDItemsByType()
order desktop items by Type
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user&#39;s personal desktop
$ilUser
Definition: imgupload.php:18
addHeaderRow(&$a_tpl, $a_type, $a_show_image=true)
adds a header row to a block template
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
& newBlockTemplate()
returns a new list block template
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static checkForumsExistsDelete($ref_id, $user_id=0)
static removeFromDesktop()
Remove item from personal desktop public.
setLimit($a_limit)
Set Limit.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
$ref_id
Definition: sahs_server.php:39
global $ilSetting
Definition: privfeed.php:17
BlockGUI class for Selected Items on Personal Desktop.
getMembershipItemsBlockHTML()
Gateway method to distinguish between sorting type.
global $lng
Definition: privfeed.php:17
global $ilBench
Definition: ilias.php:18
global $ilDB
getColSpan()
Get Columns Span.
& getItemListGUI($a_type)
get item list gui class for type
getMembershipItemsPerLocation($tpl)
Generates the block html string by location ordering.
This class represents a block method of a block.
const IL_SCREEN_SIDE
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
const ID_PART_SCREEN
$_POST["username"]
$html
Definition: example_001.php:87
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
getCurrentDetailLevel()
Get Current Detail Level.
Confirmation screen class.