ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 (
66 $DIC->access()->checkAccess('read', '', $t_arr[1]) ||
67 $DIC->access()->checkAccess('visible', '', $t_arr[1])
68 ) {
69 return true;
70 }
71
72 return false;
73 }
$DIC
Definition: xapitoken.php:46

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 81 of file class.ilObjForumAccess.php.

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

References $DIC, $ilDB, and $res.

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 103 of file class.ilObjForumAccess.php.

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

References $DIC, $ilDB, $res, 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 152 of file class.ilObjForumAccess.php.

153 {
154 /*
155 We are only able to preload the top_pk values for the forum ref_ids.
156 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
157 */
158 ilObjForum::preloadForumIdsByRefIds((array) $ref_ids);
159 }
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 186 of file class.ilObjForumAccess.php.

187 {
188 if (!isset(self::$userInstanceCache[$usr_id]) && ilObjUser::userExists([$usr_id])) {
189 self::$userInstanceCache[$usr_id] = ilObjectFactory::getInstanceByObjId($usr_id, false);
190 }
191
192 return self::$userInstanceCache[$usr_id];
193 }
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 166 of file class.ilObjForumAccess.php.

167 {
168 return ilObjForum::lookupLastPostByRefId($ref_id);
169 }
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 176 of file class.ilObjForumAccess.php.

177 {
179 }
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 136 of file class.ilObjForumAccess.php.

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

References 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: