/**
  * Remove item from personal desktop
  * @access public
  */
 public static function removeFromDesktop()
 {
     global $ilUser;
     if ($_GET["item_ref_id"] and $_GET["type"]) {
         ilObjUser::_dropDesktopItem($ilUser->getId(), (int) $_GET['item_ref_id'], $_GET['type']);
     } else {
         if ($_POST["items"]) {
             foreach ($_POST["items"] as $item) {
                 $type = ilObject::_lookupType($item, true);
                 ilObjUser::_dropDesktopItem($ilUser->getId(), $item, $type);
             }
         }
     }
     return true;
 }
 /**
  * Drop desktop item
  *
  * @access public
  * @param int usr_id
  * 
  */
 function dropDesktopItem($a_usr_id)
 {
     if (ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
         ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id, $this->type);
     }
     return true;
 }
 public function confirmedRemove()
 {
     global $ilCtrl, $ilUser;
     if (!sizeof($_POST["ref_id"])) {
         $ilCtrl->redirect($this, "manage");
     }
     foreach ($_POST["ref_id"] as $ref_id) {
         $type = ilObject::_lookupType($ref_id, true);
         ilObjUser::_dropDesktopItem($ilUser->getId(), $ref_id, $type);
     }
     ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
     $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
 }
 /**
 * Disinvites a user from a survey
 *
 * @param integer $user_id The database id of the disinvited user
 */
 public function disinviteUser($user_id)
 {
     global $ilDB;
     $affectedRows = $ilDB->manipulateF("DELETE FROM svy_inv_usr WHERE survey_fi = %s AND user_fi = %s", array('integer', 'integer'), array($this->getSurveyId(), $user_id));
     include_once './Services/User/classes/class.ilObjUser.php';
     ilObjUser::_dropDesktopItem($user_id, $this->getRefId(), "svy");
 }
 /**
  * Detachs a user from a role.
  */
 function detachFromRole($a_user_obj, $a_role_id)
 {
     global $rbacreview, $rbacadmin, $tree;
     $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
     if (substr(ilObject::_lookupTitle($a_role_id), 0, 6) == 'il_crs' or substr(ilObject::_lookupTitle($a_role_id), 0, 6) == 'il_grp') {
         $obj = $rbacreview->getObjectOfRole($a_role_id);
         $ref = ilObject::_getAllReferences($obj);
         $ref_id = end($ref);
         ilObjUser::_dropDesktopItem($a_user_obj->getId(), $ref_id, ilObject::_lookupType($obj));
     }
 }
 public function deleteCrsGrpMembers($sco_id, $delete_user_ids)
 {
     $this->pluginObj->includeClass('class.ilAdobeConnectRoles.php');
     $this->pluginObj->includeClass('class.ilXAVCMembers.php');
     $xavcRoles = new ilAdobeConnectRoles($this->getRefId());
     if (is_array($delete_user_ids) && count($delete_user_ids) > 0) {
         foreach ($delete_user_ids as $usr_id) {
             $xavcRoles->detachMemberRole($usr_id);
             ilXAVCMembers::deleteXAVCMember($usr_id, $this->getRefId());
             $xavc_login = ilXAVCMembers::_lookupXAVCLogin($usr_id);
             $session = $this->xmlApi->getBreezeSession();
             if ($session != NULL && $this->xmlApi->login($this->adminLogin, $this->adminPass, $session)) {
                 $this->xmlApi->deleteMeetingParticipant($sco_id, $xavc_login, $session);
             }
             //remove from pd
             ilObjUser::_dropDesktopItem($usr_id, $this->getRefId(), 'xavc');
         }
     }
 }
 protected function assignGroups()
 {
     if (count($this->getAssignedGroupes()) == 0) {
         return false;
     }
     foreach ($this->getAssignedGroupes() as $grp_obj_id) {
         if (ilObject2::_lookupType($grp_obj_id) != 'grp') {
             continue;
         }
         $part = ilGroupParticipants::_getInstanceByObjId($grp_obj_id);
         $usr_id = $this->getUsrObject()->getId();
         $part->add($usr_id, IL_GRP_MEMBER);
         $all_refs = ilObject2::_getAllReferences($grp_obj_id);
         $first = array_shift(array_values($all_refs));
         ilObjUser::_dropDesktopItem($usr_id, $first, 'grp');
     }
 }
 /**
  * drop an item from user's personal desktop
  *
  * @param	int		$a_item_id		ref_id for objects, that are in the main tree
  *									(learning modules, forums) obj_id for others
  * @param	string	$a_type			object type
  */
 function dropDesktopItem($a_item_id, $a_type)
 {
     ilObjUser::_dropDesktopItem($this->getId(), $a_item_id, $a_type);
 }
 public function performDetachMember()
 {
     $this->pluginObj->includeClass('class.ilAdobeConnectRoles.php');
     $this->pluginObj->includeClass('class.ilXAVCMembers.php');
     $xavcRoles = new ilAdobeConnectRoles($this->object->getRefId());
     $detach_user_ids = array();
     $detach_user_ids = $_POST['usr_id'];
     foreach ($detach_user_ids as $usr_id) {
         $is_admin = $xavcRoles->isAdministrator($usr_id);
         $xavcRoles->detachMemberRole($usr_id);
         if (!$is_admin) {
             $xavc_login = ilXAVCMembers::_lookupXAVCLogin($usr_id);
             ilXAVCMembers::deleteXAVCMember($usr_id, $this->object->getRefId());
             $this->object->deleteParticipant($xavc_login);
         }
         //remove from pd
         ilObjUser::_dropDesktopItem($usr_id, $this->object->getRefId(), 'xavc');
     }
     ilUtil::sendInfo($this->txt('participants_detached_successfully'));
     return $this->editParticipants();
 }
 /**
  * Perform update
  * @param type $a_content_id
  * @param type $course
  */
 protected function doUpdate($a_usr_id, ilECSEnrolmentStatus $status)
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
     $obj_ids = ilECSImport::lookupObjIdsByContentId($status->getId());
     $obj_id = end($obj_ids);
     $ref_ids = ilObject::_getAllReferences($obj_id);
     $ref_id = end($ref_ids);
     if (!$ref_id) {
         // Remote object not found
         return TRUE;
     }
     switch ($status->getStatus()) {
         case ilECSEnrolmentStatus::STATUS_PENDING:
             // nothing todo in the moment: maybe send mail
             break;
         case ilECSEnrolmentStatus::STATUS_ACTIVE:
             $GLOBALS['ilLog']->write(__METHOD__ . ': Add desktop item: ' . $a_usr_id . ' ' . $ref_id . ' ' . $obj_id);
             ilObjUser::_addDesktopItem($a_usr_id, $ref_id, ilObject::_lookupType($obj_id));
             break;
         case ilECSEnrolmentStatus::STATUS_ACCOUNT_DEACTIVATED:
         case ilECSEnrolmentStatus::STATUS_DENIED:
         case ilECSEnrolmentStatus::STATUS_REJECTED:
         case ilECSEnrolmentStatus::STATUS_UNSUBSCRIBED:
             $GLOBALS['ilLog']->write(__METHOD__ . ': Remove desktop item: ' . $a_usr_id . ' ' . $ref_id . ' ' . $obj_id);
             ilObjUser::_dropDesktopItem($a_usr_id, $ref_id, ilObject::_lookupType($obj_id));
             break;
     }
     return TRUE;
 }
 public function confirmedRemove()
 {
     global $ilCtrl, $ilUser;
     if (!sizeof($_POST["ref_id"])) {
         $ilCtrl->redirect($this, "manage");
     }
     foreach ($_POST["ref_id"] as $ref_id) {
         $type = ilObject::_lookupType($ref_id, true);
         ilObjUser::_dropDesktopItem($ilUser->getId(), $ref_id, $type);
     }
     // #12909
     ilUtil::sendSuccess($this->lng->txt("pd_remove_multi_confirm"), true);
     $ilCtrl->setParameterByClass('ilpersonaldesktopgui', 'view', $this->view);
     $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
 }