ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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. More...
 
 getAttributes ()
 Get current attributes. More...
 
 getFirstAttribute ()
 Get first defined attribute. More...
 
 getFirstAttributeName ()
 Get first attribute name. More...
 
 getAttributeSequence ($a_last_attribute)
 Get attribute sequence. More...
 
 getUpperAttributes ($a_name)
 Get upper attributes in hierarchy. More...
 
 getNextAttributeName ($a_name)
 Get next attribute name in sequence. More...
 
 getPreviousAttributeName ($a_name)
 Get next attribute name in sequence. More...
 
 getAttributeValues ()
 Get active attribute values. More...
 
 delete ()
 Delete all mappings. More...
 

Static Public Member Functions

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

Protected Member Functions

 read ()
 Read attributes type $ilDB. More...
 

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

◆ __construct()

ilECSCourseAttributes::__construct (   $a_server_id,
  $a_mid 
)

Constructor.

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

References read().

25  {
26  $this->server_id = $a_server_id;
27  $this->mid = $a_mid;
28 
29  $this->read();
30  }
read()
Read attributes type $ilDB.
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilECSCourseAttributes::delete ( )

Delete all mappings.

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

References array, and getAttributes().

182  {
183  foreach ($this->getAttributes() as $att) {
184  $att->delete();
185  }
186  $this->attributes = array();
187  }
getAttributes()
Get current attributes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getAttributes()

ilECSCourseAttributes::getAttributes ( )

Get current attributes.

Returns
type

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

References $attributes, and array.

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

51  {
52  return (array) $this->attributes;
53  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getAttributeSequence()

ilECSCourseAttributes::getAttributeSequence (   $a_last_attribute)

Get attribute sequence.

Parameters
type$a_last_attribute
Returns
type

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

References array, and getAttributes().

85  {
86  if (!$a_last_attribute) {
87  return array();
88  }
89  $sequence = array();
90  foreach ($this->getAttributes() as $att) {
91  $sequence[] = $att->getName();
92  if ($a_last_attribute == $att->getName()) {
93  break;
94  }
95  }
96  return $sequence;
97  }
getAttributes()
Get current attributes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getAttributeValues()

ilECSCourseAttributes::getAttributeValues ( )

Get active attribute values.

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

References array, and getAttributes().

170  {
171  $values = array();
172  foreach ($this->getAttributes() as $att) {
173  $values[] = $att->getName();
174  }
175  return $values;
176  }
getAttributes()
Get current attributes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getFirstAttribute()

ilECSCourseAttributes::getFirstAttribute ( )

Get first defined attribute.

Returns
ilECSCourseAttribute

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

References getAttributes().

Referenced by getFirstAttributeName().

60  {
61  foreach ($this->getAttributes() as $att) {
62  return $att;
63  }
64  return null;
65  }
getAttributes()
Get current attributes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstAttributeName()

ilECSCourseAttributes::getFirstAttributeName ( )

Get first attribute name.

Returns
type

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

References getFirstAttribute().

Referenced by getNextAttributeName().

72  {
73  if ($this->getFirstAttribute() instanceof ilECSCourseAttribute) {
74  return $this->getFirstAttribute()->getName();
75  }
76  return '';
77  }
getFirstAttribute()
Get first defined attribute.
Storage of course attributes for assignment rules.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

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().

39  {
40  if (isset(self::$instances[$a_server_id . '_' . $a_mid])) {
41  return self::$instances[$a_server_id . '_' . $a_mid];
42  }
43  return self::$instances[$a_server_id . '_' . $a_mid] = new ilECSCourseAttributes($a_server_id, $a_mid);
44  }
Storage of course attributes for assignment rules.
+ Here is the caller graph for this function:

◆ getNextAttributeName()

ilECSCourseAttributes::getNextAttributeName (   $a_name)

Get next attribute name in sequence.

Parameters
string$a_name

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

References getAttributes(), and getFirstAttributeName().

126  {
127  if (!$a_name) {
128  return $this->getFirstAttributeName();
129  }
130  $found = false;
131  foreach ($this->getAttributes() as $att) {
132  if ($a_name == $att->getName()) {
133  $found = true;
134  continue;
135  }
136  if ($found) {
137  return $att->getName();
138  }
139  }
140  return '';
141  }
getFirstAttributeName()
Get first attribute name.
getAttributes()
Get current attributes.
+ Here is the call graph for this function:

◆ getPreviousAttributeName()

ilECSCourseAttributes::getPreviousAttributeName (   $a_name)

Get next attribute name in sequence.

Parameters
string$a_name

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

References getAttributes().

148  {
149  if (!$a_name) {
150  return '';
151  }
152  $found = false;
153  $reverse_attributes = array_reverse($this->getAttributes());
154  foreach ($reverse_attributes as $att) {
155  if ($a_name == $att->getName()) {
156  $found = true;
157  continue;
158  }
159  if ($found) {
160  return $att->getName();
161  }
162  }
163  return '';
164  }
getAttributes()
Get current attributes.
+ Here is the call graph for this function:

◆ getUpperAttributes()

ilECSCourseAttributes::getUpperAttributes (   $a_name)

Get upper attributes in hierarchy.

Parameters
type$a_name

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

References array, and getAttributes().

104  {
105  $reverse_attributes = array_reverse($this->getAttributes());
106 
107  $found = false;
108  $upper = array();
109  foreach ($reverse_attributes as $att) {
110  if ($att->getName() == $a_name) {
111  $found = true;
112  continue;
113  }
114  if ($found) {
115  $upper[] = $att->getName();
116  }
117  }
118  return array_reverse($upper);
119  }
getAttributes()
Get current attributes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ read()

ilECSCourseAttributes::read ( )
protected

Read attributes type $ilDB.

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __construct().

195  {
196  global $ilDB;
197 
198  $this->attributes = array();
199 
200  $query = 'SELECT * FROM ecs_crs_mapping_atts ' .
201  'WHERE sid = ' . $ilDB->quote($this->server_id, 'integer') . ' ' .
202  'AND mid = ' . $ilDB->quote($this->mid, 'integer') . ' ' .
203  'ORDER BY id';
204  $res = $ilDB->query($query);
205  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
206  $this->attributes[] = new ilECSCourseAttribute($row->id);
207  }
208  }
foreach($_POST as $key=> $value) $res
Storage of course attributes for assignment rules.
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

Field Documentation

◆ $attributes

ilECSCourseAttributes::$attributes = array()
private

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

Referenced by getAttributes().

◆ $instances

ilECSCourseAttributes::$instances = null
staticprivate

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

◆ $mid

ilECSCourseAttributes::$mid = 0
private

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

◆ $server_id

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: