This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.Turn Editing ON | |
2.Click on any course. | |
3.Click on "Add an activity or resource" | |
4.Choose "Quiz" as the option. Click Add. | |
5.Fill up details for the Quiz. In the "Grade" options, specify a finite attempt value. | |
6.Add questions to the Quiz. | |
7.Log in as a student. | |
8.Take the quiz making all the attempts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This file is part of Moodle - http://moodle.org/ | |
// | |
// Moodle is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// | |
// Moodle is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$options = array( 'hostname' => 127.0.0.1 ); | |
$client = new SolrClient($options, "4.0"); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/> | |
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/> | |
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/> | |
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[response] => SolrObject Object | |
( | |
[numFound] => 3 | |
[start] => 0 | |
[docs] => Array | |
( | |
[0] => SolrObject Object | |
( | |
[id] => 1 | |
[title] => Array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$s = ''; | |
$s.= '<add>'; | |
for ($id = 1; $id <=1000; $id++){ | |
$s.= '<doc>'; | |
$s.= '<field name="id">' . $id . '</field>'; | |
$s.= '<field name="courseid" update="set">2</field>'; | |
$s.= '</doc>'; | |
} | |
$s.= '</add>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mod_get_search_iterator($from = 0) { | |
global $DB; | |
$sql = "SELECT id, modified FROM {mod_table} WHERE modified >= ? ORDER BY modified ASC"; | |
return $DB->get_recordset_sql($sql, array($from)); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($mods as $key => $name) { | |
set_config($name . '_indexingstart', 0, 'search'); | |
set_config($name . '_indexingend', 0, 'search'); | |
set_config($name . '_lastindexrun', 0, 'search'); | |
set_config($name . '_docsignored', 0, 'search'); | |
set_config($name . '_docsprocessed', 0, 'search'); | |
set_config($name . '_recordsprocessed', 0, 'search'); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//get a chapter's records for each chapter id | |
$chapter = $DB->get_record('book_chapters', array('id' => $id), '*', MUST_EXIST); | |
//get book record for that chapter | |
$book = $DB->get_record('book', array('id' => $chapter->bookid), '*', MUST_EXIST); | |
$doc = new SolrInputDocument(); | |
$doc->addField('id', 'book_' . $chapter->id); | |
$doc->addField('name', $book->name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = search_curl_url(); // returns SOLR_SERVER_HOSTNAME . ':' . SOLR_SERVER_PORT . '/solr/update/extract?' | |
$url .= 'literal.id=' . 'forum_file_' . $id . '&literal.module=forum&literal.type=3&literal.courseid=' . $post->course; | |
$params = array(); | |
$params[$id] = $file; // adds the $file stdClass object into $params array | |
$curl->post($url, $params); // sets CURLOPT_POST = 1 | |
// sets CURLOPT_POSTFIELDS = array ($id => '@' . $filepath) via add_to_curl_request | |
// finally posts this curl request | |
?> |
OlderNewer