ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Exercise\Assignment\AssignmentManager Class Reference
+ Collaboration diagram for ILIAS\Exercise\Assignment\AssignmentManager:

Public Member Functions

 __construct (InternalRepoService $repo_service, InternalDomainService $domain_service, int $obj_id, int $user_id)
 
 getValidListMode (string $mode)
 
 getListModes ()
 
 getListModeLabel (string $mode)
 
 getList (string $mode)
 
 getAll ()
 
 get (int $ass_id)
 

Data Fields

const TYPE_ALL = "all"
 
const TYPE_ONGOING = "ongoing"
 
const TYPE_FUTURE = "future"
 
const TYPE_PAST = "past"
 

Protected Member Functions

 getExcId ()
 

Protected Attributes

int $user_id
 
ilLanguage $lng
 
InternalDomainService $domain
 
AssignmentsDBRepository $repo
 
int $obj_id
 

Detailed Description

Definition at line 26 of file AssignmentManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Exercise\Assignment\AssignmentManager::__construct ( InternalRepoService  $repo_service,
InternalDomainService  $domain_service,
int  $obj_id,
int  $user_id 
)

Definition at line 38 of file AssignmentManager.php.

43 {
44 $this->obj_id = $obj_id;
45 $this->domain = $domain_service;
46 $this->repo = $repo_service->assignment()->assignments();
47 $this->lng = $domain_service->lng();
48 $this->user_id = $user_id;
49 }

References ILIAS\Exercise\Assignment\AssignmentManager\$obj_id, ILIAS\Exercise\Assignment\AssignmentManager\$user_id, ILIAS\Exercise\InternalRepoService\assignment(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ get()

ILIAS\Exercise\Assignment\AssignmentManager::get ( int  $ass_id)

Definition at line 109 of file AssignmentManager.php.

109 : Assignment
110 {
111 $ass = $this->repo->get($this->getExcId(), $ass_id);
112 if (is_null($ass)) {
113 throw new \ilExerciseException("Assignment not found (" . $this->getExcId() . "," . $ass_id . ").");
114 }
115 return $ass;
116 }

References $ass_id, and ILIAS\Exercise\Assignment\AssignmentManager\getExcId().

+ Here is the call graph for this function:

◆ getAll()

ILIAS\Exercise\Assignment\AssignmentManager::getAll ( )
Returns
iterable<Assignment>

Definition at line 102 of file AssignmentManager.php.

102 : \Iterator
103 {
104 foreach ($this->repo->getList($this->getExcId()) as $ass) {
105 yield $ass;
106 }
107 }

◆ getExcId()

ILIAS\Exercise\Assignment\AssignmentManager::getExcId ( )
protected

Definition at line 51 of file AssignmentManager.php.

51 : int
52 {
53 return $this->obj_id;
54 }

References ILIAS\Exercise\Assignment\AssignmentManager\$obj_id.

Referenced by ILIAS\Exercise\Assignment\AssignmentManager\get().

+ Here is the caller graph for this function:

◆ getList()

ILIAS\Exercise\Assignment\AssignmentManager::getList ( string  $mode)
Returns
iterable<Assignment>

Definition at line 83 of file AssignmentManager.php.

83 : \Iterator
84 {
85 foreach ($this->repo->getList($this->getExcId()) as $ass) {
86 $state = $this->domain->assignment()->state($ass->getId(), $this->user_id);
87 if ($mode === self::TYPE_PAST && $state->hasEnded()) {
88 yield $ass;
89 }
90 if ($mode === self::TYPE_FUTURE && $state->isFuture()) {
91 yield $ass;
92 }
93 if ($mode === self::TYPE_ONGOING && !$state->hasEnded() && !$state->isFuture()) {
94 yield $ass;
95 }
96 }
97 }

◆ getListModeLabel()

ILIAS\Exercise\Assignment\AssignmentManager::getListModeLabel ( string  $mode)

Definition at line 74 of file AssignmentManager.php.

74 : string
75 {
76 $modes = $this->getListModes();
77 return $modes[$mode] ?? "";
78 }

References ILIAS\Exercise\Assignment\AssignmentManager\getListModes().

+ Here is the call graph for this function:

◆ getListModes()

ILIAS\Exercise\Assignment\AssignmentManager::getListModes ( )

Definition at line 64 of file AssignmentManager.php.

64 : array
65 {
66 return [
67 self::TYPE_ONGOING => $this->lng->txt("exc_ongoing"),
68 self::TYPE_FUTURE => $this->lng->txt("exc_future"),
69 self::TYPE_PAST => $this->lng->txt("exc_past"),
70 self::TYPE_ALL => $this->lng->txt("exc_all")
71 ];
72 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Exercise\Assignment\AssignmentManager\getListModeLabel().

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

◆ getValidListMode()

ILIAS\Exercise\Assignment\AssignmentManager::getValidListMode ( string  $mode)

Definition at line 56 of file AssignmentManager.php.

56 : string
57 {
58 if (!in_array($mode, [self::TYPE_ONGOING,self::TYPE_FUTURE,self::TYPE_PAST,self::TYPE_ALL])) {
59 return self::TYPE_ONGOING;
60 }
61 return $mode;
62 }

References ILIAS\Exercise\Assignment\AssignmentManager\TYPE_ONGOING.

Field Documentation

◆ $domain

InternalDomainService ILIAS\Exercise\Assignment\AssignmentManager::$domain
protected

Definition at line 34 of file AssignmentManager.php.

◆ $lng

ilLanguage ILIAS\Exercise\Assignment\AssignmentManager::$lng
protected

Definition at line 33 of file AssignmentManager.php.

◆ $obj_id

int ILIAS\Exercise\Assignment\AssignmentManager::$obj_id
protected

◆ $repo

AssignmentsDBRepository ILIAS\Exercise\Assignment\AssignmentManager::$repo
protected

Definition at line 35 of file AssignmentManager.php.

◆ $user_id

int ILIAS\Exercise\Assignment\AssignmentManager::$user_id
protected

◆ TYPE_ALL

const ILIAS\Exercise\Assignment\AssignmentManager::TYPE_ALL = "all"

Definition at line 28 of file AssignmentManager.php.

◆ TYPE_FUTURE

const ILIAS\Exercise\Assignment\AssignmentManager::TYPE_FUTURE = "future"

Definition at line 30 of file AssignmentManager.php.

◆ TYPE_ONGOING

const ILIAS\Exercise\Assignment\AssignmentManager::TYPE_ONGOING = "ongoing"

◆ TYPE_PAST

const ILIAS\Exercise\Assignment\AssignmentManager::TYPE_PAST = "past"

Definition at line 31 of file AssignmentManager.php.


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