ILIAS  release_8 Revision v8.24
ilBlogDraftsDerivedTaskProvider Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

ilTaskService $taskService
 
ilAccess $accessHandler
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilBlogDraftsDerivedTaskProvider

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

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

Constructor & Destructor Documentation

◆ __construct()

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

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

33 {
34 $this->taskService = $taskService;
35 $this->accessHandler = $accessHandler;
36 $this->lng = $lng;
37
38 $this->lng->loadLanguageModule('blog');
39 }

References $accessHandler, $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 95 of file class.ilBlogDraftsDerivedTaskProvider.php.

99 : int {
101 if ($this->accessHandler->checkAccessOfUser($userId, $operation, '', $refId)) {
102 return $refId;
103 }
104 }
105
106 return 0;
107 }
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 46 of file class.ilBlogDraftsDerivedTaskProvider.php.

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

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

+ Here is the call graph for this function:

◆ getWspId()

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

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

109 : int
110 {
111 $wst = new ilWorkspaceTree($userId);
112 return $wst->lookupNodeId($objId);
113 }
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 41 of file class.ilBlogDraftsDerivedTaskProvider.php.

41 : bool
42 {
43 return true;
44 }

Field Documentation

◆ $accessHandler

ilAccess ilBlogDraftsDerivedTaskProvider::$accessHandler
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilBlogDraftsDerivedTaskProvider::$lng
protected

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

Referenced by __construct().

◆ $taskService

ilTaskService ilBlogDraftsDerivedTaskProvider::$taskService
protected

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

Referenced by __construct().


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