ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSCourseAttributes Class Reference

Storage of course attributes for assignment rules. More...

+ Collaboration diagram for ilECSCourseAttributes:

Public Member Functions

 __construct ($a_server_id, $a_mid)
 Constructor.
 getAttributes ()
 Get current attributes.
 getFirstAttribute ()
 Get first defined attribute.
 getFirstAttributeName ()
 Get first attribute name.
 getAttributeSequence ($a_last_attribute)
 Get attribute sequence.
 getUpperAttributes ($a_name)
 Get upper attributes in hierarchy.
 getNextAttributeName ($a_name)
 Get next attribute name in sequence.
 getPreviousAttributeName ($a_name)
 Get next attribute name in sequence.
 getAttributeValues ()
 Get active attribute values.
 delete ()
 Delete all mappings.

Static Public Member Functions

static getInstance ($a_server_id, $a_mid)
 Get instance.

Protected Member Functions

 read ()
 Read attributes type $ilDB.

Private Attributes

 $server_id = 0
 $mid = 0
 $attributes = array()

Static Private Attributes

static $instances = null

Detailed Description

Storage of course attributes for assignment rules.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 12 of file class.ilECSCourseAttributes.php.

Constructor & Destructor Documentation

ilECSCourseAttributes::__construct (   $a_server_id,
  $a_mid 
)

Constructor.

Definition at line 24 of file class.ilECSCourseAttributes.php.

References read().

{
$this->server_id = $a_server_id;
$this->mid = $a_mid;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilECSCourseAttributes::delete ( )

Delete all mappings.

Definition at line 199 of file class.ilECSCourseAttributes.php.

References getAttributes().

{
foreach($this->getAttributes() as $att)
{
$att->delete();
}
$this->attributes = array();
}

+ Here is the call graph for this function:

ilECSCourseAttributes::getAttributes ( )

Get current attributes.

Returns
type

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

References $attributes.

Referenced by delete(), getAttributeSequence(), getAttributeValues(), getFirstAttribute(), getNextAttributeName(), getPreviousAttributeName(), and getUpperAttributes().

{
return (array) $this->attributes;
}

+ Here is the caller graph for this function:

ilECSCourseAttributes::getAttributeSequence (   $a_last_attribute)

Get attribute sequence.

Parameters
type$a_last_attribute
Returns
type

Definition at line 87 of file class.ilECSCourseAttributes.php.

References getAttributes().

{
if(!$a_last_attribute)
{
return array();
}
$sequence = array();
foreach ($this->getAttributes() as $att)
{
$sequence[] = $att->getName();
if($a_last_attribute == $att->getName())
{
break;
}
}
return $sequence;
}

+ Here is the call graph for this function:

ilECSCourseAttributes::getAttributeValues ( )

Get active attribute values.

Definition at line 186 of file class.ilECSCourseAttributes.php.

References getAttributes().

{
$values = array();
foreach ($this->getAttributes() as $att)
{
$values[] = $att->getName();
}
return $values;
}

+ Here is the call graph for this function:

ilECSCourseAttributes::getFirstAttribute ( )

Get first defined attribute.

Returns
ilECSCourseAttribute

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

References getAttributes().

Referenced by getFirstAttributeName().

{
foreach ($this->getAttributes() as $att)
{
return $att;
}
return NULL;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseAttributes::getFirstAttributeName ( )

Get first attribute name.

Returns
type

Definition at line 73 of file class.ilECSCourseAttributes.php.

References getFirstAttribute().

Referenced by getNextAttributeName().

{
if($this->getFirstAttribute() instanceof ilECSCourseAttribute)
{
return $this->getFirstAttribute()->getName();
}
return '';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilECSCourseAttributes::getInstance (   $a_server_id,
  $a_mid 
)
static

Get instance.

Parameters
type$a_server_id
type$a_mid
Returns
ilECSCourseAttributes

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

Referenced by ilECSMappingSettingsGUI\cAddAttribute(), ilECSMappingSettingsGUI\cAttributes(), ilECSMappingSettingsGUI\cDeleteAttribute(), ilECSMappingSettingsGUI\cInitMappingForm(), ilECSMappingSettingsGUI\initFormCSettings(), and ilECSMappingSettingsGUI\setSubTabs().

{
if(isset(self::$instances[$a_server_id.'_'.$a_mid]))
{
return self::$instances[$a_server_id.'_'.$a_mid];
}
return self::$instances[$a_server_id.'_'.$a_mid] = new ilECSCourseAttributes($a_server_id,$a_mid);
}

+ Here is the caller graph for this function:

ilECSCourseAttributes::getNextAttributeName (   $a_name)

Get next attribute name in sequence.

Parameters
string$a_name

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

References getAttributes(), and getFirstAttributeName().

{
if(!$a_name)
{
return $this->getFirstAttributeName();
}
$found = false;
foreach($this->getAttributes() as $att)
{
if($a_name == $att->getName())
{
$found = true;
continue;
}
if($found)
{
return $att->getName();
}
}
return '';
}

+ Here is the call graph for this function:

ilECSCourseAttributes::getPreviousAttributeName (   $a_name)

Get next attribute name in sequence.

Parameters
string$a_name

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

References getAttributes().

{
if(!$a_name)
{
return '';
}
$found = false;
$reverse_attributes = array_reverse($this->getAttributes());
foreach($reverse_attributes as $att)
{
if($a_name == $att->getName())
{
$found = true;
continue;
}
if($found)
{
return $att->getName();
}
}
return '';
}

+ Here is the call graph for this function:

ilECSCourseAttributes::getUpperAttributes (   $a_name)

Get upper attributes in hierarchy.

Parameters
type$a_name

Definition at line 109 of file class.ilECSCourseAttributes.php.

References getAttributes().

{
$reverse_attributes = array_reverse($this->getAttributes());
$found = false;
$upper = array();
foreach ($reverse_attributes as $att)
{
if($att->getName() == $a_name)
{
$found = true;
continue;
}
if($found)
{
$upper[] = $att->getName();
}
}
return array_reverse($upper);
}

+ Here is the call graph for this function:

ilECSCourseAttributes::read ( )
protected

Read attributes type $ilDB.

Definition at line 213 of file class.ilECSCourseAttributes.php.

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

Referenced by __construct().

{
global $ilDB;
$this->attributes = array();
$query = 'SELECT * FROM ecs_crs_mapping_atts '.
'WHERE sid = '.$ilDB->quote($this->server_id,'integer').' '.
'AND mid = '.$ilDB->quote($this->mid,'integer').' '.
'ORDER BY id';
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->attributes[] = new ilECSCourseAttribute($row->id);
}
}

+ Here is the caller graph for this function:

Field Documentation

ilECSCourseAttributes::$attributes = array()
private

Definition at line 19 of file class.ilECSCourseAttributes.php.

Referenced by getAttributes().

ilECSCourseAttributes::$instances = null
staticprivate

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

ilECSCourseAttributes::$mid = 0
private

Definition at line 17 of file class.ilECSCourseAttributes.php.

ilECSCourseAttributes::$server_id = 0
private

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


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