diff --git a/blocks/new_forum_replies/block_new_forum_replies.php b/blocks/new_forum_replies/block_new_forum_replies.php deleted file mode 100644 index a8c1c8e1816..00000000000 --- a/blocks/new_forum_replies/block_new_forum_replies.php +++ /dev/null @@ -1,149 +0,0 @@ -title = get_string('blockname_replies', 'block_new_forum_replies'); - $this->version = 2008070900; - } - - function specialization() { - if(empty($this->config->style)) { - // set the default and save it - $this->config->style = 'replies'; - $this->instance_config_commit(); - } - if(!empty($this->config->title)) { - $this->title = $this->config->title; - } - else { - if($this->config->style=='newposts') { - $this->title = get_string('blockname_newposts', 'block_new_forum_replies'); - } - elseif($this->config->style=='threads') { - $this->title = get_string('blockname_threads', 'block_new_forum_replies'); - } - else { - $this->title = get_string('blockname_replies', 'block_new_forum_replies'); - } - } - } - - function get_content() { - if ($this->content !== NULL) { - return $this->content; - } - - global $CFG, $USER, $course, $isteacher, $timestart; - - $this->content = new stdClass; - $this->content->text = ''; - $this->content->footer = ''; - - $strby = get_string('by', 'block_new_forum_replies'); - $strnewpost = get_string('newpost', 'block_new_forum_replies'); - $strnewposts = get_string('newposts', 'block_new_forum_replies'); - - - $timestart = time() - COURSE_MAX_RECENT_PERIOD; - $course = get_record('course', 'id', $this->instance->pageid); - $context = get_context_instance(CONTEXT_COURSE, $course->id); - - if (!has_capability('moodle/legacy:guest', $context, NULL, false)) { - if (!empty($USER->lastcourseaccess[$course->id])) { - if ($USER->lastcourseaccess[$course->id] > $timestart) { - $timestart = $USER->lastcourseaccess[$course->id]; - } - } - } - - if($this->config->style=='replies') { - $sql = "SELECT * FROM {$CFG->prefix}forum_posts WHERE - parent IN (SELECT id FROM {$CFG->prefix}forum_posts WHERE userid = '$USER->id') - AND discussion IN (SELECT id FROM {$CFG->prefix}forum_discussions WHERE course = {$course->id}) - AND modified > '$timestart' ORDER BY created DESC"; - } - elseif($this->config->style=='newposts') { - $sql = "SELECT * FROM {$CFG->prefix}forum_posts WHERE - discussion IN (SELECT DISTINCT discussion FROM {$CFG->prefix}forum_posts WHERE userid = '$USER->id') - AND discussion IN (SELECT id FROM {$CFG->prefix}forum_discussions WHERE course = {$course->id}) - AND userid != '$USER->id' - AND modified > '$timestart' ORDER BY created DESC"; - } - else - { - $sql = "SELECT * FROM {$CFG->prefix}forum_discussions WHERE id IN (SELECT DISTINCT discussion - FROM {$CFG->prefix}forum_posts WHERE userid = '$USER->id') AND id IN ( - SELECT discussion FROM {$CFG->prefix}forum_posts WHERE userid != '$USER->id' - AND modified > '$timestart') AND course = {$course->id}"; - } - //echo "
$sql"; - - $instances = get_records_sql($sql); - $displayedinstances = 0; - if($instances !== false) { - if($this->config->style!='threads') { - foreach ($instances as $post) { - - $tempmod = new object; - $tempmod->course = $course->id; - $discussion = get_record('forum_discussions', 'id', $post->discussion); - $poster = get_record('user', 'id', $post->userid); - $tempmod->id = $discussion->forum; - - $visible = instance_is_visible('forum', $tempmod) - || has_capability('moodle/course:viewhiddenactivities', $context); - if($visible) { - - $date = userdate($post->modified); - - //echo "
"; print_r($post); echo ""; - $link = $CFG->wwwroot.'/mod/forum/discuss.php?d='.$post->discussion.'&parent='.$post->parent.'#p'.$post->id; - $this->content->text .= '
$sql"; - $count = get_field_sql($sql); - $link = $CFG->wwwroot.'/mod/forum/discuss.php?d='.$discussion->id; - $this->content->text .= '
|
-config->style)){
- $this->config->style = 'replies';
-}
-$repliessel = $this->config->style=='replies'?'checked="1"':'';
-$newpostssel = $this->config->style=='newposts'?'checked="1"':'';
-$threadssel = $this->config->style=='threads'?'checked="1"':'';
-?>
-/> -/> -/> - - |
| - - |