ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSSettings Class Reference
+ Collaboration diagram for ilECSSettings:

Public Member Functions

 setEnabledStatus ($a_status)
 en/disable ecs functionality
 isEnabled ()
 is enabled
 setServer ($a_server)
 set server
 getServer ()
 get server
 getServerURI ()
 get complete server uri
 setProtocol ($a_prot)
 set protocol
 getProtocol ()
 get protocol
 setPort ($a_port)
 set port
 getPort ()
 get port
 setPollingTime ($a_time)
 set polling time
 getPollingTime ()
 get polling time
 getPollingTimeSeconds ()
 get polling time seconds (<60)
 getPollingTimeMinutes ()
 get polling time minutes
 setPollingTimeMS ($a_min, $a_sec)
 Set polling time.
 setClientCertPath ($a_path)
 set
 getClientCertPath ()
 get certificate path
 setCACertPath ($a_ca)
 set ca cert path
 getCACertPath ()
 get ca cert path
 getKeyPath ()
 get key path
 setKeyPath ($a_path)
 set key path
 getKeyPassword ()
 get key password
 setKeyPassword ($a_pass)
 set key password
 setImportId ($a_id)
 set import id Object of category, that store new remote courses
 getImportId ()
 get import id
 setCertSerialNumber ($a_cert_serial)
 set cert serial number
 getCertSerialNumber ()
 get cert serial number
 getGlobalRole ()
 get global role
 setGlobalRole ($a_role_id)
 set default global role
 setDuration ($a_duration)
 set Duration
 getDuration ()
 get duration
 getUserRecipients ()
 Get new user recipients.
 getUserRecipientsAsString ()
 Get new user recipients.
 setUserRecipients ($a_logins)
 set user recipients
 getEContentRecipients ()
 get Econtent recipients
 getEContentRecipientsAsString ()
 get EContent recipients as string
 setEContentRecipients ($a_logins)
 set EContent recipients
 getApprovalRecipients ()
 get approval recipients
 getApprovalRecipientsAsString ()
 get approval recipients as string
 setApprovalRecipients ($a_rcp)
 set approval recipients
 validate ()
 Validate settings.
 checkImportId ()
 check import id
 save ()
 save settings

Static Public Member Functions

static _getInstance ()
 singleton getInstance

Data Fields

const ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'
const ERROR_REQUIRED = 'fill_out_all_required_fields'
const ERROR_INVALID_IMPORT_ID = 'ecs_check_import_id'
const DEFAULT_DURATION = 6
const PROTOCOL_HTTP = 0
const PROTOCOL_HTTPS = 1

Static Protected Attributes

static $instance = null

Private Member Functions

 __construct ()
 Singleton contructor.
 fetchSerialID ()
 Fetch serial ID from cert.
 initStorage ()
 Init storage class (ilSetting) private.
 read ()
 Read settings.

Private Attributes

 $active = false
 $server
 $protocol
 $port
 $client_cert_path
 $ca_cert_path
 $key_path
 $key_pathword
 $polling
 $import_id
 $cert_serial
 $global_role
 $duration
 $user_recipients = array()
 $econtent_recipients = array()
 $approval_recipients = array()

Detailed Description

Definition at line 33 of file class.ilECSSettings.php.

Constructor & Destructor Documentation

ilECSSettings::__construct ( )
private

Singleton contructor.

private

Definition at line 70 of file class.ilECSSettings.php.

References initStorage(), and read().

{
$this->initStorage();
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilECSSettings::checkImportId ( )

check import id

public

Definition at line 589 of file class.ilECSSettings.php.

References getImportId().

Referenced by validate().

{
global $ilObjDataCache,$tree;
if(!$this->getImportId())
{
return false;
}
if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) != 'cat')
{
return false;
}
if($tree->isDeleted($this->getImportId()))
{
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettings::fetchSerialID ( )
private

Fetch serial ID from cert.

private

Definition at line 640 of file class.ilECSSettings.php.

References $ilLog, getClientCertPath(), and setCertSerialNumber().

Referenced by validate().

{
global $ilLog;
if(function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://'.$this->getClientCertPath()))
{
if(isset($cert['serialNumber']) and $cert['serialNumber'])
{
$this->setCertSerialNumber($cert['serialNumber']);
$ilLog->write(__METHOD__.': Serial number is '.$cert['serialNumber']);
return true;
}
}
if(!file_exists($this->getClientCertPath()) or !is_readable($this->getClientCertPath()))
{
return false;
}
$lines = file($this->getClientCertPath());
$found = false;
foreach($lines as $line)
{
if(strpos($line,'Serial Number:') !== false)
{
$found = true;
$serial_line = explode(':',$line);
$serial = (int) trim($serial_line[1]);
break;
}
}
if($found)
{
$this->setCertSerialNumber($serial);
return true;
}
else
{
return false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettings::getApprovalRecipients ( )

get approval recipients

public

Returns
bool

Definition at line 522 of file class.ilECSSettings.php.

{
return explode(',',$this->approval_recipients);
}
ilECSSettings::getApprovalRecipientsAsString ( )

get approval recipients as string

public

Parameters
@return

Definition at line 534 of file class.ilECSSettings.php.

References $approval_recipients.

Referenced by save().

+ Here is the caller graph for this function:

ilECSSettings::getCACertPath ( )

get ca cert path

public

Definition at line 306 of file class.ilECSSettings.php.

References $ca_cert_path.

Referenced by save(), and validate().

{
}

+ Here is the caller graph for this function:

ilECSSettings::getCertSerialNumber ( )

get cert serial number

public

Definition at line 397 of file class.ilECSSettings.php.

Referenced by save().

{
return $this->cert_serial_number;
}

+ Here is the caller graph for this function:

ilECSSettings::getClientCertPath ( )

get certificate path

public

Definition at line 283 of file class.ilECSSettings.php.

References $client_cert_path.

Referenced by fetchSerialID(), save(), and validate().

+ Here is the caller graph for this function:

ilECSSettings::getDuration ( )

get duration

public

Definition at line 443 of file class.ilECSSettings.php.

References DEFAULT_DURATION.

Referenced by save(), and validate().

{
return $this->duration ? $this->duration : self::DEFAULT_DURATION;
}

+ Here is the caller graph for this function:

ilECSSettings::getEContentRecipients ( )

get Econtent recipients

public

Definition at line 488 of file class.ilECSSettings.php.

{
return explode(',',$this->econtent_recipients);
}
ilECSSettings::getEContentRecipientsAsString ( )

get EContent recipients as string

public

Definition at line 499 of file class.ilECSSettings.php.

References $econtent_recipients.

Referenced by save().

+ Here is the caller graph for this function:

ilECSSettings::getGlobalRole ( )

get global role

public

Definition at line 408 of file class.ilECSSettings.php.

References $global_role.

Referenced by save(), and validate().

{
}

+ Here is the caller graph for this function:

ilECSSettings::getImportId ( )

get import id

public

Definition at line 374 of file class.ilECSSettings.php.

References $import_id.

Referenced by checkImportId(), save(), and validate().

{
}

+ Here is the caller graph for this function:

ilECSSettings::getKeyPassword ( )

get key password

public

Definition at line 340 of file class.ilECSSettings.php.

Referenced by save(), and validate().

{
return $this->key_password;
}

+ Here is the caller graph for this function:

ilECSSettings::getKeyPath ( )

get key path

public

Definition at line 317 of file class.ilECSSettings.php.

References $key_path.

Referenced by save(), and validate().

{
}

+ Here is the caller graph for this function:

ilECSSettings::getPollingTime ( )

get polling time

public

Definition at line 226 of file class.ilECSSettings.php.

References $polling.

Referenced by save(), and validate().

{
}

+ Here is the caller graph for this function:

ilECSSettings::getPollingTimeMinutes ( )

get polling time minutes

public

Definition at line 248 of file class.ilECSSettings.php.

{
return (int) ($this->polling / 60);
}
ilECSSettings::getPollingTimeSeconds ( )

get polling time seconds (<60)

public

Definition at line 237 of file class.ilECSSettings.php.

{
return (int) ($this->polling % 60);
}
ilECSSettings::getPort ( )

get port

public

Parameters

Definition at line 203 of file class.ilECSSettings.php.

References $port.

Referenced by getServerURI(), save(), and validate().

{
return $this->port;
}

+ Here is the caller graph for this function:

ilECSSettings::getProtocol ( )

get protocol

public

Definition at line 179 of file class.ilECSSettings.php.

References $protocol.

Referenced by getServerURI(), and save().

{
}

+ Here is the caller graph for this function:

ilECSSettings::getServer ( )

get server

public

Parameters

Definition at line 134 of file class.ilECSSettings.php.

References $server.

Referenced by getServerURI(), save(), and validate().

{
return $this->server;
}

+ Here is the caller graph for this function:

ilECSSettings::getServerURI ( )

get complete server uri

public

Definition at line 145 of file class.ilECSSettings.php.

References getPort(), getProtocol(), and getServer().

{
switch($this->getProtocol())
{
case self::PROTOCOL_HTTP:
$uri = 'http://';
break;
case self::PROTOCOL_HTTPS:
$uri = 'https://';
break;
}
$uri .= $this->getServer().':'.$this->getPort();
return $uri;
}

+ Here is the call graph for this function:

ilECSSettings::getUserRecipients ( )

Get new user recipients.

public

Definition at line 454 of file class.ilECSSettings.php.

{
return explode(',',$this->user_recipients);
}
ilECSSettings::getUserRecipientsAsString ( )

Get new user recipients.

public

Definition at line 465 of file class.ilECSSettings.php.

References $user_recipients.

Referenced by save().

+ Here is the caller graph for this function:

ilECSSettings::initStorage ( )
private

Init storage class (ilSetting) private.

Definition at line 688 of file class.ilECSSettings.php.

Referenced by __construct().

{
include_once('./Services/Administration/classes/class.ilSetting.php');
$this->storage = new ilSetting('ecs');
}

+ Here is the caller graph for this function:

ilECSSettings::isEnabled ( )

is enabled

public

Definition at line 110 of file class.ilECSSettings.php.

References $active.

Referenced by save(), and validate().

{
return $this->active;
}

+ Here is the caller graph for this function:

ilECSSettings::read ( )
private

Read settings.

private

Definition at line 699 of file class.ilECSSettings.php.

References setCACertPath(), setCertSerialNumber(), setClientCertPath(), setDuration(), setEnabledStatus(), setGlobalRole(), setImportId(), setKeyPassword(), setKeyPath(), setPollingTime(), setPort(), setProtocol(), and setServer().

Referenced by __construct().

{
$this->setServer($this->storage->get('server'));
$this->setProtocol($this->storage->get('protocol'));
$this->setPort($this->storage->get('port'));
$this->setClientCertPath($this->storage->get('client_cert_path'));
$this->setCACertPath($this->storage->get('ca_cert_path'));
$this->setKeyPath($this->storage->get('key_path'));
$this->setKeyPassword($this->storage->get('key_password'));
$this->setPollingTime($this->storage->get('polling',128));
$this->setImportId($this->storage->get('import_id'));
$this->setEnabledStatus((int) $this->storage->get('active'));
$this->setCertSerialNumber($this->storage->get('cert_serial'));
$this->setGlobalRole($this->storage->get('global_role'));
$this->econtent_recipients = $this->storage->get('econtent_rcp');
$this->approval_recipients = $this->storage->get('approval_rcp');
$this->user_recipients = $this->storage->get('user_rcp');
$this->setDuration($this->storage->get('duration'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSSettings::save ( )

save settings

public

Definition at line 614 of file class.ilECSSettings.php.

References getApprovalRecipientsAsString(), getCACertPath(), getCertSerialNumber(), getClientCertPath(), getDuration(), getEContentRecipientsAsString(), getGlobalRole(), getImportId(), getKeyPassword(), getKeyPath(), getPollingTime(), getPort(), getProtocol(), getServer(), getUserRecipientsAsString(), and isEnabled().

{
$this->storage->set('active',(int) $this->isEnabled());
$this->storage->set('server',$this->getServer());
$this->storage->set('port',$this->getPort());
$this->storage->set('protocol',$this->getProtocol());
$this->storage->set('client_cert_path',$this->getClientCertPath());
$this->storage->set('ca_cert_path',$this->getCACertPath());
$this->storage->set('key_path',$this->getKeyPath());
$this->storage->set('key_password',$this->getKeyPassword());
$this->storage->set('import_id',$this->getImportId());
$this->storage->set('polling',$this->getPollingTime());
$this->storage->set('cert_serial',$this->getCertSerialNumber());
$this->storage->set('global_role',(int) $this->getGlobalRole());
$this->storage->set('user_rcp',$this->getUserRecipientsAsString());
$this->storage->set('econtent_rcp',$this->getEContentRecipientsAsString());
$this->storage->set('approval_rcp',$this->getApprovalRecipientsAsString());
$this->storage->set('duration',$this->getDuration());
}

+ Here is the call graph for this function:

ilECSSettings::setApprovalRecipients (   $a_rcp)

set approval recipients

public

Parameters
stringrecipients

Definition at line 545 of file class.ilECSSettings.php.

{
$this->approval_recipients = $a_rcp;
}
ilECSSettings::setCACertPath (   $a_ca)

set ca cert path

public

Parameters
stringca cert path

Definition at line 295 of file class.ilECSSettings.php.

Referenced by read().

{
$this->ca_cert_path = $a_ca;
}

+ Here is the caller graph for this function:

ilECSSettings::setCertSerialNumber (   $a_cert_serial)

set cert serial number

public

Parameters

Definition at line 386 of file class.ilECSSettings.php.

Referenced by fetchSerialID(), and read().

{
$this->cert_serial_number = $a_cert_serial;
}

+ Here is the caller graph for this function:

ilECSSettings::setClientCertPath (   $a_path)

set

public

Parameters

Definition at line 273 of file class.ilECSSettings.php.

Referenced by read().

{
$this->client_cert_path = $a_path;
}

+ Here is the caller graph for this function:

ilECSSettings::setDuration (   $a_duration)

set Duration

public

Parameters
intduration

Definition at line 432 of file class.ilECSSettings.php.

Referenced by read().

{
$this->duration = $a_duration;
}

+ Here is the caller graph for this function:

ilECSSettings::setEContentRecipients (   $a_logins)

set EContent recipients

public

Parameters
arrayof user obj_ids

Definition at line 511 of file class.ilECSSettings.php.

{
$this->econtent_recipients = $a_logins;
}
ilECSSettings::setEnabledStatus (   $a_status)

en/disable ecs functionality

public

Parameters
boolstatus

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

Referenced by read().

{
$this->active = $a_status;
}

+ Here is the caller graph for this function:

ilECSSettings::setGlobalRole (   $a_role_id)

set default global role

public

Parameters
introle_id

Definition at line 420 of file class.ilECSSettings.php.

Referenced by read().

{
$this->global_role = $a_role_id;
}

+ Here is the caller graph for this function:

ilECSSettings::setImportId (   $a_id)

set import id Object of category, that store new remote courses

public

Definition at line 364 of file class.ilECSSettings.php.

Referenced by read().

{
$this->import_id = $a_id;
}

+ Here is the caller graph for this function:

ilECSSettings::setKeyPassword (   $a_pass)

set key password

public

Parameters
stringkey password

Definition at line 352 of file class.ilECSSettings.php.

Referenced by read().

{
$this->key_password = $a_pass;
}

+ Here is the caller graph for this function:

ilECSSettings::setKeyPath (   $a_path)

set key path

public

Parameters
stringkey path

Definition at line 329 of file class.ilECSSettings.php.

Referenced by read().

{
$this->key_path = $a_path;
}

+ Here is the caller graph for this function:

ilECSSettings::setPollingTime (   $a_time)

set polling time

public

Parameters
intpolling time

Definition at line 215 of file class.ilECSSettings.php.

Referenced by read(), and setPollingTimeMS().

{
$this->polling = $a_time;
}

+ Here is the caller graph for this function:

ilECSSettings::setPollingTimeMS (   $a_min,
  $a_sec 
)

Set polling time.

public

Parameters
intminutes
intseconds

Definition at line 261 of file class.ilECSSettings.php.

References setPollingTime().

{
$this->setPollingTime(60 * $a_min + $a_sec);
}

+ Here is the call graph for this function:

ilECSSettings::setPort (   $a_port)

set port

public

Parameters
intport

Definition at line 191 of file class.ilECSSettings.php.

Referenced by read().

{
$this->port = $a_port;
}

+ Here is the caller graph for this function:

ilECSSettings::setProtocol (   $a_prot)

set protocol

public

Parameters

Definition at line 168 of file class.ilECSSettings.php.

Referenced by read().

{
$this->protocol = $a_prot;
}

+ Here is the caller graph for this function:

ilECSSettings::setServer (   $a_server)

set server

public

Parameters

Definition at line 122 of file class.ilECSSettings.php.

Referenced by read().

{
$this->server = $a_server;
}

+ Here is the caller graph for this function:

ilECSSettings::setUserRecipients (   $a_logins)

set user recipients

public

Parameters
arrayof recipients (array of user login names)

Definition at line 477 of file class.ilECSSettings.php.

{
$this->user_recipients = $a_logins;
}
ilECSSettings::validate ( )

Validate settings.

public

Parameters
void
Returns
bool

Definition at line 558 of file class.ilECSSettings.php.

References checkImportId(), ERROR_EXTRACT_SERIAL, ERROR_INVALID_IMPORT_ID, ERROR_REQUIRED, fetchSerialID(), getCACertPath(), getClientCertPath(), getDuration(), getGlobalRole(), getImportId(), getKeyPassword(), getKeyPath(), getPollingTime(), getPort(), getServer(), and isEnabled().

{
if(!$this->isEnabled())
{
return '';
}
if(!$this->getServer() or !$this->getPort() or !$this->getClientCertPath() or !$this->getCACertPath()
or !$this->getKeyPath() or !$this->getKeyPassword() or !$this->getPollingTime() or !$this->getImportId()
or !$this->getGlobalRole() or !$this->getDuration())
{
}
// Check import id
if(!$this->fetchSerialID())
{
}
if(!$this->checkImportId())
{
}
return '';
}

+ Here is the call graph for this function:

Field Documentation

ilECSSettings::$active = false
private

Definition at line 47 of file class.ilECSSettings.php.

Referenced by isEnabled().

ilECSSettings::$approval_recipients = array()
private

Definition at line 63 of file class.ilECSSettings.php.

Referenced by getApprovalRecipientsAsString().

ilECSSettings::$ca_cert_path
private

Definition at line 52 of file class.ilECSSettings.php.

Referenced by getCACertPath().

ilECSSettings::$cert_serial
private

Definition at line 57 of file class.ilECSSettings.php.

ilECSSettings::$client_cert_path
private

Definition at line 51 of file class.ilECSSettings.php.

Referenced by getClientCertPath().

ilECSSettings::$duration
private

Definition at line 59 of file class.ilECSSettings.php.

ilECSSettings::$econtent_recipients = array()
private

Definition at line 62 of file class.ilECSSettings.php.

Referenced by getEContentRecipientsAsString().

ilECSSettings::$global_role
private

Definition at line 58 of file class.ilECSSettings.php.

Referenced by getGlobalRole().

ilECSSettings::$import_id
private

Definition at line 56 of file class.ilECSSettings.php.

Referenced by getImportId().

ilECSSettings::$instance = null
staticprotected

Definition at line 45 of file class.ilECSSettings.php.

Referenced by _getInstance().

ilECSSettings::$key_path
private

Definition at line 53 of file class.ilECSSettings.php.

Referenced by getKeyPath().

ilECSSettings::$key_pathword
private

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

ilECSSettings::$polling
private

Definition at line 55 of file class.ilECSSettings.php.

Referenced by getPollingTime().

ilECSSettings::$port
private

Definition at line 50 of file class.ilECSSettings.php.

Referenced by getPort().

ilECSSettings::$protocol
private

Definition at line 49 of file class.ilECSSettings.php.

Referenced by getProtocol().

ilECSSettings::$server
private

Definition at line 48 of file class.ilECSSettings.php.

Referenced by getServer().

ilECSSettings::$user_recipients = array()
private

Definition at line 61 of file class.ilECSSettings.php.

Referenced by getUserRecipientsAsString().

const ilECSSettings::DEFAULT_DURATION = 6

Definition at line 39 of file class.ilECSSettings.php.

Referenced by getDuration().

const ilECSSettings::ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'

Definition at line 35 of file class.ilECSSettings.php.

Referenced by validate().

const ilECSSettings::ERROR_INVALID_IMPORT_ID = 'ecs_check_import_id'

Definition at line 37 of file class.ilECSSettings.php.

Referenced by validate().

const ilECSSettings::ERROR_REQUIRED = 'fill_out_all_required_fields'

Definition at line 36 of file class.ilECSSettings.php.

Referenced by validate().

const ilECSSettings::PROTOCOL_HTTP = 0

Definition at line 42 of file class.ilECSSettings.php.

const ilECSSettings::PROTOCOL_HTTPS = 1

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