From: toyomoyo Date: Thu, 16 Mar 2006 04:33:47 +0000 (+0000) Subject: more cleaning for filter class X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=60534cfc9cd2c2e595ce9ecfe08445c38374a28a;p=moodle.git more cleaning for filter class --- diff --git a/blog/class.BlogFilter.php b/blog/class.BlogFilter.php index cd5b6e8b81..cce776228b 100755 --- a/blog/class.BlogFilter.php +++ b/blog/class.BlogFilter.php @@ -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'
"; //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 "
filter trying to do its job"; - echo "
filtertype = $this->filtertype"; - echo "
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 .= '&m=' . $this->startmonth; - } - if (!in_array('startday', $unused)) { - $getargs .= '&d=' . $this->startday; - } - if (!in_array('startyear', $unused)) { - $getargs .= '&y=' . $this->startyear; - } if (!in_array('limit', $unused)) { $getargs .= '&limit=' . $this->fetchlimit; } - if (!in_array('formstart', $unused)) { - $getargs .= '&formstart=' . $this->fetchstart; - } if (!in_array('courseid', $unused)) { $getargs .= '&courseid=' . $this->courseid; } if (!in_array('userid', $unused)) { $getargs .= '&userid=' . $this->userid; } - if (!in_array('categoryid', $unused)) { - $getargs .= '&categoryid=' . $this->categoryid; - } - if (!in_array('groupid', $unused)) { - $getargs .= '&groupid=' . $this->groupid; - } return $getargs; } diff --git a/blog/edit.php b/blog/edit.php index f561dfe8e1..2b72a3bf63 100755 --- a/blog/edit.php +++ b/blog/edit.php @@ -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;