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

Class ilBlogDraftsDerivedTaskProvider. More...

+ Inheritance diagram for ilBlogDraftsDerivedTaskProvider:
+ Collaboration diagram for ilBlogDraftsDerivedTaskProvider:

Public Member Functions

 __construct (ilTaskService $taskService, \ilAccessHandler $accessHandler, \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 $operation, int $objId, int $userId)
 
 getWspId (int $objId, int $userId)
 

Protected Attributes

ILIAS Blog InternalGUIService $gui
 
ilTaskService $taskService
 
ilAccess $accessHandler
 
ilLanguage $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBlogDraftsDerivedTaskProvider::__construct ( ilTaskService  $taskService,
\ilAccessHandler  $accessHandler,
\ilLanguage  $lng 
)

Definition at line 32 of file class.ilBlogDraftsDerivedTaskProvider.php.

36 {
37 global $DIC;
38
39 $this->gui = $DIC->blog()->internal()->gui();
40 $this->taskService = $taskService;
41 $this->accessHandler = $accessHandler;
42 $this->lng = $lng;
43
44 $this->lng->loadLanguageModule('blog');
45 }
global $DIC
Definition: shib_login.php:26

References $accessHandler, $DIC, $lng, $taskService, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstRefIdWithPermission()

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

Definition at line 103 of file class.ilBlogDraftsDerivedTaskProvider.php.

107 : int {
109 if ($this->accessHandler->checkAccessOfUser($userId, $operation, '', $refId)) {
110 return $refId;
111 }
112 }
113
114 return 0;
115 }
static _getAllReferences(int $id)
get all reference ids for object ID
$objId
Definition: xapitoken.php:57
$refId
Definition: xapitoken.php:58

References $refId.

Referenced by getTasks().

+ Here is the caller graph for this function:

◆ getTasks()

ilBlogDraftsDerivedTaskProvider::getTasks ( int  $user_id)

Get providers.

Returns
ilDerivedTask[]

Implements ilDerivedTaskProvider.

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

52 : array
53 {
54 $tasks = [];
55
56 global $DIC;
57 $mgr = $DIC->blog()->internal()->domain()->posting();
58 $blogs = $mgr->searchBlogsByAuthor($user_id);
59 foreach ($blogs as $blog_id) {
60 $posts = $mgr->getAllByBlog($blog_id);
61 foreach ($posts as $post) {
62 $post_id = $post->getId();
63 if ($post->getAuthor() !== $user_id) {
64 continue;
65 }
66
67 $active = ilBlogPosting::_lookupActive($post->getId(), "blp");
68 $withdrawn = $post->getLastWithdrawn()?->get(IL_CAL_DATETIME);
69 if (!$active && $withdrawn === null) {
70 $refId = $this->getFirstRefIdWithPermission('read', $blog_id, $user_id);
71 $wspId = 0;
72 $url = $this->gui->permanentLink($refId)->getPermanentLink($post->getId(), true);
73
74 if ($refId === 0) {
75 $wspId = $this->getWspId($blog_id, $user_id);
76 if ($wspId === 0) {
77 continue;
78 }
79 $url = $this->gui->permanentLink(0, $wspId)->getPermanentLink($post_id, true);
80 }
81
82 $title = sprintf(
83 $this->lng->txt('blog_task_publishing_draft_title'),
84 $post->getTitle(),
85 );
86
87 $task = $this->taskService->derived()->factory()->task(
88 $title,
89 $refId,
90 0,
91 0,
92 $wspId
93 );
94
95 $tasks[] = $task->withUrl($url);
96 }
97 }
98 }
99
100 return $tasks;
101 }
const IL_CAL_DATETIME
getFirstRefIdWithPermission(string $operation, int $objId, int $userId)
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
$post
Definition: ltitoken.php:46
$url
Definition: shib_logout.php:68

References $DIC, $post, $refId, $url, $user_id, ilPageObject\_lookupActive(), getFirstRefIdWithPermission(), getWspId(), IL_CAL_DATETIME, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getWspId()

ilBlogDraftsDerivedTaskProvider::getWspId ( int  $objId,
int  $userId 
)
protected

Definition at line 117 of file class.ilBlogDraftsDerivedTaskProvider.php.

117 : int
118 {
119 $wst = new ilWorkspaceTree($userId);
120 return $wst->lookupNodeId($objId);
121 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $objId.

Referenced by getTasks().

+ Here is the caller graph for this function:

◆ isActive()

ilBlogDraftsDerivedTaskProvider::isActive ( )

Is provider active?

Implements ilDerivedTaskProvider.

Definition at line 47 of file class.ilBlogDraftsDerivedTaskProvider.php.

47 : bool
48 {
49 return true;
50 }

Field Documentation

◆ $accessHandler

ilAccess ilBlogDraftsDerivedTaskProvider::$accessHandler
protected

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

Referenced by __construct().

◆ $gui

ILIAS Blog InternalGUIService ilBlogDraftsDerivedTaskProvider::$gui
protected

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

◆ $lng

ilLanguage ilBlogDraftsDerivedTaskProvider::$lng
protected

Definition at line 30 of file class.ilBlogDraftsDerivedTaskProvider.php.

Referenced by __construct().

◆ $taskService

ilTaskService ilBlogDraftsDerivedTaskProvider::$taskService
protected

Definition at line 28 of file class.ilBlogDraftsDerivedTaskProvider.php.

Referenced by __construct().


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