$inputdata->author = $author; $editform->set_data($inputdata); if ($editform->is_cancelled()) { if (isset($forum)) { $returnurl = $forum->get_url(mod_forumng::PARAM_PLAIN); } else { $returnurl = $CFG->wwwroot . '/course/view.php?id=' . $course->id; } redirect($returnurl, '', 0); } // Process form data. $data = $editform->get_data(); // Display header $out = mod_forumng_utils::get_renderer(); print $out->header(); $searchtitle = forumng_get_search_results_title($query, $data ? $data->author : '', $data ? $data->datefrom : 0, $data ? $data->dateto : 0); if (!$allforums) { // Display group selector if required groups_print_activity_menu($cm, $url); $groupid = mod_forumng::get_activity_group($cm, true); $forum->require_view($groupid, 0, true); print '<br/><br/>'; } $editform->display(); if ($data) { // Searching for free text with or without filtering author and date range. if ($query) { $result = new local_ousearch_search($query); if ($allforums) { // Search all forums. // NOTE: I think this code branch is no longer used as we removed
$daterangefrom = $data->daterangefrom; $daterangeto = $data->daterangeto; } $action = $query !== '' || $author !== '' || $daterangefrom || $daterangeto; // Display header $navigation = array(); $navigation[] = array('name' => get_string('moresearchoptions', 'forumng', ''), 'type' => 'forumng'); if ($allforums) { print_header_simple('', '', build_navigation($navigation)); } else { print_header_simple(format_string($forum->get_name()), '', build_navigation($navigation, $cm), '', '', true, navmenu($course, $cm)); } // Set the search results title, URL and URL options $urlrequired = $allforums ? "course={$courseid}" : $forum->get_link_params(forum::PARAM_PLAIN); $url = $CFG->wwwroot . "/mod/forumng/advancedsearch.php?" . $urlrequired; $searchtitle = forumng_get_search_results_title(stripslashes($query), stripslashes($author), $daterangefrom, $daterangeto); $urloptions = $query ? '&query=' . rawurlencode($query) : ''; $urloptions = $author ? '&author=' . rawurlencode($author) : ''; $urloptions .= $daterangefrom ? '&datefrom=' . $daterangefrom : ''; $urloptions .= $daterangeto ? '&dateto=' . $daterangeto : ''; if (!$allforums) { // Display group selector if required groups_print_activity_menu($cm, $url . $urloptions); $groupid = forum::get_activity_group($cm, true); $forum->require_view($groupid, 0, true); print '<br/><br/>'; } $editform->display(); // Searching for free text with or without filtering author and date range if ($query) { $result = new ousearch_search(stripslashes($query));