ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Survey\Tasks\DerivedTaskProvider Class Reference

Exercise derived task provider. More...

+ Inheritance diagram for ILIAS\Survey\Tasks\DerivedTaskProvider:
+ Collaboration diagram for ILIAS\Survey\Tasks\DerivedTaskProvider:

Public Member Functions

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

Protected Member Functions

 getFirstRefIdWithPermission (string $perm, int $obj_id, int $user_id)
 Get first ref id for an object id with permission. More...
 

Protected Attributes

ilTaskService $task_service
 
ilAccessHandler $access
 
ilLanguage $lng
 
InvitationsManager $inv_manager
 
SettingsDBRepository $set_repo
 
Survey360Manager $svy_360_manager
 

Detailed Description

Exercise derived task provider.

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Tasks\DerivedTaskProvider::__construct ( \ilTaskService  $task_service,
\ilAccess  $access,
\ilLanguage  $lng 
)

Definition at line 38 of file class.DerivedTaskProvider.php.

42 {
43 global $DIC;
44
45 $survey_service = $DIC->survey()->internal();
46
47 $this->access = $access;
48 $this->task_service = $task_service;
49 $this->lng = $lng;
50
51 $this->lng->loadLanguageModule("svy");
52
53 $this->inv_manager = $survey_service
54 ->domain()
55 ->participants()
56 ->invitations();
57
58 $this->set_repo = $survey_service->repo()->settings();
59 $this->svy_360_manager = new Survey360Manager(
60 $survey_service->repo()
61 );
62 }
global $DIC
Definition: shib_login.php:26

References ILIAS\Survey\Tasks\DerivedTaskProvider\$access, $DIC, ILIAS\Survey\Tasks\DerivedTaskProvider\$lng, ILIAS\Survey\Tasks\DerivedTaskProvider\$task_service, ILIAS\Repository\access(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstRefIdWithPermission()

ILIAS\Survey\Tasks\DerivedTaskProvider::getFirstRefIdWithPermission ( string  $perm,
int  $obj_id,
int  $user_id 
)
protected

Get first ref id for an object id with permission.

Definition at line 139 of file class.DerivedTaskProvider.php.

143 : int {
145
146 foreach (\ilObject::_getAllReferences($obj_id) as $ref_id) {
147 if ($access->checkAccessOfUser($user_id, $perm, "", $ref_id)) {
148 return $ref_id;
149 }
150 }
151 return 0;
152 }
static _getAllReferences(int $id)
get all reference ids for object ID
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
$ref_id
Definition: ltiauth.php:66

References ILIAS\Survey\Tasks\DerivedTaskProvider\$access, $ref_id, $user_id, and ilRBACAccessHandler\checkAccessOfUser().

Referenced by ILIAS\Survey\Tasks\DerivedTaskProvider\getTasks().

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

◆ getTasks()

ILIAS\Survey\Tasks\DerivedTaskProvider::getTasks ( int  $user_id)

Get providers.

Returns
ilDerivedTask[]

Implements ilDerivedTaskProvider.

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

69 : array
70 {
72
73 $tasks = [];
74
75 // open assignments
76 $survey_ids = $this->inv_manager->getOpenInvitationsOfUser($user_id);
77 if (count($survey_ids) > 0) {
78 $obj_ids = $this->set_repo->getObjIdsForSurveyIds($survey_ids);
79 $access = $this->set_repo->getAccessSettings($survey_ids);
80 foreach ($obj_ids as $survey_id => $obj_id) {
81 $ref_id = $this->getFirstRefIdWithPermission("read", $obj_id, $user_id);
82 if ($ref_id > 0) {
83 $title = str_replace("%1", \ilObject::_lookupTitle($obj_id), $lng->txt("svy_finish_survey"));
84 $tasks[] = $this->task_service->derived()->factory()->task(
85 $title,
86 $ref_id,
87 $access[$survey_id]->getEndDate(),
88 $access[$survey_id]->getStartDate()
89 );
90 }
91 }
92 }
93
94 // open raters in 360
95 $survey_ids = $this->svy_360_manager->getOpenSurveysForRater($user_id);
96 if (count($survey_ids) > 0) {
97 $obj_ids = $this->set_repo->getObjIdsForSurveyIds($survey_ids);
98 $access = $this->set_repo->getAccessSettings($survey_ids);
99 foreach ($obj_ids as $survey_id => $obj_id) {
100 $ref_id = $this->getFirstRefIdWithPermission("read", $obj_id, $user_id);
101 if ($ref_id > 0) {
102 $title = str_replace("%1", \ilObject::_lookupTitle($obj_id), $lng->txt("svy_finish_survey"));
103 $tasks[] = $this->task_service->derived()->factory()->task(
104 $title,
105 $ref_id,
106 $access[$survey_id]->getEndDate(),
107 $access[$survey_id]->getStartDate()
108 );
109 }
110 }
111 }
112
113 // unclosed 360 survey of appraisee
114 $survey_ids = $this->svy_360_manager->getOpenSurveysForAppraisee($user_id);
115 if (count($survey_ids) > 0) {
116 $obj_ids = $this->set_repo->getObjIdsForSurveyIds($survey_ids);
117 $access = $this->set_repo->getAccessSettings($survey_ids);
118 foreach ($obj_ids as $survey_id => $obj_id) {
119 $ref_id = $this->getFirstRefIdWithPermission("read", $obj_id, $user_id);
120 if ($ref_id > 0) {
121 $title = str_replace("%1", \ilObject::_lookupTitle($obj_id), $lng->txt("svy_finish_survey"));
122 $tasks[] = $this->task_service->derived()->factory()->task(
123 $title,
124 $ref_id,
125 $access[$survey_id]->getEndDate(),
126 $access[$survey_id]->getStartDate()
127 );
128 }
129 }
130 }
131
132 return $tasks;
133 }
getFirstRefIdWithPermission(string $perm, int $obj_id, int $user_id)
Get first ref id for an object id with permission.
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...
static _lookupTitle(int $obj_id)

References ILIAS\Survey\Tasks\DerivedTaskProvider\$access, ILIAS\Survey\Tasks\DerivedTaskProvider\$lng, $ref_id, $user_id, ilObject\_lookupTitle(), ILIAS\Survey\Tasks\DerivedTaskProvider\getFirstRefIdWithPermission(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ isActive()

ILIAS\Survey\Tasks\DerivedTaskProvider::isActive ( )

Is provider active?

Implements ilDerivedTaskProvider.

Definition at line 64 of file class.DerivedTaskProvider.php.

64 : bool
65 {
66 return true;
67 }

Field Documentation

◆ $access

◆ $inv_manager

InvitationsManager ILIAS\Survey\Tasks\DerivedTaskProvider::$inv_manager
protected

Definition at line 34 of file class.DerivedTaskProvider.php.

◆ $lng

ilLanguage ILIAS\Survey\Tasks\DerivedTaskProvider::$lng
protected

◆ $set_repo

SettingsDBRepository ILIAS\Survey\Tasks\DerivedTaskProvider::$set_repo
protected

Definition at line 35 of file class.DerivedTaskProvider.php.

◆ $svy_360_manager

Survey360Manager ILIAS\Survey\Tasks\DerivedTaskProvider::$svy_360_manager
protected

Definition at line 36 of file class.DerivedTaskProvider.php.

◆ $task_service

ilTaskService ILIAS\Survey\Tasks\DerivedTaskProvider::$task_service
protected

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