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

Public Member Functions

 __construct ($a_user_id, $a_field_id=0)
 Contructor.
 setValue ($a_value)
 getValue ()
 update ()
 update value
 delete ()
 insert entry
 create ()
 Add entry.

Static Public Member Functions

static _getValuesByObjId ($a_obj_id)
 Get values by obj_id (for all users)
static _checkRequired ($a_usr_id, $a_obj_id)
 Check required fields.
static _deleteByUser ($a_user_id)
 Delete all entries of an user.
static _deleteByField ($a_field_id)
 Delete by field.

Private Member Functions

 read ()
 Read value.

Private Attributes

 $db
 $user_id
 $field_id
 $value

Detailed Description

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

Definition at line 32 of file class.ilCourseUserData.php.

Constructor & Destructor Documentation

ilCourseUserData::__construct (   $a_user_id,
  $a_field_id = 0 
)

Contructor.

public

Parameters
intuser id
intfield id

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

References read().

{
global $ilDB;
$this->db = $ilDB;
$this->user_id = $a_user_id;
$this->field_id = $a_field_id;
if($this->field_id)
{
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCourseUserData::_checkRequired (   $a_usr_id,
  $a_obj_id 
)
static

Check required fields.

public

Parameters
intuser id
intobject id
Returns
bool all fields filled

Definition at line 105 of file class.ilCourseUserData.php.

References $query, $res, $row, ilCourseDefinedFieldDefinition\_getRequiredFieldIds(), and DB_FETCHMODE_OBJECT.

Referenced by ilObjGroupGUI\checkAgreement(), ilObjCourseGUI\checkAgreement(), and ilMemberAgreementGUI\init().

{
global $ilDB;
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
if(!count($required))
{
return true;
}
//$and = ("AND field_id IN (".implode(",",ilUtil::quoteArray($required)).")");
$and = "AND ".$ilDB->in('field_id',$required,false,'integer');
$query = "SELECT COUNT(*) num_entries FROM crs_user_data ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND value != '' AND value IS NOT NULL ".
$and." ".
" ";
$res = $ilDB->query($query);
return $row->num_entries == count($required);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCourseUserData::_deleteByField (   $a_field_id)
static

Delete by field.

public

Parameters

Definition at line 155 of file class.ilCourseUserData.php.

References $query, and $res.

Referenced by ilCourseDefinedFieldDefinition\_deleteByContainer(), and ilCourseDefinedFieldDefinition\delete().

{
global $ilDB;
$query = "DELETE FROM crs_user_data ".
"WHERE field_id = ".$ilDB->quote($a_field_id ,'integer');
$res = $ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

static ilCourseUserData::_deleteByUser (   $a_user_id)
static

Delete all entries of an user.

public

Parameters
intuser_id

Definition at line 138 of file class.ilCourseUserData.php.

References $query, and $res.

{
global $ilDB;
$query = "DELETE FROM crs_user_data ".
"WHERE usr_id = ".$ilDB->quote($a_user_id ,'integer');
$res = $ilDB->manipulate($query);
}
static ilCourseUserData::_getValuesByObjId (   $a_obj_id)
static

Get values by obj_id (for all users)

public

Parameters
intobj_id

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

References $query, $res, $row, ilCourseDefinedFieldDefinition\_getFieldIds(), and DB_FETCHMODE_OBJECT.

Referenced by ilGroupParticipantsTableGUI\parse(), ilCourseParticipantsTableGUI\parse(), ilMemberExport\readCourseSpecificFieldsData(), ilSubscriberTableGUI\readSubscriberData(), and ilWaitingListTableGUI\readUserData().

{
global $ilDB;
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
if(!count($field_ids))
{
return array();
}
$where = "WHERE ".$ilDB->in('field_id',$field_ids,false,'integer');
$query = "SELECT * FROM crs_user_data ".
$where;
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$user_data[$row->usr_id][$row->field_id] = $row->value;
}
return $user_data ? $user_data : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseUserData::create ( )

Add entry.

public

Definition at line 207 of file class.ilCourseUserData.php.

References $query, $res, and getValue().

Referenced by update().

{
global $ilDB;
$query = "INSERT INTO crs_user_data (value,usr_id,field_id) ".
"VALUES( ".
$this->db->quote($this->getValue() ,'text').", ".
$this->db->quote($this->user_id ,'integer').", ".
$this->db->quote($this->field_id ,'integer')." ".
")";
$res = $ilDB->manipulate($query);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseUserData::delete ( )

insert entry

public

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

References $query, and $res.

{
global $ilDB;
$query = "DELETE FROM crs_user_data ".
"WHERE usr_id = ".$this->db->quote($this->user_id ,'integer')." ".
"AND field_id = ".$this->db->quote($this->field_id ,'integer');
$res = $ilDB->manipulate($query);
}
ilCourseUserData::getValue ( )

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

References $value.

Referenced by create().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilCourseUserData::read ( )
private

Read value.

private

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

References $query, $res, $row, DB_FETCHMODE_OBJECT, and setValue().

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM crs_user_data ".
"WHERE usr_id = ".$this->db->quote($this->user_id ,'integer')." ".
"AND field_id = ".$this->db->quote($this->field_id ,'integer');
$res = $this->db->query($query);
$this->setValue($row->value);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCourseUserData::setValue (   $a_value)

Definition at line 164 of file class.ilCourseUserData.php.

Referenced by ilMemberAgreementGUI\checkCourseDefinedFields(), read(), and ilRegistrationGUI\validateCustomFields().

{
$this->value = $a_value;
}

+ Here is the caller graph for this function:

ilCourseUserData::update ( )

update value

public

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

References create().

{
$this->delete();
$this->create();
}

+ Here is the call graph for this function:

Field Documentation

ilCourseUserData::$db
private

Definition at line 34 of file class.ilCourseUserData.php.

ilCourseUserData::$field_id
private

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

ilCourseUserData::$user_id
private

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

ilCourseUserData::$value
private

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

Referenced by getValue().


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