ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMemberAgreement Class Reference
+ Collaboration diagram for ilMemberAgreement:

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.
 read ()
 Read user entries.

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 lookupAcceptedAgreements ($a_obj_id)
 Lookup users who have accepted the 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 Attributes

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

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilMemberAgreement::__construct (   $a_usr_id,
  $a_obj_id 
)

Constructor.

public

Parameters
intusr_id
intobj_id

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

static ilMemberAgreement::_deleteByObjId (   $a_obj_id)
static

Delete all entries by obj_id.

public static

Parameters
intobj_id

Definition at line 205 of file class.ilMemberAgreement.php.

References $query, and $res.

Referenced by ilObjectCustomUserFieldsGUI\deleteFields(), ilObjectCustomUserFieldsGUI\saveFields(), and ilObjectCustomUserFieldsGUI\updateField().

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

+ Here is the caller graph for this function:

static ilMemberAgreement::_deleteByUser (   $a_usr_id)
static

Delete all entries by user.

public static

Parameters
intuser id

Definition at line 187 of file class.ilMemberAgreement.php.

References $query, and $res.

Referenced by ilCourseTest\testMemberAgreement().

{
global $ilDB;
$query = "DELETE FROM member_agreement ".
"WHERE usr_id =".$ilDB->quote($a_usr_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

static ilMemberAgreement::_hasAccepted (   $a_usr_id,
  $a_obj_id 
)
static

Check if user has accepted agreement.

public

Parameters

Definition at line 142 of file class.ilMemberAgreement.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjGroupGUI\checkAgreement(), ilObjCourseGUI\checkAgreement(), and ilCourseTest\testMemberAgreement().

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

+ Here is the caller graph for this function:

static ilMemberAgreement::_hasAgreements ( )
static

Check if there is any user agreement.

public

Parameters
intobj_id

Definition at line 123 of file class.ilMemberAgreement.php.

References $query, and $res.

Referenced by ilCustomUserFieldsGUI\initForm(), ilObjPrivacySecurityGUI\showPrivacy(), and ilCourseTest\testMemberAgreement().

{
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 ilMemberAgreement::_hasAgreementsByObjId (   $a_obj_id)
static

Check if there is any user agreement.

public

Parameters
intobj_id

Definition at line 103 of file class.ilMemberAgreement.php.

References $query, and $res.

Referenced by ilObjectCustomUserFieldsGUI\show(), and ilCourseTest\testMemberAgreement().

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

+ Here is the caller graph for this function:

static ilMemberAgreement::_readByObjId (   $a_obj_id)
static

Read user data by object id.

public

Parameters
intobj_id

Definition at line 79 of file class.ilMemberAgreement.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMemberExport\__construct().

{
global $ilDB;
$query = "SELECT * FROM member_agreement ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer');
$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 ilMemberAgreement::_reset ( )
static

Reset all.

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

public

Parameters

Definition at line 225 of file class.ilMemberAgreement.php.

References $query, and $res.

Referenced by ilCustomUserFieldsGUI\create(), ilObjPrivacySecurityGUI\save_privacy(), ilObjUserFolderGUI\saveGlobalUserSettingsObject(), and ilCustomUserFieldsGUI\update().

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

+ Here is the caller graph for this function:

static ilMemberAgreement::_resetContainer (   $a_container_id)
static

Reset all agreements for a specific container.

public static

Parameters
intobj_id of container

Definition at line 242 of file class.ilMemberAgreement.php.

References $query, and $res.

{
global $ilDB;
$query = "UPDATE member_agreement ".
"SET accepted = 0 ".
"WHERE obj_id = ".$ilDB->quote($a_container_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}
ilMemberAgreement::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 283 of file class.ilMemberAgreement.php.

References ilCourseDefinedFieldDefinition\_hasFields().

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

+ Here is the call graph for this function:

ilMemberAgreement::delete ( )

Delete entry.

public

Definition at line 345 of file class.ilMemberAgreement.php.

References $query, and $res.

{
global $ilDB;
$query = "DELETE FROM member_agreement ".
"WHERE usr_id = ".$this->db->quote($this->user_id ,'integer')." ".
"AND obj_id = ".$this->db->quote($this->obj_id ,'integer');
$res = $ilDB->manipulate($query);
return true;
}
ilMemberAgreement::getAcceptanceTime ( )

get Acceptance time

public

Parameters

Definition at line 311 of file class.ilMemberAgreement.php.

References $acceptance_time.

Referenced by save().

+ Here is the caller graph for this function:

ilMemberAgreement::isAccepted ( )

Is accepted.

public

Parameters

Definition at line 299 of file class.ilMemberAgreement.php.

References $accepted.

Referenced by save().

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

+ Here is the caller graph for this function:

static ilMemberAgreement::lookupAcceptedAgreements (   $a_obj_id)
static

Lookup users who have accepted the agreement.

Parameters
int$a_obj_id
Returns

Definition at line 160 of file class.ilMemberAgreement.php.

References $query, $res, $row, and DB_FETCHMODE_ASSOC.

Referenced by ilTrQuery\getUserDataForObject(), ilGroupParticipantsTableGUI\initAcceptedAgreements(), and ilCourseParticipantsTableGUI\initAcceptedAgreements().

{
global $ilDB;
$query = "SELECT usr_id FROM member_agreement ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer').' '.
"AND accepted = 1 ";
$res = $ilDB->query($query);
$user_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$user_ids[] = $row['usr_id'];
}
return $user_ids;
}

+ Here is the caller graph for this function:

ilMemberAgreement::read ( )

Read user entries.

private

Definition at line 361 of file class.ilMemberAgreement.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

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

+ Here is the caller graph for this function:

ilMemberAgreement::save ( )

save Acceptance settings

public

Definition at line 322 of file class.ilMemberAgreement.php.

References $query, $res, getAcceptanceTime(), and isAccepted().

{
global $ilDB;
$this->delete();
$query = "INSERT INTO member_agreement (usr_id,obj_id,accepted,acceptance_time) ".
"VALUES( ".
$this->db->quote($this->user_id ,'integer').", ".
$this->db->quote($this->obj_id ,'integer').", ".
$this->db->quote((int) $this->isAccepted() ,'integer').", ".
$this->db->quote($this->getAcceptanceTime() ,'integer')." ".
")";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilMemberAgreement::setAcceptanceTime (   $a_timest)

set acceptance time

public

Parameters
intunix time of acceptance

Definition at line 272 of file class.ilMemberAgreement.php.

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

set accepted

public

Parameters
boolstatus

Definition at line 260 of file class.ilMemberAgreement.php.

Referenced by ilRegistrationGUI\setAccepted().

{
$this->accepted = $a_status;
}

+ Here is the caller graph for this function:

Field Documentation

ilMemberAgreement::$acceptance_time = 0
private

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

Referenced by getAcceptanceTime().

ilMemberAgreement::$accepted = false
private

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

Referenced by isAccepted().

ilMemberAgreement::$db
private

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

ilMemberAgreement::$obj_id
private

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

ilMemberAgreement::$privacy
private

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

ilMemberAgreement::$type
private

Definition at line 40 of file class.ilMemberAgreement.php.

ilMemberAgreement::$user_id
private

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


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