ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCronDeleteInactiveUserAccounts Class Reference
+ Inheritance diagram for ilCronDeleteInactiveUserAccounts:
+ Collaboration diagram for ilCronDeleteInactiveUserAccounts:

Public Member Functions

 __construct ()
 getId ()
 Get id.
 getTitle ()
 Get title.
 getDescription ()
 Get description.
 getDefaultScheduleType ()
 Get schedule type.
 getDefaultScheduleValue ()
 Get schedule value.
 hasAutoActivation ()
 Is to be activated on "installation".
 hasFlexibleSchedule ()
 Can the schedule be configured?
 hasCustomSettings ()
 Has cron job any custom setting which can be edited?
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form.
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings.
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active?
 getScheduleType ()
 Get current schedule type (if flexible)
 getScheduleValue ()
 Get current schedule value (if flexible)
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible)
 getValidScheduleTypes ()
 Get all available schedule types.
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually.
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form.
 activationWasToggled ($a_currently_active)
 Cron job status was changed.
 run ()
 Run job.

Data Fields

const DEFAULT_INACTIVITY_PERIOD = 365
const DEFAULT_REMINDER_PERIOD = 0
- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
const SCHEDULE_TYPE_IN_MINUTES = 2
const SCHEDULE_TYPE_IN_HOURS = 3
const SCHEDULE_TYPE_IN_DAYS = 4
const SCHEDULE_TYPE_WEEKLY = 5
const SCHEDULE_TYPE_MONTHLY = 6
const SCHEDULE_TYPE_QUARTERLY = 7
const SCHEDULE_TYPE_YEARLY = 8

Protected Member Functions

 getTimeDifferenceBySchedule ($schedule_time, $multiplier)
 calculateDeletionData ($date_for_deletion)
 isDecimal ($number)
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)

Private Attributes

 $period = null
 $reminderTimer = null
 $include_roles = null

Detailed Description

Definition at line 17 of file class.ilCronDeleteInactiveUserAccounts.php.

Constructor & Destructor Documentation

ilCronDeleteInactiveUserAccounts::__construct ( )

Definition at line 26 of file class.ilCronDeleteInactiveUserAccounts.php.

References $ilSetting.

{
global $ilSetting;
if(is_object($ilSetting))
{
$this->include_roles = $ilSetting->get(
'cron_inactive_user_delete_include_roles', null
);
if($this->include_roles === null) $this->include_roles = array();
else $this->include_roles = explode(',', $this->include_roles);
$this->period = $ilSetting->get(
'cron_inactive_user_delete_period',
self::DEFAULT_INACTIVITY_PERIOD
);
$this->reminderTimer = $ilSetting->get(
'cron_inactive_user_reminder_period',
self::DEFAULT_REMINDER_PERIOD
);
}
}

Member Function Documentation

ilCronDeleteInactiveUserAccounts::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Add custom settings to form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

Definition at line 218 of file class.ilCronDeleteInactiveUserAccounts.php.

References $ilSetting, $lng, ilPropertyFormGUI\addItem(), DEFAULT_INACTIVITY_PERIOD, ilPropertyFormGUI\getItemByPostVar(), and ilFormPropertyGUI\setInfo().

{
global $lng, $rbacreview, $ilObjDataCache, $ilSetting;
$lng->loadLanguageModule("user");
$schedule = $a_form->getItemByPostVar('type');
$schedule->setTitle($lng->txt('delete_inactive_user_accounts_frequency'),
'delete_inactive_user_accounts_frequency');
$schedule->setInfo($lng->txt('delete_inactive_user_accounts_frequency_desc'),
'delete_inactive_user_accounts_frequency_desc');
include_once('Services/Form/classes/class.ilMultiSelectInputGUI.php');
$sub_mlist = new ilMultiSelectInputGUI(
$lng->txt('delete_inactive_user_accounts_include_roles'),
'cron_inactive_user_delete_include_roles'
);
$sub_mlist->setInfo($lng->txt('delete_inactive_user_accounts_include_roles_desc'));
$roles = array();
foreach($rbacreview->getGlobalRoles() as $role_id)
{
if( $role_id != ANONYMOUS_ROLE_ID )
$roles[$role_id] = $ilObjDataCache->lookupTitle($role_id);
}
$sub_mlist->setOptions($roles);
$setting = $ilSetting->get('cron_inactive_user_delete_include_roles', null);
if($setting === null) $setting = array();
else $setting = explode(',', $setting);
$sub_mlist->setValue($setting);
$sub_mlist->setWidth(300);
#$sub_mlist->setHeight(100);
$a_form->addItem($sub_mlist);
$default_setting = self::DEFAULT_INACTIVITY_PERIOD;
$sub_text = new ilNumberInputGUI(
$lng->txt('delete_inactive_user_accounts_period'),
'cron_inactive_user_delete_period'
);
$sub_text->setInfo($lng->txt('delete_inactive_user_accounts_period_desc'));
$sub_text->setValue($ilSetting->get("cron_inactive_user_delete_period", $default_setting));
$sub_text->setSize(4);
$sub_text->setMaxLength(4);
$sub_text->setRequired(true);
$a_form->addItem($sub_text);
$sub_period = new ilNumberInputGUI(
$lng->txt('send_mail_to_inactive_users'),
'cron_inactive_user_reminder_period'
);
$sub_period->setInfo($lng->txt("send_mail_to_inactive_users_desc"));
$sub_period->setValue($ilSetting->get("cron_inactive_user_reminder_period", $default_setting));
$sub_period->setSuffix($lng->txt("send_mail_to_inactive_users_suffix"));
$sub_period->setSize(4);
$sub_period->setMaxLength(4);
$sub_period->setRequired(false);
$sub_period->setMinValue(0);
$a_form->addItem($sub_period);
/*
$default_setting = ilCronDeleteInactiveUserAccounts::DEFAULT_SETTING_INCLUDE_ADMINS;
$sub_cb = new ilCheckboxInputGUI($lng->txt('delete_inactive_user_accounts_include_admins'),'cron_inactive_user_delete_include_admins');
$sub_cb->setChecked($ilSetting->get("cron_inactive_user_delete_include_admins", $default_setting) ? 1 : 0 );
//$sub_cb->setOptionTitle($lng->txt('delete_inactive_user_accounts_include_admins'));
$sub_cb->setInfo($lng->txt('delete_inactive_user_accounts_include_admins_desc'));
$a_form->addItem($sub_cb);
*/
}

+ Here is the call graph for this function:

ilCronDeleteInactiveUserAccounts::calculateDeletionData (   $date_for_deletion)
protected

Definition at line 196 of file class.ilCronDeleteInactiveUserAccounts.php.

References ilCronManager\getCronJobData(), getId(), and getTimeDifferenceBySchedule().

{
$cron_timing = ilCronManager::getCronJobData($this->getId());
$time_difference = 0;
$multiplier = 1;
if(!is_array($cron_timing) || !is_array($cron_timing[0]))
{
return time() + $date_for_deletion + $time_difference;
}
if(array_key_exists('schedule_type', $cron_timing[0]))
{
if((array_key_exists('schedule_type', $cron_timing[0]) && $cron_timing[0]['schedule_value'] != null))
{
$multiplier = $cron_timing[0]['schedule_value'];
}
$time_difference = $this->getTimeDifferenceBySchedule($cron_timing[0]['schedule_type'], $multiplier);
}
return time() + $date_for_deletion + $time_difference;
}

+ Here is the call graph for this function:

ilCronDeleteInactiveUserAccounts::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 106 of file class.ilCronDeleteInactiveUserAccounts.php.

References ilCronJob\SCHEDULE_TYPE_DAILY.

ilCronDeleteInactiveUserAccounts::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 111 of file class.ilCronDeleteInactiveUserAccounts.php.

{
return;
}
ilCronDeleteInactiveUserAccounts::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 99 of file class.ilCronDeleteInactiveUserAccounts.php.

References $lng.

{
global $lng;
return $lng->txt("delete_inactive_user_accounts_desc");
}
ilCronDeleteInactiveUserAccounts::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 87 of file class.ilCronDeleteInactiveUserAccounts.php.

Referenced by calculateDeletionData().

{
return "user_inactive";
}

+ Here is the caller graph for this function:

ilCronDeleteInactiveUserAccounts::getTimeDifferenceBySchedule (   $schedule_time,
  $multiplier 
)
protected
Parameters
$schedule_time
$multiplier
Returns
int

Definition at line 54 of file class.ilCronDeleteInactiveUserAccounts.php.

References ilCronJob\SCHEDULE_TYPE_DAILY, ilCronJob\SCHEDULE_TYPE_IN_DAYS, ilCronJob\SCHEDULE_TYPE_IN_HOURS, ilCronJob\SCHEDULE_TYPE_IN_MINUTES, ilCronJob\SCHEDULE_TYPE_MONTHLY, ilCronJob\SCHEDULE_TYPE_QUARTERLY, ilCronJob\SCHEDULE_TYPE_WEEKLY, and ilCronJob\SCHEDULE_TYPE_YEARLY.

Referenced by calculateDeletionData().

{
$time_difference = 0;
switch($schedule_time)
{
$time_difference = 86400;
break;
$time_difference = 60 * $multiplier;
break;
$time_difference = 3600 * $multiplier;
break;
$time_difference = 86400 * $multiplier;
break;
$time_difference = 604800;
break;
$time_difference = 2629743;
break;
$time_difference = 7889229;
break;
$time_difference = 31556926;
break;
}
return $time_difference;
}

+ Here is the caller graph for this function:

ilCronDeleteInactiveUserAccounts::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 92 of file class.ilCronDeleteInactiveUserAccounts.php.

References $lng.

{
global $lng;
return $lng->txt("delete_inactive_user_accounts");
}
ilCronDeleteInactiveUserAccounts::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 116 of file class.ilCronDeleteInactiveUserAccounts.php.

{
return false;
}
ilCronDeleteInactiveUserAccounts::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 126 of file class.ilCronDeleteInactiveUserAccounts.php.

{
return true;
}
ilCronDeleteInactiveUserAccounts::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 121 of file class.ilCronDeleteInactiveUserAccounts.php.

{
return true;
}
ilCronDeleteInactiveUserAccounts::isDecimal (   $number)
protected

Definition at line 380 of file class.ilCronDeleteInactiveUserAccounts.php.

Referenced by saveCustomSettings().

{
if(strpos($number,',') || strpos($number,'.'))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilCronDeleteInactiveUserAccounts::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Save custom settings.

Parameters
ilPropertyFormGUI$a_form
Returns
boolean

Reimplemented from ilCronJob.

Definition at line 284 of file class.ilCronDeleteInactiveUserAccounts.php.

References $_POST, $ilSetting, $lng, $valid, ilCronDeleteInactiveUserReminderMail\flushDataTable(), ilPropertyFormGUI\getItemByPostVar(), isDecimal(), ilCronJob\SCHEDULE_TYPE_IN_DAYS, ilCronJob\SCHEDULE_TYPE_MONTHLY, ilCronJob\SCHEDULE_TYPE_QUARTERLY, ilCronJob\SCHEDULE_TYPE_WEEKLY, ilCronJob\SCHEDULE_TYPE_YEARLY, ilUtil\sendFailure(), and ilUtil\stripSlashes().

{
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($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)
{
}
$ilSetting->set('cron_inactive_user_reminder_period', $reminder_period);
if(!$valid)
{
ilUtil::sendFailure($lng->txt("form_input_not_valid"));
return false;
}
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilCronDeleteInactiveUserAccounts::$include_roles = null
private

Definition at line 24 of file class.ilCronDeleteInactiveUserAccounts.php.

ilCronDeleteInactiveUserAccounts::$period = null
private

Definition at line 22 of file class.ilCronDeleteInactiveUserAccounts.php.

ilCronDeleteInactiveUserAccounts::$reminderTimer = null
private

Definition at line 23 of file class.ilCronDeleteInactiveUserAccounts.php.

const ilCronDeleteInactiveUserAccounts::DEFAULT_INACTIVITY_PERIOD = 365

Definition at line 19 of file class.ilCronDeleteInactiveUserAccounts.php.

Referenced by addCustomSettingsToForm().

const ilCronDeleteInactiveUserAccounts::DEFAULT_REMINDER_PERIOD = 0

Definition at line 20 of file class.ilCronDeleteInactiveUserAccounts.php.


The documentation for this class was generated from the following file: