ILIAS  release_7 Revision v7.30-3-g800a261c036
ilExAssignmentTypes Class Reference

Assignment types. More...

+ Collaboration diagram for ilExAssignmentTypes:

Public Member Functions

 getAllIds ()
 Get all ids. More...
 
 isValidId ($a_id)
 Is valid id. More...
 
 getAll ()
 Get all. More...
 
 getAllActivated ()
 Get all activated. More...
 
 getAllAllowed (ilObjExercise $exc)
 Get all allowed types for an exercise for an exercise. More...
 
 getById ($a_id)
 Get type object by id. More...
 
 getIdsForSubmissionType ($a_submission_type)
 Get assignment type IDs for given submission type. More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Data Fields

const STR_IDENTIFIER_PORTFOLIO = "prtf"
 

Protected Member Functions

 __construct (ilExerciseInternalService $service=null)
 Constructor. More...
 

Protected Attributes

 $service
 

Detailed Description

Assignment types.

Gives information on available types and acts as factory to get assignment type objects.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilExAssignmentTypes::__construct ( ilExerciseInternalService  $service = null)
protected

Constructor.

Definition at line 25 of file class.ilExAssignmentTypes.php.

26 {
27 global $DIC;
28
29 $this->service = ($service == null)
30 ? $DIC->exercise()->internal()->service()
31 : $service;
32 }
global $DIC
Definition: goto.php:24

References $DIC, and $service.

Member Function Documentation

◆ getAll()

ilExAssignmentTypes::getAll ( )

Get all.

Parameters

return

Definition at line 81 of file class.ilExAssignmentTypes.php.

82 {
83 return array_column(
84 array_map(
85 function ($id) {
86 return [$id, $this->getById($id)];
87 },
88 $this->getAllIds()
89 ),
90 1,
91 0
92 );
93 }
getById($a_id)
Get type object by id.

References getAllIds(), and getById().

Referenced by getAllActivated().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllActivated()

ilExAssignmentTypes::getAllActivated ( )

Get all activated.

Parameters

return

Definition at line 101 of file class.ilExAssignmentTypes.php.

102 {
103 return array_filter($this->getAll(), function (ilExAssignmentTypeInterface $at) {
104 return $at->isActive();
105 });
106 }
isActive()
Is assignment type active?

References getAll(), and ilExAssignmentTypeInterface\isActive().

Referenced by getAllAllowed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllAllowed()

ilExAssignmentTypes::getAllAllowed ( ilObjExercise  $exc)

Get all allowed types for an exercise for an exercise.

Parameters
ilObjExercise$exc
Returns
array

Definition at line 114 of file class.ilExAssignmentTypes.php.

115 {
116 $random_manager = $this->service->getRandomAssignmentManager($exc);
117 $active = $this->getAllActivated();
118
119 // no team assignments, if random mandatory assignments is activated
120 if ($random_manager->isActivated()) {
121 $active = array_filter($active, function (ilExAssignmentTypeInterface $at) {
122 return !$at->usesTeams();
123 });
124 }
125 return $active;
126 }
getAllActivated()
Get all activated.

References getAllActivated(), and ilExAssignmentTypeInterface\usesTeams().

+ Here is the call graph for this function:

◆ getAllIds()

◆ getById()

ilExAssignmentTypes::getById (   $a_id)

Get type object by id.

Centralized ID management is still an issue to be tackled in the future and caused by initial consts definition.

Parameters
int$a_idtype id
Returns
ilExAssignmentTypeInterface

Definition at line 137 of file class.ilExAssignmentTypes.php.

138 {
139 switch ($a_id) {
141 return new ilExAssTypeUpload();
142 break;
143
145 return new ilExAssTypeBlog();
146 break;
147
149 return new ilExAssTypePortfolio();
150 break;
151
153 return new ilExAssTypeUploadTeam();
154 break;
155
157 return new ilExAssTypeText();
158 break;
159
161 return new ilExAssTypeWikiTeam();
162 break;
163 }
164
165 // we should throw some exception here
166 }

References ilExAssignment\TYPE_BLOG, ilExAssignment\TYPE_PORTFOLIO, ilExAssignment\TYPE_TEXT, ilExAssignment\TYPE_UPLOAD, ilExAssignment\TYPE_UPLOAD_TEAM, and ilExAssignment\TYPE_WIKI_TEAM.

Referenced by getAll(), and getIdsForSubmissionType().

+ Here is the caller graph for this function:

◆ getIdsForSubmissionType()

ilExAssignmentTypes::getIdsForSubmissionType (   $a_submission_type)

Get assignment type IDs for given submission type.

Parameters
int$a_submission_type
Returns
array

Definition at line 174 of file class.ilExAssignmentTypes.php.

175 {
176 $ids = [];
177 foreach ($this->getAllIds() as $id) {
178 if ($this->getById($id)->getSubmissionType() == $a_submission_type) {
179 $ids[] = $id;
180 }
181 }
182 return $ids;
183 }

References getAllIds(), and getById().

+ Here is the call graph for this function:

◆ getInstance()

◆ isValidId()

ilExAssignmentTypes::isValidId (   $a_id)

Is valid id.

Parameters
int$a_id
Returns
bool

Definition at line 68 of file class.ilExAssignmentTypes.php.

69 {
70 return in_array($a_id, $this->getAllIds());
71 }

References getAllIds().

+ Here is the call graph for this function:

Field Documentation

◆ $service

ilExAssignmentTypes::$service
protected

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

Referenced by __construct().

◆ STR_IDENTIFIER_PORTFOLIO

const ilExAssignmentTypes::STR_IDENTIFIER_PORTFOLIO = "prtf"

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