Public Member Functions | |
ilForumExport () | |
Constructor public. | |
setOrderField ($orderField) | |
set database field for sorting results | |
getOrderField () | |
get name of orderField | |
setDbTable ($dbTable) | |
set database table | |
getDbTable () | |
get name of database table | |
setWhereCondition ($whereCondition="1") | |
set content of WHERE condition | |
getWhereCondition () | |
get content of whereCondition | |
getOneTopic () | |
get one topic-dataset by WhereCondition | |
getOneThread () | |
get one thread-dataset by WhereCondition | |
getFirstPostNode ($tree_id) | |
get data of the first node from frm_posts_tree and frm_posts public | |
getPostTree ($a_node) | |
get all nodes in the subtree under specified node | |
fetchPostNodeData ($a_row) | |
get data of parent node from frm_posts_tree and frm_posts private | |
getUser ($a_user_id) | |
get content of given user-ID | |
convertDate ($date) | |
converts the date format | |
countUserArticles ($user) | |
get number of articles from given user-ID | |
prepareText ($text, $edit=0) | |
prepares given string public | |
getOnePost ($post) | |
get one post-dataset | |
getThreadList ($topic) | |
get all threads of given forum | |
getUserData ($id, $a_import_name=0) | |
Data Fields | |
$ilias | |
$dbTable | |
$className = "ilForumExport" | |
$orderField | |
$whereCondition = "1" | |
$txtQuote1 = "[quote]" | |
$txtQuote2 = "[/quote]" | |
$replQuote1 = "<blockquote class=\"quote\"><hr size=\"1\" color=\"#000000\">" | |
$replQuote2 = "<hr size=\"1\" color=\"#000000\"/></blockquote>" | |
$pageHits = 20 | |
$id |
Definition at line 34 of file class.ilForumExport.php.
ilForumExport::convertDate | ( | $ | date | ) |
converts the date format
string | $date |
Definition at line 323 of file class.ilForumExport.php.
References $lng, and formatDate().
Referenced by getOnePost().
{ global $lng; # if ($date > date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d"), date("Y")))) # { # return $lng->txt("today").", ".ilFormat::formatDate($date,"time"); # } return ilFormat::formatDate($date); }
ilForumExport::countUserArticles | ( | $ | user | ) |
get number of articles from given user-ID
integer | $user: user-ID |
Definition at line 344 of file class.ilForumExport.php.
ilForumExport::fetchPostNodeData | ( | $ | a_row | ) |
get data of parent node from frm_posts_tree and frm_posts private
object | db db result object containing node_data |
Definition at line 271 of file class.ilForumExport.php.
References $data.
Referenced by getFirstPostNode(), getOnePost(), and getPostTree().
{ $data = array( "pos_pk" => $a_row->pos_pk, "author" => $a_row->pos_usr_id, "message" => $a_row->pos_message, "subject" => $a_row->pos_subject, "pos_cens_com" => $a_row->pos_cens_com, "pos_cens" => $a_row->pos_cens, "date" => $a_row->date, "create_date" => $a_row->pos_date, "update" => $a_row->pos_update, "update_user" => $a_row->update_user, "tree" => $a_row->thr_fk, "parent" => $a_row->parent_pos, "lft" => $a_row->lft, "rgt" => $a_row->rgt, "depth" => $a_row->depth, "id" => $a_row->fpt_pk, "import_name" => $a_row->import_name ); $data["message"] = stripslashes($data["message"]); return $data ? $data : array(); }
ilForumExport::getDbTable | ( | ) |
get name of database table
Definition at line 145 of file class.ilForumExport.php.
{
return $this->dbTable;
}
ilForumExport::getFirstPostNode | ( | $ | tree_id | ) |
get data of the first node from frm_posts_tree and frm_posts public
integer | tree id |
Definition at line 221 of file class.ilForumExport.php.
References $query, $res, $row, and fetchPostNodeData().
{ $query = "SELECT * FROM frm_posts, frm_posts_tree ". "WHERE pos_pk = pos_fk ". "AND parent_pos = 0 ". "AND thr_fk = '".$tree_id."'"; $res = $this->ilias->db->query($query); $row = $res->fetchRow(DB_FETCHMODE_OBJECT); return $this->fetchPostNodeData($row); }
ilForumExport::getOnePost | ( | $ | post | ) |
get one post-dataset
integer | post id |
Definition at line 436 of file class.ilForumExport.php.
References $lng, $q, $result, convertDate(), and fetchPostNodeData().
{ global $lng; $q = "SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data WHERE "; $q .= "pos_pk = '".$post."' AND "; $q .= "pos_usr_id = usr_id"; $q = "SELECT frm_posts.* FROM frm_posts WHERE "; $q .= "pos_pk = '".$post."' "; $result = $this->ilias->db->getRow($q, DB_FETCHMODE_ASSOC); $ROW = $this->fetchPostNodeData($result); $result["create_date"] = $this->convertDate($result["pos_date"]); $result["message"] = nl2br(stripslashes($result["pos_message"])); $result["author"] = nl2br(stripslashes($result["pos_usr_id"])); $result["date"] = date; $result["update"] = $result["pos_update"]; return $result; }
ilForumExport::getOneThread | ( | ) |
get one thread-dataset by WhereCondition
Definition at line 200 of file class.ilForumExport.php.
References $query, $result, and setWhereCondition().
{ $query = "SELECT * FROM frm_threads WHERE ( ".$this->whereCondition." )"; $result = $this->ilias->db->getRow($query, DB_FETCHMODE_ASSOC); $this->setWhereCondition("1"); $result["thr_subject"] = trim(stripslashes($result["thr_subject"])); return $result; }
ilForumExport::getOneTopic | ( | ) |
get one topic-dataset by WhereCondition
Definition at line 179 of file class.ilForumExport.php.
References $query, $result, and setWhereCondition().
{ $query = "SELECT * FROM frm_data WHERE ( ".$this->whereCondition." )"; $result = $this->ilias->db->getRow($query, DB_FETCHMODE_ASSOC); $this->setWhereCondition("1"); $result["top_name"] = trim(stripslashes($result["top_name"])); $result["top_description"] = nl2br(stripslashes($result["top_description"])); return $result; }
ilForumExport::getOrderField | ( | ) |
get name of orderField
Definition at line 116 of file class.ilForumExport.php.
{
return $this->orderField;
}
ilForumExport::getPostTree | ( | $ | a_node | ) |
get all nodes in the subtree under specified node
public
array | node_data |
Definition at line 242 of file class.ilForumExport.php.
References $query, $res, $row, and fetchPostNodeData().
{ $subtree = array(); $query = "SELECT * FROM frm_posts_tree ". "LEFT JOIN frm_posts ON frm_posts.pos_pk = frm_posts_tree.pos_fk ". "WHERE frm_posts_tree.lft BETWEEN '".$a_node["lft"]."' AND '".$a_node["rgt"]."' ". "AND thr_fk = '".$a_node["tree"]."'"; if ($this->orderField != "") $query .= " ORDER BY ".$this->orderField." DESC"; $res = $this->ilias->db->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $subtree[] = $this->fetchPostNodeData($row); } return $subtree; }
ilForumExport::getThreadList | ( | $ | topic | ) |
get all threads of given forum
integer | topic: forum-ID |
Definition at line 468 of file class.ilForumExport.php.
{ $q = "SELECT frm_threads.*, usr_data.lastname FROM frm_threads, usr_data WHERE "; $q .= "thr_top_fk ='".$topic."' AND "; $q .= "thr_usr_id = usr_id"; $q = "SELECT frm_threads.* FROM frm_threads WHERE "; $q .= "thr_top_fk ='".$topic."' "; if ($this->orderField != "") { $q .= " ORDER BY ".$this->orderField; } $res = $this->ilias->db->query($q); return $res; }
ilForumExport::getUser | ( | $ | a_user_id | ) |
get content of given user-ID
integer | $a_user_id: user-ID |
Definition at line 307 of file class.ilForumExport.php.
{ $userObj = new ilObjUser($a_user_id); return $userObj; }
ilForumExport::getUserData | ( | $ | id, | |
$ | a_import_name = 0 | |||
) |
Definition at line 487 of file class.ilForumExport.php.
References $id, $lng, $query, $res, $row, ilObject::_exists(), and ilObjectFactory::getInstanceByObjId().
{ global $lng; if($id && ilObject::_exists($id) && ilObjectFactory::getInstanceByObjId($id,false)) { $query = "SELECT * FROM usr_data WHERE usr_id = '".$id."'"; $res = $this->ilias->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $tmp_array["usr_id"] = $row->usr_id; $tmp_array["login"] = $row->login; $tmp_array["create_date"] = $row->create_date; $tmp_array["id"] = $row->usr_id; } return $tmp_array ? $tmp_array : array(); } else { $login = $a_import_name ? $a_import_name." (".$lng->txt("imported").")" : $lng->txt("unknown"); return array("usr_id" => 0,"login" => $login); } }
ilForumExport::getWhereCondition | ( | ) |
get content of whereCondition
Definition at line 168 of file class.ilForumExport.php.
{
return $this->whereCondition;
}
ilForumExport::ilForumExport | ( | ) |
Constructor public.
Definition at line 83 of file class.ilForumExport.php.
References $ilias.
{ global $ilias; $this->ilias =& $ilias; }
ilForumExport::prepareText | ( | $ | text, | |
$ | edit = 0 | |||
) |
prepares given string public
string | ||
integer |
Definition at line 363 of file class.ilForumExport.php.
References $lng.
{ global $lng; if ($edit == 1) { $text = str_replace($this->txtQuote1, "", $text); $text = str_replace($this->txtQuote2, "", $text); $text = $this->txtQuote1.$text.$this->txtQuote2; } else { // check for quotation $startZ = substr_count ($text, $this->txtQuote1); $endZ = substr_count ($text, $this->txtQuote2); if ($startZ > 0 || $endZ > 0) { if ($startZ > $endZ) { $diff = $startZ - $endZ; for ($i = 0; $i < $diff; $i++) { $text .= $this->txtQuote2; } } elseif ($startZ < $endZ) { $diff = $endZ - $startZ; for ($i = 0; $i < $diff; $i++) { $text = $this->txtQuote1.$text; } } // only one txtQuote can exist... if ($startZ > 1) { $start_firstPos = strpos($text, $this->txtQuote1); $text_s2 = str_replace($this->txtQuote1, "", substr($text, ($start_firstPos+strlen($this->txtQuote1)))); $text_s1 = substr($text, 0, ($start_firstPos+strlen($this->txtQuote1))); $text = $text_s1.$text_s2; } if ($endZ > 1) { $end_firstPos = strrpos($text, $this->txtQuote2); $text_e1 = str_replace($this->txtQuote2, "", substr($text, 0, $end_firstPos)); $text_e2 = substr($text, $end_firstPos); $text = $text_e1.$text_e2; } if ($edit == 0) { $text = str_replace($this->txtQuote1, "<blockquote><span><b>".$lng->txt("quote")."</b>:</blockquote>".$this->replQuote1, $text); $text = str_replace($this->txtQuote2, $this->replQuote2, $text); } } } $text = stripslashes($text); return $text; }
ilForumExport::setDbTable | ( | $ | dbTable | ) |
ilForumExport::setOrderField | ( | $ | orderField | ) |
set database field for sorting results
string | $orderField database field for sorting |
Definition at line 98 of file class.ilForumExport.php.
References $orderField.
{ if ($orderField == "") { die($this->className . "::setOrderField(): No orderField given."); } else { $this->orderField = $orderField; } }
ilForumExport::setWhereCondition | ( | $ | whereCondition = "1" |
) |
set content of WHERE condition
string | $whereCondition |
Definition at line 156 of file class.ilForumExport.php.
References $whereCondition.
Referenced by getOneThread(), and getOneTopic().
{ $this->whereCondition = $whereCondition; return true; }
ilForumExport::$className = "ilForumExport" |
Definition at line 56 of file class.ilForumExport.php.
ilForumExport::$dbTable |
Definition at line 49 of file class.ilForumExport.php.
Referenced by setDbTable().
ilForumExport::$id |
Definition at line 77 of file class.ilForumExport.php.
Referenced by getUserData().
ilForumExport::$ilias |
Definition at line 41 of file class.ilForumExport.php.
Referenced by ilForumExport().
ilForumExport::$orderField |
Definition at line 64 of file class.ilForumExport.php.
Referenced by setOrderField().
ilForumExport::$pageHits = 20 |
Definition at line 74 of file class.ilForumExport.php.
ilForumExport::$replQuote1 = "<blockquote class=\"quote\"><hr size=\"1\" color=\"#000000\">" |
Definition at line 70 of file class.ilForumExport.php.
ilForumExport::$replQuote2 = "<hr size=\"1\" color=\"#000000\"/></blockquote>" |
Definition at line 71 of file class.ilForumExport.php.
ilForumExport::$txtQuote1 = "[quote]" |
Definition at line 68 of file class.ilForumExport.php.
ilForumExport::$txtQuote2 = "[/quote]" |
Definition at line 69 of file class.ilForumExport.php.
ilForumExport::$whereCondition = "1" |
Definition at line 66 of file class.ilForumExport.php.
Referenced by setWhereCondition().