mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
General updates, see README.txt.
This commit is contained in:
parent
d9e1bf2478
commit
b585dc5fcb
12 changed files with 149 additions and 279 deletions
|
@ -3,7 +3,7 @@
|
|||
* extend.
|
||||
* */
|
||||
|
||||
class SearchDocument extends Zend_Search_Lucene_Document {
|
||||
abstract class SearchDocument extends Zend_Search_Lucene_Document {
|
||||
public function __construct(&$doc, &$data, $document_type, $course_id, $group_id) {
|
||||
$this->addField(Zend_Search_Lucene_Field::Keyword('id', $doc->id));
|
||||
$this->addField(Zend_Search_Lucene_Field::Text('title', $doc->title));
|
||||
|
|
|
@ -7,12 +7,7 @@
|
|||
|
||||
class ForumSearchDocument extends SearchDocument {
|
||||
public function __construct(&$post, $forum_id, $course_id, $group_id) {
|
||||
// generic information
|
||||
/*$doc->id = $post->id;
|
||||
$doc->title = $post->subject;
|
||||
$doc->author = $post->firstname." ".$post->lastname;
|
||||
$doc->contents = $post->message;*/
|
||||
|
||||
// generic information
|
||||
$doc->id = $post['id'];
|
||||
$doc->title = $post['subject'];
|
||||
$doc->author = $post['firstname']." ".$post['lastname'];
|
||||
|
@ -24,7 +19,7 @@
|
|||
$data->forum = $forum_id;
|
||||
$data->discussion = $post['discussion'];
|
||||
|
||||
parent::__construct($doc, $data, SEARCH_FORUM_TYPE, $course_id, $group_id);
|
||||
parent::__construct($doc, $data, SEARCH_TYPE_FORUM, $course_id, $group_id);
|
||||
} //constructor
|
||||
} //ForumSearchDocument
|
||||
|
||||
|
@ -34,7 +29,7 @@
|
|||
} //forum_make_link
|
||||
|
||||
function forum_iterator() {
|
||||
//no @ = Undefined index: 82 in /home/michael/public_html/moodle/lib/datalib.php on line 2671
|
||||
//no @ = Undefined index: 82 in moodle/lib/datalib.php on line 2671
|
||||
return @get_all_instances_in_courses("forum", get_courses());
|
||||
} //forum_iterator
|
||||
|
||||
|
@ -72,33 +67,6 @@
|
|||
return $documents;
|
||||
} //forum_get_content_for_index
|
||||
|
||||
//old slower version
|
||||
function forum_get_content_for_index_old(&$forum) {
|
||||
$documents = array();
|
||||
if (!$forum) return $documents;
|
||||
|
||||
$posts = forum_get_discussions($forum->id);
|
||||
if (!$posts) return $documents;
|
||||
|
||||
foreach($posts as $post) {
|
||||
if (is_object($post)) {
|
||||
if (strlen($post->message) > 0 && ($post->deleted != 1)) {
|
||||
$documents[] = new ForumSearchDocument($post, $forum->id, $forum->course, $post->groupid);
|
||||
} //if
|
||||
|
||||
if ($children = forum_get_child_posts($post->id, $forum->id)) {
|
||||
foreach ($children as $child) {
|
||||
if (strlen($child->message) > 0 && ($child->deleted != 1)) {
|
||||
$documents[] = new ForumSearchDocument($child, $forum->id, $forum->course, $post->groupid);
|
||||
} //if
|
||||
} //foreach
|
||||
} //if
|
||||
} //if
|
||||
} //foreach
|
||||
|
||||
return $documents;
|
||||
} //forum_get_content_for_index_old
|
||||
|
||||
//reworked faster version from /mod/forum/lib.php
|
||||
function forum_get_discussions_fast($forum) {
|
||||
global $CFG, $USER;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
$data->wiki = $wiki_id;
|
||||
|
||||
// construct the parent class
|
||||
parent::__construct($doc, $data, SEARCH_WIKI_TYPE, $course_id, $group_id);
|
||||
parent::__construct($doc, $data, SEARCH_TYPE_WIKI, $course_id, $group_id);
|
||||
} //constructor
|
||||
} //WikiSearchDocument
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue