]> git.mjollnir.org Git - moodle.git/commitdiff
more cleaning
authortoyomoyo <toyomoyo>
Thu, 16 Mar 2006 04:21:13 +0000 (04:21 +0000)
committertoyomoyo <toyomoyo>
Thu, 16 Mar 2006 04:21:13 +0000 (04:21 +0000)
blog/class.BlogEntry.php
blog/class.BlogFilter.php
blog/edit.php
blog/header.php

index aced56596ddf028bfd1222bf0e9ee36ea09ed9e5..9aba078bb797b834b2a3c7a61f571694effa2951 100755 (executable)
@@ -72,24 +72,6 @@ class BlogEntry {
 
         $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
         
@@ -103,10 +85,8 @@ class BlogEntry {
         
         $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;
@@ -126,17 +106,6 @@ class BlogEntry {
         //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;
-                }
-            }
-        }
     }
 
     /**
@@ -375,16 +344,6 @@ class BlogEntry {
         $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);
@@ -403,18 +362,6 @@ class BlogEntry {
         $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;
index bafdcc3d30e0e9f6f744f5d132e73c5436ef8e1a..cd5b6e8b81ae232b582a7b2283ca3c178cb0d0b5 100755 (executable)
@@ -100,7 +100,6 @@ class BlogFilter {
             $this->fetchlimit = $fetchlimit;
         }
         
-        
         $this->postid = $postid;
 
         $this->sort = $sort;
index 56f9173a01f984bde14b368eec4092fdb267b1ae..f561dfe8e1cf25def49ca266a5a2e3267e8098d0 100755 (executable)
@@ -310,7 +310,6 @@ function do_update(&$post, &$bloginfo) {
     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
index 45e8fc2d610bbef188d57d4d243f2c78eb1c5daf..f5f84c12e2b5c3a77bb843a796a30f43f104300e 100755 (executable)
@@ -59,11 +59,11 @@ else {
 $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);
@@ -84,7 +84,7 @@ $tagstring = get_string('tag');
 
 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 {
@@ -94,7 +94,7 @@ switch ($filtertype) {
     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&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
@@ -109,7 +109,7 @@ switch ($filtertype) {
 
         $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.'&amp;group='.$filterselect.'">'.$thisgroup->name.'</a> ->
@@ -129,7 +129,7 @@ switch ($filtertype) {
         $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> ->
@@ -149,7 +149,7 @@ switch ($filtertype) {
         //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&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());