ILIAS  release_8 Revision v8.24
ilExerciseDerivedTaskProvider Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExerciseDerivedTaskProvider:
+ Collaboration diagram for ilExerciseDerivedTaskProvider:

Public Member Functions

 __construct (ilTaskService $task_service, ilAccess $access, ilLanguage $lng, ilExerciseDerivedTaskAction $derived_task_action)
 
 isActive ()
 Is provider active? More...
 
 getTasks (int $user_id)
 
 getTasks (int $user_id)
 Get providers. More...
 
 isActive ()
 Is provider active? More...
 

Protected Member Functions

 getFirstRefIdWithPermission (string $perm, int $obj_id, int $user_id)
 

Protected Attributes

ilTaskService $task_service
 
ilExerciseDerivedTaskAction $task_action
 
ilAccess $access
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Exercise derived task provider

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

Definition at line 24 of file class.ilExerciseDerivedTaskProvider.php.

Constructor & Destructor Documentation

◆ __construct()

ilExerciseDerivedTaskProvider::__construct ( ilTaskService  $task_service,
ilAccess  $access,
ilLanguage  $lng,
ilExerciseDerivedTaskAction  $derived_task_action 
)

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

36 {
37 $this->access = $access;
38 $this->task_service = $task_service;
39 $this->task_action = $derived_task_action;
40 $this->lng = $lng;
41
42 $this->lng->loadLanguageModule("exc");
43 }

References $access, $lng, $task_service, ILIAS\Repository\access(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstRefIdWithPermission()

ilExerciseDerivedTaskProvider::getFirstRefIdWithPermission ( string  $perm,
int  $obj_id,
int  $user_id 
)
protected

Definition at line 107 of file class.ilExerciseDerivedTaskProvider.php.

111 : int {
113
114 foreach (ilObject::_getAllReferences($obj_id) as $ref_id) {
115 if ($access->checkAccessOfUser($user_id, $perm, "", $ref_id)) {
116 return $ref_id;
117 }
118 }
119 return 0;
120 }
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67

References $access, $ref_id, and ilAccess\checkAccessOfUser().

Referenced by getTasks().

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

◆ getTasks()

ilExerciseDerivedTaskProvider::getTasks ( int  $user_id)
Exceptions
ilExcUnknownAssignmentTypeException
Returns
\ilDerivedTask[]

Implements ilDerivedTaskProvider.

Definition at line 54 of file class.ilExerciseDerivedTaskProvider.php.

54 : array
55 {
57
58 $tasks = [];
59
60 // open assignments
61 foreach ($this->task_action->getOpenAssignmentsOfUser($user_id) as $ass) {
62 $ref_id = $this->getFirstRefIdWithPermission("read", $ass->getExerciseId(), $user_id);
63 if ($ref_id == 0) {
64 continue;
65 }
66 $state = ilExcAssMemberState::getInstanceByIds($ass->getId(), $user_id);
67 $title = str_replace("%1", $ass->getTitle(), $lng->txt("exc_task_submission"));
68 $tasks[] = $this->task_service->derived()->factory()->task(
69 $title,
70 $ref_id,
71 $state->getOfficialDeadline(),
72 (int) $state->getGeneralStart()
73 );
74 }
75
76 // open peer feedbacks
77 foreach ($this->task_action->getOpenPeerReviewsOfUser($user_id) as $ass) {
78 $ref_id = $this->getFirstRefIdWithPermission("read", $ass->getExerciseId(), $user_id);
79 if ($ref_id == 0) {
80 continue;
81 }
82 $state = ilExcAssMemberState::getInstanceByIds($ass->getId(), $user_id);
83 $title = str_replace("%1", $ass->getTitle(), $lng->txt("exc_task_peer_feedback"));
84 $tasks[] = $this->task_service->derived()->factory()->task(
85 $title,
86 $ref_id,
87 $state->getPeerReviewDeadline(),
88 0
89 );
90 }
91
92 // open gradings
93 foreach ($this->task_action->getOpenGradingsOfUser($user_id) as $ass) {
94 $ref_id = $this->getFirstRefIdWithPermission("write", $ass->getExerciseId(), $user_id);
95 if ($ref_id == 0) {
96 continue;
97 }
98 $title = str_replace("%1", $ass->getTitle(), $lng->txt("exc_task_grading"));
99 $tasks[] = $this->task_service->derived()->factory()->task($title, $ref_id, 0, 0);
100 }
101
102 return $tasks;
103 }
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
getFirstRefIdWithPermission(string $perm, int $obj_id, int $user_id)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $lng, $ref_id, getFirstRefIdWithPermission(), ilExcAssMemberState\getInstanceByIds(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ isActive()

ilExerciseDerivedTaskProvider::isActive ( )

Is provider active?

Implements ilDerivedTaskProvider.

Definition at line 45 of file class.ilExerciseDerivedTaskProvider.php.

45 : bool
46 {
47 return true;
48 }

Field Documentation

◆ $access

ilAccess ilExerciseDerivedTaskProvider::$access
protected

◆ $lng

ilLanguage ilExerciseDerivedTaskProvider::$lng
protected

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

Referenced by __construct(), and getTasks().

◆ $task_action

ilExerciseDerivedTaskAction ilExerciseDerivedTaskProvider::$task_action
protected

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

◆ $task_service

ilTaskService ilExerciseDerivedTaskProvider::$task_service
protected

Definition at line 26 of file class.ilExerciseDerivedTaskProvider.php.

Referenced by __construct().


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