本文整理汇总了PHP中Resource::getSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::getSearch方法的具体用法?PHP Resource::getSearch怎么用?PHP Resource::getSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource::getSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPigSearchDetails
public static function getPigSearchDetails()
{
// A successful mysql_connect must be run before mysql_real_escape_string will function. Instantiating a resource model will set up the connection
$resource = new Resource();
$search = Resource::getSearch();
$whereAdd = array();
$searchDisplay = array();
$config = new Configuration();
//if name is passed in also search alias, organizations and organization aliases
if (!empty($search['name'])) {
$nameQueryString = self::escapeStr(strtoupper($search['name']));
$nameQueryString = "'%" . str_replace(" ", "%", $nameQueryString) . "%'";
if ($config->settings->organizationsModule == 'Y') {
//$dbName = $config->settings->organizationsDatabaseName; //unused
$whereAdd[] = "((UPPER(R.titleText) LIKE " . $nameQueryString . ") OR (UPPER(A.shortName) LIKE " . $nameQueryString . ") OR (UPPER(O.name) LIKE " . $nameQueryString . ") OR (UPPER(OA.name) LIKE " . $nameQueryString . ") OR (UPPER(RP.titleText) LIKE " . $nameQueryString . ") OR (UPPER(RC.titleText) LIKE " . $nameQueryString . ") OR (UPPER(R.recordSetIdentifier) LIKE " . $nameQueryString . "))";
} else {
$whereAdd[] = "((UPPER(R.titleText) LIKE " . $nameQueryString . ") OR (UPPER(A.shortName) LIKE " . $nameQueryString . ") OR (UPPER(O.shortName) LIKE " . $nameQueryString . ") OR (UPPER(RP.titleText) LIKE " . $nameQueryString . ") OR (UPPER(RC.titleText) LIKE " . $nameQueryString . ") OR (UPPER(R.recordSetIdentifier) LIKE " . $nameQueryString . "))";
}
$searchDisplay[] = "Name contains: " . $search['name'];
}
//if descriptionText is passed
if (!empty($search['descriptionText'])) {
$descriptionQueryString = self::escapeStr(strtoupper($search['descriptionText']));
$descriptionQueryString = "'%" . str_replace(" ", "%", $descriptionQueryString) . "%'";
$whereAdd[] = "(UPPER(R.descriptionText) LIKE " . $descriptionQueryString . ")";
$searchDisplay[] = "Description contains: " . $search['descriptionText'];
}
//if providerText is passed
if (!empty($search['providerText'])) {
$providerQueryString = self::escapeStr(strtoupper($search['providerText']));
$providerQueryString = "'%" . str_replace(" ", "%", $providerQueryString) . "%'";
$whereAdd[] = "(UPPER(R.providerText) LIKE " . $providerQueryString . ")";
$searchDisplay[] = "Provider contains: " . $search['providerText'];
}
//get where statements together (and escape single quotes)
if (!empty($search['resourceID'])) {
$whereAdd[] = "R.resourceID = '" . self::escapeStr($search['resourceID']) . "'";
$searchDisplay[] = "Resource ID: " . $search['resourceID'];
}
if (!empty($search['resourceISBNOrISSN'])) {
$resourceISBNOrISSN = self::escapeStr(str_replace("-", "", $search['resourceISBNOrISSN']));
$whereAdd[] = "REPLACE(R.isbnOrISSN,'-','') = '" . $resourceISBNOrISSN . "'";
$searchDisplay[] = "ISSN/ISBN: " . $search['resourceISBNOrISSN'];
}
if (!empty($search['fund'])) {
$fund = self::escapeStr(str_replace("-", "", $search['fund']));
$whereAdd[] = "REPLACE(RPAY.fundName,'-','') = '" . $fund . "'";
$searchDisplay[] = "Fund: " . $search['fund'];
}
if (!empty($search['stepName'])) {
$status = new Status();
$completedStatusID = $status->getIDFromName('complete');
$whereAdd[] = "(R.statusID != {$completedStatusID} AND RS.stepName = '" . self::escapeStr($search['stepName']) . "' AND RS.stepStartDate IS NOT NULL AND RS.stepEndDate IS NULL)";
$searchDisplay[] = "Routing Step: " . $search['stepName'];
}
// Return all results except the records with this statusID
if (!empty($search['statusID'])) {
$whereAdd[] = "R.statusID <> '" . self::escapeStr($search['statusID']) . "'";
$status = new Status(new NamedArguments(array('primaryKey' => $search['statusID'])));
$searchDisplay[] = "Status: " . $status->shortName;
}
if (!empty($search['creatorLoginID'])) {
$whereAdd[] = "R.createLoginID = '" . self::escapeStr($search['creatorLoginID']) . "'";
$createUser = new User(new NamedArguments(array('primaryKey' => $search['creatorLoginID'])));
if ($createUser->firstName) {
$name = $createUser->lastName . ", " . $createUser->firstName;
} else {
$name = $createUser->loginID;
}
$searchDisplay[] = "Creator: " . $name;
}
if (!empty($search['resourceFormatID'])) {
$whereAdd[] = "R.resourceFormatID = '" . self::escapeStr($search['resourceFormatID']) . "'";
$resourceFormat = new ResourceFormat(new NamedArguments(array('primaryKey' => $search['resourceFormatID'])));
$searchDisplay[] = "Resource Format: " . $resourceFormat->shortName;
}
if (!empty($search['acquisitionTypeID'])) {
$whereAdd[] = "R.acquisitionTypeID = '" . self::escapeStr($search['acquisitionTypeID']) . "'";
$acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $search['acquisitionTypeID'])));
$searchDisplay[] = "Acquisition Type: " . $acquisitionType->shortName;
}
if (!empty($search['resourceNote'])) {
$whereAdd[] = "UPPER(RN.noteText) LIKE UPPER('%" . self::escapeStr($search['resourceNote']) . "%')";
$searchDisplay[] = "Note contains: " . $search['resourceNote'];
}
if (!empty($search['createDateStart'])) {
$whereAdd[] = "R.createDate >= STR_TO_DATE('" . self::escapeStr($search['createDateStart']) . "','%m/%d/%Y')";
if (!$search['createDateEnd']) {
$searchDisplay[] = "Created on or after: " . $search['createDateStart'];
} else {
$searchDisplay[] = "Created between: " . $search['createDateStart'] . " and " . $search['createDateEnd'];
}
}
if (!empty($search['createDateEnd'])) {
$whereAdd[] = "R.createDate <= STR_TO_DATE('" . self::escapeStr($search['createDateEnd']) . "','%m/%d/%Y')";
if (!$search['createDateStart']) {
$searchDisplay[] = "Created on or before: " . $search['createDateEnd'];
}
}
if (!empty($search['startWith'])) {
//.........这里部分代码省略.........
示例2: session_start
** You should have received a copy of the GNU General Public License along with CORAL. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************************************************************
*/
session_start();
include_once 'directory.php';
//print header
$pageTitle = 'Home';
include 'templates/header.php';
//used for creating a "sticky form" for back buttons
//except we don't want it to retain if they press the 'index' button
//check what referring script is
if ($_SESSION['ref_script'] != "resource.php") {
Resource::resetSearch();
}
$search = Resource::getSearch();
$_SESSION['ref_script'] = $currentPage;
?>
<div style='text-align:left;'>
<table class="headerTable" style="background-image:url('images/header.gif');background-repeat:no-repeat;">
<tr style='vertical-align:top;'>
<td style="width:155px;padding-right:10px;">
<form method="get" action="ajax_htmldata.php?action=getSearchResources" id="resourceSearchForm">
<?php
foreach (array('orderBy', 'page', 'recordsPerPage', 'startWith') as $hidden) {
echo Html::hidden_search_field_tag($hidden, $search[$hidden]);
}
?>
<table class='noBorder'>