/**
  * Show user's courses
  */
 public function showMyGroups()
 {
     global $lng, $ilUser, $ilObjDataCache, $tree;
     include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
     $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
     $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
     $_GET['view'] = 'mygroups';
     $lng->loadLanguageModule('crs');
     $this->ctrl->setParameter($this, 'view', 'mygroups');
     include_once 'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
     $table = new ilMailSearchCoursesTableGUI($this, 'grp', $_GET["ref"]);
     $table->setId('search_grps_tbl');
     $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
     $counter = 0;
     $tableData = array();
     if (is_array($grp_ids) && count($grp_ids) > 0) {
         include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
         foreach ($grp_ids as $grp_id) {
             if (ilObject::_hasUntrashedReference($grp_id)) {
                 $oGroupParticipants = ilGroupParticipants::_getInstanceByObjId($grp_id);
                 $grp_members = $oGroupParticipants->getParticipants();
                 foreach ($grp_members as $key => $member) {
                     $tmp_usr = new ilObjUser($member);
                     if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) {
                         unset($grp_members[$key]);
                     }
                 }
                 unset($tmp_usr);
                 $ref_ids = ilObject::_getAllReferences($grp_id);
                 $ref_id = current($ref_ids);
                 $path_arr = $tree->getPathFull($ref_id, $tree->getRootId());
                 $path_counter = 0;
                 $path = '';
                 foreach ($path_arr as $data) {
                     if ($path_counter++) {
                         $path .= " -> ";
                     }
                     $path .= $data['title'];
                 }
                 $path = $this->lng->txt('path') . ': ' . $path;
                 $current_selection_list = new ilAdvancedSelectionListGUI();
                 $current_selection_list->setListTitle($this->lng->txt("actions"));
                 $current_selection_list->setId("act_" . $counter);
                 $this->ctrl->setParameter($this, 'search_grp', $grp_id);
                 $this->ctrl->setParameter($this, 'view', 'mygroups');
                 if ($_GET["ref"] == "mail") {
                     if ($this->mailing_allowed) {
                         $current_selection_list->addItem($this->lng->txt("mail_members"), '', $this->ctrl->getLinkTarget($this, "mail"));
                     }
                 } else {
                     if ($_GET["ref"] == "wsp") {
                         $current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this, "share"));
                     }
                 }
                 $current_selection_list->addItem($this->lng->txt("mail_list_members"), '', $this->ctrl->getLinkTarget($this, "showMembers"));
                 $this->ctrl->clearParameters($this);
                 $rowData = array('CRS_ID' => $grp_id, 'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id), 'CRS_NO_MEMBERS' => count($grp_members), 'CRS_PATH' => $path, 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML());
                 $counter++;
                 $tableData[] = $rowData;
             }
         }
     }
     $table->setData($tableData);
     if ($counter > 0) {
         $this->tpl->setVariable('TXT_MARKED_ENTRIES', $lng->txt('marked_entries'));
     }
     $searchTpl->setVariable('TABLE', $table->getHtml());
     $this->tpl->setContent($searchTpl->get());
     if ($_GET["ref"] != "wsp") {
         $this->tpl->show();
     }
 }
 protected function share()
 {
     global $ilToolbar, $tpl, $ilUser, $ilSetting;
     $options = array();
     $options["user"] = $this->lng->txt("wsp_set_permission_single_user");
     include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
     $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
     if (sizeof($grp_ids)) {
         $options["group"] = $this->lng->txt("wsp_set_permission_group");
     }
     include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
     $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs');
     if (sizeof($crs_ids)) {
         $options["course"] = $this->lng->txt("wsp_set_permission_course");
     }
     if (!$this->getAccessHandler()->hasRegisteredPermission($this->node_id)) {
         $options["registered"] = $this->lng->txt("wsp_set_permission_registered");
     }
     if ($ilSetting->get("enable_global_profiles")) {
         if (!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id)) {
             $options["password"] = $this->lng->txt("wsp_set_permission_all_password");
         }
         if (!$this->getAccessHandler()->hasGlobalPermission($this->node_id)) {
             $options["all"] = $this->lng->txt("wsp_set_permission_all");
         }
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $actions = new ilSelectInputGUI("", "action");
     $actions->setOptions($options);
     $ilToolbar->addInputItem($actions);
     $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
     $ilToolbar->addFormButton($this->lng->txt("add"), "addpermissionhandler");
     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessTableGUI.php";
     $table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler());
     $tpl->setContent($table->getHTML() . $this->footer);
 }