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);
178 function update($a_validate =
true, $a_no_history =
false, $a_notify =
true)
184 $query =
"UPDATE il_blog_posting SET".
185 " title = ".$ilDB->quote($this->
getTitle(),
"text").
187 ",approved =".$ilDB->quote($this->
isApproved(),
"integer").
188 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
189 $ilDB->manipulate(
$query);
195 include_once
"Modules/Blog/classes/class.ilObjBlog.php";
209 $query =
"SELECT * FROM il_blog_posting".
210 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
211 $set = $ilDB->query(
$query);
212 $rec = $ilDB->fetchAssoc($set);
218 if((
bool)$rec[
"approved"])
233 $this->approved =
false;
247 $query =
"DELETE FROM il_blog_posting".
248 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
249 $ilDB->manipulate(
$query);
265 include_once
'Services/MetaData/classes/class.ilMD.php';
267 $query =
"SELECT * FROM il_blog_posting".
268 " WHERE blog_id = ".$ilDB->quote($a_blog_id,
"integer");
269 $set = $ilDB->query(
$query);
270 while($rec = $ilDB->fetchAssoc($set))
273 $md_obj =
new ilMD($a_blog_id, $rec[
"id"],
"blp");
274 if(is_object($md_section = $md_obj->getGeneral()))
276 foreach($md_section->getKeywordIds() as
$id)
278 $md_key = $md_section->getKeyword(
$id);
298 $query =
"SELECT blog_id FROM il_blog_posting".
299 " WHERE id = ".$ilDB->quote($a_posting_id,
"integer");
300 $set = $ilDB->query(
$query);
301 if ($rec = $ilDB->fetchAssoc($set))
303 return $rec[
"blog_id"];
324 $ilDB->setLimit($a_limit, $a_offset);
327 $query =
"SELECT * FROM il_blog_posting".
328 " WHERE blog_id = ".$ilDB->quote($a_blog_id,
"integer").
329 " ORDER BY created DESC";
330 $set = $ilDB->query(
$query);
332 while($rec = $ilDB->fetchAssoc($set))
334 if (isset($pages[$rec[
"id"]]))
336 $post[$rec[
"id"]] = $pages[$rec[
"id"]];
337 $post[$rec[
"id"]][
"title"] = $rec[
"title"];
339 $post[$rec[
"id"]][
"author"] = $rec[
"author"];
340 $post[$rec[
"id"]][
"approved"] = (bool)$rec[
"approved"];
354 static function exists($a_blog_id, $a_posting_id)
358 $query =
"SELECT id FROM il_blog_posting".
359 " WHERE blog_id = ".$ilDB->quote($a_blog_id,
"integer").
360 " AND id = ".$ilDB->quote($a_posting_id,
"integer");
361 $set = $ilDB->query(
$query);
362 if($rec = $ilDB->fetchAssoc($set))
380 return array_pop(array_keys($data));
392 $this->blog_node_id = (int)$a_id;
393 $this->blog_node_is_wsp = (bool)$a_is_in_workspace;
408 $sql =
"SELECT DISTINCT(blog_id)".
409 " FROM il_blog_posting".
410 " WHERE author = ".$ilDB->quote($a_user_id);
411 $set = $ilDB->query($sql);
412 while(
$row = $ilDB->fetchAssoc($set))
414 $ids[] =
$row[
"blog_id"];