ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 public. More...
 
 create ()
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 initDefaultRoles ()
 init default roles settings public More...
 
 createSettings ()
 
 setThreadSorting ($a_thr_pk, $a_sorting_value)
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title 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 ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. 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...
 
 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. 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...
 
 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 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data 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 _lookupCreationDate ($a_id)
 Lookup creation date. 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
 

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()
 

Private Member Functions

 deleteDraftsByForumId ($forum_id)
 

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 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.

References time.

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) ...
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

Member Function Documentation

◆ create()

ilObjForum::create ( )
Returns
int

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

References ilObject\$id, $ilDB, array, createSettings(), ilObject\getId(), ilForumProperties\getInstance(), ilObject\getOwner(), ilObject\getRefId(), and ilObject\setPermissions().

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 public
+ Here is the call graph for this function:

◆ createSettings()

ilObjForum::createSettings ( )

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

References $_GET, $ilDB, $ilUser, ilNewsItem\_getDefaultVisibilityForRefId(), ilBlockSetting\_write(), array, ilObject\getDescription(), ilObject\getId(), ilObject\getTitle(), and ilUtil\now().

Referenced by create().

801  {
802  // news settings (public notifications yes/no)
803  include_once("./Services/News/classes/class.ilNewsItem.php");
804  $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]);
805  if($default_visibility == "public")
806  {
807  ilBlockSetting::_write("news", "public_notifications", 1, 0, $this->getId());
808  }
809 
810  return true;
811  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$_GET["client_id"]
getId()
get object id public
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDraftsByForumId()

ilObjForum::deleteDraftsByForumId (   $forum_id)
private
Parameters
int$forum_id

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

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

Referenced by getDiskUsage().

732  {
733  global $ilDB;
734  $res = $ilDB->queryF('SELECT draft_id FROM frm_posts_drafts WHERE forum_id = %s',
735  array('integer'), array((int)$forum_id));
736 
737  $draft_ids = array();
738  while($row = $ilDB->fetchAssoc($res))
739  {
740  $draft_ids[] = $row['draft_id'];
741  }
742 
743  if(count($draft_ids) > 0)
744  {
745  require_once 'Modules/Forum/classes/class.ilForumDraftsHistory.php';
746  $historyObj = new ilForumDraftsHistory();
747  $historyObj->deleteHistoryByDraftIds($draft_ids);
748 
749  require_once 'Modules/Forum/classes/class.ilForumPostDraft.php';
750  $draftObj = new ilForumPostDraft();
751  $draftObj->deleteDraftsByDraftIds($draft_ids);
752  }
753  }
Class ilForumPostDraft.
Class ilForumDraftHistory.
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getDiskUsage()

ilObjForum::getDiskUsage ( )

Gets the disk usage of the object in bytes.

public

Returns
integer the disk usage in bytes

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

References $data, $GLOBALS, $ilBench, $ilDB, ilObject\$ilias, $ilLog, $options, $res, $row, ilCopyWizardOptions\_getInstance(), ilForum\_lookupPostMessage(), array, ilObject\cloneObject(), date, deleteDraftsByForumId(), ilObject\getDescription(), ilObject\getId(), ilForumProperties\getInstance(), ilObject\getOwner(), ilObject\getRefId(), ilObject\getTitle(), time, and ilObject\update().

139  {
140  require_once("./Modules/File/classes/class.ilObjFileAccess.php");
141  return ilObjForumAccess::_lookupDiskUsage($this->id);
142  }
+ Here is the call graph for this function:

◆ initDefaultRoles()

ilObjForum::initDefaultRoles ( )

init default roles settings public

Returns
array object IDs of created local roles.

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

References $ilDB, $res, $row, array, ilObjRole\createDefaultRole(), ilObject\getId(), and ilObject\getRefId().

761  {
762  include_once './Services/AccessControl/classes/class.ilObjRole.php';
764  'il_frm_moderator_'.$this->getRefId(),
765  "Moderator of forum obj_no.".$this->getId(),
766  'il_frm_moderator',
767  $this->getRefId()
768  );
769  return array();
770  }
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
getId()
get object id public
Create styles array
The data for the language used.
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ lookupForumIdByObjId()

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

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

References array.

Referenced by ilForumExportGUI\ensureThreadBelongsToForum(), ilObjForumGUI\ensureThreadBelongsToForum(), and ilObjForumGUI\getSubTabs().

881  {
882  if(array_key_exists($obj_id, self::$obj_id_to_forum_id_cache))
883  {
884  return (int)self::$obj_id_to_forum_id_cache[$obj_id];
885  }
886 
887  self::preloadForumIdsByObjIds(array($obj_id));
888 
889  return (int)self::$obj_id_to_forum_id_cache[$obj_id];
890  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ lookupForumIdByRefId()

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

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

References $data, $ilDB, $ilSetting, $ilUser, $in, $query, ilObject\$ref_id, $res, $row, ilObject\_lookupObjectId(), array, date, ilForumProperties\FORUM_OVERVIEW_WITH_NEW_POSTS, ilForumProperties\getInstance(), and time.

Referenced by ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilForumPostDraft\getDraftsStatisticsByRefId(), and ilForumPostDraft\moveDraftsByMovedThread().

898  {
899  if(array_key_exists($ref_id, self::$ref_id_to_forum_id_cache))
900  {
901  return (int)self::$ref_id_to_forum_id_cache[$ref_id];
902  }
903 
904  self::preloadForumIdsByRefIds(array($ref_id));
905 
906  return (int)self::$ref_id_to_forum_id_cache[$ref_id];
907  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mergeForumUserRead()

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

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

References $ilDB, and array.

Referenced by ilForum\mergeThreads().

1236  {
1237  global $ilDB;
1238 
1239  $ilDB->update('frm_user_read',
1240  array('thread_id' => array('integer', $merge_target_thread_id)),
1241  array('thread_id' => array('integer',$merge_source_thread_id)));
1242  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ setThreadSorting()

ilObjForum::setThreadSorting (   $a_thr_pk,
  $a_sorting_value 
)

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

References $ilDB, and array.

866  {
867  global $ilDB;
868 
869  $ilDB->update('frm_threads',
870  array('thread_sorting' => array('integer',$a_sorting_value)),
871  array('thr_pk' => array('integer', $a_thr_pk)));
872  }
Create styles array
The data for the language used.
global $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: