ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilForumDraftsDerivedTaskProvider Class Reference

Class ilForumDraftsDerivedTaskProvider. More...

+ Inheritance diagram for ilForumDraftsDerivedTaskProvider:
+ Collaboration diagram for ilForumDraftsDerivedTaskProvider:

Public Member Functions

 __construct (protected ilTaskService $taskService, protected ilAccessHandler $accessHandler, protected ilLanguage $lng, protected ilSetting $settings, protected ilCtrlInterface $ctrl)
 
 getTasks (int $user_id)
 Get providers. More...
 
 isActive ()
 Is provider active? More...
 
 getTasks (int $user_id)
 Get providers. More...
 
 isActive ()
 Is provider active? More...
 

Protected Member Functions

 getFirstRefIdWithPermission (string $operation, int $objId, int $userId)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumDraftsDerivedTaskProvider::__construct ( protected ilTaskService  $taskService,
protected ilAccessHandler  $accessHandler,
protected ilLanguage  $lng,
protected ilSetting  $settings,
protected ilCtrlInterface  $ctrl 
)

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

33 {
34 $this->lng->loadLanguageModule('forum');
35 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstRefIdWithPermission()

ilForumDraftsDerivedTaskProvider::getFirstRefIdWithPermission ( string  $operation,
int  $objId,
int  $userId 
)
protected

Definition at line 100 of file class.ilForumDraftsDerivedTaskProvider.php.

100 : int
101 {
103 if ($this->accessHandler->checkAccessOfUser($userId, $operation, '', $refId)) {
104 return $refId;
105 }
106 }
107
108 return 0;
109 }
static _getAllReferences(int $id)
get all reference ids for object ID
$objId
Definition: xapitoken.php:57
$refId
Definition: xapitoken.php:58

References $objId, $refId, and ilObject\_getAllReferences().

Referenced by getTasks().

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

◆ getTasks()

ilForumDraftsDerivedTaskProvider::getTasks ( int  $user_id)

Get providers.

Returns
ilDerivedTask[]

Implements ilDerivedTaskProvider.

Definition at line 37 of file class.ilForumDraftsDerivedTaskProvider.php.

37 : array
38 {
39 $tasks = [];
40
42 foreach ($drafts as $draft) {
43 $objId = ilForum::_lookupObjIdForForumId($draft->getForumId());
45
46 if (0 === $refId) {
47 continue;
48 }
49
50 $title = sprintf(
51 $this->lng->txt('frm_task_publishing_draft_title'),
52 $draft->getPostSubject()
53 );
54
55 $task = $this->taskService->derived()->factory()->task(
56 $title,
57 $refId,
58 0,
59 0
60 );
61
62 $isThread = false;
63 if (0 === $draft->getThreadId()) {
64 $isThread = true;
65 }
66
67 $anchor = '';
68 $params = ['ref_id' => $refId];
69 if ($isThread) {
70 $params['draft_id'] = $draft->getDraftId();
71 $cmd = 'editThreadDraft';
72 } else {
73 $params['thr_pk'] = $draft->getThreadId();
74 $params['pos_pk'] = $draft->getPostId();
75 $cmd = 'viewThread';
76 $anchor = 'draft_' . $draft->getDraftId();
77 }
78
79 foreach ($params as $name => $value) {
80 $this->ctrl->setParameterByClass(ilObjForumGUI::class, $name, $value);
81 }
82 $url = $this->ctrl->getLinkTargetByClass(
83 [
84 ilRepositoryGUI::class,
85 ilObjForumGUI::class
86 ],
87 $cmd,
88 $anchor
89 );
90 foreach (array_keys($params) as $name) {
91 $this->ctrl->setParameterByClass(ilObjForumGUI::class, $name, null);
92 }
93
94 $tasks[] = $task->withUrl($url);
95 }
96
97 return $tasks;
98 }
getFirstRefIdWithPermission(string $operation, int $objId, int $userId)
static getDraftInstancesByUserId(int $user_id)
static _lookupObjIdForForumId(int $a_for_id)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
$url
Definition: shib_logout.php:68

References $objId, $params, $refId, $url, $user_id, ilForum\_lookupObjIdForForumId(), ILIAS\Repository\ctrl(), ilForumPostDraft\getDraftInstancesByUserId(), getFirstRefIdWithPermission(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ isActive()

ilForumDraftsDerivedTaskProvider::isActive ( )

Is provider active?

Implements ilDerivedTaskProvider.

Definition at line 111 of file class.ilForumDraftsDerivedTaskProvider.php.

111 : bool
112 {
113 return (bool) $this->settings->get('save_post_drafts', '0');
114 }

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

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