ILIAS  Release_3_10_x_branch Revision 61812
 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 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 366 of file class.ilForumPost.php.

Referenced by activatePost(), and activatePostAndChildPosts().

{
if ($this->id)
{
$query = "UPDATE frm_posts
INNER JOIN frm_posts_tree ON pos_fk = pos_pk
SET pos_status = '1'
WHERE 1
AND lft < ".$this->db->quote($this->lft)." AND rgt > ".$this->db->quote($this->rgt)."
AND thr_fk = ".$this->db->quote($this->thread_id)." ";
$this->db->query($query);
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilForumPost::activatePost ( )

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

References activateParentPosts().

{
if ($this->id)
{
$query = "UPDATE frm_posts SET pos_status = '1' WHERE pos_pk = " . $this->db->quote($this->id) . " ";
$this->db->query($query);
return true;
}
return false;
}

+ Here is the call graph for this function:

ilForumPost::activatePostAndChildPosts ( )

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

References activateParentPosts().

{
if ($this->id)
{
$query = "UPDATE frm_posts_tree AS treea
INNER JOIN frm_posts_tree AS 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
SET pos_status = '1'
WHERE 1
AND treea.pos_fk = " . $this->db->quote($this->id) . " ";
$this->db->query($query);
return true;
}
return false;
}

+ Here is the call graph for this function:

ilForumPost::deactivatePostAndChildPosts ( )

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

{
if ($this->id)
{
$query = "UPDATE frm_posts_tree AS treea
INNER JOIN frm_posts_tree AS 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
SET pos_status = '0'
WHERE 1
AND treea.pos_fk = " . $this->db->quote($this->id) . " ";
$this->db->query($query);
return true;
}
return false;
}
ilForumPost::getCensorshipComment ( )

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

References $censorship_comment.

ilForumPost::getChangeDate ( )

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

References $changedate.

{
}
ilForumPost::getCreateDate ( )

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

References $createdate.

{
}
ilForumPost::getDataAsArray ( )

Definition at line 162 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 187 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 608 of file class.ilForumPost.php.

References $depth.

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

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

References $forum_id.

{
}
ilForumPost::getFullname ( )

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

References $fullname.

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

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

References $id.

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

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

References $import_name.

{
}
ilForumPost::getLft ( )

Definition at line 592 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 325 of file class.ilForumPost.php.

References $loginname.

{
}
ilForumPost::getMessage ( )

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

References $message.

{
}
ilForumPost::getParentId ( )

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

References $parent_id.

{
}
ilForumPost::getRgt ( )

Definition at line 600 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 496 of file class.ilForumPost.php.

References $subject.

{
}
ilForumPost::getThread ( )

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

References $objThread.

{
}
ilForumPost::getThreadId ( )

Definition at line 472 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 576 of file class.ilForumPost.php.

References $tree_id.

{
}
ilForumPost::getUpdateUserId ( )

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

References $user_id_update.

{
}
ilForumPost::getUserAlias ( )

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

References $user_alias.

{
}
ilForumPost::getUserData ( )
private

Definition at line 284 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 480 of file class.ilForumPost.php.

References $user_id.

{
}
ilForumPost::hasReplies ( )

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

References $res.

{
if ($this->id && $this->rgt && $this->lft)
{
$query = "SELECT *
FROM frm_posts_tree
WHERE 1
AND lft > ".$this->db->quote($this->lft)." AND rgt < ".$this->db->quote($this->rgt)."
AND thr_fk = ".$this->db->quote($this->thread_id);
$res = $this->db->query($query);
return $res->numRows() ? true : false;
}
return false;
}
ilForumPost::insert ( )

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

{
if ($this->forum_id && $this->thread_id)
{
$query = "INSERT INTO frm_posts "
."SET "
."pos_pk = " . $this->db->quote($this->id). ", "
."pos_top_fk = " . $this->db->quote($this->forum_id). ", "
."pos_thr_fk = " . $this->db->quote($this->thread_id). ", "
."pos_usr_id = " . $this->db->quote($this->user_id). ", "
."pos_usr_alias = " . $this->db->quote($this->user_alias). ", "
."pos_subject = " . $this->db->quote($this->subject). ", "
."pos_message = " . $this->db->quote($this->message). ", "
."pos_date = " . $this->db->quote($this->createdate). ", "
."pos_update = " . $this->db->quote($this->changedate). ", "
."update_user = " . $this->db->quote($this->user_id_update). ", "
."pos_cens = " . $this->db->quote($this->censored). ", "
."pos_cens_com = " . $this->db->quote($this->censorship_comment). ", "
."notify = " . $this->db->quote($this->notification). ", "
."import_name = " . $this->db->quote($this->import_name). ", "
."pos_status = " . $this->db->quote($this->status). " ";
$this->db->query($query);
$this->id = $this->db->getLastInsertId();
return true;
}
return false;
}
ilForumPost::isActivated ( )

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

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

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

References $res.

{
if ($this->id)
{
$query = "SELECT *
FROM frm_posts_tree
INNER JOIN frm_posts ON pos_pk = pos_fk
WHERE 1
AND pos_status = '0'
AND lft < ".$this->db->quote($this->lft)." AND rgt > ".$this->db->quote($this->rgt)."
AND thr_fk = ".$this->db->quote($this->thread_id)." ";
$res = $this->db->query($query);
return $res->numRows();
}
return false;
}
ilForumPost::isCensored ( )

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

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

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

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

Definition at line 439 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 404 of file class.ilForumPost.php.

References $res.

{
if ($a_user_id && $this->id)
{
$query = "SELECT *
FROM frm_user_read
WHERE 1
AND usr_id = ".$this->db->quote($a_user_id)."
AND post_id = ".$this->db->quote($this->id)." ";
$res = $this->db->query($query);
return $res->numRows() ? true : false;
}
return false;
}
ilForumPost::read ( )
private

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

References getUserData().

Referenced by __construct(), and reload().

{
if ($this->id)
{
$query = "SELECT * FROM frm_posts
INNER JOIN frm_posts_tree ON pos_fk = pos_pk
WHERE pos_pk = " . $this->db->quote($this->id) . " ";
$row = $this->db->getrow($query);
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 308 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 532 of file class.ilForumPost.php.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

References $id.

{
if ($this->id)
{
$query = "UPDATE frm_posts "
."SET "
."pos_top_fk = " . $this->db->quote($this->forum_id). ", "
."pos_thr_fk = " . $this->db->quote($this->thread_id). ", "
."pos_subject = " . $this->db->quote($this->subject). ", "
."pos_message = " . $this->db->quote($this->message). ", "
."pos_update = " . $this->db->quote($this->changedate). ", "
."update_user = " . $this->db->quote($this->user_id_update). ", "
."pos_cens = " . $this->db->quote($this->censored). ", "
."pos_cens_com = " . $this->db->quote($this->censorship_comment). ", "
."notify = " . $this->db->quote($this->notification). " "
."WHERE pos_pk = ". $this->db->quote($this->id) ." ";
$this->db->query($query);
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: