ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjForumAccess Class Reference

Class ilObjForumAccess. More...

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

Static Public Member Functions

static _getCommands ()
 get commands this method returns an array of all possible commands/permission combinations example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), ); Comment mjansen: Cannot make this static because parent method is not static ... More...
 
static _checkGoto ($a_target)
 Check whether goto script will succeed Comment mjansen: Cannot make this static because parent method is not static ... More...
 
static _getThreadForPosting ($a_pos_id)
 Get thread id for posting. More...
 
static _lookupDiskUsage ($a_obj_id)
 Returns the number of bytes used on the harddisk by the specified forum. More...
 
static prepareMessageForLists ($text)
 Prepare message for container view. More...
 
static _preloadData ($obj_ids, $ref_ids)
 
static getLastPostByRefId ($ref_id)
 
static getStatisticsByRefId ($ref_id)
 
static getCachedUserInstance ($usr_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Protected Attributes

static $userInstanceCache = array()
 

Additional Inherited Members

- Public Member Functions inherited from ilObjectAccess
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Detailed Description

Class ilObjForumAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ _checkGoto()

static ilObjForumAccess::_checkGoto (   $a_target)
static

Check whether goto script will succeed Comment mjansen: Cannot make this static because parent method is not static ...

Parameters
string$a_target
Returns
bool

Reimplemented from ilObjectAccess.

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

56 {
57 global $DIC;
58
59 $t_arr = explode('_', $a_target);
60
61 if ($t_arr[0] != 'frm' || ((int) $t_arr[1]) <= 0) {
62 return false;
63 }
64
65 if ($DIC->access()->checkAccess('read', '', $t_arr[1])) {
66 return true;
67 }
68
69 return false;
70 }
global $DIC
Definition: saml.php:7

References $DIC.

◆ _getCommands()

static ilObjForumAccess::_getCommands ( )
static

get commands this method returns an array of all possible commands/permission combinations example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), ); Comment mjansen: Cannot make this static because parent method is not static ...

Returns
array

Reimplemented from ilObjectAccess.

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

31 {
32 $commands = array(
33 array(
34 'permission' => 'read',
35 'cmd' => 'showThreads',
36 'lang_var' => 'show',
37 'default' => true
38 ),
39 array(
40 'permission' => 'write',
41 'cmd' => 'edit',
42 'lang_var' => 'settings'
43 ),
44 );
45
46 return $commands;
47 }

Referenced by ilObjForumListGUI\init().

+ Here is the caller graph for this function:

◆ _getThreadForPosting()

static ilObjForumAccess::_getThreadForPosting (   $a_pos_id)
static

Get thread id for posting.

Parameters
int$a_pos_id
Returns
int

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

79 {
80 global $DIC;
81 $ilDB = $DIC->database();
82
83 $res = $ilDB->queryF(
84 'SELECT pos_thr_fk FROM frm_posts WHERE pos_pk = %s',
85 array('integer'),
86 array($a_pos_id)
87 );
88
89 $row = $ilDB->fetchAssoc($res);
90
91 return $row['pos_thr_fk'];
92 }
$row
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $res, and $row.

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

+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

static ilObjForumAccess::_lookupDiskUsage (   $a_obj_id)
static

Returns the number of bytes used on the harddisk by the specified forum.

Parameters
int$a_obj_id
Returns
int

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

101 {
102 global $DIC;
103 $ilDB = $DIC->database();
104
105 $res = $ilDB->queryf(
106 'SELECT top_frm_fk, pos_pk FROM frm_posts p
107 JOIN frm_data d ON d.top_pk = p.pos_top_fk
108 WHERE top_frm_fk = %s',
109 array('integer'),
110 array($a_obj_id)
111 );
112
113 $size = 0;
114 while ($row = $ilDB->fetchAssoc($res)) {
115 $fileDataForum = new ilFileDataForum($row['top_frm_fk'], $row['pos_pk']);
116 $filesOfPost = $fileDataForum->getFilesOfPost();
117 foreach ($filesOfPost as $attachment) {
118 $size += $attachment['size'];
119 }
120 unset($fileDataForum);
121 unset($filesOfPost);
122 }
123
124 return $size;
125 }
$size
Definition: RandomTest.php:84
This class handles all operations on files for the forum object.

References $DIC, $ilDB, $res, $row, and $size.

Referenced by ilObjForum\getDiskUsage().

+ Here is the caller graph for this function:

◆ _preloadData()

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

Reimplemented from ilObjectAccess.

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

150 {
151 /*
152 We are only able to preload the top_pk values for the forum ref_ids.
153 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
154 */
155 ilObjForum::preloadForumIdsByRefIds((array) $ref_ids);
156 }
static preloadForumIdsByRefIds(array $ref_ids)

References ilObjForum\preloadForumIdsByRefIds().

+ Here is the call graph for this function:

◆ getCachedUserInstance()

static ilObjForumAccess::getCachedUserInstance (   $usr_id)
static
Parameters
int$usr_id
Returns
ilObjUser|boolean

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

184 {
185 if (!isset(self::$userInstanceCache[$usr_id]) && ilObjUser::userExists([$usr_id])) {
186 self::$userInstanceCache[$usr_id] = ilObjectFactory::getInstanceByObjId($usr_id, false);
187 }
188
189 return self::$userInstanceCache[$usr_id];
190 }
static userExists($a_usr_ids=array())
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

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

Referenced by ilForumAuthorInformation\initUserInstance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastPostByRefId()

static ilObjForumAccess::getLastPostByRefId (   $ref_id)
static
Parameters
int$ref_id
Returns
array

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

164 {
165 return ilObjForum::lookupLastPostByRefId($ref_id);
166 }
static lookupLastPostByRefId($ref_id)

References ilObjForum\lookupLastPostByRefId().

Referenced by ilObjForumListGUI\getProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStatisticsByRefId()

static ilObjForumAccess::getStatisticsByRefId (   $ref_id)
static
Parameters
int$ref_id
Returns
array

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

174 {
176 }
static lookupStatisticsByRefId($ref_id)

References ilObjForum\lookupStatisticsByRefId().

Referenced by ilObjForumListGUI\getProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareMessageForLists()

static ilObjForumAccess::prepareMessageForLists (   $text)
static

Prepare message for container view.

Parameters
string$text
Returns
string

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

134 {
135 $text = str_replace('<br />', ' ', $text);
136 $text = strip_tags($text);
137 $text = preg_replace('/\[(\/)?quote\]/', '', $text);
138 if (ilStr::strLen($text) > 40) {
139 $text = ilStr::subStr($text, 0, 37) . '...';
140 }
141
142 return $text;
143 }
static subStr($a_str, $a_start, $a_length=null)
Definition: class.ilStr.php:15
static strLen($a_string)
Definition: class.ilStr.php:78
$text
Definition: errorreport.php:18

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

Referenced by ilObjForumListGUI\getProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $userInstanceCache

ilObjForumAccess::$userInstanceCache = array()
staticprotected

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


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