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


PHP Control\Querier类代码示例

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


在下文中一共展示了Querier类的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: __construct

 public function __construct($lib_guides_xml_path, Logger $log, Querier $db, CatalogMigrator $cm)
 {
     $libguides_xml = new \SimpleXMLElement(file_get_contents($lib_guides_xml_path, 'r'));
     $this->libguidesxml = $libguides_xml;
     $this->log = $log;
     $this->db = $db;
     $this->connection = $db->getConnection();
     $this->cm = $cm;
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:9,代码来源:LGImport.php

示例3: 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

示例4: __construct

 public function __construct(Querier $db)
 {
     $this->connection = $db->getConnection();
     $statement = $this->connection->prepare("SELECT title_id FROM title");
     $statement->execute();
     $title_ids = $statement->fetchAll();
     foreach ($title_ids as $title_id) {
         $azrecord = new AzRecord($db);
         $azrecord->getRecord($title_id['title_id']);
         $this->records[] = $azrecord->toArray();
     }
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:12,代码来源:AzRecordList.php

示例5: __construct

 public function __construct(Querier $db)
 {
     $this->connection = $db->getConnection();
     $statement = $this->connection->prepare("SELECT subject_id FROM subject WHERE active = :active AND `type` = :type");
     $statement->bindParam(':active', $this->active);
     $statement->bindParam(':type', $this->type);
     $statement->execute();
     $subject_ids = $statement->fetchAll();
     foreach ($subject_ids as $subject_id) {
         $record = new Record($db);
         $record->getRecord($subject_id['subject_id']);
         $this->records[] = $record;
     }
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:14,代码来源:RecordList.php

示例6: 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

示例7: 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

示例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: Querier

 *
 *   @author adarby
 *   @date jan 2012
 */
use SubjectsPlus\Control\Querier;
use SubjectsPlus\Control\CompleteMe;
use SubjectsPlus\Control\DbHandler;
include "../control/includes/config.php";
include "../control/includes/functions.php";
include "../control/includes/autoloader.php";
// If you have a theme set, but DON'T want to use it for this page, comment out the next line
if (isset($subjects_theme) && $subjects_theme != "") {
    include "themes/{$subjects_theme}/databases.php";
    exit;
}
$db = new Querier();
$use_jquery = array("ui");
$page_title = _("Database List");
$description = _("An alphabetical list of the electronic resources available.");
$keywords = _("library, research, electronic journals, databases, electronic resources, full text, online, magazine, articles, paper, assignment");
// set a default if the letter isn't set
if (!isset($_GET["letter"])) {
    $_GET["letter"] = "A";
    $page_title .= ":  A";
} else {
    $page_title .= ": " . ucfirst(scrubData($_GET["letter"]));
}
// Deal with databases by subject display
if (!isset($_GET["subject_id"])) {
    $_GET["subject_id"] = "";
    $clean_id = "";
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:databases.php

示例10: catch

$page_title = "FAQ Admin";
include "../includes/header.php";
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>";
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:index.php

示例11: catch

$page_title = "Video Admin";
include "../includes/header.php";
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 = "";
}
$querierVid = new Querier();
$qVid = "SELECT video_id, title, description, source, foreign_id, duration, date, display, vtags\n\tFROM video\n\tORDER BY video_id DESC\n\t{$limit}";
$vidArray = $querierVid->query($qVid);
$row_count1 = 0;
$row_count2 = 0;
$colour1 = "evenrow";
$colour2 = "oddrow";
$vid_list = "";
if ($vidArray) {
    foreach ($vidArray as $value) {
        $row_colour1 = $row_count1 % 2 ? $colour1 : $colour2;
        $short_title = Truncate($value["title"], 200);
        $short_desc = stripslashes(htmlspecialchars_decode(TruncByWord($value["description"], 15)));
        $last_revised_line = lastModded("video", $value[0]);
        if ($value[7] != "1") {
            $activity = " <span style=\"color: #666;\">* " . _("unpublished") . "</span>";
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:31,代码来源:index.php

示例12: Querier

}
///////////////////
// Browse View
///////////////////
if (isset($_GET["browse"])) {
    $q = "SELECT user_type_id, user_type FROM user_type ORDER BY user_type_id";
    $querier = new Querier();
    $typeArray = $querier->query($q);
    print "<div class=\"pure-g\">\n  <div class=\"pure-u-2-3\">";
    // Loop through user types
    foreach ($typeArray as $value) {
        $staff_list = "";
        $staffArray = "";
        $our_title = $value[1];
        $q2 = "SELECT staff_id, fname, lname, email, ptags FROM staff WHERE user_type_id = " . $value[0] . " ORDER BY lname, fname";
        $querier2 = new Querier();
        $staffArray = $querier2->query($q2);
        $staff_list .= "";
        // if there are no results
        if (!$staffArray) {
            $staff_list .= "<p>" . _("None registered.  Just as well.  They're going to rise up against us someday.") . "</p>";
        } else {
            $staff_list .= "<p>" . _("Click on a name to update details and privileges") . "</p>";
            // set up striping
            $row_count = 0;
            $colour1 = "oddrow";
            $colour2 = "evenrow";
            foreach ($staffArray as $staff) {
                // unpack the ptags
                $these_tags = "";
                $current_ptags = explode("|", $staff[4]);
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:user.php

示例13: Querier

 *   @date Nov, 2011; last mod dec 2014
 */
use SubjectsPlus\Control\Dropdown;
use SubjectsPlus\Control\Record;
use SubjectsPlus\Control\LinkChecker;
use SubjectsPlus\Control\Querier;
$subcat = "records";
$subsubcat = "index.php";
$page_title = "Browse Items";
// init some vars
$atoz = "";
$letter = "";
$ctag = "";
$full_query = "";
include "../includes/header.php";
$db = new Querier();
// Where to start?
// Choose initial letter to display
$alpha_query = "SELECT  distinct left(title,1) as 'initial' FROM  title, restrictions, location, location_title, source where title.title_id = location_title.title_id and location.location_id = location_title.location_id and restrictions_id = access_restrictions ORDER BY initial";
$alpha_result = $db->query($alpha_query);
$count = 0;
$firstletter = "A";
foreach ($alpha_result as $myletter) {
    if ($count == 0) {
        $firstletter = $myletter[0][0];
    }
    $atoz .= "<a href=\"" . "index.php?letter=" . $myletter[0][0] . "\">" . $myletter[0][0] . "</a> &nbsp;";
    $count++;
}
$atoz .= "<a href=\"index.php?letter=all\">[all]</a>";
// end A-Z header for now
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:index.php

示例14: Querier

        // Show feedbck
        $feedback = $record->getMessage();
    } 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"] == "") {
        $querierDupe = new Querier();
        $qDupe = "SELECT title_id, title FROM title WHERE title LIKE " . $db->quote($_POST["title"]);
        $dupetitleArray = $querierDupe->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();
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:record.php

示例15: search

 public function search()
 {
     $db = new Querier();
     $search_param = $db->quote("%" . $this->param . "%");
     $subject_id = $db->quote($this->subject_id);
     switch ($this->collection) {
         case "home":
             $q = "SELECT subject_id AS 'id', subject AS 'matching_text',subject AS 'label', description as 'additional_text', shortform AS 'short_form', 'Subject Guide' as 'content_type', '' as 'additional_id', '' as 'parent' FROM subject\n                    WHERE description LIKE " . $search_param . "\n                    OR subject LIKE " . $search_param . "\n                    OR keywords LIKE " . $search_param . "\n                    UNION\n                    SELECT p.pluslet_id, p.title,p.title AS 'label', su.subject_id AS 'parent_id', su.shortform, 'Pluslet' AS 'content_type', t.tab_index as 'additional_id',su.subject as 'parent' 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 su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.body LIKE " . $search_param . "\n                    OR p.title LIKE " . $search_param . "\n\n                    UNION\n                    SELECT faq_id AS 'id', question AS 'matching_text',question AS 'label',  answer as 'additional_text','' AS 'short_form','FAQ' as 'content_type', '' as 'additional_id', '' as 'parent' FROM faq\n                    WHERE question LIKE " . $search_param . "\n                    OR answer LIKE " . $search_param . "\n                    OR keywords LIKE " . $search_param . "\n                    UNION\n                    SELECT talkback_id AS 'id', question AS 'matching_text' ,question AS 'label', answer as 'additional_text','' AS 'short_form', 'Talkback' as 'content_type', '' as 'additional_id', '' as 'parent' FROM talkback\n                    WHERE question LIKE " . $search_param . "\n                    OR answer LIKE " . $search_param . "\n                    UNION\n                    SELECT staff_id AS 'id', email AS 'matching_text' ,email AS 'label', fname as 'additional_text','' AS 'short_form', 'Staff' as 'content_type', '' as 'additional_id', '' as 'parent' FROM staff\n                    WHERE fname LIKE " . $search_param . "\n                    OR lname LIKE " . $search_param . "\n                    OR email LIKE " . $search_param . "\n                    OR tel LIKE " . $search_param . "\n                    UNION\n                    SELECT department_id AS 'id', name AS 'matching_text' , name AS 'label', telephone as 'additional_text','' AS 'short_form', 'Department' as 'content_type', '' as 'additional_id','' as 'parent' FROM department\n                    WHERE name LIKE " . $search_param . "\n                    OR telephone LIKE  " . $search_param . "\n                    UNION\n                    SELECT video_id AS 'id', title AS 'matching_text' ,title AS 'label', description as 'additional_text','' AS 'short_form', 'Video' as 'content_type', '' as 'additional_id', '' as 'parent' FROM video\n                    WHERE title LIKE " . $search_param . "\n                    OR description LIKE " . $search_param . "\n                    OR vtags LIKE " . $search_param;
             break;
         case "guides":
             $q = "SELECT subject_id as 'id', subject,'Subject Guide' as 'content_type', subject AS 'label',shortform AS 'short_form' FROM subject WHERE subject LIKE " . $search_param . "OR shortform LIKE " . $search_param . "OR description LIKE " . $search_param . "OR keywords LIKE " . $search_param . "OR type LIKE " . $search_param;
             break;
         case "guide":
             $q = "SELECT p.pluslet_id as 'id',su.shortform as 'short_form','Pluslet' as 'content_type', p.title, p.title AS 'label', ps.section_id, t.tab_index AS 'additional_id', t.subject_id, su.subject 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 su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.body LIKE " . $search_param . " AND t.subject_id = " . $subject_id;
             break;
         case "records":
             $q = "SELECT title_id AS 'id', 'Record' as 'content_type',title AS 'label', title FROM title WHERE title LIKE " . $search_param;
             break;
         case "faq":
             $q = "SELECT faq_id AS 'id',question AS 'label', LEFT(question, 55), 'FAQ' as 'content_type'  FROM faq WHERE question LIKE " . $search_param;
             break;
         case "talkback":
             $q = "SELECT talkback_id AS 'id',question AS 'label','Talkback' as content_type, LEFT(question, 55) FROM talkback WHERE question LIKE " . $search_param;
             break;
         case "admin":
             $q = "SELECT staff_id AS 'id',email AS 'label','Staff' as 'content_type', CONCAT(fname, ' ', lname, ' (', email, ')') as fullname FROM staff WHERE (fname LIKE " . $search_param . ") OR (lname LIKE " . $search_param . ")";
             break;
     }
     //print_r ($q);
     $result = $db->query($q);
     $arr = array();
     $i = 0;
     // This takes the results and creates an array that will be turned into JSON
     foreach ($result as $myrow) {
         //add no title label if empty
         $myrow['label'] = empty($myrow['label']) ? '[no title]' : $myrow['label'];
         $arr[$i]['label'] = $myrow['label'];
         if (isset($myrow['content_type'])) {
             $arr[$i]['id'] = $myrow['id'];
             if (isset($myrow['short_form'])) {
                 $arr[$i]['shortform'] = $myrow['short_form'];
             }
             if (isset($myrow['matching_text'])) {
                 $arr[$i]['value'] = $myrow['matching_text'];
             }
             if (isset($myrow['content_type'])) {
                 $arr[$i]['content_type'] = $myrow['content_type'];
             }
             if (isset($myrow['parent'])) {
                 $arr[$i]['parent'] = $myrow['parent'];
             }
             if (isset($myrow['additional_id'])) {
                 $arr[$i]['parent_id'] = $myrow['additional_id'];
             }
             switch ($myrow['content_type']) {
                 case "Record":
                     $arr[$i]['label'] = $myrow['label'];
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'record.php?record_id=' . $myrow['id'];
                     } else {
                         $db = new Querier();
                         $record_url_sql = "SELECT location, title\n\t\t\t\tFROM location l, title t, location_title lt \n\t\t\t\tWHERE  t.title_id = lt.title_id\n\t\t\t\tAND l.location_id = lt.location_id AND t.title_id = " . $db->quote($myrow['id']) . " ";
                         $record_url_result = $db->query($record_url_sql);
                         if (isset($record_url_result[0]['location'])) {
                             $arr[$i]['url'] = $record_url_result[0]['location'];
                         } else {
                             $arr[$i]['url'] = '';
                         }
                     }
                     break;
                 case "Subject Guide":
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = getControlURL() . 'guides/guide.php?subject_id=' . $myrow['id'];
                     } else {
                         $arr[$i]['url'] = 'guide.php?subject=' . $myrow['short_form'];
                     }
                     break;
                 case "FAQ":
                     $arr[$i]['label'] = $myrow['label'];
                     $arr[$i]['url'] = 'faq.php?faq_id=' . $myrow['id'];
                     break;
                 case "Pluslet":
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = getControlURL() . 'guides/guide.php?subject_id=' . $myrow['short_form'] . '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['hash'] = '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['label'] = $myrow['label'];
                     } else {
                         $arr[$i]['url'] = 'guide.php?subject=' . $myrow['short_form'] . '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['hash'] = '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['tab_index'] = $myrow['additional_id'];
                     }
                     break;
                 case "Talkback":
                     $arr[$i]['label'] = $myrow['label'];
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'talkback.php?talkback_id=' . $myrow['id'];
                     } else {
                         $arr[$i]['url'] = 'talkback.php';
                     }
                     break;
//.........这里部分代码省略.........
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:101,代码来源:Autocomplete.php


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