ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilForumPost Class Reference
+ Collaboration diagram for ilForumPost:

Public Member Functions

 __construct ($a_id=0, $a_is_moderator=false)
 __destruct ()
 insert ()
 update ()
 getDataAsArray ()
 getDataAsArrayForExplorer ()
 isAnyParentDeactivated ()
 reload ()
 setFullname ($a_fullname)
 getFullname ()
 setLoginName ($a_loginname)
 getLoginName ()
 activatePost ()
 activatePostAndChildPosts ()
 activateParentPosts ()
 deactivatePostAndChildPosts ()
 isRead ($a_user_id=0)
 hasReplies ()
 isOwner ($a_user_id=0)
 setId ($a_id)
 getId ()
 setForumId ($a_forum_id)
 getForumId ()
 setThreadId ($a_thread_id)
 getThreadId ()
 setUserId ($a_user_id)
 getUserId ()
 setUserAlias ($a_user_alias)
 getUserAlias ()
 setSubject ($a_subject)
 getSubject ()
 setMessage ($a_message)
 getMessage ()
 setCreateDate ($a_createdate)
 getCreateDate ()
 setChangeDate ($a_changedate)
 getChangeDate ()
 setUpdateUserId ($a_user_id_update)
 getUpdateUserId ()
 setCensorship ($a_censorship)
 isCensored ()
 setCensorshipComment ($a_comment)
 getCensorshipComment ()
 setNotification ($a_notification)
 isNotificationEnabled ()
 setImportName ($a_import_name)
 getImportName ()
 setStatus ($a_status)
 isActivated ()
 setTreeId ($a_tree_id)
 getTreeId ()
 setParentId ($a_parent_id)
 getParentId ()
 setLft ($a_lft)
 getLft ()
 setRgt ($a_rgt)
 getRgt ()
 setDepth ($a_depth)
 getDepth ()
 setThread (ilForumTopic $thread)
 getThread ()

Private Member Functions

 read ()
 getUserData ()

Private Attributes

 $id = 0
 $forum_id = 0
 $thread_id = 0
 $user_id = 0
 $user_alias = ''
 $subject = ''
 $message = ''
 $createdate = '0000-00-00 00:00:00'
 $changedate = '0000-00-00 00:00:00'
 $user_id_update = 0
 $censored = 0
 $censorship_comment = ''
 $notification = 0
 $import_name = ''
 $status = 1
 $tree_id = 0
 $parent_id = 0
 $lft = 0
 $rgt = 0
 $depth = 0
 $fullname = ''
 $loginname = ''
 $objThread = null
 $db = null
 $is_moderator = false

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 32 of file class.ilForumPost.php.

Constructor & Destructor Documentation

ilForumPost::__construct (   $a_id = 0,
  $a_is_moderator = false 
)

Definition at line 84 of file class.ilForumPost.php.

References $ilDB, and read().

{
global $ilDB;
$this->is_moderator = $a_is_moderator;
$this->db = $ilDB;
$this->id = $a_id;
$this->read();
}

+ Here is the call graph for this function:

ilForumPost::__destruct ( )

Definition at line 94 of file class.ilForumPost.php.

{
unset($this->db);
unset($this->objThread);
}

Member Function Documentation

ilForumPost::activateParentPosts ( )

Definition at line 387 of file class.ilForumPost.php.

References $query, $result, and $row.

Referenced by activatePost(), and activatePostAndChildPosts().

{
if ($this->id)
{
$query = "SELECT pos_pk FROM frm_posts "
. "INNER JOIN frm_posts_tree ON pos_fk = pos_pk "
. "WHERE lft < %s AND rgt > %s AND thr_fk = %s";
$result = $this->db->queryF(
array('integer', 'integer', 'integer'),
array($this->lft, $this->rgt, $this->thread_id)
);
while($row = $this->db->fetchAssoc($result))
{
$query = "UPDATE frm_posts SET pos_status = %s WHERE pos_pk = %s";
$this->db->manipulateF(
array('integer', 'integer'),
array(1, $row['pos_pk'])
);
}
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilForumPost::activatePost ( )

Definition at line 336 of file class.ilForumPost.php.

References activateParentPosts().

{
if ($this->id)
{
$statement = $this->db->manipulateF('
UPDATE frm_posts SET pos_status = %s
WHERE pos_pk = %s',
array('integer', 'integer'),
array('1', $this->id));
return true;
}
return false;
}

+ Here is the call graph for this function:

ilForumPost::activatePostAndChildPosts ( )

Definition at line 354 of file class.ilForumPost.php.

References $query, $result, $row, and activateParentPosts().

{
if ($this->id)
{
$query = "SELECT pos_pk FROM frm_posts_tree treea "
. "INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk "
. "AND treeb.lft BETWEEN treea.lft AND treea.rgt "
. "INNER JOIN frm_posts ON pos_pk = treeb.pos_fk "
. "WHERE treea.pos_fk = %s";
$result = $this->db->queryF(
array('integer'),
array($this->id)
);
while($row = $this->db->fetchAssoc($result))
{
$query = "UPDATE frm_posts SET pos_status = %s WHERE pos_pk = %s";
$this->db->manipulateF(
array('integer', 'integer'),
array(1, $row['pos_pk'])
);
}
return true;
}
return false;
}

+ Here is the call graph for this function:

ilForumPost::deactivatePostAndChildPosts ( )

Definition at line 416 of file class.ilForumPost.php.

References $query, $result, and $row.

{
if ($this->id)
{
$query = "SELECT pos_pk FROM frm_posts_tree treea "
. "INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk "
. "AND treeb.lft BETWEEN treea.lft AND treea.rgt "
. "INNER JOIN frm_posts ON pos_pk = treeb.pos_fk "
. "WHERE treea.pos_fk = %s";
$result = $this->db->queryF(
array('integer'),
array($this->id)
);
while($row = $this->db->fetchAssoc($result))
{
$query = "UPDATE frm_posts SET pos_status = %s WHERE pos_pk = %s";
$this->db->manipulateF(
array('integer', 'integer'),
array(0, $row['pos_pk'])
);
}
return true;
}
return false;
}
ilForumPost::getCensorshipComment ( )

Definition at line 588 of file class.ilForumPost.php.

References $censorship_comment.

ilForumPost::getChangeDate ( )

Definition at line 564 of file class.ilForumPost.php.

References $changedate.

{
}
ilForumPost::getCreateDate ( )

Definition at line 556 of file class.ilForumPost.php.

References $createdate.

{
}
ilForumPost::getDataAsArray ( )

Definition at line 167 of file class.ilForumPost.php.

References $data.

{
$data = array(
'pos_pk' => $this->id,
'pos_top_fk' => $this->forum_id,
'pos_thr_fk' => $this->thread_id,
'pos_usr_id' => $this->user_id,
'pos_usr_alias' => $this->user_alias,
'title' => $this->fullname,
'loginname' => $this->loginname,
'pos_message' => $this->message,
'pos_subject' => $this->subject,
'pos_cens_com' => $this->censorship_comment,
'pos_cens' => $this->censored,
'pos_date' => $this->createdate,
'pos_update' => $this->changedate,
'update_user' => $this->user_id_update,
'notify' => $this->notification,
'import_name' => $this->import_name,
'pos_status' => $this->status
);
return $data;
}
ilForumPost::getDataAsArrayForExplorer ( )

Definition at line 192 of file class.ilForumPost.php.

References $data.

{
$data = array(
'pos_pk' => $this->id,
'child' => $this->id,
'author' => $this->user_id,
'alias' => $this->user_alias,
'title' => $this->fullname,
'loginname' => $this->loginname,
'type' => 'post',
'message' => $this->message,
'subject' => $this->subject,
'pos_cens_com' => $this->censorship_comment,
'pos_cens' => $this->censored,
'date' => $this->createdate,
'create_date' => $this->createdate,
'update' => $this->changedate,
'update_user' => $this->user_id_update,
'tree' => $this->thread_id,
'parent' => $this->parent_id,
'lft' => $this->lft,
'rgt' => $this->rgt,
'depth' => $this->depth,
'id' => $this->tree_id,
'notify' => $this->notification,
'import_name' => $this->import_name,
'pos_status' => $this->status
);
return $data;
}
ilForumPost::getDepth ( )

Definition at line 652 of file class.ilForumPost.php.

References $depth.

{
return $this->depth;
}
ilForumPost::getForumId ( )

Definition at line 508 of file class.ilForumPost.php.

References $forum_id.

{
}
ilForumPost::getFullname ( )

Definition at line 323 of file class.ilForumPost.php.

References $fullname.

{
return $this->fullname;
}
ilForumPost::getId ( )

Definition at line 500 of file class.ilForumPost.php.

References $id.

{
return $this->id;
}
ilForumPost::getImportName ( )

Definition at line 604 of file class.ilForumPost.php.

References $import_name.

{
}
ilForumPost::getLft ( )

Definition at line 636 of file class.ilForumPost.php.

References $lft.

Referenced by ilForumTopic\getPostTree().

{
return $this->lft;
}

+ Here is the caller graph for this function:

ilForumPost::getLoginName ( )

Definition at line 331 of file class.ilForumPost.php.

References $loginname.

{
}
ilForumPost::getMessage ( )

Definition at line 548 of file class.ilForumPost.php.

References $message.

{
}
ilForumPost::getParentId ( )

Definition at line 628 of file class.ilForumPost.php.

References $parent_id.

{
}
ilForumPost::getRgt ( )

Definition at line 644 of file class.ilForumPost.php.

References $rgt.

Referenced by ilForumTopic\getPostTree().

{
return $this->rgt;
}

+ Here is the caller graph for this function:

ilForumPost::getSubject ( )

Definition at line 540 of file class.ilForumPost.php.

References $subject.

{
}
ilForumPost::getThread ( )

Definition at line 660 of file class.ilForumPost.php.

References $objThread.

{
}
ilForumPost::getThreadId ( )

Definition at line 516 of file class.ilForumPost.php.

References $thread_id.

Referenced by ilForumTopic\getPostTree().

{
}

+ Here is the caller graph for this function:

ilForumPost::getTreeId ( )

Definition at line 620 of file class.ilForumPost.php.

References $tree_id.

{
}
ilForumPost::getUpdateUserId ( )

Definition at line 572 of file class.ilForumPost.php.

References $user_id_update.

{
}
ilForumPost::getUserAlias ( )

Definition at line 532 of file class.ilForumPost.php.

References $user_alias.

{
}
ilForumPost::getUserData ( )
private

Definition at line 290 of file class.ilForumPost.php.

References $lng, and ilObject\_exists().

Referenced by read().

{
global $lng;
if ($this->id && $this->user_id)
{
require_once("./Services/User/classes/class.ilObjUser.php");
if (ilObject::_exists($this->user_id))
{
$tmp_user = new ilObjUser($this->user_id);
$this->fullname = $tmp_user->getFullname();
$this->loginname = $tmp_user->getLogin();
unset($tmp_user);
}
$this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $lng->txt('unknown'));
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilForumPost::getUserId ( )

Definition at line 524 of file class.ilForumPost.php.

References $user_id.

{
}
ilForumPost::hasReplies ( )

Definition at line 465 of file class.ilForumPost.php.

References $res.

{
if ($this->id && $this->rgt && $this->lft)
{
$res = $this->db->queryf('
SELECT * FROM frm_posts_tree
WHERE lft > %s AND rgt < %s
AND thr_fk = %s',
array('integer', 'integer', 'integer'),
array($this->lft, $this->rgt, $this->thread_id));
return $res->numRows() ? true : false;
}
return false;
}
ilForumPost::insert ( )

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

References $ilDB.

{
global $ilDB;
if ($this->forum_id && $this->thread_id)
{
$this->id = $this->db->nextId('frm_posts');
$ilDB->insert('frm_posts', array(
'pos_pk' => array('integer', $this->id),
'pos_top_fk' => array('integer', $this->forum_id),
'pos_thr_fk' => array('integer', $this->thread_id),
'pos_usr_id' => array('integer', $this->user_id),
'pos_usr_alias' => array('text', $this->user_alias),
'pos_subject' => array('text', $this->subject),
'pos_message' => array('clob', $this->message),
'pos_date' => array('timestamp', $this->createdate),
'pos_update' => array('timestamp', null),
'update_user' => array('integer', $this->user_id_update),
'pos_cens' => array('integer', $this->censored),
'notify' => array('integer', (int)$this->notification),
'import_name' => array('text', (string)$this->import_name),
'pos_status' => array('integer', (int)$this->status)
));
return true;
}
return false;
}
ilForumPost::isActivated ( )

Definition at line 612 of file class.ilForumPost.php.

{
return $this->status == 1 ? true : false;
}
ilForumPost::isAnyParentDeactivated ( )

Definition at line 271 of file class.ilForumPost.php.

References $res.

{
if ($this->id)
{
$res = $this->db->queryf('
SELECT * FROM frm_posts_tree
INNER JOIN frm_posts ON pos_pk = pos_fk
WHERE pos_status = %s
AND lft < %s AND rgt > %s
AND thr_fk = %s',
array('integer', 'integer', 'integer', 'integer'),
array('0', $this->lft, $this->rgt, $this->thread_id));
return $res->numRows();
}
return false;
}
ilForumPost::isCensored ( )

Definition at line 580 of file class.ilForumPost.php.

{
return $this->censored == 1 ? true : false;
}
ilForumPost::isNotificationEnabled ( )

Definition at line 596 of file class.ilForumPost.php.

{
return $this->notification == 1 ? true : false;
}
ilForumPost::isOwner (   $a_user_id = 0)

Definition at line 483 of file class.ilForumPost.php.

{
if ($this->user_id && $a_user_id)
{
if ((int) $this->user_id == (int) $a_user_id)
{
return true;
}
return false;
}
return false;
}
ilForumPost::isRead (   $a_user_id = 0)

Definition at line 447 of file class.ilForumPost.php.

References $res.

{
if ($a_user_id && $this->id)
{
$res = $this->db->queryf('
SELECT * FROM frm_user_read
WHERE usr_id = %s
AND post_id = %s',
array('integer', 'integer'),
array($a_user_id, $this->id));
return $res->numRows() ? true : false;
}
return false;
}
ilForumPost::read ( )
private

Definition at line 224 of file class.ilForumPost.php.

References $res, $row, DB_FETCHMODE_OBJECT, and getUserData().

Referenced by __construct(), and reload().

{
if ($this->id)
{
$res = $this->db->queryf('
SELECT * FROM frm_posts
INNER JOIN frm_posts_tree ON pos_fk = pos_pk
WHERE pos_pk = %s',
array('integer'), array($this->id));
if (is_object($row))
{
$this->id = $row->pos_pk;
$this->forum_id = $row->pos_top_fk;
$this->thread_id = $row->pos_thr_fk;
$this->user_id = $row->pos_usr_id;
$this->user_alias = $row->pos_usr_alias;
$this->subject = $row->pos_subject;
$this->message = $row->pos_message;
$this->createdate = $row->pos_date;
$this->changedate = $row->pos_update;
$this->user_id_update = $row->update_user;
$this->censored = $row->pos_cens;
$this->censorship_comment = $row->pos_cens_com;
$this->notification = $row->notify;
$this->import_name = $row->import_name ;
$this->status = $row->pos_status;
$this->tree_id = $row->fpt_pk;
$this->parent_id = $row->parent_pos;
$this->lft = $row->lft;
$this->rgt = $row->rgt;
$this->depth = $row->depth;
$this->getUserData();
$this->objThread = new ilForumTopic($this->thread_id, $this->is_moderator);
return true;
}
return false;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilForumPost::reload ( )

Definition at line 314 of file class.ilForumPost.php.

References read().

{
return $this->read();
}

+ Here is the call graph for this function:

ilForumPost::setCensorship (   $a_censorship)

Definition at line 576 of file class.ilForumPost.php.

{
$this->censored = $a_censorship;
}
ilForumPost::setCensorshipComment (   $a_comment)

Definition at line 584 of file class.ilForumPost.php.

{
$this->censorship_comment = $a_comment;
}
ilForumPost::setChangeDate (   $a_changedate)

Definition at line 560 of file class.ilForumPost.php.

{
$this->changedate = $a_changedate;
}
ilForumPost::setCreateDate (   $a_createdate)

Definition at line 552 of file class.ilForumPost.php.

{
$this->createdate = $a_createdate;
}
ilForumPost::setDepth (   $a_depth)

Definition at line 648 of file class.ilForumPost.php.

{
$this->depth = $a_depth;
}
ilForumPost::setForumId (   $a_forum_id)

Definition at line 504 of file class.ilForumPost.php.

{
$this->forum_id = $a_forum_id;
}
ilForumPost::setFullname (   $a_fullname)

Definition at line 319 of file class.ilForumPost.php.

{
$this->fullname = $a_fullname;
}
ilForumPost::setId (   $a_id)

Definition at line 496 of file class.ilForumPost.php.

{
$this->id = $a_id;
}
ilForumPost::setImportName (   $a_import_name)

Definition at line 600 of file class.ilForumPost.php.

{
$this->import_name = $a_import_name;
}
ilForumPost::setLft (   $a_lft)

Definition at line 632 of file class.ilForumPost.php.

{
$this->lft = $a_lft;
}
ilForumPost::setLoginName (   $a_loginname)

Definition at line 327 of file class.ilForumPost.php.

{
$this->loginname = $a_loginname;
}
ilForumPost::setMessage (   $a_message)

Definition at line 544 of file class.ilForumPost.php.

{
$this->message = $a_message;
}
ilForumPost::setNotification (   $a_notification)

Definition at line 592 of file class.ilForumPost.php.

{
$this->notification = $a_notification;
}
ilForumPost::setParentId (   $a_parent_id)

Definition at line 624 of file class.ilForumPost.php.

{
$this->parent_id = $a_parent_id;
}
ilForumPost::setRgt (   $a_rgt)

Definition at line 640 of file class.ilForumPost.php.

{
$this->rgt = $a_rgt;
}
ilForumPost::setStatus (   $a_status)

Definition at line 608 of file class.ilForumPost.php.

{
$this->status = $a_status;
}
ilForumPost::setSubject (   $a_subject)

Definition at line 536 of file class.ilForumPost.php.

{
$this->subject = $a_subject;
}
ilForumPost::setThread ( ilForumTopic  $thread)

Definition at line 656 of file class.ilForumPost.php.

{
$this->objThread = $thread;
}
ilForumPost::setThreadId (   $a_thread_id)

Definition at line 512 of file class.ilForumPost.php.

{
$this->thread_id = $a_thread_id;
}
ilForumPost::setTreeId (   $a_tree_id)

Definition at line 616 of file class.ilForumPost.php.

{
$this->tree_id = $a_tree_id;
}
ilForumPost::setUpdateUserId (   $a_user_id_update)

Definition at line 568 of file class.ilForumPost.php.

{
$this->user_id_update = $a_user_id_update;
}
ilForumPost::setUserAlias (   $a_user_alias)

Definition at line 528 of file class.ilForumPost.php.

{
$this->user_alias = $a_user_alias;
}
ilForumPost::setUserId (   $a_user_id)

Definition at line 520 of file class.ilForumPost.php.

{
$this->user_id = $a_user_id;
}
ilForumPost::update ( )

Definition at line 131 of file class.ilForumPost.php.

References $id, and $ilDB.

{
global $ilDB;
if($this->id)
{
$ilDB->update('frm_posts',
array(
'pos_top_fk' => array('integer', $this->forum_id),
'pos_thr_fk' => array('integer', $this->thread_id),
'pos_subject' => array('text', $this->subject),
'pos_message' => array('clob', $this->message),
'pos_update' => array('timestamp', $this->changedate),
'update_user' => array('integer', $this->user_id_update),
'pos_cens' => array('integer', $this->censored),
'pos_cens_com' => array('text', $this->censorship_comment),
'notify' => array('integer', (int)$this->notification)
),
array(
'pos_pk' => array('integer', (int)$this->id)
)
);
if($this->objThread->getFirstPostId() == $this->id)
{
$this->objThread->setSubject($this->subject);
$this->objThread->update();
$this->objThread->reload();
}
return true;
}
return false;
}

Field Documentation

ilForumPost::$censored = 0
private

Definition at line 54 of file class.ilForumPost.php.

ilForumPost::$censorship_comment = ''
private

Definition at line 56 of file class.ilForumPost.php.

Referenced by getCensorshipComment().

ilForumPost::$changedate = '0000-00-00 00:00:00'
private

Definition at line 50 of file class.ilForumPost.php.

Referenced by getChangeDate().

ilForumPost::$createdate = '0000-00-00 00:00:00'
private

Definition at line 48 of file class.ilForumPost.php.

Referenced by getCreateDate().

ilForumPost::$db = null
private

Definition at line 80 of file class.ilForumPost.php.

ilForumPost::$depth = 0
private

Definition at line 72 of file class.ilForumPost.php.

Referenced by getDepth().

ilForumPost::$forum_id = 0
private

Definition at line 36 of file class.ilForumPost.php.

Referenced by getForumId().

ilForumPost::$fullname = ''
private

Definition at line 74 of file class.ilForumPost.php.

Referenced by getFullname().

ilForumPost::$id = 0
private

Definition at line 34 of file class.ilForumPost.php.

Referenced by getId(), and update().

ilForumPost::$import_name = ''
private

Definition at line 60 of file class.ilForumPost.php.

Referenced by getImportName().

ilForumPost::$is_moderator = false
private

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

ilForumPost::$lft = 0
private

Definition at line 68 of file class.ilForumPost.php.

Referenced by getLft().

ilForumPost::$loginname = ''
private

Definition at line 76 of file class.ilForumPost.php.

Referenced by getLoginName().

ilForumPost::$message = ''
private

Definition at line 46 of file class.ilForumPost.php.

Referenced by getMessage().

ilForumPost::$notification = 0
private

Definition at line 58 of file class.ilForumPost.php.

ilForumPost::$objThread = null
private

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

Referenced by getThread().

ilForumPost::$parent_id = 0
private

Definition at line 66 of file class.ilForumPost.php.

Referenced by getParentId().

ilForumPost::$rgt = 0
private

Definition at line 70 of file class.ilForumPost.php.

Referenced by getRgt().

ilForumPost::$status = 1
private

Definition at line 62 of file class.ilForumPost.php.

ilForumPost::$subject = ''
private

Definition at line 44 of file class.ilForumPost.php.

Referenced by getSubject().

ilForumPost::$thread_id = 0
private

Definition at line 38 of file class.ilForumPost.php.

Referenced by getThreadId().

ilForumPost::$tree_id = 0
private

Definition at line 64 of file class.ilForumPost.php.

Referenced by getTreeId().

ilForumPost::$user_alias = ''
private

Definition at line 42 of file class.ilForumPost.php.

Referenced by getUserAlias().

ilForumPost::$user_id = 0
private

Definition at line 40 of file class.ilForumPost.php.

Referenced by getUserId().

ilForumPost::$user_id_update = 0
private

Definition at line 52 of file class.ilForumPost.php.

Referenced by getUpdateUserId().


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