ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjForum Class Reference

Class ilObjForum. More...

+ Inheritance diagram for ilObjForum:
+ Collaboration diagram for ilObjForum:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 create ()
 
 setPermissions (int $parent_ref_id)
 
 updateModeratorRole (int $role_id)
 
 getCountUnread (int $a_usr_id, int $a_thread_id=0, bool $ignoreRoot=false)
 
 markThreadRead (int $a_usr_id, int $a_thread_id)
 
 markAllThreadsRead (int $a_usr_id)
 
 markPostRead (int $a_usr_id, int $a_thread_id, int $a_post_id)
 
 markPostUnread (int $a_user_id, int $a_post_id)
 
 isRead ($a_usr_id, $a_post_id)
 
 updateModificationUserId (int $usr_id)
 
 update ()
 
 cloneAutoGeneratedRoles (self $new_obj)
 
 delete ()
 
 initDefaultRoles ()
 
 createSettings ()
 
 saveData ()
 
 getNumStickyThreads ()
 
 getPageObjIds ()
 
- 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 _lookupThreadSubject (int $a_thread_id)
 
static _deleteUser (int $a_usr_id)
 
static _deleteReadEntries (int $a_post_id)
 
static _lookupModeratorRole (int $a_ref_id)
 
static lookupForumIdByObjId (int $obj_id)
 
static lookupForumIdByRefId (int $ref_id)
 
static preloadForumIdsByObjIds (array $obj_ids)
 
static preloadForumIdsByRefIds (array $ref_ids)
 
static lookupStatisticsByRefId (int $ref_id)
 
static lookupLastPostByRefId (int $ref_id)
 
static getUserIdsOfLastPostsByRefIdAndThreadIds (int $ref_id, array $thread_ids)
 
static mergeForumUserRead (int $merge_source_thread_id, int $merge_target_thread_id)
 
- 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

ilForum $Forum
 
- 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
 

Private Member Functions

 deleteDraftsByForumId (int $forum_id)
 

Private Attributes

readonly ILIAS DI RBACServices $rbac
 
readonly ilLogger $logger
 
readonly ilSetting $settings
 

Static Private Attributes

static array $obj_id_to_forum_id_cache = []
 
static array $ref_id_to_forum_id_cache = []
 
static array $forum_statistics_cache = []
 
static array $forum_last_post_cache = []
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 
- 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

Class ilObjForum.

Author
Wolfgang Merkens wmerk.nosp@m.ens@.nosp@m.datab.nosp@m.ay.d.nosp@m.e \

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

Constructor & Destructor Documentation

◆ __construct()

ilObjForum::__construct ( int  $a_id = 0,
bool  $a_call_by_reference = true 
)

Definition at line 41 of file class.ilObjForum.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\logger(), ILIAS\Repository\rbac(), and ILIAS\Repository\settings().

42  {
43  global $DIC;
44 
45  $this->type = 'frm';
46  parent::__construct($a_id, $a_call_by_reference);
47 
48  $this->rbac = $DIC->rbac();
49  $this->logger = $DIC->logger()->root();
50 
51  $this->settings = $DIC->settings();
52  $this->Forum = new ilForum();
53  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteReadEntries()

static ilObjForum::_deleteReadEntries ( int  $a_post_id)
static

Definition at line 259 of file class.ilObjForum.php.

References $DIC.

Referenced by ilForum\deletePost().

259  : void
260  {
261  global $DIC;
262 
263  $DIC->database()->manipulateF('DELETE FROM frm_user_read WHERE post_id = %s', ['integer'], [$a_post_id]);
264  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _deleteUser()

static ilObjForum::_deleteUser ( int  $a_usr_id)
static

Definition at line 249 of file class.ilObjForum.php.

References $data, and $DIC.

249  : void
250  {
251  global $DIC;
252 
253  $data = [$a_usr_id];
254 
255  $DIC->database()->manipulateF('DELETE FROM frm_user_read WHERE usr_id = %s', ['integer'], $data);
256  $DIC->database()->manipulateF('DELETE FROM frm_notification WHERE user_id = %s', ['integer'], $data);
257  }
global $DIC
Definition: shib_login.php:22

◆ _lookupModeratorRole()

static ilObjForum::_lookupModeratorRole ( int  $a_ref_id)
static

Definition at line 576 of file class.ilObjForum.php.

References $DIC, $ilDB, and $res.

576  : int
577  {
578  global $DIC;
579 
580  $ilDB = $DIC->database();
581 
582  $mod_title = 'il_frm_moderator_' . $a_ref_id;
583 
584  $res = $ilDB->queryF('SELECT obj_id FROM object_data WHERE title = %s', ['text'], [$mod_title]);
585  while ($row = $ilDB->fetchObject($res)) {
586  return (int) $row->obj_id;
587  }
588 
589  return 0;
590  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22

◆ _lookupThreadSubject()

static ilObjForum::_lookupThreadSubject ( int  $a_thread_id)
static

Definition at line 96 of file class.ilObjForum.php.

References $DIC, $ilDB, and $res.

Referenced by ilObjForumSubItemListGUI\getHTML().

96  : string
97  {
98  global $DIC;
99 
100  $ilDB = $DIC->database();
101 
102  $res = $ilDB->queryF('SELECT thr_subject FROM frm_threads WHERE thr_pk = %s', ['integer'], [$a_thread_id]);
103  while ($row = $ilDB->fetchObject($res)) {
104  return $row->thr_subject ?? '';
105  }
106 
107  return '';
108  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ cloneAutoGeneratedRoles()

ilObjForum::cloneAutoGeneratedRoles ( self  $new_obj)

Definition at line 411 of file class.ilObjForum.php.

References ilObject\getOwner(), ilObject\getRefId(), ILIAS\Repository\logger(), and ILIAS\Repository\rbac().

Referenced by update().

411  : void
412  {
413  $src_moderator_role_id = self::_lookupModeratorRole($this->getRefId());
414  $new_moderator_role_id = self::_lookupModeratorRole($new_obj->getRefId());
415 
416  if (
417  0 === $src_moderator_role_id ||
418  0 === $new_moderator_role_id ||
419  0 === $this->getRefId() ||
420  0 === $new_obj->getRefId()
421  ) {
422  $this->logger->write(__METHOD__ . ' : Error cloning auto generated role: il_frm_moderator');
423  }
424 
425  $this->rbac->admin()->copyRolePermissions(
426  $src_moderator_role_id,
427  $this->getRefId(),
428  $new_obj->getRefId(),
429  $new_moderator_role_id,
430  true
431  );
432 
433  $this->logger->write(__METHOD__ . ' : Finished copying of role il_frm_moderator.');
434 
435  $moderators = new ilForumModerators($this->getRefId());
436  $src_moderator_usr_ids = $moderators->getCurrentModerators();
437  foreach ($src_moderator_usr_ids as $usr_id) {
438  // The object owner is already member of the moderator role when this method is called
439  // Since the new static caches are introduced with ILIAS 5.0, a database error occurs if we try to assign the user here.
440  if ($this->getOwner() !== $usr_id) {
441  $this->rbac->admin()->assignUser($new_moderator_role_id, $usr_id);
442  }
443  }
444  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilObjForum::create ( )

Definition at line 55 of file class.ilObjForum.php.

References $id, createSettings(), ilObject\getId(), ilForumProperties\getInstance(), saveData(), ilObject\setOfflineStatus(), ILIAS\Repository\settings(), update(), and ilForumProperties\VIEW_DATE_ASC.

55  : int
56  {
57  $id = parent::create();
58 
59  $properties = ilForumProperties::getInstance($this->getId());
60  $properties->setDefaultView(
61  (int) $this->settings->get('forum_default_view', (string) ilForumProperties::VIEW_DATE_ASC)
62  );
63  $properties->setAnonymisation(false);
64  $properties->setStatisticsStatus(false);
65  $properties->setPostActivation(false);
66  $properties->insert();
67 
68  $this->createSettings();
69 
70  $this->setOfflineStatus(true);
71  $this->update();
72  $this->saveData();
73 
74  return $id;
75  }
static getInstance(int $a_obj_id=0)
setOfflineStatus(bool $status)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ createSettings()

ilObjForum::createSettings ( )

Definition at line 592 of file class.ilObjForum.php.

References $DIC, ilObject\$ref_id, ilNewsItem\_getDefaultVisibilityForRefId(), ilBlockSetting\_write(), and ilObject\getId().

Referenced by create().

592  : void
593  {
594  global $DIC;
595 
596  $ref_id = 0;
597  if ($DIC->http()->wrapper()->query()->has('ref_id')) {
598  $ref_id = $DIC->http()->wrapper()->query()->retrieve(
599  'ref_id',
600  $DIC->refinery()->kindlyTo()->int()
601  );
602  }
603 
604  // news settings (public notifications yes/no)
605  $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($ref_id);
606  if ($default_visibility === 'public') {
607  ilBlockSetting::_write('news', 'public_notifications', '1', 0, $this->getId());
608  }
609  }
static _getDefaultVisibilityForRefId(int $a_ref_id)
Get default visibility for reference id.
global $DIC
Definition: shib_login.php:22
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjForum::delete ( )

Definition at line 446 of file class.ilObjForum.php.

References $res, ilPageObject\_exists(), deleteDraftsByForumId(), ilObject\getId(), ilObject\getType(), ILIAS\Repository\int(), and ilDBConstants\T_INTEGER.

446  : bool
447  {
448  $this->Forum->setForumId($this->getId());
449 
450  if (!parent::delete()) {
451  return false;
452  }
453 
454  if (ilForumPage::_exists($this->getType(), $this->getId())) {
455  $originalPageObject = new ilForumPage($this->getId());
456  $originalPageObject->delete();
457  }
458 
459  $this->Forum->setMDB2WhereCondition('top_frm_fk = %s ', [ilDBConstants::T_INTEGER], [$this->getId()]);
460 
461  $topData = $this->Forum->getOneTopic();
462 
463  $threads = $this->Forum->getAllThreads($topData->getTopPk(), [
464  'is_moderator' => true,
465  ]);
466  $thread_ids_to_delete = [];
467  foreach ($threads['items'] as $thread) {
468  $thread_ids_to_delete[$thread->getId()] = $thread->getId();
469  }
470 
471  // Get All posting IDs
472  $posting_ids = [];
473  $res = $this->db->query(
474  'SELECT pos_pk FROM frm_posts WHERE '
475  . $this->db->in('pos_thr_fk', $thread_ids_to_delete, false, ilDBConstants::T_INTEGER)
476  );
477 
478  while ($row = $res->fetchObject()) {
479  $posting_ids[] = (int) $row->pos_pk;
480  }
481 
482  $tmp_file_obj = new ilFileDataForum($this->getId());
483  $tmp_file_obj->delete($posting_ids);
484 
485  // Get All draft IDs
486  $draft_ids = [];
487  $res = $this->db->query(
488  'SELECT draft_id FROM frm_posts_drafts WHERE '
489  . $this->db->in('thread_id', $thread_ids_to_delete, false, ilDBConstants::T_INTEGER)
490  );
491 
492  while ($row = $res->fetchObject()) {
493  $draft_ids[] = (int) $row->draft_id;
494  }
495 
496  $tmp_file_obj = new ilFileDataForumDrafts($this->getId());
497  $tmp_file_obj->delete($draft_ids);
498 
499  $this->db->manipulate(
500  'DELETE FROM frm_posts_tree WHERE ' . $this->db->in(
501  'thr_fk',
502  $thread_ids_to_delete,
503  false,
505  )
506  );
507  $this->db->manipulate(
508  'DELETE FROM frm_posts WHERE ' . $this->db->in(
509  'pos_thr_fk',
510  $thread_ids_to_delete,
511  false,
513  )
514  );
515  $this->db->manipulate(
516  'DELETE FROM frm_threads WHERE ' . $this->db->in(
517  'thr_pk',
518  $thread_ids_to_delete,
519  false,
521  )
522  );
523 
524  $obj_id = [$this->getId()];
525 
526  $this->db->manipulateF('DELETE FROM frm_data WHERE top_frm_fk = %s', [ilDBConstants::T_INTEGER], $obj_id);
527  $this->db->manipulateF('DELETE FROM frm_settings WHERE obj_id = %s', [ilDBConstants::T_INTEGER], $obj_id);
528  $this->db->manipulateF('DELETE FROM frm_user_read WHERE obj_id = %s', [ilDBConstants::T_INTEGER], $obj_id);
529  $this->db->manipulate(
530  'DELETE FROM frm_notification WHERE ' . $this->db->in(
531  'thread_id',
532  $thread_ids_to_delete,
533  false,
534  'integer'
535  )
536  );
537  $this->db->manipulateF('DELETE FROM frm_notification WHERE frm_id = %s', [ilDBConstants::T_INTEGER], $obj_id);
538  $this->db->manipulateF('DELETE FROM frm_posts_deleted WHERE obj_id = %s', [ilDBConstants::T_INTEGER], $obj_id);
539  $this->deleteDraftsByForumId($topData->getTopPk());
540 
541  return true;
542  }
$res
Definition: ltiservices.php:66
deleteDraftsByForumId(int $forum_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:

◆ deleteDraftsByForumId()

ilObjForum::deleteDraftsByForumId ( int  $forum_id)
private

Definition at line 544 of file class.ilObjForum.php.

References $res, and ILIAS\Repository\int().

Referenced by delete().

544  : void
545  {
546  $res = $this->db->queryF(
547  'SELECT draft_id FROM frm_posts_drafts WHERE forum_id = %s',
548  ['integer'],
549  [$forum_id]
550  );
551 
552  $draft_ids = [];
553  while ($row = $this->db->fetchAssoc($res)) {
554  $draft_ids[] = (int) $row['draft_id'];
555  }
556 
557  if ($draft_ids !== []) {
558  $historyObj = new ilForumDraftsHistory();
559  $historyObj->deleteHistoryByDraftIds($draft_ids);
560 
561  $draftObj = new ilForumPostDraft();
562  $draftObj->deleteDraftsByDraftIds($draft_ids);
563  }
564  }
$res
Definition: ltiservices.php:66
Class ilForumDraftHistory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCountUnread()

ilObjForum::getCountUnread ( int  $a_usr_id,
int  $a_thread_id = 0,
bool  $ignoreRoot = false 
)

Definition at line 110 of file class.ilObjForum.php.

References $res, ilObject\getId(), and ILIAS\Repository\int().

110  : int
111  {
112  $a_frm_id = $this->getId();
113  $topic_id = 0;
114  $num_posts = 0;
115  $count_read = 0;
116 
117  if ($a_thread_id === 0) {
118  $res = $this->db->queryF('SELECT top_pk FROM frm_data WHERE top_frm_fk = %s', ['integer'], [$a_frm_id]);
119  while ($row = $this->db->fetchObject($res)) {
120  $topic_id = (int) $row->top_pk;
121  }
122 
123  $res = $this->db->queryF(
124  '
125  SELECT COUNT(pos_pk) num_posts
126  FROM frm_posts
127  LEFT JOIN frm_posts_tree ON frm_posts_tree.pos_fk = pos_pk
128  WHERE pos_top_fk = %s' . ($ignoreRoot ? ' AND parent_pos != 0 ' : ''),
129  ['integer'],
130  [$topic_id]
131  );
132 
133  while ($row = $this->db->fetchObject($res)) {
134  $num_posts = (int) $row->num_posts;
135  }
136 
137  $res = $this->db->queryF(
138  'SELECT COUNT(post_id) count_read FROM frm_user_read WHERE obj_id = %s AND usr_id = %s',
139  ['integer', 'integer'],
140  [$a_frm_id, $a_usr_id]
141  );
142 
143  while ($row = $this->db->fetchObject($res)) {
144  $count_read = (int) $row->count_read;
145  }
146  } else {
147  $res = $this->db->queryF(
148  '
149  SELECT COUNT(pos_pk) num_posts FROM frm_posts
150  LEFT JOIN frm_posts_tree ON frm_posts_tree.pos_fk = pos_pk
151  WHERE pos_thr_fk = %s' . ($ignoreRoot ? ' AND parent_pos != 0 ' : ''),
152  ['integer'],
153  [$a_thread_id]
154  );
155 
156  $row = $this->db->fetchObject($res);
157  $num_posts = (int) $row->num_posts;
158 
159  $res = $this->db->queryF(
160  '
161  SELECT COUNT(post_id) count_read FROM frm_user_read
162  WHERE obj_id = %s
163  AND usr_id = %s
164  AND thread_id = %s',
165  ['integer', 'integer', 'integer'],
166  [$a_frm_id, $a_frm_id, $a_thread_id]
167  );
168 
169  $row = $this->db->fetchObject($res);
170  $count_read = (int) $row->count_read;
171  }
172  $unread = $num_posts - $count_read;
173 
174  return max($unread, 0);
175  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getNumStickyThreads()

ilObjForum::getNumStickyThreads ( )

Definition at line 1013 of file class.ilObjForum.php.

References $res.

1013  : int
1014  {
1015  $res = $this->db->query(
1016  'SELECT COUNT(is_sticky) num_sticky FROM frm_threads
1017  INNER JOIN frm_data ON top_pk = thr_top_fk
1018  WHERE frm_data.top_frm_fk = ' . $this->db->quote($this->getId(), 'integer') . '
1019  AND is_sticky = ' . $this->db->quote(1, 'integer')
1020  );
1021  if ($row = $this->db->fetchAssoc($res)) {
1022  return (int) $row['num_sticky'];
1023  }
1024 
1025  return 0;
1026  }
$res
Definition: ltiservices.php:66

◆ getPageObjIds()

ilObjForum::getPageObjIds ( )
Returns
int[]

Definition at line 1031 of file class.ilObjForum.php.

References $res, ilObject\getId(), ilObject\getType(), and ILIAS\Repository\int().

1031  : array
1032  {
1033  $pageObjIds = [];
1034 
1035  $sql = 'SELECT DISTINCT page_id FROM page_object WHERE parent_id = %s AND parent_type = %s';
1036  $res = $this->db->queryF(
1037  $sql,
1038  ['integer', 'text'],
1039  [$this->getId(), $this->getType()]
1040  );
1041 
1042  while ($row = $this->db->fetchAssoc($res)) {
1043  $pageObjIds[] = (int) $row['page_id'];
1044  }
1045 
1046  return $pageObjIds;
1047  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getUserIdsOfLastPostsByRefIdAndThreadIds()

static ilObjForum::getUserIdsOfLastPostsByRefIdAndThreadIds ( int  $ref_id,
array  $thread_ids 
)
static
Parameters
int[]$thread_ids
Returns
int[]

Definition at line 948 of file class.ilObjForum.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ILIAS\Forum\Thread\ForumThreadTableSessionStorage\__construct(), and ilForumTopicTableGUI\initMergeThreadsTable().

948  : array
949  {
950  global $DIC;
951 
952  $ilAccess = $DIC->access();
953  $ilUser = $DIC->user();
954  $ilDB = $DIC->database();
955 
956  $act_clause = '';
957  $act_inner_clause = '';
958  if (!$ilAccess->checkAccess('moderate_frm', '', $ref_id)) {
959  $act_clause .= " AND (t1.pos_status = " . $ilDB->quote(
960  1,
961  "integer"
962  ) . " OR t1.pos_author_id = " . $ilDB->quote($ilUser->getId(), "integer") . ") ";
963  $act_inner_clause .= " AND (t3.pos_status = " . $ilDB->quote(
964  1,
965  "integer"
966  ) . " OR t3.pos_author_id = " . $ilDB->quote($ilUser->getId(), "integer") . ") ";
967  }
968 
969  $in = $ilDB->in("t1.pos_thr_fk", $thread_ids, false, 'integer');
970  $inner_in = $ilDB->in("t3.pos_thr_fk", $thread_ids, false, 'integer');
971 
972  $query = "
973  SELECT t1.pos_display_user_id, t1.update_user
974  FROM frm_posts t1
975  INNER JOIN frm_posts_tree tree1 ON tree1.pos_fk = t1.pos_pk AND tree1.parent_pos != 0
976  INNER JOIN (
977  SELECT t3.pos_thr_fk, MAX(t3.pos_date) pos_date
978  FROM frm_posts t3
979  INNER JOIN frm_posts_tree tree2 ON tree2.pos_fk = t3.pos_pk AND tree2.parent_pos != 0
980  WHERE $inner_in $act_inner_clause
981  GROUP BY t3.pos_thr_fk
982  ) t2 ON t2.pos_thr_fk = t1.pos_thr_fk AND t2.pos_date = t1.pos_date
983  WHERE $in $act_clause
984  GROUP BY t1.pos_thr_fk, t1.pos_display_user_id, t1.update_user
985  ";
986 
987  $usr_ids = [];
988 
989  $res = $ilDB->query($query);
990  while ($row = $ilDB->fetchAssoc($res)) {
991  if ((int) $row['pos_display_user_id'] !== 0) {
992  $usr_ids[] = (int) $row['pos_display_user_id'];
993  }
994  if ((int) $row['update_user'] !== 0) {
995  $usr_ids[] = (int) $row['update_user'];
996  }
997  }
998 
999  return array_unique($usr_ids);
1000  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initDefaultRoles()

ilObjForum::initDefaultRoles ( )

Definition at line 566 of file class.ilObjForum.php.

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

566  : void
567  {
569  'il_frm_moderator_' . $this->getRefId(),
570  "Moderator of forum obj_no." . $this->getId(),
571  'il_frm_moderator',
572  $this->getRefId()
573  );
574  }
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)
+ Here is the call graph for this function:

◆ isRead()

ilObjForum::isRead (   $a_usr_id,
  $a_post_id 
)

Definition at line 238 of file class.ilObjForum.php.

References $res.

238  : bool
239  {
240  $res = $this->db->queryF(
241  'SELECT * FROM frm_user_read WHERE usr_id = %s AND post_id = %s',
242  ['integer', 'integer'],
243  [$a_usr_id, $a_post_id]
244  );
245 
246  return (bool) $this->db->numRows($res);
247  }
$res
Definition: ltiservices.php:66

◆ lookupForumIdByObjId()

static ilObjForum::lookupForumIdByObjId ( int  $obj_id)
static

Definition at line 670 of file class.ilObjForum.php.

Referenced by ilObjForumGUI\addDraftButtonIfDraftsExists(), ilObjForumGUI\confirmDeleteThreadDraftsObject(), ilForumExportGUI\ensureThreadBelongsToForum(), ilObjForumGUI\ensureThreadBelongsToForum(), and ILIAS\Forum\Drafts\ForumDraftsTable\initRecords().

670  : int
671  {
672  if (array_key_exists($obj_id, self::$obj_id_to_forum_id_cache)) {
673  return self::$obj_id_to_forum_id_cache[$obj_id];
674  }
675 
676  self::preloadForumIdsByObjIds([$obj_id]);
677 
678  return self::$obj_id_to_forum_id_cache[$obj_id];
679  }
+ Here is the caller graph for this function:

◆ lookupForumIdByRefId()

static ilObjForum::lookupForumIdByRefId ( int  $ref_id)
static

Definition at line 681 of file class.ilObjForum.php.

References ilObject\$ref_id.

Referenced by ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), and ilForumPostDraft\getDraftsStatisticsByRefId().

681  : int
682  {
683  if (array_key_exists($ref_id, self::$ref_id_to_forum_id_cache)) {
684  return self::$ref_id_to_forum_id_cache[$ref_id];
685  }
686 
687  self::preloadForumIdsByRefIds([$ref_id]);
688 
689  return self::$ref_id_to_forum_id_cache[$ref_id];
690  }
+ Here is the caller graph for this function:

◆ lookupLastPostByRefId()

static ilObjForum::lookupLastPostByRefId ( int  $ref_id)
static

Definition at line 870 of file class.ilObjForum.php.

References $data, $DIC, $ilDB, ilObject\$ref_id, $res, ILIAS\Repository\int(), and null.

Referenced by ilObjForumAccess\getLastPostByRefId().

870  : ?array
871  {
872  global $DIC;
873 
874  $ilAccess = $DIC->access();
875  $ilUser = $DIC->user();
876  $ilDB = $DIC->database();
877 
878  if (array_key_exists($ref_id, self::$forum_last_post_cache)) {
879  return self::$forum_last_post_cache[$ref_id];
880  }
881 
882  $forumId = self::lookupForumIdByRefId($ref_id);
883  if ($forumId === 0) {
884  self::$forum_last_post_cache[$ref_id] = null;
885  return self::$forum_last_post_cache[$ref_id];
886  }
887 
888  $act_clause = '';
889  if (!$ilAccess->checkAccess('moderate_frm', '', $ref_id)) {
890  $act_clause .= ' AND (frm_posts.pos_status = ' . $ilDB->quote(
891  1,
892  'integer'
893  ) . ' OR frm_posts.pos_author_id = ' . $ilDB->quote($ilUser->getId(), 'integer') . ') ';
894  }
895 
896  $ilDB->setLimit(1, 0);
897  $query = "
898  SELECT *
899  FROM frm_posts
900  INNER JOIN frm_posts_tree tree1
901  ON tree1.pos_fk = frm_posts.pos_pk
902  AND tree1.parent_pos != 0
903  WHERE pos_top_fk = %s $act_clause
904  ORDER BY pos_date DESC
905  ";
906  $res = $ilDB->queryF(
907  $query,
908  ['integer'],
909  [$forumId]
910  );
911 
912  $data = $ilDB->fetchAssoc($res);
913  if (!is_array($data) || empty($data)) {
914  self::$forum_last_post_cache[$ref_id] = null;
915  return self::$forum_last_post_cache[$ref_id];
916  }
917 
918  $casted_data = [];
919  $casted_data['pos_pk'] = (int) $data['pos_pk'];
920  $casted_data['pos_top_fk'] = (int) $data['pos_top_fk'];
921  $casted_data['pos_thr_fk'] = (int) $data['pos_thr_fk'];
922  $casted_data['pos_usr_alias'] = (string) $data['pos_usr_alias'];
923  $casted_data['pos_subject'] = (string) $data['pos_subject'];
924  $casted_data['pos_date'] = (string) $data['pos_date'];
925  $casted_data['pos_update'] = (string) $data['pos_update'];
926  $casted_data['update_user'] = (int) $data['update_user'];
927  $casted_data['pos_cens'] = (int) $data['pos_cens'];
928  $casted_data['pos_cens_com'] = (string) $data['pos_cens_com'];
929  $casted_data['notify'] = (int) $data['notify'];
930  $casted_data['import_name'] = (string) $data['import_name'];
931  $casted_data['pos_status'] = (int) $data['pos_status'];
932  $casted_data['pos_message'] = (string) $data['pos_message'];
933  $casted_data['pos_author_id'] = (int) $data['pos_author_id'];
934  $casted_data['pos_display_user_id'] = (int) $data['pos_display_user_id'];
935  $casted_data['is_author_moderator'] = (int) $data['is_author_moderator'];
936  $casted_data['pos_cens_date'] = (string) $data['pos_cens_date'];
937  $casted_data['pos_activation_date'] = (string) $data['pos_activation_date'];
938 
939  self::$forum_last_post_cache[$ref_id] = $casted_data;
940 
941  return self::$forum_last_post_cache[$ref_id];
942  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupStatisticsByRefId()

static ilObjForum::lookupStatisticsByRefId ( int  $ref_id)
static
Returns
array{num_posts: int, num_unread_posts: int}

Definition at line 763 of file class.ilObjForum.php.

References $DIC, $ilDB, $ilSetting, ilObject\$ref_id, $res, ilObject\_lookupObjectId(), ilForumProperties\getInstance(), and ILIAS\Repository\int().

Referenced by ilObjForumAccess\getStatisticsByRefId().

763  : array
764  {
765  global $DIC;
766 
767  $ilAccess = $DIC->access();
768  $ilUser = $DIC->user();
769  $ilDB = $DIC->database();
770  $ilSetting = $DIC->settings();
771 
772  if (isset(self::$forum_statistics_cache[$ref_id])) {
773  return self::$forum_statistics_cache[$ref_id];
774  }
775 
776  $statistics = [
777  'num_posts' => 0,
778  'num_unread_posts' => 0,
779  ];
780 
781  $forumId = self::lookupForumIdByRefId($ref_id);
782  if ($forumId === 0) {
783  self::$forum_statistics_cache[$ref_id] = $statistics;
784  return self::$forum_statistics_cache[$ref_id];
785  }
786 
788  $is_post_activation_enabled = $objProperties->isPostActivationEnabled();
789 
790  $act_clause = '';
791 
792  if ($is_post_activation_enabled && !$ilAccess->checkAccess('moderate_frm', '', $ref_id)) {
793  $act_clause .= ' AND (frm_posts.pos_status = ' . $ilDB->quote(
794  1,
795  'integer'
796  ) . ' OR frm_posts.pos_author_id = ' . $ilDB->quote($ilUser->getId(), 'integer') . ') ';
797  }
798 
799  if (!$ilUser->isAnonymous()) {
800  $query = "
801  (SELECT COUNT(frm_posts.pos_pk) cnt
802  FROM frm_posts
803  INNER JOIN frm_posts_tree tree1
804  ON tree1.pos_fk = frm_posts.pos_pk
805  AND tree1.parent_pos != 0
806  INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk
807  WHERE frm_threads.thr_top_fk = %s $act_clause)
808 
809  UNION ALL
810 
811  (SELECT COUNT(DISTINCT(frm_user_read.post_id)) cnt
812  FROM frm_user_read
813  INNER JOIN frm_posts ON frm_user_read.post_id = frm_posts.pos_pk
814  INNER JOIN frm_posts_tree tree1
815  ON tree1.pos_fk = frm_posts.pos_pk
816  AND tree1.parent_pos != 0
817  INNER JOIN frm_threads ON frm_threads.thr_pk = frm_posts.pos_thr_fk
818  WHERE frm_user_read.usr_id = %s AND frm_posts.pos_top_fk = %s $act_clause)
819  ";
820 
821  $types = ['integer', 'integer', 'integer'];
822  $values = [$forumId, $ilUser->getId(), $forumId];
823 
824  $mapping = array_keys($statistics);
825  $res = $ilDB->queryF(
826  $query,
827  $types,
828  $values
829  );
830  for ($i = 0; $i < 2; $i++) {
831  $row = $ilDB->fetchAssoc($res);
832 
833  $statistics[$mapping[$i]] = (int) ((is_array($row) ? $row['cnt'] : 0));
834 
835  if ($i === 1) {
836  // unread = all - read
837  $statistics[$mapping[$i]] = $statistics[$mapping[$i - 1]] - $statistics[$mapping[$i]];
838  }
839  }
840  } else {
841  $query = "
842  SELECT COUNT(frm_posts.pos_pk) cnt
843  FROM frm_posts
844  INNER JOIN frm_posts_tree tree1
845  ON tree1.pos_fk = frm_posts.pos_pk
846  AND tree1.parent_pos != 0
847  INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk
848  WHERE frm_threads.thr_top_fk = %s $act_clause
849  ";
850  $types = ['integer'];
851  $values = [$forumId];
852  $res = $ilDB->queryF(
853  $query,
854  $types,
855  $values
856  );
857  $row = $ilDB->fetchAssoc($res);
858 
859  $statistics = [
860  'num_posts' => (int) $row['cnt'],
861  'num_unread_posts' => (int) $row['cnt'],
862  ];
863  }
864 
865  self::$forum_statistics_cache[$ref_id] = $statistics;
866 
867  return self::$forum_statistics_cache[$ref_id];
868  }
$res
Definition: ltiservices.php:66
static getInstance(int $a_obj_id=0)
global $DIC
Definition: shib_login.php:22
static _lookupObjectId(int $ref_id)
global $ilSetting
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markAllThreadsRead()

ilObjForum::markAllThreadsRead ( int  $a_usr_id)

Definition at line 187 of file class.ilObjForum.php.

References $res, ilObject\getId(), and markThreadRead().

187  : void
188  {
189  $res = $this->db->queryF(
190  'SELECT thr_pk FROM frm_data, frm_threads WHERE top_frm_fk = %s AND top_pk = thr_top_fk',
191  ['integer'],
192  [$this->getId()]
193  );
194 
195  while ($row = $this->db->fetchObject($res)) {
196  $this->markThreadRead($a_usr_id, (int) $row->thr_pk);
197  }
198  }
$res
Definition: ltiservices.php:66
markThreadRead(int $a_usr_id, int $a_thread_id)
+ Here is the call graph for this function:

◆ markPostRead()

ilObjForum::markPostRead ( int  $a_usr_id,
int  $a_thread_id,
int  $a_post_id 
)

Definition at line 200 of file class.ilObjForum.php.

References $res, and ilObject\getId().

Referenced by markThreadRead().

200  : void
201  {
202  $res = $this->db->queryF(
203  '
204  SELECT thread_id FROM frm_user_read
205  WHERE usr_id = %s
206  AND obj_id = %s
207  AND thread_id = %s
208  AND post_id = %s',
209  ['integer', 'integer', 'integer', 'integer'],
210  [$a_usr_id, $this->getId(), $a_thread_id, $a_post_id]
211  );
212 
213  if ($this->db->numRows($res) === 0) {
214  $this->db->manipulateF(
215  '
216  INSERT INTO frm_user_read
217  ( usr_id,
218  obj_id,
219  thread_id,
220  post_id
221  )
222  VALUES (%s,%s,%s,%s)',
223  ['integer', 'integer', 'integer', 'integer'],
224  [$a_usr_id, $this->getId(), $a_thread_id, $a_post_id]
225  );
226  }
227  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markPostUnread()

ilObjForum::markPostUnread ( int  $a_user_id,
int  $a_post_id 
)

Definition at line 229 of file class.ilObjForum.php.

229  : void
230  {
231  $this->db->manipulateF(
232  'DELETE FROM frm_user_read WHERE usr_id = %s AND post_id = %s',
233  ['integer', 'integer'],
234  [$a_user_id, $a_post_id]
235  );
236  }

◆ markThreadRead()

ilObjForum::markThreadRead ( int  $a_usr_id,
int  $a_thread_id 
)

Definition at line 177 of file class.ilObjForum.php.

References $res, and markPostRead().

Referenced by markAllThreadsRead().

177  : bool
178  {
179  $res = $this->db->queryF('SELECT pos_pk FROM frm_posts WHERE pos_thr_fk = %s', ['integer'], [$a_thread_id]);
180  while ($row = $this->db->fetchObject($res)) {
181  $this->markPostRead($a_usr_id, $a_thread_id, (int) $row->pos_pk);
182  }
183 
184  return true;
185  }
$res
Definition: ltiservices.php:66
markPostRead(int $a_usr_id, int $a_thread_id, int $a_post_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mergeForumUserRead()

static ilObjForum::mergeForumUserRead ( int  $merge_source_thread_id,
int  $merge_target_thread_id 
)
static

Definition at line 1002 of file class.ilObjForum.php.

References $DIC.

Referenced by ilForum\mergeThreads().

1002  : void
1003  {
1004  global $DIC;
1005 
1006  $DIC->database()->update(
1007  'frm_user_read',
1008  ['thread_id' => ['integer', $merge_target_thread_id]],
1009  ['thread_id' => ['integer', $merge_source_thread_id]]
1010  );
1011  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ preloadForumIdsByObjIds()

static ilObjForum::preloadForumIdsByObjIds ( array  $obj_ids)
static
Parameters
int[]$obj_ids

Definition at line 695 of file class.ilObjForum.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

695  : void
696  {
697  global $DIC;
698 
699  $ilDB = $DIC->database();
700 
701  if (count($obj_ids) === 1) {
702  $in = ' objr.obj_id = ' . $ilDB->quote(current($obj_ids), 'integer') . ' ';
703  } else {
704  $in = $ilDB->in('objr.obj_id', $obj_ids, false, 'integer');
705  }
706  $query = "
707  SELECT frmd.top_pk, objr.ref_id, objr.obj_id
708  FROM object_reference objr
709  INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id
710  WHERE $in
711  ";
712  $res = $ilDB->query($query);
713 
714  // Prepare cache array
715  foreach ($obj_ids as $obj_id) {
716  self::$obj_id_to_forum_id_cache[$obj_id] = 0;
717  }
718 
719  while ($row = $ilDB->fetchAssoc($res)) {
720  self::$obj_id_to_forum_id_cache[(int) $row['obj_id']] = (int) $row['top_pk'];
721  self::$ref_id_to_forum_id_cache[(int) $row['ref_id']] = (int) $row['top_pk'];
722  }
723  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ preloadForumIdsByRefIds()

static ilObjForum::preloadForumIdsByRefIds ( array  $ref_ids)
static
Parameters
int[]$ref_ids

Definition at line 728 of file class.ilObjForum.php.

References $DIC, $ilDB, ilObject\$ref_id, $res, and ILIAS\Repository\int().

Referenced by ilObjForumAccess\_preloadData().

728  : void
729  {
730  global $DIC;
731 
732  $ilDB = $DIC->database();
733 
734  if (count($ref_ids) === 1) {
735  $in = " objr.ref_id = " . $ilDB->quote(current($ref_ids), 'integer') . " ";
736  } else {
737  $in = $ilDB->in('objr.ref_id', $ref_ids, false, 'integer');
738  }
739  $query = "
740  SELECT frmd.top_pk, objr.ref_id, objr.obj_id
741  FROM object_reference objr
742  INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id
743  WHERE $in
744  ";
745  $res = $ilDB->query($query);
746 
747  // Prepare cache array
748  foreach ($ref_ids as $ref_id) {
749  if (!array_key_exists($ref_id, self::$ref_id_to_forum_id_cache)) {
750  self::$ref_id_to_forum_id_cache[$ref_id] = 0;
751  }
752  }
753 
754  while ($row = $ilDB->fetchAssoc($res)) {
755  self::$obj_id_to_forum_id_cache[(int) $row['obj_id']] = (int) $row['top_pk'];
756  self::$ref_id_to_forum_id_cache[(int) $row['ref_id']] = (int) $row['top_pk'];
757  }
758  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveData()

ilObjForum::saveData ( )

Definition at line 611 of file class.ilObjForum.php.

References ilObject\getDescription(), ilObject\getId(), ilObject\getTitle(), ilUtil\now(), null, and ILIAS\Repository\user().

Referenced by create().

611  : void
612  {
613  $nextId = $this->db->nextId('frm_data');
614 
615  $top_data = [
616  'top_frm_fk' => $this->getId(),
617  'top_name' => $this->getTitle(),
618  'top_description' => $this->getDescription(),
619  'top_num_posts' => 0,
620  'top_num_threads' => 0,
621  'top_last_post' => null,
622  'top_mods' => 0,
623  'top_usr_id' => $this->user->getId(),
624  'top_date' => ilUtil::now()
625  ];
626 
627  $this->db->manipulateF(
628  '
629  INSERT INTO frm_data
630  (
631  top_pk,
632  top_frm_fk,
633  top_name,
634  top_description,
635  top_num_posts,
636  top_num_threads,
637  top_last_post,
638  top_mods,
639  top_date,
640  top_usr_id
641  )
642  VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
643  [
644  'integer',
645  'integer',
646  'text',
647  'text',
648  'integer',
649  'integer',
650  'text',
651  'integer',
652  'timestamp',
653  'integer'
654  ],
655  [
656  $nextId,
657  $top_data['top_frm_fk'],
658  $top_data['top_name'],
659  $top_data['top_description'],
660  $top_data['top_num_posts'],
661  $top_data['top_num_threads'],
662  $top_data['top_last_post'],
663  $top_data['top_mods'],
664  $top_data['top_date'],
665  $top_data['top_usr_id']
666  ]
667  );
668  }
static now()
Return current timestamp in Y-m-d H:i:s format.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPermissions()

ilObjForum::setPermissions ( int  $parent_ref_id)

Definition at line 77 of file class.ilObjForum.php.

References ilObject\getOwner(), ilObject\getRefId(), ILIAS\Repository\rbac(), and updateModeratorRole().

77  : void
78  {
79  parent::setPermissions($parent_ref_id);
80 
81  $roles = [self::_lookupModeratorRole($this->getRefId())];
82  $this->rbac->admin()->assignUser($roles[0], $this->getOwner());
83  $this->updateModeratorRole($roles[0]);
84  }
updateModeratorRole(int $role_id)
+ Here is the call graph for this function:

◆ update()

ilObjForum::update ( )

Definition at line 275 of file class.ilObjForum.php.

References ilPageObject\_exists(), ilCopyWizardOptions\_getInstance(), cloneAutoGeneratedRoles(), ilObject\getDescription(), ilObject\getId(), ilForumProperties\getInstance(), ilObject\getOfflineStatus(), ilObject\getRefId(), ilObject\getTitle(), ilObject\getType(), ilFileDataForum\ilClone(), ilPageObject\lookupTranslations(), and ILIAS\Repository\user().

Referenced by create().

275  : bool
276  {
277  if (parent::update()) {
278  $this->db->manipulateF(
279  'UPDATE frm_data SET top_name = %s, top_description = %s, top_update = %s, update_user = %s WHERE top_frm_fk = %s',
280  ['text', 'text', 'timestamp', 'integer', 'integer'],
281  [
282  $this->getTitle(),
283  $this->getDescription(),
284  date("Y-m-d H:i:s"),
285  $this->user->getId(),
286  $this->getId()
287  ]
288  );
289 
290  return true;
291  }
292 
293  return false;
294  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateModeratorRole()

ilObjForum::updateModeratorRole ( int  $role_id)

Definition at line 86 of file class.ilObjForum.php.

References ilObject\getId().

Referenced by setPermissions().

86  : void
87  {
88  $this->db->manipulate(
89  'UPDATE frm_data SET top_mods = ' . $this->db->quote(
90  $role_id,
91  'integer'
92  ) . ' WHERE top_frm_fk = ' . $this->db->quote($this->getId(), 'integer')
93  );
94  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateModificationUserId()

ilObjForum::updateModificationUserId ( int  $usr_id)

Definition at line 266 of file class.ilObjForum.php.

References ilObject\getId().

266  : void
267  {
268  $this->db->manipulateF(
269  'UPDATE frm_data SET update_user = %s WHERE top_frm_fk = %s',
270  ['integer', 'integer'],
271  [$usr_id, $this->getId()],
272  );
273  }
+ Here is the call graph for this function:

Field Documentation

◆ $Forum

ilForum ilObjForum::$Forum

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

◆ $forum_last_post_cache

array ilObjForum::$forum_last_post_cache = []
staticprivate

Definition at line 36 of file class.ilObjForum.php.

◆ $forum_statistics_cache

array ilObjForum::$forum_statistics_cache = []
staticprivate

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

◆ $logger

readonly ilLogger ilObjForum::$logger
private

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

◆ $obj_id_to_forum_id_cache

array ilObjForum::$obj_id_to_forum_id_cache = []
staticprivate

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

◆ $rbac

readonly ILIAS DI RBACServices ilObjForum::$rbac
private

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

◆ $ref_id_to_forum_id_cache

array ilObjForum::$ref_id_to_forum_id_cache = []
staticprivate

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

◆ $settings

readonly ilSetting ilObjForum::$settings
private

Definition at line 39 of file class.ilObjForum.php.


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