ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjForum Class Reference

Class ilObjForum. More...

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

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor @access public. More...
 
 create ()
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 initDefaultRoles ()
 init default roles settings @access public More...
 
 createSettings ()
 
 setThreadSorting ($a_thr_pk, $a_sorting_value)
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 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 If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static lookupForumIdByObjId ($obj_id)
 
static lookupForumIdByRefId ($ref_id)
 
static mergeForumUserRead ($merge_source_thread_id, $merge_target_thread_id)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $Forum
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Static Protected Attributes

static $obj_id_to_forum_id_cache = array()
 
static $ref_id_to_forum_id_cache = array()
 
static $forum_statistics_cache = array()
 
static $forum_last_post_cache = array()
 

Detailed Description

Class ilObjForum.

Author
Wolfgang Merkens wmerk.nosp@m.ens@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Parameters
integer$a_idreference_id or object_id
boolean$a_call_by_referencetreat the id as reference_id (true) or object_id (false)

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

60 {
61 $this->type = 'frm';
62 parent::__construct($a_id, $a_call_by_reference);
63
64 /*
65 * this constant is used for the information if a single post is marked as new
66 * All threads/posts created before this date are never marked as new
67 * Default is 8 weeks
68 *
69 */
70 $new_deadline = time() - 60 * 60 * 24 * 7 * ($this->ilias->getSetting('frm_store_new') ?
71 $this->ilias->getSetting('frm_store_new') :
72 8);
73 define('NEW_DEADLINE', $new_deadline);
74
75 // TODO: needs to rewrite scripts that are using Forum outside this class
76 $this->Forum = new ilForum();
77 }
Class Forum core functions for forum.
redirection script todo: (a better solution should control the processing via a xml file)

Member Function Documentation

◆ create()

ilObjForum::create ( )
Returns
int

Reimplemented from ilObject.

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

83 {
84 $id = parent::create();
85
86 require_once 'Modules/Forum/classes/class.ilForumProperties.php';
87 $properties = ilForumProperties::getInstance($this->getId());
88 $properties->setDefaultView(1);
89 $properties->setAnonymisation(0);
90 $properties->setStatisticsStatus(0);
91 $properties->setPostActivation(0);
92 $properties->setThreadSorting(0);
93 $properties->insert();
94
95 $this->createSettings();
96
97 $this->saveData();
98
99 return $id;
100 }
static getInstance($a_obj_id=0)
getId()
get object id @access public

References ilObject\$id, createSettings(), ilObject\getId(), and ilForumProperties\getInstance().

+ Here is the call graph for this function:

◆ createSettings()

ilObjForum::createSettings ( )

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

761 {
762 // news settings (public notifications yes/no)
763 include_once("./Services/News/classes/class.ilNewsItem.php");
764 $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]);
765 if($default_visibility == "public")
766 {
767 ilBlockSetting::_write("news", "public_notifications", 1, 0, $this->getId());
768 }
769
770 return true;
771 }
$_GET["client_id"]
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.

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

Referenced by create().

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

◆ getDiskUsage()

ilObjForum::getDiskUsage ( )

Gets the disk usage of the object in bytes.

@access public

Returns
integer the disk usage in bytes

Reimplemented from ilObject.

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

139 {
140 require_once("./Modules/File/classes/class.ilObjFileAccess.php");
141 return ilObjForumAccess::_lookupDiskUsage($this->id);
142 }

◆ initDefaultRoles()

ilObjForum::initDefaultRoles ( )

init default roles settings @access public

Returns
array object IDs of created local roles.

Reimplemented from ilObject.

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

721 {
722 include_once './Services/AccessControl/classes/class.ilObjRole.php';
724 'il_frm_moderator_'.$this->getRefId(),
725 "Moderator of forum obj_no.".$this->getId(),
726 'il_frm_moderator',
727 $this->getRefId()
728 );
729 return array();
730 }
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
getRefId()
get reference id @access public

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

+ Here is the call graph for this function:

◆ lookupForumIdByObjId()

static ilObjForum::lookupForumIdByObjId (   $obj_id)
static
Parameters
int$obj_id
Returns
int

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

841 {
842 if(array_key_exists($obj_id, self::$obj_id_to_forum_id_cache))
843 {
844 return (int)self::$obj_id_to_forum_id_cache[$obj_id];
845 }
846
847 self::preloadForumIdsByObjIds(array($obj_id));
848
849 return (int)self::$obj_id_to_forum_id_cache[$obj_id];
850 }

Referenced by ilObjForumGUI\updateThreadObject().

+ Here is the caller graph for this function:

◆ lookupForumIdByRefId()

static ilObjForum::lookupForumIdByRefId (   $ref_id)
static
Parameters
int$ref_id
Returns
int

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

858 {
859 if(array_key_exists($ref_id, self::$ref_id_to_forum_id_cache))
860 {
861 return (int)self::$ref_id_to_forum_id_cache[$ref_id];
862 }
863
864 self::preloadForumIdsByRefIds(array($ref_id));
865
866 return (int)self::$ref_id_to_forum_id_cache[$ref_id];
867 }

References ilObject\$ref_id.

◆ mergeForumUserRead()

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

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

1196 {
1197 global $ilDB;
1198
1199 $ilDB->update('frm_user_read',
1200 array('thread_id' => array('integer', $merge_target_thread_id)),
1201 array('thread_id' => array('integer',$merge_source_thread_id)));
1202 }
global $ilDB

References $ilDB.

Referenced by ilForum\mergeThreads().

+ Here is the caller graph for this function:

◆ setThreadSorting()

ilObjForum::setThreadSorting (   $a_thr_pk,
  $a_sorting_value 
)

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

826 {
827 global $ilDB;
828
829 $ilDB->update('frm_threads',
830 array('thread_sorting' => array('integer',$a_sorting_value)),
831 array('thr_pk' => array('integer', $a_thr_pk)));
832 }

References $ilDB.

Field Documentation

◆ $Forum

ilObjForum::$Forum

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

◆ $forum_last_post_cache

ilObjForum::$forum_last_post_cache = array()
staticprotected

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

◆ $forum_statistics_cache

ilObjForum::$forum_statistics_cache = array()
staticprotected

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

◆ $obj_id_to_forum_id_cache

ilObjForum::$obj_id_to_forum_id_cache = array()
staticprotected

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

◆ $ref_id_to_forum_id_cache

ilObjForum::$ref_id_to_forum_id_cache = array()
staticprotected

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


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