本文整理汇总了PHP中showResults函数的典型用法代码示例。如果您正苦于以下问题:PHP showResults函数的具体用法?PHP showResults怎么用?PHP showResults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showResults函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initializeReport
/**
* @param $course_code
* @return array|bool
*/
function initializeReport($course_code)
{
$course_info = api_get_course_info($course_code);
$table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
$table_students_report = Database::get_main_table('rp_students_report');
$table_semanas_curso = Database::get_main_table('rp_semanas_curso');
$table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_post = Database::get_course_table(TABLE_FORUM_POST, $course_info['dbName']);
$table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION, $course_info['dbName']);
$course_code = Database::escape_string($course_code);
$res = Database::query("SELECT COUNT(*) as cant FROM $table_reporte_semanas WHERE course_code = '" . $course_code . "'");
$sqlWeeks = "SELECT semanas FROM $table_semanas_curso WHERE course_code = '$course_code'";
$resWeeks = Database::query($sqlWeeks);
$weeks = Database::fetch_object($resWeeks);
$obj = Database::fetch_object($res);
$weeksCount = (!isset($_POST['weeksNumber'])) ? (($weeks->semanas == 0) ? 7 : $weeks->semanas) : $_POST['weeksNumber'];
$weeksCount = Database::escape_string($weeksCount);
Database::query("REPLACE INTO $table_semanas_curso (course_code , semanas) VALUES ('$course_code','$weeksCount')");
if (intval($obj->cant) != $weeksCount) {
if (intval($obj->cant) > $weeksCount) {
$sql = "DELETE FROM $table_reporte_semanas WHERE week_id > $weeksCount AND course_code = '$course_code'";
Database::query("DELETE FROM $table_reporte_semanas WHERE week_id > $weeksCount AND course_code = '$course_code'");
} else {
for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
if (!Database::query("INSERT INTO $table_reporte_semanas (week_id, course_code, forum_id, work_id, quiz_id, pc_id)
VALUES ($i, '$course_code', '0', '0', '0', '0' )")) {
return false;
}
}
}
}
$sql = "REPLACE INTO $table_students_report (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)
SELECT cu.user_id, rs.id, 0, 0, 0, 0
FROM $table_course_rel_user cu
LEFT JOIN $table_reporte_semanas rs ON cu.course_code = rs.course_code
WHERE cu.status = 5 AND rs.course_code = '$course_code'
ORDER BY cu.user_id, rs.id";
if (!Database::query($sql)) {
return false;
} else {
$page = (!isset($_GET['page'])) ? 1 : $_GET['page'];
Database::query("UPDATE $table_students_report sr SET sr.work_ok = 1
WHERE CONCAT (sr.user_id,',',sr.week_report_id)
IN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)
FROM $table_work w JOIN $table_reporte_semanas rs ON w.parent_id = rs.work_id)");
Database::query("UPDATE $table_students_report sr SET sr.thread_ok = 1
WHERE CONCAT (sr.user_id,',',sr.week_report_id)
IN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)
FROM $table_post f JOIN $table_reporte_semanas rs ON f.thread_id = rs.forum_id)");
return showResults($course_info, $weeksCount, $page);
}
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:60,代码来源:tutor_report.lib.php
示例2: searchBooks
function searchBooks()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
$query = composeQuery();
$connection = connect();
$results = mysql_query($query, $connection);
showResults($results);
mysql_close($connection);
}
开发者ID:xukmin,项目名称:aladdin,代码行数:11,代码来源:search_books.php
示例3: showMonthlySalesSummary
function showMonthlySalesSummary()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
$connection = connect();
if (empty($_POST['month'])) {
echo "<p class='center'>Please input a month.</p>";
return;
}
if (empty($_POST['year'])) {
echo "<p class='center'>Please input a year.</p>";
return;
}
$query = composeQuery();
$results = mysql_query($query, $connection);
showResults($results);
mysql_close($connection);
}
开发者ID:xukmin,项目名称:aladdin,代码行数:19,代码来源:manager_sales_summary.php
示例4: initializeReport
/**
* @param $course_code
* @return array|bool
*/
function initializeReport($course_code)
{
$course_info = api_get_course_info($course_code);
$table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
$table_students_report = Database::get_main_table('rp_students_report');
$table_semanas_curso = Database::get_main_table('rp_semanas_curso');
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_post = Database::get_course_table(TABLE_FORUM_POST);
$table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$course_code = Database::escape_string($course_code);
$res = Database::query("SELECT COUNT(*) as cant FROM {$table_reporte_semanas} WHERE course_code = '" . $course_code . "'");
$sqlWeeks = "SELECT semanas FROM {$table_semanas_curso} WHERE course_code = '{$course_code}'";
$resWeeks = Database::query($sqlWeeks);
$weeks = Database::fetch_object($resWeeks);
$obj = Database::fetch_object($res);
$weeksCount = !isset($_POST['weeksNumber']) ? $weeks->semanas == 0 ? 7 : $weeks->semanas : $_POST['weeksNumber'];
$weeksCount = Database::escape_string($weeksCount);
Database::query("REPLACE INTO {$table_semanas_curso} (course_code , semanas) VALUES ('{$course_code}','{$weeksCount}')");
if (intval($obj->cant) != $weeksCount) {
if (intval($obj->cant) > $weeksCount) {
$sql = "DELETE FROM {$table_reporte_semanas} WHERE week_id > {$weeksCount} AND course_code = '{$course_code}'";
Database::query("DELETE FROM {$table_reporte_semanas} WHERE week_id > {$weeksCount} AND course_code = '{$course_code}'");
} else {
for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
if (!Database::query("INSERT INTO {$table_reporte_semanas} (week_id, course_code, forum_id, work_id, quiz_id, pc_id)\n\t\t\t\t\t\tVALUES ({$i}, '{$course_code}', '0', '0', '0', '0' )")) {
return false;
}
}
}
}
$sql = "REPLACE INTO {$table_students_report} (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)\n\t\t\tSELECT cu.user_id, rs.id, 0, 0, 0, 0\n\t\t\tFROM {$table_course_rel_user} cu\n\t\t\tINNER JOIN {$courseTable} c\n\t\t\tON (c.id = cu.c_id)\n\t\t\tLEFT JOIN {$table_reporte_semanas} rs ON c.code = rs.course_code\n\t\t\tWHERE cu.status = 5 AND rs.course_code = '{$course_code}'\n\t\t\tORDER BY cu.user_id, rs.id";
if (!Database::query($sql)) {
return false;
} else {
$page = !isset($_GET['page']) ? 1 : $_GET['page'];
Database::query("UPDATE {$table_students_report} sr SET sr.work_ok = 1\n\t\tWHERE CONCAT (sr.user_id,',',sr.week_report_id)\n\t\tIN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)\n\t\tFROM {$table_work} w JOIN {$table_reporte_semanas} rs ON w.parent_id = rs.work_id)");
Database::query("UPDATE {$table_students_report} sr SET sr.thread_ok = 1\n\t\tWHERE CONCAT (sr.user_id,',',sr.week_report_id)\n\t\tIN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)\n\t\tFROM {$table_post} f JOIN {$table_reporte_semanas} rs ON f.thread_id = rs.forum_id)");
return showResults($course_info, $weeksCount, $page);
}
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:45,代码来源:tutor_report.lib.php
示例5: showContent
function showContent()
{
#----------------------------------------------------------------------
#--- In debug mode, just calculate freshly and don't cache
if (wcaDebug()) {
showResults();
return;
}
#--- If there's no cache or this is an update request, then freshly build the cache
if (!file_exists('generated/statistics.cache') || getBooleanParam('update8392')) {
$startTime = microtime_float();
ob_start();
showResults();
file_put_contents('generated/statistics.cache', ob_get_contents());
ob_end_clean();
$logMessage = sprintf("%s: Updating took %.2f seconds.", wcaDate(), microtime_float() - $startTime);
file_put_contents('generated/statistics.log', "{$logMessage}\n", FILE_APPEND);
echo "<p>{$logMessage}</p>";
}
#--- Show the cache
echo file_get_contents('generated/statistics.cache');
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:22,代码来源:statistics.php
示例6: printfive
function printfive($result)
{
$query = "SELECT questionText, answer1Text, answer2Text, postID FROM Question ORDER BY postID DESC;";
$result = mysql_query($query);
$record = mysql_fetch_array($result);
while ($record != false) {
$questionText = $record['questionText'];
$answer1Text = $record['answer1Text'];
$answer2Text = $record['answer2Text'];
$postID = $record['postID'];
$normalQuestion = stripslashes($questionText);
$normalA1 = stripslashes($answer1Text);
$normalA2 = stripslashes($answer2Text);
if (hasVoted($userID, $postID)) {
showResults($postID, $normalQuestion, $normalA1, $normalA2);
} else {
echo "\t<td>{$normalQuestion}</td> ";
echo <<<BLOCK2
\t\t\t\t<tr>
\t\t
\t\t\t\t\t<td>\t\t\t\t\t
\t\t\t\t\t\t\t<div onclick="location.href='vote.php?postID={$postID}&answerChoice=1'" class="ans1">
\t\t\t\t\t\t\t\t<input type="image" src="MidiateRedMan.png" name="redman"
\t\t\t\t\t\t\t\twidth="60" height="60" /> {$normalA1}      
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div onclick="location.href='vote.php?postID={$postID}&answerChoice=2'" class="ans2">
\t\t\t\t\t\t\t
\t\t\t\t\t\t\t {$normalA2} <input type="image" src="MidiateBlueMan.png" name="blueman"
\t\t\t\t\t\t\t\twidth="60" height="60" />
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
BLOCK2;
}
$record = mysql_fetch_array($result);
}
}
开发者ID:theemj,项目名称:CS407,代码行数:38,代码来源:answer_It.php
示例7: htmlspecialchars
?>
">
<input type="hidden" name="userid" value="<?php
echo htmlspecialchars($spotuser['userid']);
?>
">
<?php
if ($dialogembedded) {
?>
<input type="hidden" name="dialogembedded" value="1">
<?php
}
?>
<?php
showResults($result, array('renderhtml' => 1));
?>
<div id="edituserpreferencetabs" class="ui-tabs">
<ul>
<li><a href="#edituserpreftab-1"><span><?php
echo _('General');
?>
</span></a></li>
<?php
if ($tplHelper->allowed(SpotSecurity::spotsec_download_integration, '')) {
?>
<li><a href="#edituserpreftab-2"><span><?php
echo _('NZB handling');
?>
</span></a></li>
开发者ID:Ernie69,项目名称:spotweb,代码行数:31,代码来源:edituserprefs.inc.php
示例8: showResults
<?php
include "includes/form-messages.inc.php";
showResults($result);
开发者ID:Ernie69,项目名称:spotweb,代码行数:4,代码来源:markallasread.inc.php
示例9: showResults
<?php
use Defuse\Crypto\Crypto;
require_once 'autoload.php';
function showResults($type, $start, $end, $count)
{
$time = $end - $start;
$rate = $count / $time;
echo $type, ': ', $rate, ' calls/s', "\n";
}
// Note: By default, the runtime tests are "cached" and not re-executed for
// every call. To disable this, look at the RuntimeTest() function.
$start = \microtime(true);
for ($i = 0; $i < 1000; $i++) {
$key = Crypto::createNewRandomKey();
}
$end = \microtime(true);
showResults("createNewRandomKey()", $start, $end, 1000);
$start = \microtime(true);
for ($i = 0; $i < 100; $i++) {
$ciphertext = Crypto::encrypt(\str_repeat("A", 1024 * 1024), \str_repeat("B", 16));
}
$end = microtime(true);
showResults("encrypt(1MB)", $start, $end, 100);
$start = microtime(true);
for ($i = 0; $i < 1000; $i++) {
$ciphertext = Crypto::encrypt(\str_repeat("A", 1024), \str_repeat("B", 16));
}
$end = \microtime(true);
showResults("encrypt(1KB)", $start, $end, 1000);
开发者ID:boots7458,项目名称:elabftw,代码行数:30,代码来源:benchmark.php
示例10: json_decode
//define vars
$apikey = "fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4";
$limit = 10;
$page = $_GET['page'];
if ($page == 0 || !$_GET['page']) {
$page = 1;
}
if ($page == 1) {
$offset = 0;
} else {
$offset = ($page - 1) * $limit - 1;
}
$blog = $term . ".tumblr.com";
//grab current page's posts
$apidata = @file_get_contents("https://api.tumblr.com/v2/blog/{$blog}/posts?api_key={$apikey}&limit={$limit}&offset={$offset}");
if ($apidata !== FALSE) {
$apidata = json_decode($apidata);
$total_post_count = $apidata->response->total_posts;
//grab total count
$mypostsdata = $apidata->response->posts;
$mypostsdata = $apidata->response;
return json_encode($mypostsdata, JSON_PRETTY_PRINT);
} else {
return "Not Found";
}
}
//output
if ($_GET['q']) {
echo showResults(str_replace(' ', '', $_GET['q']));
//remove spaces before searching
}
开发者ID:socca1157,项目名称:Tumblr-API-Implementation-using-AJAX-PHP,代码行数:31,代码来源:search.php
示例11: showResults
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Phonebook Web Application</title>
<!-- instructor-provided CSS and Image links; do not modify -->
<link href="css/page.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="validator.js"></script>
</head>
<body>
<?php
include "header.html";
include "common.php";
if (isset($_POST["search"])) {
showResults($_POST["criteria"]);
} else {
showResults("");
}
include "footer.html";
?>
</body>
</html>
开发者ID:bahadircyildiz,项目名称:PhonebookPHP,代码行数:26,代码来源:index.php
示例12: htmlspecialchars
<?php
include "includes/form-messages.inc.php";
if (!showResults($result)) {
?>
<form class="edituserform" name="edituserform" action="<?php
echo $tplHelper->makeEditUserAction();
?>
" method="post">
<input type="hidden" name="edituserform[xsrfid]" value="<?php
echo $tplHelper->generateXsrfCookie('edituserform');
?>
">
<input type="hidden" name="userid" value="<?php
echo htmlspecialchars($edituserform['userid']);
?>
">
<fieldset>
<dl>
<dt><label for="edituserform[username]"><?php
echo _('Username');
?>
</label></dt>
<dd><input type="text" disabled="disabled" value="<?php
echo htmlspecialchars($edituserform['username']);
?>
"></dd>
<?php
if ($edituserform['userid'] > SPOTWEB_ANONYMOUS_USERID) {
?>
开发者ID:Ernie69,项目名称:spotweb,代码行数:31,代码来源:edituser.inc.php
示例13: showResults
<?php
include "includes/form-messages.inc.php";
/*
* Do we need to redirect on success? If so, perform this
*/
if (isset($data['performredirect']) && $result->isSuccess()) {
$tplHelper->redirect($loginform['http_referer']);
return;
}
# if
$didSubmitForm = showResults($result, $data);
/*
* If the form submission was successful, all output
* we wanted has already been sent (either the JSON
* or the redirect).
*
* If not, we try to re-render the form again
*/
if ($didSubmitForm && !isset($data['renderhtml'])) {
return;
}
# if
/*
* If no HTML headers are sent just yet, make sure
* we send them to the client
*/
if (!isset($data['htmlheaderssent'])) {
include_once "includes/basic-html-header.inc.php";
$data['renderhtml'] = true;
}
开发者ID:Sternisaea,项目名称:spotweb,代码行数:31,代码来源:login.inc.php
示例14: showResults
?>
</p>
<?php
}
?>
<?php
$city = 0;
if (isset($_GET['city'])) {
$city = $_GET['city'];
}
if (isset($_GET['page']) && !preg_match("#[^0-9]#", $_GET['page']) && $_GET['page'] != 0 && $_GET['page'] != '') {
$page = $_GET['page'];
} else {
$page = 1;
}
showResults($_GET['location'], $city, '', 0, '', '', $currentCountry, $page, new mysqli($QL_Host, $QL_User, $QL_Password, $QL_DB));
?>
</div>
<div class="right-container">
<?php
showSearchDiv(new mysqli($QL_Host, $QL_User, $QL_Password, $QL_DB), $currentCountry);
?>
</div>
</div>
<?php
} else {
开发者ID:rhondamoananui,项目名称:ec,代码行数:31,代码来源:index.php
示例15: mb_internal_encoding
<title>SELK - Search results for "<?php
print $_POST['search'];
?>
"</title>
<link href="./css/layout.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<?php
mb_internal_encoding("UTF-8");
include "./includes/functions.inc";
$searchstr = $_POST["search"];
$words = returnWords($searchstr);
$sites = findAndSortSites($words);
if (is_array($sites)) {
$results = showResults($sites);
$index = 1;
for ($i = 0; $i < sizeof($results); $i++) {
$index;
$url = $results[$i]['url'];
$title = $results[$i]['title'];
print "<p>{$index}. <a href=\"{$url}\">{$title}</a></p>";
$index++;
}
} else {
print $sites;
}
?>
</body>
</html>
开发者ID:larry482gr,项目名称:selk,代码行数:30,代码来源:results.php
示例16: Test
<?php
/**
* Tests the Issue model's core functionality
* @package Test
* @author Alan Hardman <[email protected]>
*/
require_once "base.php";
$test = new Test();
$issue = new Model\Issue();
$test->expect($issue->load(1) && $issue->id == 1, "Issue->load() by Integer");
$test->expect($issue->load(array('id = ?', 1)) && $issue->id == 1, "Issue->load() by String");
$test->expect(is_array($issue->getChildren()), "Issue->getChildren()");
$test->expect(is_array($issue->getAncestors()), "Issue->getAncestors()");
$test->expect($issue->save(false) && $issue->id, "Issue->save() without notifications");
// Output results
showResults($test);
开发者ID:phemmyster,项目名称:phproject,代码行数:17,代码来源:issues.php
示例17: defined
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* RSGallery is Free Software
*/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
global $rsgOptions_path;
require_once $rsgOptions_path . 'search.html.php';
$cid = JRequest::getVar('cid', array(), 'default', 'array');
$task = rsgInstance::getVar('task', null);
//Load stylesheet from current template
global $rsgConfig;
$template_dir = JURI_SITE . "/components/com_rsgallery2/templates/" . $rsgConfig->get('template');
$doc =& JFactory::getDocument();
$doc->addStyleSheet($template_dir . "/css/template.css", "text/css");
switch ($task) {
case 'showResults':
showResults();
break;
}
function showResults()
{
$database = JFactory::getDBO();
//Retrieve search string
$searchtext = rsgInstance::getVar('searchtext', '');
//Check searchtext against database
$sql = "SELECT *, a.name as itemname, a.id as item_id FROM #__rsgallery2_files as a, #__rsgallery2_galleries as b " . "WHERE a.gallery_id = b.id " . "AND (" . "a.title LIKE '%{$searchtext}%' OR " . "a.descr LIKE '%{$searchtext}%'" . ") " . "AND a.published = 1 " . "AND b.published = 1 " . "GROUP BY a.id " . "ORDER BY a.id DESC";
$database->setQuery($sql);
$result = $database->loadObjectList();
//show results
html_rsg2_search::showResults($result, $searchtext);
}
function showExtendedSearch()
开发者ID:realityking,项目名称:rsgallery2,代码行数:31,代码来源:search.php
示例18: csv_to_array
$("your-circle").circliful({
animationStep: 5,
foregroundBorderWidth: 5,
backgroundBorderWidth: 15,
percent:' . $value['Percent'] . '});
});
</script>';
if ($value['Percent'] <= 50) {
echo "<tr>";
echo "<td><img src ='images/CapstoneImages/{$value['Team One']}.png' style = 'opacity:0.4;'>";
echo "{$value['Team One']}</td>";
echo "<td>{$value['Percent']}%</td>";
echo "<td><img src ='images/CapstoneImages/{$value['Team Two']}.png'>";
echo "{$value['Team Two']}</td>";
echo '</tr>';
//echo $donut;
} else {
echo "<tr>";
echo "<td><img src ='images/CapstoneImages/{$value['Team One']}.png'>";
echo "{$value['Team One']}</td>";
echo "<td>{$value['Percent']}%</td>";
echo "<td><img src ='images/CapstoneImages/{$value['Team Two']}.png' style = 'opacity:0.4;'></td>";
echo "<td>{$value['Team Two']}</td>";
echo '</tr>';
}
}
$gameData = csv_to_array('final_results_.csv');
$team_one = $_POST['Home'];
$team_two = $_POST['Away'];
showResults($gameData, $team_one, $team_two);
开发者ID:TeamBall,项目名称:CapstoneProject,代码行数:30,代码来源:displayResults.php
示例19: _
<?php
include "includes/form-messages.inc.php";
if (showResults($result)) {
return;
}
# if
?>
<div class="newspotdiv">
<div></div> <!-- Empty div we can set loading to -->
<form class="newspotform" name="newspotform" id="newspotform" action="<?php
echo $tplHelper->makePostSpotAction();
?>
" method="post" enctype="multipart/form-data">
<input type="hidden" name="newspotform[xsrfid]" value="<?php
echo $tplHelper->generateXsrfCookie('newspotform');
?>
">
<input type="hidden" name="newspotform[newmessageid]" value="">
<input type="hidden" name="newspotform[submitpost]" value="Post">
<input type="hidden" name="newspotform[randomstr]" value="<?php
echo $tplHelper->getCleanRandomString(12);
?>
">
<fieldset>
<div>
<div class="categorydropdown">
<dt id='txtcategory'><?php
echo _('Category');
开发者ID:CptChaos,项目名称:spotweb,代码行数:31,代码来源:newspot.inc.php
示例20: processGET
/**
* Function to Process GET Requests
* @global string $resRoot
* @global string $resServer
* @global string $resType
* @global class array $db_tables
* @global class array $db_conn
* @global class $api
* @param string $input_data
*/
function processGET($input_data)
{
global $resRoot, $resServer, $resType, $db_tables, $db_conn, $api, $req_url;
// Get Directory - Includes Token as first parameter
$dir = explode("/", $input_data);
// Clean up array
$tmp = array();
foreach ($dir as $item) {
if (strlen($item) > 0) {
$tmp[] = $item;
}
}
$dir = $tmp;
$tmp = NULL;
// If API Key is true then the first element must be the API Key
$api_key = 'public';
$item_key = 0;
// Used to keep track of the array items
if ($api->getUseAPIKey()) {
$api_key = $dir[$item_key];
$valid = testAPIKey($api_key);
if (!$valid) {
exit(Error403($input_data));
}
$item_key++;
}
// If only API Key then show list of Connections
$conID = -9999;
$resConn = new DB_Connection();
if ($item_key + 1 > count($dir)) {
// Return a List of Connections
$resData = array();
$resCount = 0;
foreach ($db_conn as $conn) {
$resData[] = array("type" => "resource", "value" => $conn->getName(), "description" => $conn->getDesc(), "link" => $resServer . "/" . $conn->getName(), "id" => $conn->getID());
$resCount++;
}
showResults($resServer, $req_url, $resCount, $resData, $resType);
exit;
} else {
// Check that the Connection is Valid
$resData = array();
$resCount = 0;
foreach ($db_conn as $conn) {
if (strtolower($dir[$item_key]) == strtolower($conn->getName())) {
$conID = $conn->getID();
$resConn = $conn;
break;
}
// Get List just in-case needed
$resData[] = array("type" => "resource", "value" => $conn->getName(), "description" => $conn->getDesc(), "link" => $resServer . "/" . $conn->getName(), "id" => $conn->getID());
$resCount++;
}
// If Connection isn't found
if ($conID === -9999) {
showResults($resServer, $req_url, $resCount, $resData, $resType);
exit;
}
// Increment Item Key
$item_key++;
}
// Check if table is listed and valid
$tblID = -9999;
$resTable = new PublishTable();
if ($item_key + 1 > count($dir)) {
// Return a List of Tables
$resData = array();
$resCount = 0;
foreach ($db_tables as $tbl) {
if (strtolower($api_key) == 'public') {
if ($tbl->getPublicAccess() > 0) {
if ($tbl->getConnID() == $conID) {
$resData[] = array("type" => "resource", "value" => $tbl->getName(), "description" => $tbl->getDesc(), "link" => $resServer . "/" . $tbl->getName(), "id" => $tbl->getTableID());
$resCount++;
}
}
} else {
if ($tbl->getConnID() == $conID) {
$resData[] = array("type" => "resource", "value" => $tbl->getName(), "description" => $tbl->getDesc(), "link" => $resServer . "/" . $tbl->getName(), "id" => $tbl->getTableID());
$resCount++;
}
}
}
showResults($resServer, $req_url, $resCount, $resData, $resType);
exit;
} else {
// Check Table Name is Valid for this Connection
$resData = array();
$resCount = 0;
foreach ($db_tables as $tbl) {
//.........这里部分代码省略.........
开发者ID:iantidy,项目名称:rest-api,代码行数:101,代码来源:index.php
注:本文中的showResults函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论