ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 31 of file class.DerivedTaskProvider.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

44 {
45 global $DIC;
46
47 $survey_service = $DIC->survey()->internal();
48
49 $this->access = $access;
50 $this->task_service = $task_service;
51 $this->lng = $lng;
52
53 $this->lng->loadLanguageModule("svy");
54
55 $this->inv_manager = $survey_service
56 ->domain()
57 ->participants()
58 ->invitations();
59
60 $this->set_repo = $survey_service->repo()->settings();
61 $this->svy_360_manager = new Survey360Manager(
62 $survey_service->repo()
63 );
64 }
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 141 of file class.DerivedTaskProvider.php.

145 : int {
147
148 foreach (\ilObject::_getAllReferences($obj_id) as $ref_id) {
149 if ($access->checkAccessOfUser($user_id, $perm, "", $ref_id)) {
150 return $ref_id;
151 }
152 }
153 return 0;
154 }
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)

References ILIAS\Survey\Tasks\DerivedTaskProvider\$access, $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 71 of file class.DerivedTaskProvider.php.

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

66 : bool
67 {
68 return true;
69 }

Field Documentation

◆ $access

◆ $inv_manager

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

Definition at line 36 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 37 of file class.DerivedTaskProvider.php.

◆ $svy_360_manager

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

Definition at line 38 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: