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

index cd5b6e8b81ae232b582a7b2283ca3c178cb0d0b5..cce776228bfafb204f5095b438dcf3a1500dbde7 100755 (executable)
@@ -27,14 +27,6 @@ class BlogFilter {
     // you can use variable names directly to access properties.
     //ie. $blogFilter->month
     
-    var $startmonth; 
-    var $startday;
-    var $startyear;
-    var $endmonth; 
-    var $endday;
-    var $endyear;
-    var $tstart; //start time, calculated from the values of startmonth, startday and startyear
-    var $tend; //end time, calculated from the values of endmonth, endday and endyear
     var $fetchlimit; //max # of entries to read from database
     var $fetchstart; //entry # to start reading from database at
     var $max_entries; //maximum number of matching entries available in database
@@ -42,11 +34,6 @@ class BlogFilter {
     var $courseid;
     var $userid; // moodle userid to specify a specific user's blog
     var $postid; //id of a single blog entry
-    var $categoryid;
-    var $groupid;
-    var $blogtitle;
-    var $blogtagline;
-    var $blogtheme;
     var $blogInfo;
     var $memberlist; //do not access directly - use getter get_member_list()
     var $filtered_entries = array();
@@ -68,20 +55,13 @@ class BlogFilter {
 
         global $CFG;    //filter settings to be pass in for baseurl
 
-        if (!empty($userid) && $userid != 0 && $userid != '') {
+        if (!empty($userid)) {
 //            print "creating blogInfo object for user with id '$userid'<br />"; //debug
             $this->blogInfo =& new BlogInfo($userid);
         }
         if ( empty($this->blogInfo) || empty($this->blogInfo->userid)) {
             unset($this->blogInfo);
-            $this->blogtitle = '';
-            $this->blogtagline = '';
-            $this->blogtheme = '';
-        } else {
-
-            $this->blogtitle = &$this->blogInfo->blogtitle;
-            $this->blogtagline = &$this->blogInfo->blogtagline;
-        }
+        } 
         
         if (! is_numeric($userid) ) {
             $this->userid = 0;
@@ -200,11 +180,6 @@ class BlogFilter {
     function fetch_entries($limit=true) {
         global $CFG, $USER;
         
-/*
-        echo "<br />filter trying to do its job";
-        echo "<br />filtertype = $this->filtertype";
-        echo "<br />filterselect = $this->filterselect";
-        */
         if (!isset($USER->id)) {
             $USER->id = 0;    //hack, for guests
         }
@@ -305,7 +280,7 @@ class BlogFilter {
 
         }
         
-        if ($this->fetchstart !== '' && $limit) {    //this can be changed to use mysql_paging_limit
+        if ($this->fetchstart !== '' && $limit) {
             $limit = sql_paging_limit($this->fetchstart, $this->fetchlimit);
         } else {
             $limit = '';
@@ -401,33 +376,15 @@ class BlogFilter {
             //argument is not an array, hopefully it's a string. wrap it in an array for comparisons below.
             $unused = array($unused);
         }
-        if (!in_array('startmonth', $unused)) {
-            $getargs .= '&amp;m=' . $this->startmonth;
-        }
-        if (!in_array('startday', $unused)) {
-            $getargs .= '&amp;d=' . $this->startday;
-        }
-        if (!in_array('startyear', $unused)) {
-            $getargs .= '&amp;y=' . $this->startyear;
-        }
         if (!in_array('limit', $unused)) {
             $getargs .= '&amp;limit=' . $this->fetchlimit;
         }
-        if (!in_array('formstart', $unused)) {
-            $getargs .= '&amp;formstart=' . $this->fetchstart;
-        }
         if (!in_array('courseid', $unused)) {
             $getargs .= '&amp;courseid=' . $this->courseid;
         }
         if (!in_array('userid', $unused)) {
             $getargs .= '&amp;userid=' . $this->userid;
         }
-        if (!in_array('categoryid', $unused)) {
-            $getargs .= '&amp;categoryid=' . $this->categoryid;
-        }
-        if (!in_array('groupid', $unused)) {
-            $getargs .= '&amp;groupid=' . $this->groupid;
-        }
         return $getargs;
     }
 
index f561dfe8e1cf25def49ca266a5a2e3267e8098d0..2b72a3bf636247b8e15b33835d64b52b73088ae1 100755 (executable)
@@ -214,26 +214,6 @@ function do_save(&$post, &$bloginfo_arg) {
         $post->error =  get_string('nomessagebodyerror', 'blog');
     } else {
 
-        //initialize courseid and groupid if specified
-        if (isset($post->courseid)) {
-            $courseid = $post->courseid;
-        } else {
-            $courseid = 1;
-        }
-        if (isset($post->groupid)) {
-            $groupid = $post->groupid;
-        } else {
-            $groupid = '';
-        }
-       
-/*     
-        //group pseudocode 
-        if ($groupid != '') {
-            if (! ismember($post->groupid) ) {
-                error('You are not a member of the specified group. Group with id#('.$groupid.')'); //Daryl Hawes note: LOCALIZATION NEEDED FOR THIS LINE
-            }
-        }*/
-
         // Insert the new blog entry.
         $entryID = $bloginfo_arg->insert_blog_entry($post->etitle, $post->body, $USER->id, $post->format, $post->publishstate, $courseid, $groupid);
 
@@ -242,7 +222,7 @@ function do_save(&$post, &$bloginfo_arg) {
         $otags = optional_param('otags','', PARAM_INT);
         $ptags = optional_param('ptags','', PARAM_INT);
 
-        // Add tags information
+        /// Add tags information
         foreach ($otags as $otag) {
             $tag->entryid = $entryID;
             $tag->tagid = $otag;
@@ -286,26 +266,6 @@ function do_update(&$post, &$bloginfo) {
 
     global $CFG, $USER;
     
-    //initialize courseid and groupid if specified
-    if (isset($post->courseid)) {
-        $courseid = $post->courseid;
-    } else {
-        $courseid = 1;
-    }
-    if (isset($post->groupid)) {
-        $groupid = $post->groupid;
-    } else {
-        $groupid = '';
-    }
-
-/*
-    //pseudocode for handling groups
-    if ($groupid != '') {
-        if (! ismember($groupid) ) {
-            error('You are not a member of the specified group. Group with id#('. $groupid .')'); //Daryl Hawes note: LOCALIZATION NEEDED FOR THIS LINE
-        }
-    }*/
-    
     $blogentry = $bloginfo->get_blog_entry_by_id($post->postid);
     echo "id id ".$post->postid;
 //  print_object($blogentry);  //debug
@@ -320,7 +280,7 @@ function do_update(&$post, &$bloginfo) {
 
         $otags = optional_param('otags','', PARAM_INT);
         $ptags = optional_param('ptags','', PARAM_INT);
-        // Add tags information
+        /// Add tags information
         foreach ($otags as $otag) {
             $tag->entryid = $blogentry->entryId;
             $tag->tagid = $otag;