ILIAS  release_7 Revision v7.30-3-g800a261c036
ilBlogDraftsDerivedTaskProvider Class Reference

Class ilBlogDraftsDerivedTaskProvider. More...

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

Public Member Functions

 __construct (ilTaskService $taskService, \ilAccessHandler $accessHandler, \ilLanguage $lng)
 ilBlogDraftsDerivedTaskProvider constructor. More...
 
 isActive ()
 @inheritDoc More...
 
 getTasks (int $user_id)
 @inheritDoc 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

 $taskService
 
 $accessHandler
 
 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilBlogDraftsDerivedTaskProvider constructor.

Parameters
\ilTaskService$taskService
\ilAccessHandler$accessHandler
\ilLanguage$lng

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

29 {
30 $this->taskService = $taskService;
31 $this->accessHandler = $accessHandler;
32 $this->lng = $lng;
33
34 $this->lng->loadLanguageModule('blog');
35 }

References $accessHandler, $lng, and $taskService.

Member Function Documentation

◆ getFirstRefIdWithPermission()

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

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

103 : int
104 {
106 if ($this->accessHandler->checkAccessOfUser($userId, $operation, '', $refId)) {
107 return $refId;
108 }
109 }
110
111 return 0;
112 }
static _getAllReferences($a_id)
get all reference ids of object
$objId
Definition: xapitoken.php:39
$refId
Definition: xapitoken.php:40

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()

ilBlogDraftsDerivedTaskProvider::getTasks ( int  $user_id)

@inheritDoc

Implements ilDerivedTaskProvider.

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

48 : array
49 {
50 $tasks = [];
51
52 $blogs = ilBlogPosting::searchBlogsByAuthor($user_id);
53 foreach ($blogs as $blog_id) {
54 $posts = ilBlogPosting::getAllPostings($blog_id);
55 foreach ($posts as $post_id => $post) {
56 if ((int) $post['author'] !== $user_id) {
57 continue;
58 }
59
60 $active = ilBlogPosting::_lookupActive($post_id, "blp");
61 $withdrawn = $post['last_withdrawn']->get(IL_CAL_DATETIME);
62 if (!$active && $withdrawn === null) {
63 $refId = $this->getFirstRefIdWithPermission('read', $blog_id, $user_id);
64 $wspId = 0;
65
66 $url = ilLink::_getStaticLink($refId, 'blog', true, "_" . $post_id . "_edit");
67
68 if ($refId === 0) {
69 $wspId = $this->getWspId($blog_id, $user_id);
70 if ($wspId === 0) {
71 continue;
72 }
73 $url = ilLink::_getStaticLink($wspId, 'blog', true, "_" . $post_id . "_edit_wsp");
74 }
75
76 $title = sprintf(
77 $this->lng->txt('blog_task_publishing_draft_title'),
78 $post['title']
79 );
80
81 $task = $this->taskService->derived()->factory()->task(
82 $title,
83 $refId,
84 0,
85 0,
86 $wspId
87 );
88
89 $tasks[] = $task->withUrl($url);
90 }
91 }
92 }
93
94 return $tasks;
95 }
const IL_CAL_DATETIME
getFirstRefIdWithPermission(string $operation, int $objId, int $userId)
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
static searchBlogsByAuthor($a_user_id)
Get all blogs where user has postings.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
$url

References $refId, $url, ilLink\_getStaticLink(), ilPageObject\_lookupActive(), ilBlogPosting\getAllPostings(), getFirstRefIdWithPermission(), getWspId(), IL_CAL_DATETIME, and ilBlogPosting\searchBlogsByAuthor().

+ Here is the call graph for this function:

◆ getWspId()

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

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

119 : int
120 {
121 $wst = new ilWorkspaceTree($userId);
122 $nodeId = $wst->lookupNodeId($objId);
123 return $nodeId;
124 }
Tree handler for personal workspace.

References $objId.

Referenced by getTasks().

+ Here is the caller graph for this function:

◆ isActive()

ilBlogDraftsDerivedTaskProvider::isActive ( )

@inheritDoc

Implements ilDerivedTaskProvider.

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

40 : bool
41 {
42 return true;
43 }

Field Documentation

◆ $accessHandler

ilBlogDraftsDerivedTaskProvider::$accessHandler
protected

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

Referenced by __construct().

◆ $lng

ilBlogDraftsDerivedTaskProvider::$lng
protected

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

Referenced by __construct().

◆ $taskService

ilBlogDraftsDerivedTaskProvider::$taskService
protected

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

Referenced by __construct().


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