4 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
41 $this->title = $a_title;
81 $this->created = $a_date;
101 $this->author = (int)$a_id;
119 $this->approved = (bool)$a_status;
139 $id = $ilDB->nextId(
"il_blog_posting");
153 $query =
"INSERT INTO il_blog_posting (id, title, blog_id, created, author, approved)".
155 $ilDB->quote($this->
getId(),
"integer").
",".
156 $ilDB->quote($this->
getTitle(),
"text").
",".
157 $ilDB->quote($this->
getBlogId(),
"integer").
",".
158 $ilDB->quote(
$created,
"timestamp").
",".
159 $ilDB->quote($this->
getAuthor(),
"integer").
",".
160 $ilDB->quote(
false,
"integer").
")";
161 $ilDB->manipulate(
$query);
179 function update($a_validate =
true, $a_no_history =
false, $a_notify =
true, $a_notify_action =
"update")
185 $query =
"UPDATE il_blog_posting SET".
186 " title = ".$ilDB->quote($this->
getTitle(),
"text").
188 ",approved =".$ilDB->quote($this->
isApproved(),
"integer").
189 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
190 $ilDB->manipulate(
$query);
196 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
210 $query =
"SELECT * FROM il_blog_posting".
211 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
212 $set = $ilDB->query(
$query);
213 $rec = $ilDB->fetchAssoc($set);
219 if((
bool)$rec[
"approved"])
234 $this->approved =
false;
248 $query =
"DELETE FROM il_blog_posting".
249 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
250 $ilDB->manipulate(
$query);
266 include_once
'Services/MetaData/classes/class.ilMD.php';
268 $query =
"SELECT * FROM il_blog_posting".
269 " WHERE blog_id = ".$ilDB->quote($a_blog_id,
"integer");
270 $set = $ilDB->query(
$query);
271 while($rec = $ilDB->fetchAssoc($set))
274 $md_obj =
new ilMD($a_blog_id, $rec[
"id"],
"blp");
275 if(is_object($md_section = $md_obj->getGeneral()))
277 foreach($md_section->getKeywordIds() as
$id)
279 $md_key = $md_section->getKeyword(
$id);
299 $query =
"SELECT blog_id FROM il_blog_posting".
300 " WHERE id = ".$ilDB->quote($a_posting_id,
"integer");
301 $set = $ilDB->query(
$query);
302 if ($rec = $ilDB->fetchAssoc($set))
304 return $rec[
"blog_id"];
325 $ilDB->setLimit($a_limit, $a_offset);
328 $query =
"SELECT * FROM il_blog_posting".
329 " WHERE blog_id = ".$ilDB->quote($a_blog_id,
"integer").
330 " ORDER BY created DESC";
331 $set = $ilDB->query(
$query);
333 while($rec = $ilDB->fetchAssoc($set))
335 if (isset($pages[$rec[
"id"]]))
337 $post[$rec[
"id"]] = $pages[$rec[
"id"]];
338 $post[$rec[
"id"]][
"title"] = $rec[
"title"];
340 $post[$rec[
"id"]][
"author"] = $rec[
"author"];
341 $post[$rec[
"id"]][
"approved"] = (bool)$rec[
"approved"];
355 static function exists($a_blog_id, $a_posting_id)
359 $query =
"SELECT id FROM il_blog_posting".
360 " WHERE blog_id = ".$ilDB->quote($a_blog_id,
"integer").
361 " AND id = ".$ilDB->quote($a_posting_id,
"integer");
362 $set = $ilDB->query(
$query);
363 if($rec = $ilDB->fetchAssoc($set))
381 return array_pop(array_keys($data));
393 $this->blog_node_id = (int)$a_id;
394 $this->blog_node_is_wsp = (bool)$a_is_in_workspace;
409 $sql =
"SELECT DISTINCT(blog_id)".
410 " FROM il_blog_posting".
411 " WHERE author = ".$ilDB->quote($a_user_id);
412 $set = $ilDB->query($sql);
413 while(
$row = $ilDB->fetchAssoc($set))
415 $ids[] =
$row[
"blog_id"];
422 include_once
"Modules/Blog/classes/class.ilBlogPostingGUI.php";
426 $snippet = str_replace(
'<br/>',
"\n", $snippet);
427 $snippet = str_replace(
'<br />',
"\n", $snippet);
428 $snippet = str_replace(
'</p>',
"\n", $snippet);
429 $snippet = str_replace(
'</div>',
"\n", $snippet);
431 return trim(strip_tags($snippet));
440 include_once
'Services/MetaData/classes/class.ilMD.php';
442 if(!is_object($md_section = $md_obj->getGeneral()))
444 $md_section = $md_obj->addGeneral();
456 $ulang = $ilUser->getLanguage();
457 $keywords = array($ulang=>$keywords);
459 include_once(
"./Services/MetaData/classes/class.ilMDKeyword.php");
465 include_once(
"./Services/MetaData/classes/class.ilMDKeyword.php");