Block with web search option?

Block with web search option?

Marc Dastous -
Erantzun kopurua: 7

Alright!!

I love the availability of the calendar on the Main page!  I do have one request and I have had this desire for a long time.  Instead of just a forum search, I need to have a "Google" or other search box available in my course.  I wish my students to have quick access to "outside" sources from within my Moodle installation.

I would think this could be a separate "block", but is there any way to have a "search this site/search the web" option?

Marc

Puntuazioen batez bestekoa: -
Marc Dastous(e)ri erantzunda

Re: Block with web search option?

Tom Murdock -
If you create a label and paste this data in, you'll have a google search (safe from adult themed sites, apparently):

<!-- Google SafeSearch  -->
<center>
<FORM method=GET action="http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/search?safe=vss">
<IMG SRC=""
 border="0" ALT="Google" width="115" height="45" align="absmiddle"></A>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=hidden name=safe value=vss>
<INPUT type=submit name=sa value="Google Search">
</td></tr></TABLE>
</FORM>
</center>
<!-- Google SafeSearch -->

This and other free "outside" Google searches are available here.
Tom Murdock(e)ri erantzunda

Re: Block with web search option?

Jon Bolton -
Particularly helpful Moodlers-ren irudia Testers-ren irudia
Further to Tom's post, I've attempted to add the code to a new block (attached).

1. In your Blocks directory, create a folder called googlesearch
2. Unzip block_googlesearch.php to your blocks/googlesearch
3. Unzip block_google.php to your language directory
4. Go to yourmoodle/admin to install

Jon Bolton(e)ri erantzunda

Re: Block with web search option?

Eloy Lafuente (stronk7) -
Core developers-ren irudia Documentation writers-ren irudia Moodle HQ-ren irudia Peer reviewers-ren irudia Plugin developers-ren irudia Testers-ren irudia
Hi Jon,

Very cool block!! Thanks!!

Perhaps, the only comment (not really important) about your block is that the lang file should be called "block_googlesearch.php" (I know that, to store it in the zip, names must be different, but perhaps is better to include it in a lang directory).

Although for now it's really a silly thing, near in the future it could be mandatory to start some new developments in Moodle...

Ciao irribarrea


Jon Bolton(e)ri erantzunda

Re: Block with web search option?

Marc Dastous -

This worked AWESOME!!!!

How would I incorporate this with the new Main page code?  I was unable to get this block to appear on the Main page.

Thanks again, this will really help my students.  BTW, I even customized the code a little further by adding a site search option.  This is hard coded into line 79 of the block_googlesearch.php.

I've attached the code, maybe someone can add to it.

Marc

Marc Dastous(e)ri erantzunda

Re: Block with web search option?

Gustav W Delius -

To be able to have the block on the site home page you need to add

    function applicable_formats() {
        return COURSE_FORMAT_WEEKS | COURSE_FORMAT_TOPICS | COURSE_FORMAT_SOCIAL | COURSE_FORMAT_SITE;
    }

If you don't have that function then the block is available on all courses EXCEPT the site.