{{!
    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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template mod_coursesearch/search_result

    Single search result item template (for both module/activity results and sections in ungrouped mode).
    In grouped mode, section results are handled in the group header, not here.

    Context variables required for this template:
    * name - The result name/title
    * url - The result URL
    * modname - The module name
    * iconurl - The icon URL
    * iconalt - Alt text for the icon
    * snippet - The content snippet with highlighting (only shown for non-title matches)
    * hassnippet - Whether to show the snippet
    * matchtype - What was matched (optional)
    * hasmatchtype - Whether there is match type info
    * forumname - The forum name (optional)
    * hasforumname - Whether this is a forum result with forum name
    * isforum - Whether this is a forum result

    Example context (json):
    {
        "name": "Introduction to the course",
        "url": "http://example.com/mod/page/view.php?id=123",
        "modname": "page",
        "iconurl": "http://example.com/theme/image.php/boost/core/1/f/pdf-24",
        "iconalt": "Page",
        "snippet": "This is a brief <mark>snippet</mark> of content...",
        "hassnippet": true,
        "matchtype": "content",
        "hasmatchtype": true,
        "forumname": "General discussion",
        "hasforumname": false,
        "isforum": false
    }
}}
<div class="coursesearch-result" data-result-type="{{resulttype}}">
    <div class="coursesearch-result-icon">
        {{#issection}}
        {{#issubsection}}
        <i class="icon fa fa-folder fa-fw" aria-hidden="true" title="{{iconalt}}"></i>
        {{/issubsection}}
        {{^issubsection}}
        <i class="icon fa fa-folder-o fa-fw" aria-hidden="true" title="{{iconalt}}"></i>
        {{/issubsection}}
        {{/issection}}
        {{^issection}}
        {{#iconurl}}
        <img src="{{iconurl}}" alt="{{iconalt}}" class="icon">
        {{/iconurl}}
        {{/issection}}
    </div>
    <div class="coursesearch-result-content">
        <div class="coursesearch-result-title">
            <a href="{{url}}">{{name}}</a>
        </div>

        {{#hasforumname}}
        <div class="coursesearch-result-forum">
            {{#str}} inforum, mod_coursesearch, {{forumname}} {{/str}}
        </div>
        {{/hasforumname}}

        {{#hassnippet}}
        <div class="coursesearch-result-snippet">
            {{{snippet}}}
        </div>
        {{/hassnippet}}

        {{#hasmatchtype}}
        <div class="coursesearch-result-match">
            {{#str}} matchedin, mod_coursesearch, {{matchtype}} {{/str}}
        </div>
        {{/hasmatchtype}}
    </div>
</div>
