public function saveCustomSettings(ilPropertyFormGUI $a_form)
 {
     global $ilSetting, $lng;
     $lng->loadLanguageModule("user");
     $setting = implode(',', $_POST['cron_inactive_user_delete_include_roles']);
     if (!strlen($setting)) {
         $setting = null;
     }
     $valid = true;
     $delete_period = ilUtil::stripSlashes($_POST['cron_inactive_user_delete_period']);
     $reminder_period = ilUtil::stripSlashes($_POST['cron_inactive_user_reminder_period']);
     $cron_period = (int) ilUtil::stripSlashes($_POST['type']);
     $cron_period_custom = (int) ilUtil::stripSlashes($_POST['sdyi']);
     if ($this->isDecimal($delete_period)) {
         $valid = false;
         $a_form->getItemByPostVar('cron_inactive_user_delete_period')->setAlert($lng->txt('send_mail_to_inactive_users_numbers_only'), 'send_mail_to_inactive_users_numbers_only');
     }
     if ($this->isDecimal($reminder_period)) {
         $valid = false;
         $a_form->getItemByPostVar('cron_inactive_user_reminder_period')->setAlert($lng->txt('send_mail_to_inactive_users_numbers_only'), 'send_mail_to_inactive_users_numbers_only');
     }
     if ($reminder_period >= $delete_period) {
         $valid = false;
         $a_form->getItemByPostVar('cron_inactive_user_reminder_period')->setAlert($lng->txt('send_mail_to_inactive_users_must_be_smaller_than'), 'send_mail_to_inactive_users_must_be_smaller_than');
     }
     if ($cron_period >= ilCronJob::SCHEDULE_TYPE_IN_DAYS && $cron_period <= ilCronJob::SCHEDULE_TYPE_YEARLY && $reminder_period > 0) {
         $logic = true;
         $check_window_logic = $delete_period - $reminder_period;
         if ($cron_period == ilCronJob::SCHEDULE_TYPE_IN_DAYS) {
             if ($check_window_logic < $cron_period_custom) {
                 $logic = false;
             }
         } else {
             if ($cron_period == ilCronJob::SCHEDULE_TYPE_WEEKLY) {
                 if ($check_window_logic <= 7) {
                     $logic = false;
                 }
             } else {
                 if ($cron_period == ilCronJob::SCHEDULE_TYPE_MONTHLY) {
                     if ($check_window_logic <= 31) {
                         $logic = false;
                     }
                 } else {
                     if ($cron_period == ilCronJob::SCHEDULE_TYPE_QUARTERLY) {
                         if ($check_window_logic <= 92) {
                             $logic = false;
                         }
                     } else {
                         if ($cron_period == ilCronJob::SCHEDULE_TYPE_YEARLY) {
                             if ($check_window_logic <= 366) {
                                 $logic = false;
                             }
                         }
                     }
                 }
             }
         }
         if (!$logic) {
             $valid = false;
             $a_form->getItemByPostVar('cron_inactive_user_reminder_period')->setAlert($lng->txt('send_mail_reminder_window_too_small'), 'send_mail_reminder_window_too_small');
         }
     }
     if ($_POST['cron_inactive_user_delete_period']) {
         $ilSetting->set('cron_inactive_user_delete_include_roles', $setting);
         $ilSetting->set('cron_inactive_user_delete_period', $_POST['cron_inactive_user_delete_period']);
     }
     if ($this->reminderTimer > $reminder_period) {
         ilCronDeleteInactiveUserReminderMail::flushDataTable();
     }
     $ilSetting->set('cron_inactive_user_reminder_period', $reminder_period);
     if (!$valid) {
         ilUtil::sendFailure($lng->txt("form_input_not_valid"));
         return false;
     }
     return true;
 }
Beispiel #2
0
 /**
  * deletes a user
  * @access	public
  * @param	integer		user_id
  */
 function delete()
 {
     global $rbacadmin, $ilDB;
     // deassign from ldap groups
     include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php';
     $mapping = ilLDAPRoleGroupMapping::_getInstance();
     $mapping->deleteUser($this->getId());
     // remove mailbox / update sent mails
     include_once "Services/Mail/classes/class.ilMailbox.php";
     $mailbox = new ilMailbox($this->getId());
     $mailbox->delete();
     $mailbox->updateMailsOfDeletedUser($this->getLogin());
     // delete feed blocks on personal desktop
     include_once "./Services/Block/classes/class.ilCustomBlock.php";
     $costum_block = new ilCustomBlock();
     $costum_block->setContextObjId($this->getId());
     $costum_block->setContextObjType("user");
     $c_blocks = $costum_block->queryBlocksForContext();
     include_once "./Services/Feeds/classes/class.ilPDExternalFeedBlock.php";
     foreach ($c_blocks as $c_block) {
         if ($c_block["type"] == "pdfeed") {
             $fb = new ilPDExternalFeedBlock($c_block["id"]);
             $fb->delete();
         }
     }
     // delete block settings
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     ilBlockSetting::_deleteSettingsOfUser($this->getId());
     // delete user_account
     $ilDB->manipulateF("DELETE FROM usr_data WHERE usr_id = %s", array("integer"), array($this->getId()));
     $this->deleteMultiTextFields();
     // delete user_prefs
     ilObjUser::_deleteAllPref($this->getId());
     $this->removeUserPicture(false);
     // #8597
     // delete user_session
     include_once "./Services/Authentication/classes/class.ilSession.php";
     ilSession::_destroyByUserId($this->getId());
     // remove user from rbac
     $rbacadmin->removeUser($this->getId());
     // remove bookmarks
     // TODO: move this to class.ilBookmarkFolder
     $q = "DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     $q = "DELETE FROM bookmark_data WHERE user_id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     // DELETE FORUM ENTRIES (not complete in the moment)
     include_once './Modules/Forum/classes/class.ilObjForum.php';
     ilObjForum::_deleteUser($this->getId());
     // Delete link check notify entries
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     ilLinkCheckNotify::_deleteUser($this->getId());
     // Delete crs entries
     include_once './Modules/Course/classes/class.ilObjCourse.php';
     ilObjCourse::_deleteUser($this->getId());
     // Delete user tracking
     include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
     ilObjUserTracking::_deleteUser($this->getId());
     include_once 'Modules/Session/classes/class.ilEventParticipants.php';
     ilEventParticipants::_deleteByUser($this->getId());
     // Delete Tracking data SCORM 2004 RTE
     include_once 'Modules/Scorm2004/classes/ilSCORM13Package.php';
     ilSCORM13Package::_removeTrackingDataForUser($this->getId());
     // Delete Tracking data SCORM 1.2 RTE
     include_once 'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
     ilObjSCORMLearningModule::_removeTrackingDataForUser($this->getId());
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForUser($this->getId());
     // remove portfolios
     include_once "./Modules/Portfolio/classes/class.ilObjPortfolio.php";
     ilObjPortfolio::deleteUserPortfolios($this->getId());
     // remove workspace
     include_once "./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
     $tree = new ilWorkspaceTree($this->getId());
     $tree->cascadingDelete();
     // remove disk quota entries
     include_once "./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::deleteByOwner($this->getId());
     // remove reminder entries
     require_once 'Services/User/classes/class.ilCronDeleteInactiveUserReminderMail.php';
     ilCronDeleteInactiveUserReminderMail::removeSingleUserFromTable($this->getId());
     // Delete user defined field entries
     $this->deleteUserDefinedFieldEntries();
     // Delete clipboard entries
     $this->clipboardDeleteAll();
     // Reset owner
     $this->resetOwner();
     include_once 'Services/Contact/classes/class.ilAddressbook.php';
     ilAddressbook::onUserDeletion($this);
     // Trigger deleteUser Event
     global $ilAppEventHandler;
     $ilAppEventHandler->raise('Services/User', 'deleteUser', array('usr_id' => $this->getId()));
     // delete object data
     parent::delete();
     return true;
 }