ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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...
 

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.

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

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:22
+ Here is the call graph for this function:

Member Function Documentation

◆ getFirstRefIdWithPermission()

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

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

References $refId, and ilObject\_getAllReferences().

Referenced by getTasks().

104  : int {
105  foreach (\ilObject::_getAllReferences($objId) as $refId) {
106  if ($this->accessHandler->checkAccessOfUser($userId, $operation, '', $refId)) {
107  return $refId;
108  }
109  }
110 
111  return 0;
112  }
static _getAllReferences(int $id)
get all reference ids for object ID
$objId
Definition: xapitoken.php:57
$refId
Definition: xapitoken.php:58
+ Here is the call graph for this function:
+ 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.

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

52  : array
53  {
54  $tasks = [];
55 
57  foreach ($blogs as $blog_id) {
58  $posts = ilBlogPosting::getAllPostings($blog_id);
59  foreach ($posts as $post_id => $post) {
60  if ((int) $post['author'] !== $user_id) {
61  continue;
62  }
63 
64  $active = ilBlogPosting::_lookupActive($post_id, "blp");
65  $withdrawn = $post['last_withdrawn']->get(IL_CAL_DATETIME);
66  if (!$active && $withdrawn === null) {
67  $refId = $this->getFirstRefIdWithPermission('read', $blog_id, $user_id);
68  $wspId = 0;
69  $url = $this->gui->permanentLink($refId)->getPermanentLink($post_id, true);
70 
71  if ($refId === 0) {
72  $wspId = $this->getWspId($blog_id, $user_id);
73  if ($wspId === 0) {
74  continue;
75  }
76  $url = $this->gui->permanentLink(0, $wspId)->getPermanentLink($post_id, true);
77  }
78 
79  $title = sprintf(
80  $this->lng->txt('blog_task_publishing_draft_title'),
81  $post['title']
82  );
83 
84  $task = $this->taskService->derived()->factory()->task(
85  $title,
86  $refId,
87  0,
88  0,
89  $wspId
90  );
91 
92  $tasks[] = $task->withUrl($url);
93  }
94  }
95  }
96 
97  return $tasks;
98  }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
const IL_CAL_DATETIME
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.
getFirstRefIdWithPermission(string $operation, int $objId, int $userId)
$refId
Definition: xapitoken.php:58
$url
Definition: shib_logout.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$post
Definition: ltitoken.php:46
+ Here is the call graph for this function:

◆ getWspId()

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

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

Referenced by getTasks().

114  : int
115  {
116  $wst = new ilWorkspaceTree($userId);
117  return $wst->lookupNodeId($objId);
118  }
$objId
Definition: xapitoken.php:57
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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: