当前位置: 首页>>代码示例>>PHP>>正文


PHP Indexer::searchRaw方法代码示例

本文整理汇总了PHP中Indexer::searchRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Indexer::searchRaw方法的具体用法?PHP Indexer::searchRaw怎么用?PHP Indexer::searchRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Indexer的用法示例。


在下文中一共展示了Indexer::searchRaw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addslashes

if (isset($_REQUEST['search_terms'])) {
    $search_terms = addslashes($_REQUEST['search_terms']);
}
if (empty($search_terms)) {
    // display form
    $tool_content .= "\n        <form method='post' action='{$_SERVER['SCRIPT_NAME']}'>\n        <fieldset>\n        <legend>{$langSearchCriteria}</legend>\n        <table width='100%' class='tbl'>\n        <tr>\n          <th class='left' width='120'>{$langOR}</th>\n          <td colspan='2'><input name='search_terms' type='text' size='80'/></td>\n        </tr>\n        <tr>\n          <th width='30%' class='left' valign='top' rowspan='4'>{$langSearchIn}</th>\n          <td width='35%'><input type='checkbox' name='announcements' checked='checked' />{$langAnnouncements}</td>\n          <td width='35%'><input type='checkbox' name='agenda' checked='checked' />{$langAgenda}</td>\n        </tr>\n        <tr>\n          <td><input type='checkbox' name='course_units' checked='checked' />{$langCourseUnits}</td>\n          <td><input type='checkbox' name='documents' checked='checked' />{$langDoc}</td>\n        </tr>\n        <tr>\n          <td><input type='checkbox' name='forums' checked='checked' />{$langForums}</td>\n          <td><input type='checkbox' name='exercises' checked='checked' />{$langExercices}</td>\n        </tr>\n       <tr>\n          <td><input type='checkbox' name='video' checked='checked' />{$langVideo}</td>\n          <td><input type='checkbox' name='links' checked='checked' />{$langLinks}</td>\n       </tr>\n       <tr>\n         <th>&nbsp;</th>\n         <td colspan='2' class='right'><input class='btn btn-primary' type='submit' name='submit' value='{$langDoSearch}' /></td>\n       </tr>\n       </table>\n       </fieldset>\n       </form>";
} else {
    // ResourceIndexers require course_id inside the input data array (POST, but we do not want to pass it through the form)
    $_POST['course_id'] = $course_id;
    // Search Terms might come from GET, but we want to pass it alltogether with POST in ResourceIndexers
    $_POST['search_terms'] = $search_terms;
    $idx = new Indexer();
    $tool_content .= "\n        <div id=\"operations_container\">\n      <ul id='opslist'>\n        <li><a href='" . $_SERVER['SCRIPT_NAME'] . "'>{$langNewSearch}</a></li>\n      </ul>\n    </div>\n        <p class='sub_title1'>{$langResults}</p>";
    // search in announcements
    if ($announcements) {
        $announceHits = $idx->searchRaw(AnnouncementIndexer::buildQuery($_POST));
        if (count($announceHits) > 0) {
            $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>\n              <table width='99%' class='sortable' id='t1' align='left'>\n              <tr>\n                <th colspan='2'>{$langAnnouncements}:</th>\n              </tr>";
            $numLine = 0;
            foreach ($announceHits as $annHit) {
                $announce = Database::get()->querySingle("SELECT title, content, date FROM announcement WHERE id = ?d", $annHit->pkid);
                $class = $numLine % 2 ? 'odd' : 'even';
                $tool_content .= "<tr class='{$class}'>\n                                  <td width='1' valign='top'><img style='padding-top:3px;' src='{$themeimg}/arrow.png' title='bullet' /></td>\n                                  <td><b><a href='" . $annHit->url . "'>" . q($announce->title) . "</a></b>&nbsp;&nbsp;\n                                  <small>(" . nice_format(claro_format_locale_date($dateFormatLong, strtotime($announce->date))) . ")\n                                  </small><br />" . $announce->content . "</td></tr>";
                $numLine++;
            }
            $tool_content .= "</table>";
            $found = true;
        }
    }
    // search in agenda
    if ($agenda) {
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:search_incourse.php

示例2: draw

$pageName = $langSearch;
// exit if search is disabled
if (!get_config('enable_search')) {
    $tool_content .= "<div class='alert alert-info'>{$langSearchDisabled}</div>";
    draw($tool_content, 0);
    exit;
}
// exit if no POST data
if (!register_posted_variables(array('search_terms' => false, 'search_terms_title' => false, 'search_terms_keywords' => false, 'search_terms_instructor' => false, 'search_terms_coursecode' => false, 'search_terms_description' => false), 'any')) {
    $tool_content .= CourseIndexer::getDetailedSearchForm();
    draw($tool_content, 0);
    exit;
}
// search in the index
$idx = new Indexer();
$hits1 = $idx->searchRaw(CourseIndexer::buildQuery($_POST));
// courses with visible 1 or 2
// Additional Access Rights
$anonymous = false;
if (isset($uid) and $uid) {
    $anonymous = true;
    $hits2 = $idx->searchRaw(CourseIndexer::buildQuery($_POST, false));
    // courses with visible 0 or 3
    if ($uid == 0) {
        $hits = array_merge($hits1, $hits2);
        // admin has access to all
    } else {
        $res = Database::get()->queryArray("SELECT course.id \n                           FROM course \n                           JOIN course_user ON course.id = course_user.course_id \n                            AND course_user.user_id = ?d", $uid);
        $subscribed = array();
        foreach ($res as $row) {
            $subscribed[] = $row->id;
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:search.php

示例3: draw

// exit if no POST data
if (!register_posted_variables(array('search_terms' => false,
            'search_terms_title' => false,
            'search_terms_keywords' => false,
            'search_terms_instructor' => false,
            'search_terms_coursecode' => false,
            'search_terms_description' => false), 'any')) {
    $tool_content .= CourseIndexer::getDetailedSearchForm();
    draw($tool_content, 0);
    exit();
}

// search in the index
$idx = new Indexer();
$hits1 = $idx->searchRaw(CourseIndexer::buildQuery($_POST));            // courses with visible 1 or 2
// Additional Access Rights
$anonymous = false;
if (isset($uid) and $uid) {
    $anonymous = true;
    $hits2 = $idx->searchRaw(CourseIndexer::buildQuery($_POST, false)); // courses with visible 0 or 3

    if ($uid == 0) {
        $hits = array_merge($hits1, $hits2); // admin has access to all
    } else {        
        $res = Database::get()->queryArray("SELECT course.id 
                           FROM course 
                           JOIN course_user ON course.id = course_user.course_id 
                            AND course_user.user_id = ?d", $uid);
        $subscribed = array();
        foreach ($res as $row) {
开发者ID:nikosv,项目名称:openeclass,代码行数:30,代码来源:search.php


注:本文中的Indexer::searchRaw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。