ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExAssignmentTypes Class Reference

Assignment types. More...

+ Collaboration diagram for ilExAssignmentTypes:

Public Member Functions

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

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 __construct (?Exercise\InternalService $service=null)
 

Protected Attributes

Exercise InternalService $service
 

Detailed Description

Assignment types.

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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilExAssignmentTypes::__construct ( ?Exercise\InternalService  $service = null)
protected

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

32 {
33 global $DIC;
34
35 $this->service = ($service == null)
36 ? $DIC->exercise()->internal()
37 : $service;
38 }
Exercise InternalService $service
global $DIC
Definition: shib_login.php:26

References $DIC, and $service.

Member Function Documentation

◆ getAll()

ilExAssignmentTypes::getAll ( )

Get all.

Returns
ilExAssignmentTypeInterface[]
Exceptions
ilExcUnknownAssignmentTypeException

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

69 : array
70 {
71 return array_column(
72 array_map(
73 function ($id) {
74 return [$id, $this->getById($id)];
75 },
76 $this->getAllIds()
77 ),
78 1,
79 0
80 );
81 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getById(int $a_id)
Get type object by id.

References $id, 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.

Returns
ilExAssignmentTypeInterface[]
Exceptions
ilExcUnknownAssignmentTypeException

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

88 : array
89 {
90 return array_filter($this->getAll(), function (ilExAssignmentTypeInterface $at) {
91 return $at->isActive();
92 });
93 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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
ilExAssignmentTypeInterface[]
Exceptions
ilExcUnknownAssignmentTypeException

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

101 : array
102 {
103 $random_manager = $this->service->domain()->assignment()->randomAssignments($exc);
104 $active = $this->getAllActivated();
105
106 // no team assignments, if random mandatory assignments is activated
107 if ($random_manager->isActivated()) {
108 $active = array_filter($active, function (ilExAssignmentTypeInterface $at) {
109 return !$at->usesTeams();
110 });
111 }
112 return $active;
113 }
getAllActivated()
Get all activated.

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

+ Here is the call graph for this function:

◆ getAllIds()

◆ getById()

ilExAssignmentTypes::getById ( int  $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
Exceptions
ilExcUnknownAssignmentTypeException

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

126 {
127 switch ($a_id) {
129 return new ilExAssTypeUpload();
130
132 return new ilExAssTypeBlog();
133
135 return new ilExAssTypePortfolio();
136
138 return new ilExAssTypeUploadTeam();
139
141 return new ilExAssTypeText();
142
144 return new ilExAssTypeWikiTeam();
145 }
146
147 throw new ilExcUnknownAssignmentTypeException("Unknown Assignment Type ($a_id).");
148 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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 ( string  $a_submission_type)

Get assignment type IDs for given submission type.

Parameters
string$a_submission_type
Returns
int[]
Exceptions
ilExcUnknownAssignmentTypeException

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

156 : array
157 {
158 $ids = [];
159 foreach ($this->getAllIds() as $id) {
160 if ($this->getById($id)->getSubmissionType() == $a_submission_type) {
161 $ids[] = $id;
162 }
163 }
164 return $ids;
165 }

References $id, getAllIds(), and getById().

Referenced by ilExcRepoObjAssignmentInfo\getInfo().

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

◆ getInstance()

◆ isValidId()

ilExAssignmentTypes::isValidId (   $a_id)

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

57 : bool
58 {
59 return in_array($a_id, $this->getAllIds());
60 }

References getAllIds().

+ Here is the call graph for this function:

Field Documentation

◆ $service

Exercise InternalService ilExAssignmentTypes::$service
protected

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

Referenced by __construct().


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