ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjBlog Class Reference
+ Inheritance diagram for ilObjBlog:
+ Collaboration diagram for ilObjBlog:

Public Member Functions

 __construct (int $a_id=0, bool $a_reference=true)
 
 getNotesStatus ()
 
 setNotesStatus (bool $a_status)
 
 initDefaultRoles ()
 
 getLocalContributorRole (int $a_node_id)
 
 getLocalEditorRole (int $a_node_id)
 
 getAllLocalRoles (int $a_node_id)
 
 getRolesWithContributeOrRedact (int $a_node_id)
 
- Public Member Functions inherited from ilObject2
 __construct (int $a_id=0, bool $a_reference=true)
 Constructor. More...
 
 read ()
 
 create (bool $a_clone_mode=false)
 
 update ()
 
 delete ()
 
 cloneMetaData (ilObject $target_obj)
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static sendNotification (string $a_action, bool $a_in_wsp, int $a_blog_node_id, int $a_posting_id, ?string $a_comment=null)
 
static deliverRSS (string $a_wsp_id)
 Deliver blog as rss feed. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

const NAV_MODE_LIST = 1
 
const NAV_MODE_MONTH = 2
 
const ABSTRACT_DEFAULT_SHORTEN_LENGTH = 500
 
const ABSTRACT_DEFAULT_IMAGE_WIDTH = 144
 
const ABSTRACT_DEFAULT_IMAGE_HEIGHT = 144
 
const NAV_MODE_LIST_DEFAULT_POSTINGS = 10
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Member Functions

 initType ()
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 doDelete ()
 
 doUpdate ()
 
 doCloneObject (ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 beforeCreate ()
 If overwritten this method should return true, there is currently no "abort" handling for cases where "false" is returned. More...
 
 doUpdate ()
 
 beforeUpdate ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject (ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
 
 beforeCloneObject ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

Settings $blog_settings = null
 
SettingsManager $settings_manager
 
ILIAS Style Content DomainService $content_style_domain
 
ILIAS Notes Service $notes_service
 
bool $notes = false
 
bool $style = false
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

Definition at line 24 of file class.ilObjBlog.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjBlog::__construct ( int  $a_id = 0,
bool  $a_reference = true 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ilObject\getId().

43  {
44  global $DIC;
45 
46  $this->notes_service = $DIC->notes();
47  $this->settings_manager = $DIC->blog()->internal()->domain()->blogSettings();
48 
49  parent::__construct($a_id, $a_reference);
50  $this->rbac_review = $DIC->rbac()->review();
51 
52  $this->content_style_domain = $DIC
53  ->contentStyle()
54  ->domain();
55 
56  if ($this->getId() > 0) {
57  $this->blog_settings = $this->settings_manager->getByObjId($this->getId());
58  }
59  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ deliverRSS()

static ilObjBlog::deliverRSS ( string  $a_wsp_id)
static

Deliver blog as rss feed.

Definition at line 257 of file class.ilObjBlog.php.

References $DIC, $id, $ilSetting, $url, ilPageObject\_lookupActive(), ilObject\_lookupObjId(), exit, ilBlogPosting\getAllPostings(), ilBlogPostingGUI\getSnippet(), IL_CAL_DATETIME, and null.

257  : void
258  {
259  global $DIC;
260 
261  $ilSetting = $DIC->settings();
262 
263  if (!$ilSetting->get('enable_global_profiles')) {
264  return;
265  }
266 
267  // #10827
268  if (!str_ends_with($a_wsp_id, "_cll")) {
269  $wsp_id = new ilWorkspaceTree(0);
270  $obj_id = $wsp_id->lookupObjectId((int) $a_wsp_id);
271  $is_wsp = "_wsp";
272  $pl = $DIC->blog()->internal()->gui()->permanentLink(0, (int) $a_wsp_id);
273  } else {
274  $a_wsp_id = substr($a_wsp_id, 0, -4);
275  $obj_id = ilObject::_lookupObjId((int) $a_wsp_id);
276  $is_wsp = null;
277  $pl = $DIC->blog()->internal()->gui()->permanentLink((int) $a_wsp_id);
278  }
279  if (!$obj_id) {
280  return;
281  }
282 
283  $blog_settings = $DIC->blog()->internal()->domain()->blogSettings()
284  ->getByObjId($obj_id);
285  if (!$blog_settings?->getRSS()) {
286  return;
287  }
288 
289  $blog = new self($obj_id, false);
290  $feed = new ilFeedWriter();
291 
292  $url = $pl->getPermanentLink();
293  $url = str_replace("&", "&", $url);
294 
295  // #11870
296  $feed->setChannelTitle(str_replace("&", "&", $blog->getTitle()));
297  $feed->setChannelDescription(str_replace("&", "&", $blog->getDescription()));
298  $feed->setChannelLink($url);
299 
300  // needed for blogpostinggui / pagegui
301  $tpl = new ilGlobalTemplate("tpl.main.html", true, true);
302 
303  foreach (ilBlogPosting::getAllPostings($obj_id) as $item) {
304  $id = $item["id"];
305 
306  // only published items
307  $is_active = ilBlogPosting::_lookupActive($id, "blp");
308  if (!$is_active) {
309  continue;
310  }
311 
312  // #16434
313  $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id), "<br><br/><div><p>");
314  $snippet = str_replace("&", "&amp;", $snippet);
315  $snippet = "<![CDATA[" . $snippet . "]]>";
316 
317  $url = $pl->getPermanentLink((int) $id);
318  $url = str_replace("&", "&amp;", $url);
319 
320  $feed_item = new ilFeedItem();
321  $feed_item->setTitle(str_replace("&", "&amp;", $item["title"])); // #16022
322  $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME));
323  $feed_item->setDescription($snippet);
324  $feed_item->setLink($url);
325  $feed_item->setAbout($url);
326  $feed->addItem($feed_item);
327  }
328 
329  $feed->showFeed();
330  exit();
331  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
Settings $blog_settings
const IL_CAL_DATETIME
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
special template class to simplify handling of ITX/PEAR
$url
Definition: shib_logout.php:66
static getSnippet(int $a_id, bool $a_truncate=false, int $a_truncate_length=500, string $a_truncate_sign="...", bool $a_include_picture=false, int $a_picture_width=144, int $a_picture_height=144, ?string $a_export_directory=null)
Get first text paragraph of page.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
global $ilSetting
Definition: privfeed.php:31
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ doCloneObject()

ilObjBlog::doCloneObject ( ilObject2  $new_obj,
int  $a_target_id,
?int  $a_copy_id = null 
)
protected

Definition at line 132 of file class.ilObjBlog.php.

References ilObject2\cloneMetaData(), ilObject\getId(), getNotesStatus(), and ilObject2\update().

132  : void
133  {
134  assert($new_obj instanceof ilObjBlog);
135 
136  $new_obj->setNotesStatus($this->getNotesStatus());
137  $new_obj->update();
138 
139  $this->settings_manager->clone($this->getId(), $new_obj->getId());
140 
141  // set/copy stylesheet
142  $this->content_style_domain->styleForObjId($this->getId())->cloneTo($new_obj->getId());
143 
144  $this->cloneMetaData($new_obj);
145  }
cloneMetaData(ilObject $target_obj)
+ Here is the call graph for this function:

◆ doCreate()

ilObjBlog::doCreate ( bool  $clone_mode = false)
protected

Definition at line 75 of file class.ilObjBlog.php.

References ilObject\$db, $ilDB, and ilObject\createMetaData().

75  : void
76  {
77  $ilDB = $this->db;
78 
79  $this->createMetaData();
80 
81  $ilDB->manipulate("INSERT INTO il_blog (id,ppic,rss_active,approval" .
82  ",abs_shorten,abs_shorten_len,abs_image,abs_img_width,abs_img_height" .
83  ",keywords,authors,nav_mode,nav_list_mon_with_post,ov_post) VALUES (" .
84  $ilDB->quote($this->id, "integer") . "," .
85  $ilDB->quote(true, "integer") . "," .
86  $ilDB->quote(true, "integer") . "," .
87  $ilDB->quote(false, "integer") . "," .
88  $ilDB->quote(false, "integer") . "," .
89  $ilDB->quote(0, "integer") . "," .
90  $ilDB->quote(false, "integer") . "," .
91  $ilDB->quote(0, "integer") . "," .
92  $ilDB->quote(0, "integer") . "," .
93  $ilDB->quote(true, "integer") . "," .
94  $ilDB->quote(false, "integer") . "," .
95  $ilDB->quote(self::NAV_MODE_LIST, "integer") . "," .
96  $ilDB->quote(5, "integer") . "," .
97  $ilDB->quote(5, "integer") .
98  ")");
99 
100  // #14661
101  $this->notes_service->domain()->activateComments($this->id);
102  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ doDelete()

ilObjBlog::doDelete ( )
protected

Definition at line 104 of file class.ilObjBlog.php.

References ilObject\$db, $ilDB, ilBlogPosting\deleteAllBlogPostings(), ilObject\deleteMetaData(), ilNotification\removeForObject(), and ilNotification\TYPE_BLOG.

104  : void
105  {
106  $ilDB = $this->db;
107 
108  $this->deleteMetaData();
109 
111 
112  // remove all notifications
114 
115  $ilDB->manipulate("DELETE FROM il_blog" .
116  " WHERE id = " . $ilDB->quote($this->id, "integer"));
117  }
static deleteAllBlogPostings(int $a_blog_id)
Delete all postings for blog.
ilDBInterface $db
static removeForObject(int $type, int $id)
Remove all notifications for given object.
+ Here is the call graph for this function:

◆ doRead()

ilObjBlog::doRead ( )
protected

Definition at line 66 of file class.ilObjBlog.php.

References ilObject\getId(), and setNotesStatus().

66  : void
67  {
68  // #14661
69  $this->setNotesStatus(
70  $this->notes_service->domain()->commentsActive($this->id)
71  );
72  $this->blog_settings = $this->settings_manager->getByObjId($this->getId());
73  }
setNotesStatus(bool $a_status)
+ Here is the call graph for this function:

◆ doUpdate()

ilObjBlog::doUpdate ( )
protected

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

References getNotesStatus(), and ilObject\updateMetaData().

119  : void
120  {
121  $this->updateMetaData();
122 
123  if ($this->id) {
124  // #14661
125  $this->notes_service->domain()->activateComments(
126  $this->id,
127  $this->getNotesStatus()
128  );
129  }
130  }
+ Here is the call graph for this function:

◆ getAllLocalRoles()

ilObjBlog::getAllLocalRoles ( int  $a_node_id)

Definition at line 370 of file class.ilObjBlog.php.

References $res, ilObjRole\_getTranslation(), and ilObject\_lookupTitle().

370  : array
371  {
372  $res = array();
373  foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
375  }
376 
377  asort($res);
378  return $res;
379  }
$res
Definition: ltiservices.php:66
static _lookupTitle(int $obj_id)
static _getTranslation(string $a_role_title)
+ Here is the call graph for this function:

◆ getLocalContributorRole()

ilObjBlog::getLocalContributorRole ( int  $a_node_id)

Definition at line 350 of file class.ilObjBlog.php.

References ilObject\_lookupTitle().

Referenced by getRolesWithContributeOrRedact().

350  : int
351  {
352  foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
353  if (str_starts_with(ilObject::_lookupTitle($role_id), "il_blog_contributor")) {
354  return $role_id;
355  }
356  }
357  return 0;
358  }
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalEditorRole()

ilObjBlog::getLocalEditorRole ( int  $a_node_id)

Definition at line 360 of file class.ilObjBlog.php.

References ilObject\_lookupTitle().

Referenced by getRolesWithContributeOrRedact().

360  : int
361  {
362  foreach ($this->rbac_review->getLocalRoles($a_node_id) as $role_id) {
363  if (strpos(ilObject::_lookupTitle($role_id), "il_blog_editor") === 0) {
364  return $role_id;
365  }
366  }
367  return 0;
368  }
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotesStatus()

ilObjBlog::getNotesStatus ( )

Definition at line 147 of file class.ilObjBlog.php.

References $notes.

Referenced by doCloneObject(), and doUpdate().

147  : bool
148  {
149  return $this->notes;
150  }
+ Here is the caller graph for this function:

◆ getRolesWithContributeOrRedact()

ilObjBlog::getRolesWithContributeOrRedact ( int  $a_node_id)

Definition at line 381 of file class.ilObjBlog.php.

References $res, ilRbacReview\_getOperationIdByName(), ilObjRole\_getTranslation(), getLocalContributorRole(), and getLocalEditorRole().

381  : array
382  {
383  $contr_op_id = ilRbacReview::_getOperationIdByName("contribute");
384  $redact_op_id = ilRbacReview::_getOperationIdByName("redact");
385  $contr_role_id = $this->getLocalContributorRole($a_node_id);
386  $editor_role_id = $this->getLocalEditorRole($a_node_id);
387 
388  $res = array();
389  foreach ($this->rbac_review->getParentRoleIds($a_node_id) as $role_id => $role) {
390  if ($role_id != $contr_role_id &&
391  $role_id != $editor_role_id) {
392  $all_ops = $this->rbac_review->getActiveOperationsOfRole($a_node_id, $role_id);
393  if (in_array($contr_op_id, $all_ops) ||
394  in_array($redact_op_id, $all_ops)) {
395  $res[$role_id] = ilObjRole::_getTranslation($role["title"]);
396  }
397  }
398  }
399 
400  return $res;
401  }
$res
Definition: ltiservices.php:66
getLocalContributorRole(int $a_node_id)
static _getTranslation(string $a_role_title)
static _getOperationIdByName(string $a_operation)
get operation id by name of operation
getLocalEditorRole(int $a_node_id)
+ Here is the call graph for this function:

◆ initDefaultRoles()

ilObjBlog::initDefaultRoles ( )

Definition at line 333 of file class.ilObjBlog.php.

References ilObjRole\createDefaultRole(), ilObject\getId(), and ilObject\getRefId().

333  : void
334  {
336  'il_blog_contributor_' . $this->getRefId(),
337  "Contributor of blog obj_no." . $this->getId(),
338  'il_blog_contributor',
339  $this->getRefId()
340  );
341 
343  'il_blog_editor_' . $this->getRefId(),
344  "Editor of blog obj_no." . $this->getId(),
345  'il_blog_editor',
346  $this->getRefId()
347  );
348  }
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)
+ Here is the call graph for this function:

◆ initType()

ilObjBlog::initType ( )
protected

Definition at line 61 of file class.ilObjBlog.php.

61  : void
62  {
63  $this->type = "blog";
64  }

◆ sendNotification()

static ilObjBlog::sendNotification ( string  $a_action,
bool  $a_in_wsp,
int  $a_blog_node_id,
int  $a_posting_id,
?string  $a_comment = null 
)
static

Definition at line 157 of file class.ilObjBlog.php.

References $DIC, ilObject\$tree, ilObject\_lookupObjId(), ilNotification\getNotificationsForObject(), null, ilNotification\TYPE_BLOG, and ilNotification\updateNotificationTime().

Referenced by ilBlogPostingGUI\activatePage(), ilBlogPostingGUI\observeNoteAction(), and ilBlogPosting\update().

163  : void {
164  global $DIC;
165 
166  $ilUser = $DIC->user();
167 
168  // get blog object id (repository or workspace)
169  if ($a_in_wsp) {
170  $tree = new ilWorkspaceTree($ilUser->getId()); // owner of tree is irrelevant
171  $blog_obj_id = $tree->lookupObjectId($a_blog_node_id);
172  $access_handler = new ilWorkspaceAccessHandler($tree);
173  } else {
174  $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id);
175  $access_handler = null;
176  }
177  if (!$blog_obj_id) {
178  return;
179  }
180 
181  $posting = new ilBlogPosting($a_posting_id);
182 
183  // #11138
184  $ignore_threshold = ($a_action === "comment");
185 
186  $admin_only = false;
187 
188  // approval handling
189  if (!$posting->isApproved()) {
190  $blog_settings = $DIC->blog()->internal()->domain()->blogSettings()->getByObjId($blog_obj_id);
191  if ($blog_settings?->getApproval()) {
192  switch ($a_action) {
193  case "update":
194  // un-approved posting was updated - no notifications
195  return;
196 
197  case "new":
198  // un-approved posting was activated - admin-only notification
199  $admin_only = true;
200  $ignore_threshold = true;
201  $a_action = "approve";
202  break;
203  }
204  }
205  }
206 
207  // create/update news item (only in repository)
208  if (!$a_in_wsp &&
209  in_array($a_action, array("update", "new"))) {
210  $posting->handleNews(($a_action === "update"));
211  }
212 
213  // recipients
216  $blog_obj_id,
217  $a_posting_id,
218  $ignore_threshold
219  );
220  if (!count($users)) {
221  return;
222  }
223 
224  $ntf = new ilSystemNotification($a_in_wsp);
225  $ntf->setLangModules(array("blog"));
226  $ntf->setRefId($a_blog_node_id);
227  $ntf->setChangedByUserId($ilUser->getId());
228  $ntf->setSubjectLangId('blog_change_notification_subject');
229  $ntf->setIntroductionLangId('blog_change_notification_body_' . $a_action);
230  $ntf->addAdditionalInfo('blog_posting', $posting->getTitle());
231  if ($a_comment) {
232  $ntf->addAdditionalInfo('comment', $a_comment, true);
233  }
234  $ntf->setGotoLangId('blog_change_notification_link');
235  $ntf->setReasonLangId('blog_change_notification_reason');
236 
237  $abstract = $posting->getNotificationAbstract();
238  if ($abstract) {
239  $ntf->addAdditionalInfo('content', $abstract, true);
240  }
241 
242  $notified = $ntf->sendMailAndReturnRecipients(
243  $users,
244  "_" . $a_posting_id,
245  ($admin_only ? "write" : "read")
246  );
247 
248  // #14387
249  if (count($notified)) {
250  ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified, $a_posting_id);
251  }
252  }
Settings $blog_settings
Class ilBlogPosting.
ilTree $tree
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
static updateNotificationTime(int $type, int $id, array $user_ids, ?int $page_id=null, bool $activate_new_entries=true)
Update the last mail timestamp for given object and users.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNotesStatus()

ilObjBlog::setNotesStatus ( bool  $a_status)

Definition at line 152 of file class.ilObjBlog.php.

Referenced by doRead().

152  : void
153  {
154  $this->notes = $a_status;
155  }
+ Here is the caller graph for this function:

Field Documentation

◆ $blog_settings

Settings ilObjBlog::$blog_settings = null
protected

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

◆ $content_style_domain

ILIAS Style Content DomainService ilObjBlog::$content_style_domain
protected

Definition at line 34 of file class.ilObjBlog.php.

◆ $notes

bool ilObjBlog::$notes = false
protected

Definition at line 37 of file class.ilObjBlog.php.

Referenced by getNotesStatus().

◆ $notes_service

ILIAS Notes Service ilObjBlog::$notes_service
protected

Definition at line 35 of file class.ilObjBlog.php.

◆ $settings_manager

SettingsManager ilObjBlog::$settings_manager
protected

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

◆ $style

bool ilObjBlog::$style = false
protected

Definition at line 38 of file class.ilObjBlog.php.

◆ ABSTRACT_DEFAULT_IMAGE_HEIGHT

const ilObjBlog::ABSTRACT_DEFAULT_IMAGE_HEIGHT = 144

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

◆ ABSTRACT_DEFAULT_IMAGE_WIDTH

const ilObjBlog::ABSTRACT_DEFAULT_IMAGE_WIDTH = 144

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

◆ ABSTRACT_DEFAULT_SHORTEN_LENGTH

const ilObjBlog::ABSTRACT_DEFAULT_SHORTEN_LENGTH = 500

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

◆ NAV_MODE_LIST

◆ NAV_MODE_LIST_DEFAULT_POSTINGS

const ilObjBlog::NAV_MODE_LIST_DEFAULT_POSTINGS = 10

Definition at line 31 of file class.ilObjBlog.php.

◆ NAV_MODE_MONTH

const ilObjBlog::NAV_MODE_MONTH = 2

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