ILIAS  release_7 Revision v7.30-3-g800a261c036
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 @global 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.

25 {
26 $this->server_id = $a_server_id;
27 $this->mid = $a_mid;
28
29 $this->read();
30 }
read()
Read attributes @global type $ilDB.

References read().

+ 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.

182 {
183 foreach ($this->getAttributes() as $att) {
184 $att->delete();
185 }
186 $this->attributes = array();
187 }
getAttributes()
Get current attributes.

References getAttributes().

+ 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.

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

+ 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.

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 }

References getAttributes().

+ Here is the call graph for this function:

◆ getAttributeValues()

ilECSCourseAttributes::getAttributeValues ( )

Get active attribute values.

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

170 {
171 $values = array();
172 foreach ($this->getAttributes() as $att) {
173 $values[] = $att->getName();
174 }
175 return $values;
176 }

References getAttributes().

+ 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.

60 {
61 foreach ($this->getAttributes() as $att) {
62 return $att;
63 }
64 return null;
65 }

References getAttributes().

Referenced by getFirstAttributeName().

+ 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.

72 {
73 if ($this->getFirstAttribute() instanceof ilECSCourseAttribute) {
74 return $this->getFirstAttribute()->getName();
75 }
76 return '';
77 }
Storage of course attributes for assignment rules.
getFirstAttribute()
Get first defined attribute.

References getFirstAttribute().

Referenced by getNextAttributeName().

+ 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.

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.

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

+ 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.

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.

References getAttributes(), and getFirstAttributeName().

+ 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.

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 }

References getAttributes().

+ 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.

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 }

References getAttributes().

+ Here is the call graph for this function:

◆ read()

ilECSCourseAttributes::read ( )
protected

Read attributes @global type $ilDB.

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

195 {
196 global $DIC;
197
198 $ilDB = $DIC['ilDB'];
199
200 $this->attributes = array();
201
202 $query = 'SELECT * FROM ecs_crs_mapping_atts ' .
203 'WHERE sid = ' . $ilDB->quote($this->server_id, 'integer') . ' ' .
204 'AND mid = ' . $ilDB->quote($this->mid, 'integer') . ' ' .
205 'ORDER BY id';
206 $res = $ilDB->query($query);
207 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
208 $this->attributes[] = new ilECSCourseAttribute($row->id);
209 }
210 }
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __construct().

+ 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: