ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 199 of file class.ilECSCourseAttributes.php.

References array, and getAttributes().

200  {
201  foreach($this->getAttributes() as $att)
202  {
203  $att->delete();
204  }
205  $this->attributes = array();
206  }
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 51 of file class.ilECSCourseAttributes.php.

References $attributes, and array.

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

52  {
53  return (array) $this->attributes;
54  }
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 87 of file class.ilECSCourseAttributes.php.

References array, and getAttributes().

88  {
89  if(!$a_last_attribute)
90  {
91  return array();
92  }
93  $sequence = array();
94  foreach ($this->getAttributes() as $att)
95  {
96  $sequence[] = $att->getName();
97  if($a_last_attribute == $att->getName())
98  {
99  break;
100  }
101  }
102  return $sequence;
103  }
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 186 of file class.ilECSCourseAttributes.php.

References array, and getAttributes().

187  {
188  $values = array();
189  foreach ($this->getAttributes() as $att)
190  {
191  $values[] = $att->getName();
192  }
193  return $values;
194  }
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 60 of file class.ilECSCourseAttributes.php.

References getAttributes().

Referenced by getFirstAttributeName().

61  {
62  foreach ($this->getAttributes() as $att)
63  {
64  return $att;
65  }
66  return NULL;
67  }
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 73 of file class.ilECSCourseAttributes.php.

References getFirstAttribute().

Referenced by getNextAttributeName().

74  {
75  if($this->getFirstAttribute() instanceof ilECSCourseAttribute)
76  {
77  return $this->getFirstAttribute()->getName();
78  }
79  return '';
80  }
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  {
42  return self::$instances[$a_server_id.'_'.$a_mid];
43  }
44  return self::$instances[$a_server_id.'_'.$a_mid] = new ilECSCourseAttributes($a_server_id,$a_mid);
45  }
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 134 of file class.ilECSCourseAttributes.php.

References getAttributes(), and getFirstAttributeName().

135  {
136  if(!$a_name)
137  {
138  return $this->getFirstAttributeName();
139  }
140  $found = false;
141  foreach($this->getAttributes() as $att)
142  {
143  if($a_name == $att->getName())
144  {
145  $found = true;
146  continue;
147  }
148  if($found)
149  {
150  return $att->getName();
151  }
152  }
153  return '';
154  }
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 160 of file class.ilECSCourseAttributes.php.

References getAttributes().

161  {
162  if(!$a_name)
163  {
164  return '';
165  }
166  $found = false;
167  $reverse_attributes = array_reverse($this->getAttributes());
168  foreach($reverse_attributes as $att)
169  {
170  if($a_name == $att->getName())
171  {
172  $found = true;
173  continue;
174  }
175  if($found)
176  {
177  return $att->getName();
178  }
179  }
180  return '';
181  }
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 109 of file class.ilECSCourseAttributes.php.

References array, and getAttributes().

110  {
111  $reverse_attributes = array_reverse($this->getAttributes());
112 
113  $found = false;
114  $upper = array();
115  foreach ($reverse_attributes as $att)
116  {
117  if($att->getName() == $a_name)
118  {
119  $found = true;
120  continue;
121  }
122  if($found)
123  {
124  $upper[] = $att->getName();
125  }
126  }
127  return array_reverse($upper);
128  }
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 213 of file class.ilECSCourseAttributes.php.

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

Referenced by __construct().

214  {
215  global $ilDB;
216 
217  $this->attributes = array();
218 
219  $query = 'SELECT * FROM ecs_crs_mapping_atts '.
220  'WHERE sid = '.$ilDB->quote($this->server_id,'integer').' '.
221  'AND mid = '.$ilDB->quote($this->mid,'integer').' '.
222  'ORDER BY id';
223  $res = $ilDB->query($query);
224  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
225  {
226  $this->attributes[] = new ilECSCourseAttribute($row->id);
227  }
228  }
Storage of course attributes for assignment rules.
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: