ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseAgreement Class Reference
+ Collaboration diagram for ilCourseAgreement:

Public Member Functions

 __construct ($a_usr_id, $a_obj_id)
 Constructor.
 setAccepted ($a_status)
 set accepted
 setAcceptanceTime ($a_timest)
 set acceptance time
 agreementRequired ()
 Checks whether the agreement is accepted This function return always true if no acceptance is required by global setting.
 isAccepted ()
 Is accepted.
 getAcceptanceTime ()
 get Acceptance time
 save ()
 save Acceptance settings
 delete ()
 Delete entry.

Static Public Member Functions

static _readByObjId ($a_obj_id)
 Read user data by object id.
static _hasAgreementsByObjId ($a_obj_id)
 Check if there is any user agreement.
static _hasAgreements ()
 Check if there is any user agreement.
static _hasAccepted ($a_usr_id, $a_obj_id)
 Check if user has accepted agreement.
static _deleteByUser ($a_usr_id)
 Delete all entries by user.
static _deleteByObjId ($a_obj_id)
 Delete all entries by obj_id.
static _reset ()
 Reset all.
static _resetContainer ($a_container_id)
 Reset all agreements for a specific container.

Private Member Functions

 read ()
 Read user entries.

Private Attributes

 $db
 $user_id
 $obj_id
 $privacy
 $accepted = false
 $acceptance_time = 0

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
$Id$

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

Constructor & Destructor Documentation

ilCourseAgreement::__construct (   $a_usr_id,
  $a_obj_id 
)

Constructor.

public

Parameters
intusr_id
intobj_id

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

References ilPrivacySettings\_getInstance(), ilCourseDefinedFieldDefinition\_hasFields(), and read().

{
global $ilDB;
$this->db = $ilDB;
$this->user_id = $a_usr_id;
$this->obj_id = $a_obj_id;
$this->privacy = ilPrivacySettings::_getInstance();
if($this->privacy->confirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->obj_id))
{
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCourseAgreement::_deleteByObjId (   $a_obj_id)
static

Delete all entries by obj_id.

public static

Parameters
intobj_id

Definition at line 180 of file class.ilCourseAgreement.php.

Referenced by ilCourseUserFieldsGUI\delete(), ilCourseUserFieldsGUI\save(), and ilCourseUserFieldsGUI\updateField().

{
global $ilDB;
$query = "DELETE FROM member_agreement ".
"WHERE obj_id =".$ilDB->quote($a_obj_id)." ";
$ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

static ilCourseAgreement::_deleteByUser (   $a_usr_id)
static

Delete all entries by user.

public static

Parameters
intuser id

Definition at line 162 of file class.ilCourseAgreement.php.

{
global $ilDB;
$query = "DELETE FROM member_agreement ".
"WHERE usr_id =".$ilDB->quote($a_usr_id)." ";
$ilDB->query($query);
return true;
}
static ilCourseAgreement::_hasAccepted (   $a_usr_id,
  $a_obj_id 
)
static

Check if user has accepted agreement.

public

Parameters

Definition at line 140 of file class.ilCourseAgreement.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseGUI\checkAgreement().

{
global $ilDB;
$query = "SELECT accepted FROM member_agreement ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
"AND obj_id = ".$ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
return $row->accepted == 1 ? true : false;
}

+ Here is the caller graph for this function:

static ilCourseAgreement::_hasAgreements ( )
static

Check if there is any user agreement.

public

Parameters
intobj_id

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

References $res.

Referenced by ilObjUserFolderGUI\__showSelectTable(), ilObjUserFolderGUI\__showTextTable(), and ilObjPrivacySecurityGUI\showPrivacy().

{
global $ilDB;
$query = "SELECT * FROM member_agreement ".
"WHERE accepted = 1";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

static ilCourseAgreement::_hasAgreementsByObjId (   $a_obj_id)
static

Check if there is any user agreement.

public

Parameters
intobj_id

Definition at line 101 of file class.ilCourseAgreement.php.

References $res.

Referenced by ilCourseUserFieldsGUI\show().

{
global $ilDB;
$query = "SELECT * FROM member_agreement ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND accepted = 1";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

static ilCourseAgreement::_readByObjId (   $a_obj_id)
static

Read user data by object id.

public

Parameters
intobj_id

Definition at line 77 of file class.ilCourseAgreement.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilMemberExport\__construct().

{
global $ilDB;
$query = "SELECT * FROM member_agreement ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$user_data[$row->usr_id]['accepted'] = $row->accepted;
$user_data[$row->usr_id]['acceptance_time'] = $row->acceptance_time;
}
return $user_data ? $user_data : array();
}

+ Here is the caller graph for this function:

static ilCourseAgreement::_reset ( )
static

Reset all.

Set all aggrement to 0. This is called after global settings have been modified.

public

Parameters

Definition at line 200 of file class.ilCourseAgreement.php.

Referenced by ilObjPrivacySecurityGUI\save_privacy(), ilObjUserFolderGUI\saveFieldObject(), ilObjUserFolderGUI\saveGlobalUserSettingsObject(), and ilObjUserFolderGUI\updateFieldsObject().

{
global $ilDB;
$query = "UPDATE member_agreement SET accepted = 0 ";
$ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

static ilCourseAgreement::_resetContainer (   $a_container_id)
static

Reset all agreements for a specific container.

public static

Parameters
intobj_id of container

Definition at line 217 of file class.ilCourseAgreement.php.

{
global $ilDB;
$query = "UPDATE member_agreement ".
"SET accepted = 0 ".
"WHERE obj_id = ".$ilDB->quote($a_container_id)." ";
$ilDB->query($query);
return true;
}
ilCourseAgreement::agreementRequired ( )

Checks whether the agreement is accepted This function return always true if no acceptance is required by global setting.

public

Returns
bool

Definition at line 258 of file class.ilCourseAgreement.php.

References ilCourseDefinedFieldDefinition\_hasFields().

{
if(!$this->privacy->confirmationRequired() and !ilCourseDefinedFieldDefinition::_hasFields($this->obj_id))
{
return false;
}
return $this->accepted ? false : true;
}

+ Here is the call graph for this function:

ilCourseAgreement::delete ( )

Delete entry.

public

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

{
$query = "DELETE FROM member_agreement ".
"WHERE usr_id = ".$this->db->quote($this->user_id)." ".
"AND obj_id = ".$this->db->quote($this->obj_id);
$this->db->query($query);
return true;
}
ilCourseAgreement::getAcceptanceTime ( )

get Acceptance time

public

Parameters

Definition at line 286 of file class.ilCourseAgreement.php.

References $acceptance_time.

Referenced by save().

+ Here is the caller graph for this function:

ilCourseAgreement::isAccepted ( )

Is accepted.

public

Parameters

Definition at line 274 of file class.ilCourseAgreement.php.

References $accepted.

Referenced by save().

{
return (bool) $this->accepted;
}

+ Here is the caller graph for this function:

ilCourseAgreement::read ( )
private

Read user entries.

private

Definition at line 332 of file class.ilCourseAgreement.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

{
$query = "SELECT * FROM member_agreement ".
"WHERE usr_id = ".$this->db->quote($this->user_id)." ".
"AND obj_id = ".$this->db->quote($this->obj_id)." ";
$res = $this->db->query($query);
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
$this->accepted = $row->accepted;
$this->acceptance_time = $row->acceptance_time;
}

+ Here is the caller graph for this function:

ilCourseAgreement::save ( )

save Acceptance settings

public

Definition at line 297 of file class.ilCourseAgreement.php.

References getAcceptanceTime(), and isAccepted().

{
$this->delete();
$query = "INSERT INTO member_agreement ".
"SET usr_id = ".$this->db->quote($this->user_id).", ".
"obj_id = ".$this->db->quote($this->obj_id).", ".
"accepted = ".$this->db->quote((int) $this->isAccepted()).", ".
"acceptance_time = ".$this->db->quote($this->getAcceptanceTime());
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilCourseAgreement::setAcceptanceTime (   $a_timest)

set acceptance time

public

Parameters
intunix time of acceptance

Definition at line 247 of file class.ilCourseAgreement.php.

{
$this->acceptance_time = $a_timest;
}
ilCourseAgreement::setAccepted (   $a_status)

set accepted

public

Parameters
boolstatus

Definition at line 235 of file class.ilCourseAgreement.php.

Referenced by ilCourseRegistrationGUI\setAccepted().

{
$this->accepted = $a_status;
}

+ Here is the caller graph for this function:

Field Documentation

ilCourseAgreement::$acceptance_time = 0
private

Definition at line 44 of file class.ilCourseAgreement.php.

Referenced by getAcceptanceTime().

ilCourseAgreement::$accepted = false
private

Definition at line 43 of file class.ilCourseAgreement.php.

Referenced by isAccepted().

ilCourseAgreement::$db
private

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

ilCourseAgreement::$obj_id
private

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

ilCourseAgreement::$privacy
private

Definition at line 41 of file class.ilCourseAgreement.php.

ilCourseAgreement::$user_id
private

Definition at line 38 of file class.ilCourseAgreement.php.


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