more cleaning

This commit is contained in:
toyomoyo 2006-03-16 06:16:54 +00:00
parent a2c28054b8
commit 3daaa61811
4 changed files with 7 additions and 133 deletions

View File

@ -142,7 +142,7 @@ class page_blog extends page_base {
$blocknames = $CFG->{'defaultblocks_'. $this->get_type()};
} else {
/// Failsafe - in case nothing was defined.
$blocknames = 'admin,calendar_month,blog_member_list:login,online_users,blog_menu,blog_categories,blog_recent_entries,blog_news_feeds';
$blocknames = 'admin,calendar_month,online_users,blog_menu';
}
return $blocknames;
@ -176,4 +176,4 @@ class page_blog extends page_base {
return $editformstring;
}
}
?>
?>

View File

@ -51,7 +51,7 @@ class BlogFilter {
* @param int $courseid = if needed the entries can be restricted to those associated with a given course.
* @param int $postid = a specific blog entry that is being sought
*/
function BlogFilter($userid='', $postid='', $fetchlimit='', $fetchstart='', $filtertype='', $filterselect='', $tagid='', $tag ='', $sort='lastmodified DESC') {
function BlogFilter($userid='', $postid='', $fetchlimit=10, $fetchstart='', $filtertype='', $filterselect='', $tagid='', $tag ='', $sort='lastmodified DESC') {
global $CFG; //filter settings to be pass in for baseurl
@ -73,12 +73,8 @@ class BlogFilter {
} else {
$this->fetchstart = $fetchstart;
}
if (!is_numeric($fetchlimit) ) {
$this->fetchlimit = $CFG->blog_default_fetch_num_entries;
} else {
$this->fetchlimit = $fetchlimit;
}
$this->fetchlimit = $fetchlimit;
$this->postid = $postid;

View File

@ -81,13 +81,7 @@ class BlogInfo {
$this->blogEntries = array();
$this->userid = $userid;
$this->blogtitle = stripslashes_safe(get_user_preferences('blogtitle', $CFG->blog_default_title, $userid));
$this->blogtagline = stripslashes_safe(get_user_preferences('blogtagline', '', $userid));
$this->bloguseextendedbody = get_user_preferences('bloguseextendedbody', false, $userid);
$this->blogtheme = get_user_preferences('blogtheme', 0, $userid); //Daryl Hawes note: investigate blogtheme usage again
/* if ($this->userid == 0) {
$this->userid = 1;
}*/
}
////////// getters and setters ///////////////

View File

@ -33,45 +33,6 @@ $BLOG_YES_NO_MODES = array ( '0' => get_string('no'),
if (empty($SESSION->blog_editing_enabled)) {
$SESSION->blog_editing_enabled = false;
}
if (!(isset($CFG->blog_enable_trackback_in) )) {
$CFG->blog_enable_trackback_in = 0; //default is 0 == do not allow for site
}
if (!(isset($CFG->blog_enable_moderation) )) {
$CFG->blog_enable_moderation = 0; //default is 0 == do not enable blog moderation on this site
}
if (!(isset($CFG->blog_enable_pingback_in) )) {
$CFG->blog_enable_pingback_in = 0; //default is 0 == do not allow for site
}
if (!(isset($CFG->blog_enable_trackback_out) )) {
$CFG->blog_enable_trackback_out = 0; //default is 0 == do not allow for site
}
if (!(isset($CFG->blog_enable_pingback_out) )) {
$CFG->blog_enable_pingback_out = 0; //default is 0 == do not allow for site
}
if (!(isset($CFG->blog_enable_moderation) )) {
$CFG->blog_enable_moderation = 0; //default is 0 == do not turn on moderation for site
}
if (!(isset($CFG->blog_useweblog_rpc) )) {
$CFG->blog_useweblog_rpc = 0;//default is 0 == do not publish to weblogs.com
}
if (empty($CFG->blog_ratename) ) {
$CFG->blog_ratename = 'Rating'; //default name for entry ratings
}
if (empty($CFG->blog_default_title) ) {
$CFG->blog_default_title = 'Moodle Blog'; //default blog title
}
if (empty($CFG->blog_blogurl) ) {
$CFG->blog_blogurl = $CFG->wwwroot.'/blog/index.php';
}
if (!(isset($CFG->blog_enable_trackback) )) {
$CFG->blog_enable_trackback = 0;
}
if (!(isset($CFG->blog_enable_pingback) )) {
$CFG->blog_enable_pingback = 0;
}
if (empty($CFG->blog_default_fetch_num_entries) ) {
$CFG->blog_default_fetch_num_entries = 8;
}
/**
* Verify that a user is logged in based on the session
@ -176,83 +137,6 @@ function blog_user_bloginfo($userid='') {
return $thisbloginfo;
}
/**
* build and return list of all member blogs
*
* @param stdObject $memberrecords An object of record entries as output from the get_member_list() function in BlogFilter (->id, ->title are the required variables).
* @param int $format - 0, 1 or 2; 0 = hyperlinked list of members, 1 = select element, 2 = select element wrapped in entire form
* @param bool $return indicates whether the function should return the text
* as a string or echo it directly to the page being rendered
* @param BlogFilter $blogFilter - a BlogFilter object with the details of the members listed in $memberrecords.
* @param string $hyperlink This is the target link to be used - there is a sensible default for each format.
*/
function blog_member_list(&$blogFilter, &$memberrecords, $format=1, $return=true, $hyperlink='') {
global $CFG, $USER;
//echo "userid = $blogFilter->userid"; //debug
//print_object($memberrecords); //debug
$returnstring = '';
if (!empty($memberrecords)) {
switch($format) {
case '0':
foreach($memberrecords as $record) {
if (empty($hyperlink)) {
$CFG->wwwroot .'/blog/index.php?userid='. $record->id;
}
$returnstring .= '<a href="'. $hyperlink . $record->id .'">'. stripslashes_safe($record->title) .'</a><br />';
}
break;
case '2':
$selected = '';
$options = array('' => 'All Member Blogs');
$formlink = $hyperlink; //TESTING
if (empty($hyperlink)) {
$getvars = $blogFilter->get_getvars('userid');
$self = basename($_SERVER['PHP_SELF']);
$formlink = $self . $getvars .'&amp;userid=';
}
foreach($memberrecords as $record) {
$id = $record->id;
if (blog_isLoggedIn() && $id == $USER->id ) {
$optiontitle = 'My Blog';
} else {
$optiontitle = stripslashes_safe($record->title);
}
$options[$id] = $optiontitle; //TESTING
if ( ($blogFilter->userid == $record->id) && ($blogFilter->userid != 0) ) {
$selected = $id;
}
}
//attach a random number to the popup function's form name
//becuase there may be multiple instances of this form on each page
$returnstring = popup_form($formlink,
$options, 'blog_member_list'. mt_rand(), $selected, '', '', '', true);
$returnstring = str_replace('<form', '<form style="display: inline;"', $returnstring);
break;
case '1':
default:
$returnstring = '<select name="userid">';
foreach($memberrecords as $record) {
$returnstring .= '<option value="'. $record->id .'"';
if ( ($record->id == $blogFilter->userid) && ($blogFilter->userid != 0) ) {
$returnstring .= ' selected';
}
$returnstring .= '>'. stripslashes_safe($record->title) .'</option>';
}
$returnstring .= '</select>';
break;
}
}
if ($return) {
return $returnstring;
}
print $returnstring;
return;
}
/**
* This function is in lib and not in BlogInfo because entries being searched
* might be found in any number of blogs rather than just one.
@ -480,7 +364,7 @@ function blog_applicable_publish_states($courseid='') {
}
}
if (!$CFG->blog_enable_moderation || isadmin() || (is_numeric($courseid) && isteacher($courseid)) ) {
if (isadmin() || (is_numeric($courseid) && isteacher($courseid)) ) {
// only admins and teachers can see site and public options when moderation is enabled
$options['site'] = get_string('publishtosite', 'blog');
$options['public'] = get_string('publishtoworld', 'blog');