ILIAS  Release_4_4_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?
 run ()
 Run job.
 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.

Data Fields

const DEFAULT_INACTIVITY_PERIOD = 365
- 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

Private Attributes

 $period = null
 $include_roles = null

Additional Inherited Members

- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)

Detailed Description

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

Constructor & Destructor Documentation

ilCronDeleteInactiveUserAccounts::__construct ( )

Definition at line 22 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
);
}
}

Member Function Documentation

ilCronDeleteInactiveUserAccounts::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Add custom settings to form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

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

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

{
global $lng, $rbacreview, $ilObjDataCache, $ilSetting;
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);
/*
$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::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

References ilCronJob\SCHEDULE_TYPE_DAILY.

ilCronDeleteInactiveUserAccounts::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

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

{
return;
}
ilCronDeleteInactiveUserAccounts::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 53 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 41 of file class.ilCronDeleteInactiveUserAccounts.php.

{
return "user_inactive";
}
ilCronDeleteInactiveUserAccounts::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 46 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 70 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 80 of file class.ilCronDeleteInactiveUserAccounts.php.

{
return true;
}
ilCronDeleteInactiveUserAccounts::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

{
return true;
}
ilCronDeleteInactiveUserAccounts::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

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

References $result, $usr_id, ilObjUser\_getUserIdsByInactivityPeriod(), ilObjectFactory\getInstanceByObjId(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

{
global $rbacreview;
$usr_ids = ilObjUser::_getUserIdsByInactivityPeriod($this->period);
$counter = 0;
foreach($usr_ids as $usr_id)
{
if($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) continue;
$continue = true;
foreach($this->include_roles as $role_id)
{
if( $rbacreview->isAssigned($usr_id, $role_id) )
{
$continue = false;
break;
}
}
if($continue) continue;
$user->delete();
$counter++;
}
if($counter)
{
}
$result->setStatus($status);
return $result;
}

+ Here is the call graph for this function:

ilCronDeleteInactiveUserAccounts::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Save custom settings.

Parameters
ilPropertyFormGUI$a_form
Returns
boolean

Reimplemented from ilCronJob.

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

References $_POST, and $ilSetting.

{
global $ilSetting;
$setting = implode(',', $_POST['cron_inactive_user_delete_include_roles']);
if( !strlen($setting) ) $setting = null;
$ilSetting->set('cron_inactive_user_delete_include_roles', $setting);
$ilSetting->set('cron_inactive_user_delete_period', $_POST['cron_inactive_user_delete_period']);
return true;
}

Field Documentation

ilCronDeleteInactiveUserAccounts::$include_roles = null
private

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

ilCronDeleteInactiveUserAccounts::$period = null
private

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

const ilCronDeleteInactiveUserAccounts::DEFAULT_INACTIVITY_PERIOD = 365

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

Referenced by addCustomSettingsToForm().


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