$this->entryId = $entrydetails->id;
- if (!empty($entrydetails->categoryid)) {
- if (is_array($entrydetails->categoryid)) {
- $this->entryCategoryIds = $entrydetails->categoryid;
- } else {
- $this->entryCategoryIds = array($entrydetails->categoryid);
- }
- } else {
- // load up all categories that this entry is associated with
- // cannot use moodle's get_records() here because this table does not conform well enough
- $sql = 'SELECT * FROM '. $CFG->prefix .'blog_categories_entries WHERE entryid='. $this->entryId;
- if($rs = $db->Execute($sql)) {
- while (!$rs->EOF) {
- $this->entryCategoryIds[] = $rs->fields['categoryid'];
- $rs->MoveNext();
- }
- }
- }
- $this->entryCategoryIds = array_unique($this->entryCategoryIds);
// print "Debug: entryId: $this->entryId"; //debug
// print_object($this->entryCategoryIds); //debug
$this->entryuserid = $entrydetails->userid;
-
//added stripslashes_safe here for rss feeds. Will this conflict anywhere?
-
$this->entryTitle = ereg_replace('<tick>', "'", stripslashes_safe($entrydetails->subject)); //subject, not title!
$this->entryFormat = $entrydetails->format;
//need to make sure that email is actually just a link to our email sending page.
$this->entryAuthorEmail = $rs->email;
- // then each category
- if (!empty($this->entryCategoryIds)) {
- foreach ($this->entryCategoryIds as $categoryid) {
- if (! $currcat = get_record('blog_categories', 'id', $categoryid)) {
- print 'Could not find category id '. $categoryid ."\n";
- $this->entryCategories[$categoryid] = '';
- } else {
- $this->entryCategories[$categoryid] = $currcat->catname;
- }
- }
- }
}
/**
$dataobject->userid = intval($this->entryuserid);
$dataobject->publishstate = $this->entryPublishState;
- if ($this->entryCourseId) {
- $dataobject->courseid = $this->entryCourseId;
- } else {
- $dataobject->courseid = SITEID; //yu: in case change to all course
- }
- if ($this->entryGroupId) {
- $dataobject->groupid = $this->entryGroupId;
- } else {
- $dataobject->groupid = 0; //yu: in case we change to all groups
- }
$dataobject->lastmodified = $timenow;
$dataobject->summary = ereg_replace("'", '<tick>', $dataobject->summary);
$sql = 'DELETE FROM '. $CFG->prefix .'blog_categories_entries WHERE entryid='. $this->entryId;
$rs = $db->Execute($sql);
- if (!empty($this->entryCategoryIds)) {
- if (!is_array($this->entryCategoryIds)) {
- $this->entryCategoryIds = array($this->entryCategoryIds);
- }
- $this->entryCategoryIds = array_unique($this->entryCategoryIds);
- foreach ($this->entryCategoryIds as $categoryid) {
- $cat->entryid = $this->entryId;
- $cat->categoryid = $categoryid;
- insert_record('blog_categories_entries', $cat);
- }
- }
-
// next update the entry itself
if (update_record('post', $dataobject)) {
return true;
$this->fetchlimit = $fetchlimit;
}
-
$this->postid = $postid;
$this->sort = $sort;
echo "id id ".$post->postid;
// print_object($blogentry); //debug
- $blogentry->set_title($post->etitle);
$blogentry->set_body($post->body);
$blogentry->set_format($post->format);
$blogentry->set_publishstate($post->publishstate); //we don't care about the return value here
$PAGE->courseid = $courseid;
$PAGE->init_full(); //init the BlogInfo object and the courserecord object
-if (isset($tagid) && $tagid) {
+if (!empty($tagid)) {
$taginstance = get_record('tags', 'id', $tagid);
} else {
$tagid = '';
- if (isset($tag) && $tag) {
+ if (!empty($tag)) {
$tagrec = get_record('tags', 'text', $tag);
$tagid = $tagrec->id;
$taginstance = get_record('tags', 'id', $tagid);
switch ($filtertype) {
case 'site':
- if ($tagid || (isset($tag) && $tag)) {
+ if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
break;
case 'course':
- if ($tagid || (isset($tag) && $tag)) {
+ if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$filterselect.'">'.$course->shortname.'</a> ->
<a href="index.php?filtertype=course&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
$thisgroup = get_record('groups', 'id', $filterselect);
- if ($tagid || (isset($tag) && $tag)) {
+ if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&group='.$filterselect.'">'.$thisgroup->name.'</a> ->
$participants = get_string('participants');
if (isset($course->id) && $course->id && $course->id != SITEID) {
- if ($tagid || (isset($tag) && $tag)) {
+ if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
//in top view
else {
- if ($tagid || (isset($tag) && $tag)) {
+ if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="index.php?filtertype=user&filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());