ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 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...
 

Protected Member Functions

 __construct ()
 Constructor. More...
 

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

Constructor.

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

18  {
19  }

Member Function Documentation

◆ getAll()

ilExAssignmentTypes::getAll ( )

Get all.

Parameters

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

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

Referenced by getAllActivated().

69  {
70  return array_column(
71  array_map(
72  function ($id) {
73  return [$id, $this->getById($id)];
74  },
75  $this->getAllIds()
76  ),
77  1,
78  0
79  );
80  }
if(!array_key_exists('StateId', $_REQUEST)) $id
getById($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.

Parameters

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

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

89  {
90  return array_filter($this->getAll(), function (ilExAssignmentTypeInterface $at) {
91  return $at->isActive();
92  });
93  }
isActive()
Is assignment type active?
+ 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 105 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().

106  {
107  switch ($a_id) {
109  include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssTypeUpload.php");
110  return new ilExAssTypeUpload();
111  break;
112 
114  include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssTypeBlog.php");
115  return new ilExAssTypeBlog();
116  break;
117 
119  include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssTypePortfolio.php");
120  return new ilExAssTypePortfolio();
121  break;
122 
124  include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssTypeUploadTeam.php");
125  return new ilExAssTypeUploadTeam();
126  break;
127 
129  include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssTypeText.php");
130  return new ilExAssTypeText();
131  break;
132 
134  include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssTypeWikiTeam.php");
135  return new ilExAssTypeWikiTeam();
136  break;
137  }
138 
139  // we should throw some exception here
140  }
+ 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 148 of file class.ilExAssignmentTypes.php.

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

149  {
150  $ids = [];
151  foreach ($this->getAllIds() as $id) {
152  if ($this->getById($id)->getSubmissionType() == $a_submission_type) {
153  $ids[] = $id;
154  }
155  }
156  return $ids;
157  }
if(!array_key_exists('StateId', $_REQUEST)) $id
getById($a_id)
Get type object by id.
+ 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 55 of file class.ilExAssignmentTypes.php.

References getAllIds().

56  {
57  return in_array($a_id, $this->getAllIds());
58  }
+ Here is the call graph for this function:

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