本文整理汇总了PHP中SubjectsPlus\Control\Querier::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Querier::getConnection方法的具体用法?PHP Querier::getConnection怎么用?PHP Querier::getConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubjectsPlus\Control\Querier
的用法示例。
在下文中一共展示了Querier::getConnection方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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;
}
示例2: __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();
}
}
示例3: isCool
function isCool($emailAdd = "", $password = "", $shibboleth = false)
{
$db = new Querier();
global $subcat;
global $CpanelPath;
global $PublicPath;
global $debugger;
global $salt;
if ($shibboleth == true) {
$connection = $db->getConnection();
$statement = $connection->prepare("SELECT staff_id, ip, fname, lname, email, user_type_id, ptags, extra\n FROM staff\n WHERE email = :mail");
$statement->bindParam(":mail", $emailAdd);
$statement->execute();
$result = $statement->fetchAll();
} else {
$query = "SELECT staff_id, ip, fname, lname, email, user_type_id, ptags, extra\n FROM staff\n WHERE email = '" . scrubData($emailAdd, "email") . "' AND password = '" . scrubData($password) . "'";
$db = new Querier();
$result = $db->query($query);
}
$numrows = count($result);
if ($numrows > 0) {
$user = $result;
if (is_array($user)) {
//set session variables
session_start();
session_regenerate_id();
// Create session vars for the basic types
$_SESSION['checkit'] = md5($user[0][4]) . $salt;
$_SESSION['staff_id'] = $user[0][0];
$_SESSION['ok_ip'] = $user[0][1];
$_SESSION['fname'] = $user[0][2];
$_SESSION['lname'] = $user[0][3];
$_SESSION['email'] = $user[0][4];
$_SESSION['user_type_id'] = $user[0][5];
// unpack our extra
if ($user[0][7] != NULL) {
$jobj = json_decode($user[0][7]);
$_SESSION['css'] = $jobj->{'css'};
}
// unpack our ptags
$current_ptags = explode("|", $user[0][6]);
foreach ($current_ptags as $value) {
$_SESSION[$value] = 1;
}
$result = "success";
}
} else {
$result = "failure";
}
return $result;
}
示例4: __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;
}
}
示例5: array
/**
* @file index.php
* @brief Display the subject guides by collection splash page
*
* @author adarby
* @date sept 2015
*/
use SubjectsPlus\Control\CompleteMe;
use SubjectsPlus\Control\Querier;
$use_jquery = array("ui");
$page_title = _("Research Guide Collections");
$description = _("The best stuff for your research. No kidding.");
$keywords = _("research, databases, subjects, search, find");
$noheadersearch = TRUE;
$db = new Querier();
$connection = $db->getConnection();
// let's use our Pretty URLs if mod_rewrite = TRUE or 1
if ($mod_rewrite == 1) {
$guide_path = "";
} else {
$guide_path = "guide.php?subject=";
}
///////////////////////
// Have they done a search?
$search = "";
if (isset($_POST["search"])) {
$search = scrubData($_POST["search"]);
}
// Get the subjects for jquery autocomplete
$suggestibles = "";
// init
示例6: search
public function search()
{
$db = new Querier();
$connection = $db->getConnection();
$search_param = "%" . $this->param . "%";
$subject_id = $this->subject_id;
switch ($this->collection) {
case "home":
$statement = $connection->prepare("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_term\n OR subject LIKE :search_term\n OR keywords LIKE :search_term\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_term\n OR p.title LIKE :search_term\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_term\n OR answer LIKE :search_term\n OR keywords LIKE :search_term\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_term\n OR answer LIKE :search_term\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_term\n OR lname LIKE :search_term\n OR email LIKE :search_term\n OR tel LIKE :search_term\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_term\n OR telephone LIKE :search_term\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_term\n OR description LIKE :search_term\n OR vtags LIKE :search_term");
break;
case "guides":
$statement = $connection->prepare("SELECT subject_id as 'id', subject,'Subject Guide' as 'content_type', subject AS 'label',shortform AS 'short_form' \n FROM subject \n WHERE active = '1'\n AND (subject LIKE :search_term\n OR shortform LIKE :search_term\n OR description LIKE :search_term\n OR keywords LIKE :search_term\n OR type LIKE :search_term)\n ");
break;
case "all_guides":
$statement = $connection->prepare("SELECT subject_id as 'id', subject,'Subject Guide' as 'content_type', subject AS 'label',shortform AS 'short_form'\n FROM subject\n WHERE (subject LIKE :search_term\n OR shortform LIKE :search_term\n OR description LIKE :search_term\n OR keywords LIKE :search_term\n OR type LIKE :search_term)\n ORDER BY subject\n ");
break;
case "guide":
$statement = $connection->prepare("SELECT p.pluslet_id as 'id',su.shortform as 'short_form','Pluslet' as 'content_type',p.type as '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_term\n \t\t\t AND t.subject_id = :subject_id");
$statement->bindParam(":subject_id", $subject_id);
break;
case "current_guide":
$statement = $connection->prepare("SELECT p.pluslet_id as 'id',su.shortform as 'short_form','Pluslet' as 'content_type',p.type as '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.title LIKE :search_term\n \t\t\t AND t.subject_id = :subject_id");
$statement->bindParam(":subject_id", $subject_id);
break;
case "records":
$statement = $connection->prepare("SELECT DISTINCT title.title_id as 'id','Record' as 'content_type', title.title as 'label', location.location as 'location_url'\nFROM title\nINNER JOIN location_title\nON title.title_id = location_title.title_id\nINNER JOIN location\nON location.location_id = location_title.location_id\nAND title.title LIKE :search_term");
break;
case "azrecords":
$statement = $connection->prepare("SELECT DISTINCT title.title_id as 'id','Record' as 'content_type', title.title as 'label', location.location as 'location_url'\nFROM title\nINNER JOIN location_title \nON title.title_id = location_title.title_id\nINNER JOIN location\nON location.location_id = location_title.location_id\nAND eres_display = 'Y'\nAND title.title LIKE :search_term");
break;
case "faq":
$statement = $connection->prepare("SELECT faq_id AS 'id',question AS 'label', LEFT(question, 55), \n \t\t'FAQ' as 'content_type' FROM faq WHERE question LIKE :search_term");
break;
case "talkback":
$statement = $connection->prepare("SELECT talkback_id AS 'id',question AS 'label','Talkback' \n \t\tas content_type, LEFT(question, 55) FROM talkback WHERE question LIKE :search_term");
break;
case "admin":
$statement = $connection->prepare("SELECT staff_id AS 'id',email AS 'label','Staff' \n \t\tas 'content_type', CONCAT(fname, ' ', lname, ' (', email, ')') as fullname \n \t\tFROM staff WHERE (fname LIKE :search_term) OR (lname LIKE :search_term)");
break;
case "pluslet":
$statement = $connection->prepare("SELECT p.pluslet_id AS 'pluslet_id', p.title,p.title AS 'label',p.type as 'type', p.pluslet_id AS 'id', su.shortform as 'short_form', '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.title LIKE :search_term\n \t\t\t\n \t\t\t\t");
break;
case "my_pluslets":
$statement = $connection->prepare("SELECT p.pluslet_id AS 'pluslet_id', p.title,p.title AS 'label',p.type as 'type', p.pluslet_id AS 'id', su.shortform as 'short_form', '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 INNER JOIN staff_subject AS st_sub\n ON st_sub.subject_id = su.subject_id\n WHERE p.title LIKE :search_term\n AND st_sub.staff_id = :staff_id\n \t\t\t\n \t\t\t\t");
$statement->bindParam(":staff_id", $this->staff_id);
break;
}
$search_param = '%' . $search_param . '%';
$statement->bindParam(":search_term", $search_param);
$statement->execute();
$result = $statement->fetchAll();
$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'] = html_entity_decode($myrow['label']);
if (isset($myrow['content_type'])) {
if (isset($myrow['id'])) {
$arr[$i]['id'] = $myrow['id'];
}
$arr[$i]['content_type'] = $myrow['content_type'];
if (isset($myrow['location_url'])) {
$arr[$i]['location_url'] = $myrow['location_url'];
}
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['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'] = html_entity_decode($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 FROM location l, title t, location_title lt \n WHERE t.title_id = lt.title_id\n AND 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'];
}
//.........这里部分代码省略.........
示例7: __construct
public function __construct(Querier $db)
{
$this->db = $db;
$this->connection = $db->getConnection();
}
示例8: displaySubjects
function displaySubjects()
{
$db = new Querier();
$connection = $db->getConnection();
$statement = $connection->prepare("SELECT subject, subject_id FROM subject WHERE active = '1' AND type = 'Subject' ORDER BY subject");
$statement->bindParam(":qualifer", $letter);
$statement->execute();
$r = $statement->fetchAll();
// check row count for 0 returns
$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;
$items .= "\n\t<tr class=\"zebra {$row_colour}\" valign=\"top\">\n\t\t<td><a href=\"databases.php?letter=bysub&subject_id={$myrow['1']}\">{$myrow['0']}</a></td>\n\t</tr>";
$row_count++;
}
$items .= "</table>";
return $items;
}
示例9: __construct
public function __construct($location_id, $title_id, Querier $db)
{
$this->location_id = $location_id;
$this->title_id = $title_id;
$this->connection = $db->getConnection();
}