ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References $DIC, $service, and null.

32  {
33  global $DIC;
34 
35  $this->service = ($service == null)
36  ? $DIC->exercise()->internal()
37  : $service;
38  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
Exercise InternalService $service

Member Function Documentation

◆ getAll()

ilExAssignmentTypes::getAll ( )

Get all.

Returns
ilExAssignmentTypeInterface[]
Exceptions
ilExcUnknownAssignmentTypeException

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

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

Referenced by getAllActivated().

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

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

Referenced by getAllAllowed().

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

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

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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getAllIds()

ilExAssignmentTypes::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.

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

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...
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
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...
+ 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.

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

Referenced by ilExcRepoObjAssignmentInfo\getInfo().

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  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getById(int $a_id)
Get type object by id.
+ 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.

References getAllIds().

57  : bool
58  {
59  return in_array($a_id, $this->getAllIds());
60  }
+ 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: