ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjForumAccess Class Reference

Class ilObjForumAccess. More...

+ Inheritance diagram for ilObjForumAccess:
+ Collaboration diagram for ilObjForumAccess:

Static Public Member Functions

static _getCommands ()
 
static _checkGoto (string $target)
 
static _getThreadForPosting (int $a_pos_id)
 
static prepareMessageForLists (string $text)
 
static _preloadData (array $obj_ids, array $ref_ids)
 
static getLastPostByRefId (int $ref_id)
 
static getStatisticsByRefId (int $ref_id)
 
static getCachedUserInstance (int $usr_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Static Protected Attributes

static array $userInstanceCache = []
 

Additional Inherited Members

- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Detailed Description

Member Function Documentation

◆ _checkGoto()

static ilObjForumAccess::_checkGoto ( string  $target)
static

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

References $DIC.

48  : bool
49  {
50  global $DIC;
51 
52  $t_arr = explode('_', $target);
53 
54  if ($t_arr[0] !== 'frm' || ((int) $t_arr[1]) <= 0) {
55  return false;
56  }
57 
58  return (
59  $DIC->access()->checkAccess('read', '', (int) $t_arr[1]) ||
60  $DIC->access()->checkAccess('visible', '', (int) $t_arr[1])
61  );
62  }
global $DIC
Definition: shib_login.php:22

◆ _getCommands()

static ilObjForumAccess::_getCommands ( )
static

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

Referenced by ilObjForumListGUI\init().

31  : array
32  {
33  return [
34  [
35  'permission' => 'read',
36  'cmd' => 'showThreads',
37  'lang_var' => 'show',
38  'default' => true
39  ],
40  [
41  'permission' => 'write',
42  'cmd' => 'edit',
43  'lang_var' => 'settings'
44  ],
45  ];
46  }
+ Here is the caller graph for this function:

◆ _getThreadForPosting()

static ilObjForumAccess::_getThreadForPosting ( int  $a_pos_id)
static

Definition at line 64 of file class.ilObjForumAccess.php.

References $DIC, $ilDB, and $res.

Referenced by ilObjectFeedWriter\__construct(), ilUserFeedWriter\__construct(), ilPDNewsTableGUI\fillRow(), ilForumNewsRendererGUI\getObjectLink(), and ilNewsForContextBlockGUI\showNews().

64  : int
65  {
66  global $DIC;
67  $ilDB = $DIC->database();
68 
69  $res = $ilDB->queryF(
70  'SELECT pos_thr_fk FROM frm_posts WHERE pos_pk = %s',
71  ['integer'],
72  [$a_pos_id]
73  );
74 
75  $row = $ilDB->fetchAssoc($res);
76 
77  return (int) $row['pos_thr_fk'];
78  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjForumAccess::_preloadData ( array  $obj_ids,
array  $ref_ids 
)
static

Definition at line 92 of file class.ilObjForumAccess.php.

References ilObjForum\preloadForumIdsByRefIds().

92  : void
93  {
94  /*
95  We are only able to preload the top_pk values for the forum ref_ids.
96  Other data like statistics and last posts require permission checks per reference, so there is no added value for using an SQL IN() function in the queries
97  */
99  }
static preloadForumIdsByRefIds(array $ref_ids)
+ Here is the call graph for this function:

◆ getCachedUserInstance()

static ilObjForumAccess::getCachedUserInstance ( int  $usr_id)
static

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

References ilObjectFactory\getInstanceByObjId(), null, and ilObjUser\userExists().

Referenced by ilForumAuthorInformation\initUserInstance().

114  : ?ilObjUser
115  {
116  if (!isset(self::$userInstanceCache[$usr_id]) && ilObjUser::userExists([$usr_id])) {
117  $user = ilObjectFactory::getInstanceByObjId($usr_id, false);
118  if ($user instanceof ilObjUser) {
119  self::$userInstanceCache[$usr_id] = $user;
120  }
121  }
122 
123  return self::$userInstanceCache[$usr_id] ?? null;
124  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static userExists(array $a_usr_ids=[])
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastPostByRefId()

static ilObjForumAccess::getLastPostByRefId ( int  $ref_id)
static

Definition at line 101 of file class.ilObjForumAccess.php.

References ilObjForum\lookupLastPostByRefId().

Referenced by ilObjForumListGUI\getProperties().

101  : ?array
102  {
104  }
$ref_id
Definition: ltiauth.php:65
static lookupLastPostByRefId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStatisticsByRefId()

static ilObjForumAccess::getStatisticsByRefId ( int  $ref_id)
static
Returns
array{num_posts: int, num_unread_posts: int}

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

References ilObjForum\lookupStatisticsByRefId().

Referenced by ilObjForumListGUI\getProperties().

109  : array
110  {
112  }
$ref_id
Definition: ltiauth.php:65
static lookupStatisticsByRefId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareMessageForLists()

static ilObjForumAccess::prepareMessageForLists ( string  $text)
static

Definition at line 80 of file class.ilObjForumAccess.php.

References ilStr\strLen(), and ilStr\subStr().

Referenced by ilObjForumListGUI\getProperties().

80  : string
81  {
82  $text = str_replace('<br />', ' ', $text);
83  $text = strip_tags($text);
84  $text = preg_replace('/\[(\/)?quote\]/', '', $text);
85  if (ilStr::strLen($text) > 40) {
86  $text = ilStr::subStr($text, 0, 37) . '...';
87  }
88 
89  return $text;
90  }
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
static strLen(string $a_string)
Definition: class.ilStr.php:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $userInstanceCache

array ilObjForumAccess::$userInstanceCache = []
staticprotected

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


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