示例#1
0
/**
 * @todo Document this function
 */
function forum_print_big_search_form($course)
{
    global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto, $PAGE, $OUTPUT;
    echo $OUTPUT->box(get_string('searchforumintro', 'forum'), 'searchbox boxaligncenter', 'intro');
    echo $OUTPUT->box_start('generalbox boxaligncenter');
    echo $PAGE->requires->js('mod/forum/forum.js')->asap();
    echo '<form id="searchform" action="search.php" method="get">';
    echo '<table cellpadding="10" class="searchbox" id="form">';
    echo '<tr>';
    echo '<td class="c0"><label for="words">' . get_string('searchwords', 'forum') . '</label>';
    echo '<input type="hidden" value="' . $course->id . '" name="id" alt="" /></td>';
    echo '<td class="c1"><input type="text" size="35" name="words" id="words"value="' . s($words, true) . '" alt="" /></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0"><label for="phrase">' . get_string('searchphrase', 'forum') . '</label></td>';
    echo '<td class="c1"><input type="text" size="35" name="phrase" id="phrase" value="' . s($phrase, true) . '" alt="" /></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0"><label for="notwords">' . get_string('searchnotwords', 'forum') . '</label></td>';
    echo '<td class="c1"><input type="text" size="35" name="notwords" id="notwords" value="' . s($notwords, true) . '" alt="" /></td>';
    echo '</tr>';
    if ($DB->get_dbfamily() == 'mysql' || $DB->get_dbfamily() == 'postgres') {
        echo '<tr>';
        echo '<td class="c0"><label for="fullwords">' . get_string('searchfullwords', 'forum') . '</label></td>';
        echo '<td class="c1"><input type="text" size="35" name="fullwords" id="fullwords" value="' . s($fullwords, true) . '" alt="" /></td>';
        echo '</tr>';
    }
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchdatefrom', 'forum') . '</td>';
    echo '<td class="c1">';
    if (empty($datefrom)) {
        $datefromchecked = '';
        $datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
    } else {
        $datefromchecked = 'checked="checked"';
    }
    echo '<input name="timefromrestrict" type="checkbox" value="1" alt="' . get_string('searchdatefrom', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timefromrestrict\', timefromitems)" ' . $datefromchecked . ' /> ';
    $selectors = html_select::make_time_selectors(array('days' => 'fromday', 'months' => 'frommonth', 'years' => 'fromyear', 'hours' => 'fromhour', 'minutes' => 'fromminute'), $datefrom);
    foreach ($selectors as $select) {
        echo $OUTPUT->select($select);
    }
    echo '<input type="hidden" name="hfromday" value="0" />';
    echo '<input type="hidden" name="hfrommonth" value="0" />';
    echo '<input type="hidden" name="hfromyear" value="0" />';
    echo '<input type="hidden" name="hfromhour" value="0" />';
    echo '<input type="hidden" name="hfromminute" value="0" />';
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchdateto', 'forum') . '</td>';
    echo '<td class="c1">';
    if (empty($dateto)) {
        $datetochecked = '';
        $dateto = time() + 3600;
    } else {
        $datetochecked = 'checked="checked"';
    }
    echo '<input name="timetorestrict" type="checkbox" value="1" alt="' . get_string('searchdateto', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timetorestrict\', timetoitems)" ' . $datetochecked . ' /> ';
    $selectors = html_select::make_time_selectors(array('days' => 'today', 'months' => 'tomonth', 'years' => 'toyear', 'hours' => 'tohour', 'minutes' => 'tominute'), $dateto);
    foreach ($selectors as $select) {
        echo $OUTPUT->select($select);
    }
    echo '<input type="hidden" name="htoday" value="0" />';
    echo '<input type="hidden" name="htomonth" value="0" />';
    echo '<input type="hidden" name="htoyear" value="0" />';
    echo '<input type="hidden" name="htohour" value="0" />';
    echo '<input type="hidden" name="htominute" value="0" />';
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0"><label for="menuforumid">' . get_string('searchwhichforums', 'forum') . '</label></td>';
    echo '<td class="c1">';
    echo $OUTPUT->select(html_select::make(forum_menu_list($course), 'forumid', '', get_string('allforums', 'forum')));
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0"><label for="subject">' . get_string('searchsubject', 'forum') . '</label></td>';
    echo '<td class="c1"><input type="text" size="35" name="subject" id="subject" value="' . s($subject, true) . '" alt="" /></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0"><label for="user">' . get_string('searchuser', 'forum') . '</label></td>';
    echo '<td class="c1"><input type="text" size="35" name="user" id="user" value="' . s($user, true) . '" alt="" /></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="submit" colspan="2" align="center">';
    echo '<input type="submit" value="' . get_string('searchforums', 'forum') . '" alt="" /></td>';
    echo '</tr>';
    echo '</table>';
    echo '</form>';
    echo $PAGE->requires->js_function_call('lockoptions_timetoitems')->asap();
    echo $PAGE->requires->js_function_call('lockoptions_timefromitems')->asap();
    echo $OUTPUT->box_end();
}