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


PHP Querier::query方法代码示例

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


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

示例1: getResults

 public function getResults()
 {
     $sql = "SELECT subject_id AS 'id', shortform AS 'shortform',  subject AS 'matching_text', description as 'additional_text', '' as 'tab_index', '' AS 'parent_id', 'Subject Guide' as 'content_type' FROM subject \nWHERE description LIKE" . $this->getSearch() . "\nOR subject LIKE " . $this->getSearch() . "\nOR keywords LIKE " . $this->getSearch() . "\nOR shortform LIKE " . $this->getSearch() . "\nOR type LIKE " . $this->getSearch() . "\nUNION \nSELECT p.pluslet_id AS 'id', su.shortform as 'shortform', p.title AS 'matching_text',p.body AS 'additional_text', t.tab_index AS 'additional_text', su.subject_id AS 'parent_id', 'Pluslet' AS 'content_type' FROM pluslet AS p \n\tINNER JOIN pluslet_section AS ps \n\tON ps.pluslet_id = p.pluslet_id\n\tINNER JOIN section AS s \n\tON ps.section_id = s.section_id\n\tINNER JOIN tab AS t\n\tON s.tab_id = t.tab_id\n\tINNER JOIN subject AS su \n\tON su.subject_id = t.subject_id\nWHERE p.body LIKE " . $this->getSearch() . "\nOR p.title LIKE " . $this->getSearch() . "\nUNION\nSELECT title_id AS 'id', '' as 'shortform', title AS 'matching_text' , description as 'additional_text','' as 'tab_index',  '' AS 'parent_id', 'Record' as 'content_type' FROM title \nWHERE title LIKE " . $this->getSearch() . "\nOR description LIKE " . $this->getSearch() . "\nUNION\nSELECT faq_id AS 'id', '' as 'shortform' ,  question AS 'matching_text', answer as 'additional_text','' as 'tab_index', '' AS 'parent_id', 'FAQ' as 'content_type' FROM faq \nWHERE question LIKE " . $this->getSearch() . "\nOR answer LIKE " . $this->getSearch() . "\nOR keywords LIKE " . $this->getSearch() . "\nUNION\nSELECT talkback_id AS 'id', '' as 'shortform',  question AS 'matching_text' , answer as 'additional_text','' as 'tab_index',  '' AS 'parent_id', 'Talkback' as 'content_type' FROM talkback \nWHERE question LIKE " . $this->getSearch() . "\nOR answer LIKE " . $this->getSearch() . "\nUNION\nSELECT staff_id AS 'id',  '' as 'shortform', email AS 'matching_text' , fname as 'additional_text','' as 'tab_index', '' AS 'parent_id', 'Staff' as 'content_type' FROM staff \nWHERE fname LIKE " . $this->getSearch() . "\nOR lname LIKE " . $this->getSearch() . "\nOR email LIKE " . $this->getSearch() . "\nOR tel LIKE " . $this->getSearch() . "\nUNION\nSELECT department_id AS 'id', '' as 'shortform', name AS 'matching_text' , telephone as 'additional_text','' as 'tab_index',  '' AS 'parent_id', 'Department' as 'content_type' FROM department \nWHERE name LIKE " . $this->getSearch() . "\nOR telephone LIKE " . $this->getSearch() . "\nUNION\nSELECT video_id AS 'id',  '' as 'shortform', title AS 'matching_text' , description as 'additional_text','' as 'tab_index', '' AS 'parent_id', 'Video' as 'content_type' FROM video \nWHERE title LIKE " . $this->getSearch() . "\nOR description LIKE " . $this->getSearch() . "\nOR vtags LIKE " . $this->getSearch();
     $db = new Querier();
     $results = $db->query($sql);
     return $results;
 }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:7,代码来源:Search.php

示例2: getFavoritePluslets

 public function getFavoritePluslets($staff_id = null)
 {
     if ($staff_id == null) {
         $staff_id = $this->_staff_id;
     }
     $querier = new Querier();
     $sql = "SELECT p.pluslet_id as 'id', p.title AS 'title', p.type AS 'type', t.tab_index AS 'tab_index' FROM pluslet AS p\n                   INNER JOIN pluslet_section AS ps\n                   ON ps.pluslet_id = p.pluslet_id\n                   INNER JOIN section AS s\n                   ON ps.section_id = s.section_id\n                   INNER JOIN tab AS t\n                   ON s.tab_id = t.tab_id\n                   INNER JOIN subject AS subject\n                   ON t.subject_id = subject.subject_id\n                   INNER JOIN staff_subject AS staff_sub\n                   ON subject.subject_id = staff_sub.subject_id\n                   WHERE p.favorite_box = 1\n                   AND staff_sub.staff_id = {$staff_id}";
     $favorites = $querier->query($sql);
     return $favorites;
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:10,代码来源:FavoritePluslet.php

示例3: setData

 /**
  * sp_WebService::setData() - this method sets the data that will be outputted for
  * the web service with a get method
  *
  * @return void
  */
 public function setData()
 {
     $lobjParams = $this->mobjUrlParams;
     $lobjParams = $this->sanitizeParams($lobjParams);
     if ($lobjParams === false) {
         die;
     }
     $lstrQuery = $this->generateQuery($lobjParams) or die;
     $lobjQuerier = new Querier();
     $lobjResults = $lobjQuerier->query($lstrQuery, \PDO::FETCH_ASSOC);
     if (!$lobjResults) {
         $lobjResults = array();
     }
     $this->mobjData[$this->mstrTag] = $lobjResults;
 }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:21,代码来源:WebService.php

示例4: setData

 /**
  * StaffWebService::setData() - this method overrides the parent method because
  * the staff webservice requires an append to the tel field
  *
  * @return void
  */
 public function setData()
 {
     $lobjParams = $this->mobjUrlParams;
     $lobjParams = $this->sanitizeParams($lobjParams);
     if ($lobjParams === false) {
         die;
     }
     $lstrQuery = $this->generateQuery($lobjParams) or die;
     $lobjQuerier = new Querier();
     $lobjResults = $lobjQuerier->query($lstrQuery, \PDO::FETCH_ASSOC);
     if (!$lobjResults) {
         $lobjResults = array();
     }
     global $tel_prefix;
     foreach ($lobjResults as &$lobjRow) {
         if (isset($tel_prefix)) {
             $lobjRow['tel'] = $tel_prefix . $lobjRow['tel'];
         }
     }
     $this->mobjData[$this->mstrTag] = $lobjResults;
 }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:27,代码来源:StaffWebService.php

示例5: Querier

    $db = new Querier();
    $content = '<strong>Results</strong><br />';
    if (get_magic_quotes_gpc()) {
        $searcher = $_POST["search_terms"];
    } else {
        $searcher = addslashes($_POST["search_terms"]);
    }
    // Connect to database
    try {
    } catch (Exception $e) {
        echo $e;
    }
    //create query to search terms
    $q = "SELECT title_id, title FROM title WHERE title LIKE '%" . $searcher . "%' ORDER BY title";
    //query results
    $r = $db->query($q);
    //total returned rows
    $total_items = count($r);
    //return message if no results
    if ($total_items == 0) {
        $content .= "<br /><div valign=\"top\" style=\"float: left; min-width: 230px;\"><p>" . _("There were no results matching your query.") . "</p></div>";
    } else {
        //while rows exist
        foreach ($r as $myrow) {
            $token = "";
            $token = "{{dab},{" . $myrow[0] . "}, {" . $myrow[1] . "}";
            $content .= "<br /><div style=\"clear: both; padding: 3px 5px; font-size: 12px;\"> <input id=\"chosen_token\" name=\"but\" type=\"radio\" value=\"{$token}\"> {$myrow['1']}</div>\n";
        }
    }
    print $content;
}
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:getResourceRadioListSearch.php

示例6: getAssocSubjects

 function getAssocSubjects($staff_id, $ptags)
 {
     global $mod_rewrite;
     $assoc_subjects = "";
     // See if they're a librarian, and then check for subjects
     $islib = preg_match('/librarian/', $ptags);
     if ($islib == 1) {
         // UM hack in query
         $q2 = "SELECT subject, shortform \n              FROM subject, staff_subject \n              WHERE subject.subject_id = staff_subject.subject_id\n              AND staff_subject.staff_id = {$staff_id}\n              AND subject.active = 1\n              AND shortform != 'NewDatabases'\n              ORDER BY subject";
         //print $q2;
         $db = new Querier();
         $r2 = $db->query($q2);
         foreach ($r2 as $myrow2) {
             if ($mod_rewrite == 1) {
                 $link_to_guide = $myrow2[1];
             } else {
                 $link_to_guide = "guide.php?subject=" . $myrow2[1];
             }
             $assoc_subjects .= "<a href=\"{$link_to_guide}\">{$myrow2['0']}</a>, ";
         }
     }
     if ($assoc_subjects != "") {
         $assoc_subjects = rtrim($assoc_subjects, ", ");
         $assoc_subjects = "<br /><span class=\"smaller\">{$assoc_subjects}</span>";
     } else {
         $assoc_subjects = "";
     }
     return $assoc_subjects;
 }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:29,代码来源:StaffDisplay.php

示例7: Record

//print_r($_POST);
switch ($_POST["type"]) {
    case "location":
        $record = new Record();
        $record->buildLocation();
        break;
    case "add_subject":
        $subject_name = Truncate($_POST["our_sub_text"], 25, '');
        $source_name = Truncate($_POST["our_source_text"], 15, '');
        echo "<div class=\"selected_item_wrapper\"><div class=\"selected_item\" id=\"root-" . $_POST["our_source_id"] . "\"><input type=\"hidden\" name=\"rank[]\" value=\"0\" /><input type=\"hidden\" name=\"subject[]\" value=\"" . $_POST["our_sub_id"] . "\" /><input type=\"hidden\" id=\"hidden_source-" . $_POST["our_sub_id"] . "-" . $_POST["our_source_id"] . "\" name=\"source[]\" value=\"" . $_POST["our_source_id"] . "\" />" . $subject_name . "<span class=\"small_extra\"> " . $source_name . " </span><br />\n        <textarea class=\"desc_override desc-area\" name=\"description_override[]\" rows=\"4\" cols=\"35\"></textarea></div>\n        <div class=\"selected_item_options\"><i class=\"fa fa-lg fa-trash delete_sub clickable\" alt=\"" . _("remove subject") . "\" title=\"" . _("remove subject") . "\"></i>\n        <i class=\"fa fa-book fa-lg\"></i>\n        <i class=\"fa fa-lg fa-file-text-o source_override clickable\" id=\"source_override-" . $_POST["our_sub_id"] . "-" . $_POST["our_source_id"] . "\"></i> </div></div>";
        break;
    case "source_override":
        // load list of sources
        $querierSource = new Querier();
        $qSource = "select source_id, source from source order by source";
        $defsourceArray = $querierSource->query($qSource);
        $sourceMe = new Dropdown("source_override[]", $defsourceArray, $_POST["our_source_id"]);
        $source_string = $sourceMe->display();
        echo "<span class=\"record-source-override\">" . _("Source Override") . "<br />{$source_string} <img src=\"{$IconPath}/list-add.png\" class=\"add_source\" id=\"add_source_id-" . $_POST["our_subject_id"] . "-" . $_POST["our_source_id"] . "\" alt=\"" . _("add source override") . "\" title=\"" . _("add source override") . "\" border=\"0\">\n        <i class=\"fa fa-times clickable cancel_add_source\" id=\"cancel_add_source_id-" . $_POST["our_subject_id"] . "-" . $_POST["our_source_id"] . "\" alt=\"" . _("never mind") . "\" title=\"" . _("never mind") . "\" border=\"0\"></i></span>";
        break;
    case "new_record_label":
        switch ($_POST["format_type_id"]) {
            case 1:
                $label_text = _("Location (Enter URL)");
                break;
            case 2:
                $label_text = _("Location (Enter Call Number)");
                break;
            case 3:
                $label_text = _("Location (Enter Persistent Catalog URL--include http://)");
                break;
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:31,代码来源:record_bits.php

示例8: getRelatedTitles

 public function getRelatedTitles()
 {
     $db = new Querier();
     //get title ids in pluslets' resource token connected to guide
     $q = "SELECT p.body\n            FROM subject AS s\n            INNER JOIN tab AS tb ON s.subject_id = tb.subject_id\n            LEFT JOIN section AS sc ON tb.tab_id = sc.tab_id\n            LEFT JOIN pluslet_section AS ps ON sc.section_id = ps.section_id\n            LEFT JOIN pluslet AS p ON ps.pluslet_id = p.pluslet_id\n            WHERE p.body LIKE  '%{{dab}%'\n            AND s.subject_id = {$this->_subject_id}";
     $lobjResults = $db->query($q);
     $lobjMatches = array();
     $lobjTitleIds = array();
     foreach ($lobjResults as $lobjResult) {
         preg_match_all('/\\{\\{dab\\},\\{([^}]*)\\}/', $lobjResult['body'], $lobjMatches);
         $lobjTitleIds = array_merge($lobjTitleIds, $lobjMatches[1]);
     }
     return $lobjTitleIds;
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:14,代码来源:Guide.php

示例9: catch

try {
} catch (Exception $e) {
    echo $e;
}
if (isset($_GET["limit"])) {
    if ($_GET["limit"] == "all") {
        $limit = "";
    } else {
        $limit = "LIMIT 0," . scrubData($_GET["limit"], "int");
    }
} else {
    $limit = "LIMIT 0,10";
}
$querierFAQ = new Querier();
$qFAQ = "SELECT faq_id, question, answer, keywords\n\tFROM faq\n\tORDER BY faq_id DESC\n\t{$limit}";
$faqArray = $querierFAQ->query($qFAQ);
$row_count1 = 0;
$row_count2 = 0;
$colour1 = "evenrow";
$colour2 = "oddrow";
$faq_list = "";
if ($faqArray) {
    foreach ($faqArray as $value) {
        $row_colour1 = $row_count1 % 2 ? $colour1 : $colour2;
        $short_question = Truncate($value["question"], 200);
        $short_answer = stripslashes(htmlspecialchars_decode(TruncByWord($value["answer"], 15)));
        $last_revised_line = lastModded("faq", $value[0]);
        // Answered FAQs
        $faq_list .= "\n            <div class=\"striper faq_wrapper {$row_colour1}\">\n                <div class=\"faq_tools\">\n                <a href=\"faq.php?faq_id={$value['0']}&amp;wintype=pop\" class=\"showmedium-reloader\"><img src=\"{$IconPath}/pencil.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a>\n                &nbsp; &nbsp;<a href=\"" . $FAQPath . "?faq_id={$value['0']}\" target=\"_blank\"><img src=\"{$IconPath}/eye.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a>\n                </div>\n                <div class=\"faq_question\">\n                 {$short_question} <span class=\"faq-short-question\">({$last_revised_line})</span>\n                </div>\n            </div>";
        $row_count1++;
    }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:index.php

示例10: Querier

    include "../includes/footer.php";
    exit;
}
$querier = new Querier();
$q1 = 'SELECT staff_id, CONCAT( fname, " ", lname ) AS fullname, email, CONCAT( emergency_contact_name, " (", emergency_contact_relation, ")", ": ", emergency_contact_phone ) AS contact, CONCAT( street_address, "<br />", city, " ", state, " ", zip ) AS full_address, home_phone, cell_phone, lat_long
FROM staff
WHERE lat_long != ""
AND active = 1';
if (isset($_GET["fac_only"]) && $_GET["fac_only"] == 1) {
    $q1 = 'SELECT staff_id, CONCAT( fname, " ", lname ) AS fullname, email, CONCAT( emergency_contact_name, " (", emergency_contact_relation, ")", ": ", emergency_contact_phone ) AS contact, CONCAT( street_address, "<br />", city, " ", state, " ", zip ) AS full_address, home_phone, cell_phone, lat_long
FROM staff
WHERE lat_long != ""
AND ptags LIKE "%librarian%"';
}
$db = new Querier();
$staffArray = $db->query($q1);
?>
<div id="map" style="width: 100%; height: 800px; border: 1px solid #333;"></div>

<?php 
include "../includes/footer.php";
?>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  
  google.maps.event.addDomListener(window, 'load', function() {
    var requested = "";
    
    /////////////////////
    // This map has Coral Gables as its center
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:staff_map.php

示例11: Querier

    } else {
        $feedback = "There is no record by that ID.";
    }
}
if (isset($_POST["submit_record"])) {
    // 1.  Make sure we have minimum non-dupe data
    // 1a. Make sure there is a title, location, and subject
    if ($_POST["title"] == "" || $_POST["location"][0] == "" || $_POST["subject"][0] == "") {
        echo "<div class=\"feedback\">" . _("You must have a title, location, and subject.  Please go back and fix these omissions.  And turn on JavaScript, for goodness sakes!") . "</div><br /><br />";
        exit;
    }
    // 1b. IF THIS IS AN INSERT make sure the title isn't an exact dupe
    if ($_POST["title_id"] == "") {
        $db = new Querier();
        $qDupe = "SELECT title_id, title FROM title WHERE title LIKE " . $db->quote($_POST["title"]);
        $dupetitleArray = $db->query($qDupe);
        if ($dupetitleArray) {
            echo _("There is already a record with this title: ") . "<a href=\"record.php?record_id=" . $dupetitleArray[0] . "\">" . $dupetitleArray[1] . "</a>.  " . _("Maybe do a search and make sure it doesn't already exist?");
            return FALSE;
        }
    }
    // Submit form
    $record = new Record($_POST["title_id"], "post");
    //////////////////////////////////
    // Is this an Insert or an update?
    //////////////////////////////////
    if ($_POST["title_id"] == "") {
        $record->insertRecord();
        $ok_record_id = $record->getRecordId();
    } else {
        $record->updateRecord();
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:31,代码来源:record.php

示例12: catch

    }
    return $row_count;
}
// Connect to database
try {
} catch (Exception $e) {
    echo $e;
}
//querier initialize
$db = new Querier();
//if browsing by subject
if (isset($_GET["browse"]) && $_GET["browse"] == "subject") {
    print "<br /><h2>" . _("<strong>Tick</strong> the boxes of any FAQs you want to include in your pluslet and hit <strong>OK</strong>.") . "</h2>";
    //sql for all subjects
    $q = "SELECT * FROM faq f, faq_subject fs, subject s WHERE f.faq_id = fs.faq_id AND s.subject_id = fs.subject_id GROUP BY subject";
    $r = $db->query($q);
    //go through all subjects and get the related faqs
    foreach ($r as $myrow) {
        $sub_id = $myrow["subject_id"];
        $subject = $myrow["subject"];
        print "<br /><p><strong style=\"font-size: large;\">{$subject}</strong></p><br />";
        //sql for faqs
        $q2 = "SELECT f.faq_id, f.question FROM faq_subject fs, faq f WHERE  f.faq_id = fs.faq_id AND fs.subject_id = '{$sub_id}' ORDER BY f.question";
        $r2 = $db->query($q2);
        //go through all results to print out checkboxes
        $rc = innerLoop($sub_id, $r2, 1);
        if ($rc == 0) {
            print "<p>" . _("There are no results.  You'll need to try something different.") . "</p>";
        }
    }
} elseif (isset($_GET["browse"]) && $_GET["browse"] == "collection") {
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:31,代码来源:getFaqCheckboxes.php

示例13: Querier

$subsubcat = "";
$subcat = "videos";
$page_title = "Video Bits include";
$header = "noshow";
use SubjectsPlus\Control\Querier;
include "../includes/header.php";
// Connect to database
//print_r($_POST);
switch ($_REQUEST["type"]) {
    case "ingest":
        $db = new Querier();
        // check if we already have a record like this
        $our_id = scrubData($_REQUEST["foreign_id"]);
        $qcheck = "SELECT video_id FROM video WHERE foreign_id = '" . $our_id . "'";
        //print $qcheck;
        $rcheck = $db->query($qcheck);
        if (count($rcheck) == 0) {
            $qinsert = "INSERT INTO video (title, description, source, foreign_id, duration, date, display)\n        values(\"" . $_POST["title"] . "\", \"" . $_POST["description"] . "\", \"" . $_POST["source"] . "\", \"" . $_POST["foreign_id"] . "\", \"" . $_POST["duration"] . "\", \"" . $_POST["upload_date"] . "\",\n          1                \n        )";
            //   print_r ($qinsert);
            $rinsert = $db->exec($qinsert);
            $video_id = $db->last_id();
        } else {
            // Do an update
            $db = new Querier();
            $qupdate = "UPDATE video \n          SET title = " . $db->quote(scrubData($_POST['title'])) . ",\n          description = " . $db->quote(scrubData($_POST['description'], 'richtext')) . ",\n          source = " . $db->quote(scrubData($_POST['source'])) . " ,\n          foreign_id = " . $db->quote(scrubData($_POST['foreign_id'])) . ",\n          duration = " . $db->quote(scrubData($_POST['duration'])) . " ,\n          date = " . $db->quote(scrubData($_POST['upload_date'])) . " ,\n          WHERE foreign_id = " . $our_id;
            //print_r ($qupdate);
            $rupdate = $db->exec($qupdate);
            $video_id = $rupdate[0];
        }
        // insert/update image
        // get small thumbnail
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:video_bits.php

示例14: writeTable

 function writeTable($qualifier, $subject_id = '', $description_search = 0)
 {
     global $IconPath;
     global $proxyURL;
     $db = new Querier();
     // sanitize submission
     $subject_id = scrubData($subject_id);
     // Prepare conditions
     $condition1 = "";
     $condition2 = "";
     $condition3 = "";
     switch ($qualifier) {
         case "Num":
             $condition1 = "WHERE left(title, 1)  REGEXP '[[:digit:]]+'";
             $condition2 = "WHERE left(alternate_title, 1)  REGEXP '[[:digit:]]+'";
             break;
         case "All":
             $condition1 = "WHERE title != ''";
             $condition2 = "WHERE alternate_title != ''";
             break;
         case "bysub":
             if (isset($subject_id)) {
                 //get title ids in pluslets' resource token connected to subject
                 $lobjGuide = new Guide($subject_id);
                 $lobjTitleIds = $lobjGuide->getRelatedTitles();
                 $condition1 = "WHERE (subject_id = {$subject_id}";
                 $condition1 .= count($lobjTitleIds) > 0 ? "\nOR t.title_id IN (" . implode(',', $lobjTitleIds) . ")" : "";
                 $condition1 .= ")";
                 $condition2 = "WHERE subject_id = {$subject_id}";
             } else {
                 $condition1 = "WHERE title LIKE " . $db->quote("%" . $qualifier . "%");
                 $condition2 = "WHERE alternate_title LIKE " . $db->quote("%" . $qualifier . "%");
             }
             break;
         case "bytype":
             if (isset($_GET["type"])) {
                 $condition1 = "WHERE ctags LIKE " . $db->quote(scrubData($_GET["type"]));
                 $condition2 = "WHERE ctags LIKE " . $db->quote(scrubData($_GET["type"]));
                 $condition3 = "and alternate_title NOT NULL";
             }
             break;
         case "search":
             $condition1 = "WHERE title LIKE " . $db->quote("%" . $qualifier . "%");
             // If you uncomment the next line, it will search description field
             $condition1 = "WHERE (title LIKE " . $db->quote("%" . $qualifier . "%") . " OR description LIKE " . $db->quote("%" . $qualifier . "%");
             $condition2 = "WHERE alternate_title LIKE " . $db->quote("%" + $qualifier + "%");
             break;
         default:
             // This is the simple output by letter and also the search
             if (strlen($qualifier) == 1) {
                 // Is like the first letter
                 $condition1 = "WHERE title LIKE " . $db->quote($qualifier . "%");
             } else {
                 $condition1 = "WHERE title LIKE " . $db->quote("%" . $qualifier . "%");
             }
             if ($description_search == 1) {
                 // If you uncomment the next line, it will search description field
                 $condition1 = "WHERE (title LIKE " . $db->quote("%" . $qualifier . "%") . " OR description LIKE " . $db->quote("%" . $qualifier . "%") . ")";
             }
             $condition2 = "WHERE alternate_title LIKE " . $db->quote("%" + $qualifier + "%");
     }
     $q1 = "SELECT distinct left(t.title,1) as initial, t.title as newtitle, t.description, location, access_restrictions, t.title_id as this_record,eres_display, display_note, pre, citation_guide, ctags, helpguide\n            FROM title as t\n            INNER JOIN location_title as lt\n            ON t.title_id = lt.title_id\n            INNER JOIN location as l\n            ON lt.location_id = l.location_id\n            INNER JOIN restrictions as r\n            ON l.access_restrictions = r.restrictions_id\n            INNER JOIN rank as rk\n            ON rk.title_id = t.title_id\n            INNER JOIN source as s\n            ON rk.source_id = s.source_id\n            {$condition1}\n            AND eres_display = 'Y'\n            ORDER BY newtitle";
     $q2 = "SELECT distinct left(t.alternate_title,1) as initial, t.alternate_title as newtitle, t.description, location, access_restrictions, t.title_id as this_record,eres_display, display_note, pre, citation_guide, ctags, helpguide\n            FROM title as t\n            INNER JOIN location_title as lt\n            ON t.title_id = lt.title_id\n            INNER JOIN location as l\n            ON lt.location_id = l.location_id\n            INNER JOIN restrictions as r\n            ON l.access_restrictions = r.restrictions_id\n            INNER JOIN rank as rk\n            ON rk.title_id = t.title_id\n            INNER JOIN source as s\n            ON rk.source_id = s.source_id\n            {$condition2}\n\t\t        AND eres_display = 'Y'\n            {$condition3}\n\n\t\t        ORDER BY newtitle";
     $r = $db->query($q1);
     $num_rows = count($r);
     if ($num_rows == 0) {
         return "<div class=\"no_results\">" . _("Sorry, there are no results at this time.") . "</div>";
     }
     // prepare 	header
     $items = "<table width=\"98%\" class=\"item_listing\">";
     $row_count = 0;
     $colour1 = "oddrow";
     $colour2 = "evenrow";
     foreach ($r as $myrow) {
         $row_colour = $row_count % 2 ? $colour1 : $colour2;
         $patterns = "/'|\"/";
         $replacements = "";
         $item_title = $myrow[1];
         if ($myrow["pre"] != "") {
             $item_title = $myrow["pre"] . " " . $item_title;
         }
         $safe_title = trim(preg_replace($patterns, $replacements, $item_title));
         $blurb = $myrow["description"];
         $bib_id = $myrow[5];
         /// CHECK RESTRICTIONS ///
         if ($myrow['4'] == 2 or $myrow['4'] == 3) {
             $url = $proxyURL . $myrow[3];
             $rest_icons = "restricted";
         } elseif ($myrow['4'] == 4) {
             $url = $myrow[3];
             $rest_icons = "restricted";
         } else {
             $url = $myrow[3];
             $rest_icons = "";
             // if you want the unlocked icon to show, enter "unrestricted" here
         }
         $current_ctags = explode("|", $myrow["ctags"]);
         // add our $rest_icons info to this array at the beginning
         array_unshift($current_ctags, $rest_icons);
         $icons = showIcons($current_ctags);
//.........这里部分代码省略.........
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:101,代码来源:DbHandler.php

示例15: catch

<?php

use SubjectsPlus\Control\Querier;
//include subjectsplus config and functions files
include_once '../../../../control/includes/config.php';
include_once '../../../../control/includes/functions.php';
include_once '../../../../control/includes/autoloader.php';
global $AssetPath;
try {
} catch (Exception $e) {
    echo $e;
}
$querier = new Querier();
if (isset($_COOKIE["our_guide"]) && isset($_COOKIE["our_guide_id"])) {
    $qs = "SELECT lname, fname, email, tel, title, s.staff_id from staff s, staff_subject ss WHERE s.staff_id = ss.staff_id and ss.subject_id = " . $_COOKIE["our_guide_id"] . " ORDER BY lname, fname";
    $sugStaffArray = $querier->query($qs);
}
$lobjStaffIds = array();
foreach ($sugStaffArray as $lobjStaff) {
    $lobjStaffIds[] = $lobjStaff[5];
}
$qs = "SELECT lname, fname, email, tel, title from staff s WHERE s.staff_id NOT IN ('" . implode('\',\'', $lobjStaffIds) . "')  ORDER BY lname, fname";
$staffArray = $querier->query($qs);
if (count($sugStaffArray) > 0) {
    $lstrHTML = "<table>";
    $lstrHTML .= "<strong>" . _("Specialists") . "</strong>";
}
foreach ($sugStaffArray as $value) {
    // get username from email
    $truncated_email = explode("@", $value[2]);
    $staff_picture = $AssetPath . "users/_" . $truncated_email[0] . "/headshot.jpg";
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:getStaffCheckboxes.php


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