Exemplo n.º 1
0
}
// Begin to process the page...
$iSearchString = $_POST['iSearchString'];
if (empty($_POST['iSearchType'])) {
    if (empty($_GET['searchType'])) {
        $iObjectType = "user";
    } else {
        $iObjectType = $_GET['searchType'];
    }
} else {
    $iObjectType = $_POST['iSearchType'];
}
?>
    <h2>Search for objects</h2>
<?php 
/*echo "\$_POST['iSearchString']=".$_POST['iSearchString']."\n<br />";
  echo "\$_POST['iSearchType']=".$_POST['iSearchType']."\n<br />";
  echo "\$_GET['searchType']=".$_GET['searchType']."\n<br />";
  echo "\$iSearchString=$iSearchString\n<br />";
  echo "\$iObjectType=$iObjectType\n<br />";*/
?>
    <h3>Help</h3>
    <p>Some help...</p>
<?php 
display_search_form($iObjectType, $iSearchString);
if (!empty($_POST['iSearchString'])) {
    echo "    <h3>Results</h3>\n";
    DB_connect($DB_host, $DB_login, $DB_pass);
    DB_select($DB_db);
    display_results($iSearchString, $iObjectType);
}
Exemplo n.º 2
0
/**
 * Show the search widget
 *
 * The form will post to index.php by default, you can pass a value to
 * $action to use a custom action.
 * IMPORTANT: you have to call search_widget_prepare() before calling this
 * function or otherwise the form will not behave correctly.
 *
 * @param   string $action     Just in case your action is not
 * index.php
 */
function search_widget_show($action = 'index.php')
{
    require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php';
    // TODO: load images dinamically when they're avalaible from specific field ui to add
    $groupId = api_get_group_id();
    $sf_terms = array();
    $specific_fields = get_specific_field_list();
    $url_params = array();
    if (($cid = api_get_course_id()) != -1) {
        // with cid
        // get search engine terms
        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
        $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter));
        //prepare specific fields names (and also get possible URL param names)
        foreach ($specific_fields as $specific_field) {
            $temp = array();
            if (is_array($dkterms) && count($dkterms) > 0) {
                foreach ($dkterms[1] as $obj) {
                    $temp = array_merge($obj['sf-' . $specific_field['code']], $temp);
                }
            }
            $sf_terms[$specific_field['code']] = $temp;
            $url_params[] = 'sf_' . $specific_field['code'];
            unset($temp);
        }
    } else {
        // without cid
        // prepare specific fields names (and also get possible URL param names)
        foreach ($specific_fields as $specific_field) {
            //get Xapian terms for a specific term prefix, in ISO, apparently
            $sf_terms[$specific_field['code']] = xapian_get_all_terms(1000, $specific_field['code']);
            $url_params[] = 'sf_' . $specific_field['code'];
        }
    }
    echo '<h2>' . get_lang('Search') . '</h2>';
    // Tool introduction
    // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here.
    if (api_get_course_id() !== -1) {
        if (!empty($groupId)) {
            Display::display_introduction_section(TOOL_SEARCH . $groupId);
        } else {
            Display::display_introduction_section(TOOL_SEARCH);
        }
    }
    $op = 'or';
    if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) {
        $op = $_REQUEST['operator'];
    }
    //check if URL params are defined (to see if we show the thesaurus or not)
    $show_thesaurus = false;
    foreach ($url_params as $param) {
        if (isset($_REQUEST[$param]) && is_array($_REQUEST[$param])) {
            $thesaurus_decided = FALSE;
            foreach ($_REQUEST[$param] as $term) {
                if (!empty($term)) {
                    $show_thesaurus = true;
                    $thesaurus_decided = TRUE;
                    break;
                }
            }
            if ($thesaurus_decided) {
                break;
            }
        }
    }
    // create the form
    // TODO: use FormValidator
    display_search_form($action, $show_thesaurus, $sf_terms, $op);
}
Exemplo n.º 3
0
            echo $current_mp->full_name();
            ?>
.
<input type="submit" value="Subscribe">
</form>
<?php 
            $PAGE->block_end();
        }
    }
    $PAGE->block_start(array('title' => 'Your current email alerts'));
    alerts_manage($details['email']);
    $PAGE->block_end();
    $sidebar = ob_get_clean();
}
$PAGE->block_start(array('id' => 'alerts', 'title' => 'Request a new TheyWorkForYou email alert'));
display_search_form($alert, $details, $errors);
$PAGE->block_end();
$end = array();
if ($sidebar) {
    $end[] = array('type' => 'html', 'content' => $sidebar);
}
$end[] = array('type' => 'include', 'content' => 'minisurvey');
$end[] = array('type' => 'include', 'content' => 'mysociety_news');
$end[] = array('type' => 'include', 'content' => 'search');
$PAGE->stripe_end($end);
$PAGE->page_end($extra);
# ---
function check_input($details)
{
    global $SEARCHENGINE;
    $errors = array();
Exemplo n.º 4
0
function search_locked()
{
    global $db, $t;
    $ul =& $db->users_find_by_string('1', 'additional:is_locked');
    if (count($ul) == 0) {
        $t->assign('error', 'Nothing was found by your request. Try to redefine search terms');
        display_search_form();
        return;
    }
    global $all_count, $count, $start;
    $all_count = count($ul);
    $ul = @array_slice($ul, $start, $count);
    $t->assign('ul', $ul);
    $t->display('admin/user_search_res.html');
}
Exemplo n.º 5
0
            $page = $dead_count > $rank_spot ? 1 : $page;
        }
        $page = $page < 1 ? 1 : $page;
        // Prevent the page number from going negative.
    }
}
$numofpages = ceil($totalrows / $record_limit);
$limitvalue = $page * $record_limit - $record_limit;
// Get the ninja information.
$sel = "SELECT rank_id, uname, class, level, alive, days, clan, player_id\n\tFROM rankings " . $where_clause . "  ORDER BY rank_id ASC, player_id ASC\n\tLIMIT {$record_limit} OFFSET {$limitvalue}";
$sql->Query($sel);
$row = $sql->data;
$ninja_count = $sql->rows;
//$microtimes[5] = microtime();
ob_start();
display_search_form($hide, $page, $searched, $dead_count);
$search_form = ob_get_contents();
ob_end_clean();
//$microtimes[6] = microtime();
// Display the nav
ob_start();
player_list_nav($page, $hide, $searched, $record_limit, $totalrows, $numofpages);
$player_list_nav = ob_get_contents();
ob_end_clean();
//$microtimes[7] = microtime();
$active_ninja = '';
if (!$searched) {
    // Will not display active ninja on a search page.
    $active_ninja = render_active(5, $alive_only);
    // Display the currently active ninjas
}
Exemplo n.º 6
0
    debug_msg("QUERY: {$query}");
    debug_msg("VALUE: {$value}");
    debug_msg("TYPE: {$type}");
    debug_msg("TITLE: {$htitle}");
    debug_msg("SEARCH: {$search}");
    echo "SESSION:";
    print_r($_SESSION);
}
if (isset($_REQUEST[op])) {
    $op = $_REQUEST[op];
} else {
    $op = "Search";
}
if ($op == "Search") {
    echo "<CENTER>";
    display_search_form();
    echo "<A NAME=result_list></A>";
    $skill = $_REQUEST[skill];
    if (isset($skill) && $skill != "ignore") {
        $type = "skill";
        $value = $skill;
        $search = $skill;
    }
    if (isset($search)) {
        debug_msg("Search is set<br>Search value is {$search}<br>");
        $topics = "";
        $pages = "";
        $skills = "";
        $resources = "";
        if (!isset($type) || $type == "all" || $type == "topic") {
            $topics = query_help_type("topic", $search);