ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilForumDraftsDerivedTaskProvider Class Reference

Class ilForumDraftsDerivedTaskProvider. More...

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

Public Member Functions

 __construct (ilTaskService $taskService, \ilAccessHandler $accessHandler, \ilLanguage $lng, \ilSetting $settings, \ilCtrl $ctrl)
 ilForumDraftsDerivedTaskProvider constructor. More...
 
 getTasks (int $user_id)
 
 isActive ()
 

Protected Member Functions

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

Protected Attributes

 $taskService
 
 $accessHandler
 
 $lng
 
 $settings
 
 $ctrl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilForumDraftsDerivedTaskProvider constructor.

Parameters
\ilTaskService$taskService
\ilAccessHandler$accessHandler
\ilLanguage$lng
\ilSetting$settings
\ilCtrl$ctrl

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

References $accessHandler, $ctrl, $lng, $settings, $taskService, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstRefIdWithPermission()

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

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

References $refId, and ilObject\_getAllReferences().

Referenced by getTasks().

107  : int
108  {
109  foreach (\ilObject::_getAllReferences($objId) as $refId) {
110  if ($this->accessHandler->checkAccessOfUser($userId, $operation, '', $refId)) {
111  return $refId;
112  }
113  }
114 
115  return 0;
116  }
$objId
Definition: xapitoken.php:41
$refId
Definition: xapitoken.php:42
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTasks()

ilForumDraftsDerivedTaskProvider::getTasks ( int  $user_id)

Implements ilDerivedTaskProvider.

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

References $objId, $refId, $url, ilLink\_getLink(), ilForum\_lookupObjIdForForumId(), ilForumPostDraft\getDraftInstancesByUserId(), and getFirstRefIdWithPermission().

52  : array
53  {
54  $tasks = [];
55 
57  foreach ($drafts as $draft) {
58  $objId = ilForum::_lookupObjIdForForumId($draft->getForumId());
59  $refId = $this->getFirstRefIdWithPermission('read', $objId, $user_id);
60 
61  if (0 === $refId) {
62  continue;
63  }
64 
65  $title = sprintf(
66  $this->lng->txt('frm_task_publishing_draft_title'),
67  $draft->getPostSubject()
68  );
69 
70  $task = $this->taskService->derived()->factory()->task(
71  $title,
72  $refId,
73  0,
74  0
75  );
76 
77  $isThread = false;
78  if (0 === (int) $draft->getThreadId()) {
79  $isThread = true;
80  }
81 
82  $anchor = '';
83  if ($isThread) {
84  $params['draft_id'] = $draft->getDraftId();
85  $params['cmd'] = 'editThreadDraft';
86  } else {
87  $params['thr_pk'] = $draft->getThreadId();
88  $params['pos_pk'] = $draft->getPostId();
89  $params['cmd'] = 'viewThread';
90  $anchor = '#draft_' . $draft->getDraftId();
91  }
92 
93  $url = \ilLink::_getLink($refId, 'frm', $params) . $anchor;
94 
95  $tasks[] = $task->withUrl($url);
96  }
97 
98  return $tasks;
99  }
static getDraftInstancesByUserId($user_id)
static _lookupObjIdForForumId($a_for_id)
$objId
Definition: xapitoken.php:41
$refId
Definition: xapitoken.php:42
getFirstRefIdWithPermission(string $operation, int $objId, int $userId)
$url
+ Here is the call graph for this function:

◆ isActive()

ilForumDraftsDerivedTaskProvider::isActive ( )

Implements ilDerivedTaskProvider.

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

References settings().

121  : bool
122  {
123  return (bool) $this->settings->get('save_post_drafts', false);
124  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Field Documentation

◆ $accessHandler

ilForumDraftsDerivedTaskProvider::$accessHandler
protected

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

Referenced by __construct().

◆ $ctrl

ilForumDraftsDerivedTaskProvider::$ctrl
protected

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

Referenced by __construct().

◆ $lng

ilForumDraftsDerivedTaskProvider::$lng
protected

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

Referenced by __construct().

◆ $settings

ilForumDraftsDerivedTaskProvider::$settings
protected

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

Referenced by __construct().

◆ $taskService

ilForumDraftsDerivedTaskProvider::$taskService
protected

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

Referenced by __construct().


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