ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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. 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...
 

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

59 {
60 global $DIC;
61
62 $t_arr = explode('_', $a_target);
63
64 if ($t_arr[0] != 'frm' || ((int) $t_arr[1]) <= 0) {
65 return false;
66 }
67
68 if ($DIC->access()->checkAccess('read', '', $t_arr[1])) {
69 return true;
70 }
71
72 return false;
73 }
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 33 of file class.ilObjForumAccess.php.

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

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

104 {
105 global $DIC;
106 $ilDB = $DIC->database();
107
108 require_once 'Modules/Forum/classes/class.ilFileDataForum.php';
109
110 $res = $ilDB->queryf(
111 'SELECT top_frm_fk, pos_pk FROM frm_posts p
112 JOIN frm_data d ON d.top_pk = p.pos_top_fk
113 WHERE top_frm_fk = %s',
114 array('integer'),
115 array($a_obj_id)
116 );
117
118 $size = 0;
119 while ($row = $ilDB->fetchAssoc($res)) {
120 $fileDataForum = new ilFileDataForum($row['top_frm_fk'], $row['pos_pk']);
121 $filesOfPost = $fileDataForum->getFilesOfPost();
122 foreach ($filesOfPost as $attachment) {
123 $size += $attachment['size'];
124 }
125 unset($fileDataForum);
126 unset($filesOfPost);
127 }
128
129 return $size;
130 }
$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 155 of file class.ilObjForumAccess.php.

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

190 {
191 if (!isset(self::$userInstanceCache[$usr_id]) && ilObjUser::userExists([$usr_id])) {
192 self::$userInstanceCache[$usr_id] = ilObjectFactory::getInstanceByObjId($usr_id, false);
193 }
194
195 return self::$userInstanceCache[$usr_id];
196 }
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 ilForumPost\getUserData(), and 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 169 of file class.ilObjForumAccess.php.

170 {
171 return ilObjForum::lookupLastPostByRefId($ref_id);
172 }
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 179 of file class.ilObjForumAccess.php.

180 {
182 }
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 138 of file class.ilObjForumAccess.php.

139 {
140 include_once 'Services/Utilities/classes/class.ilStr.php';
141
142 $text = strip_tags($text);
143 $text = preg_replace('/\[(\/)?quote\]/', '', $text);
144 if (ilStr::strLen($text) > 40) {
145 $text = ilStr::subStr($text, 0, 37) . '...';
146 }
147
148 return $text;
149 }
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 19 of file class.ilObjForumAccess.php.


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