本文整理汇总了PHP中NDB_Client类的典型用法代码示例。如果您正苦于以下问题:PHP NDB_Client类的具体用法?PHP NDB_Client怎么用?PHP NDB_Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NDB_Client类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Initialize all of the class variables and things required from the
* REQUEST.
*
* @return none, but as a side-effect modifies class
*/
function initialize()
{
ob_start('ob_gzhandler');
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize();
$this->caller =& NDB_Caller::singleton();
$this->caller->setDataEntryType('Direct');
if (empty($_REQUEST['key'])) {
throw new Exception("Missing parameter", 403);
}
$this->key = $_REQUEST['key'];
$DB = Database::singleton();
$this->TestName = $DB->pselectOne("SELECT Test_name FROM participant_accounts\n WHERE OneTimePassword=:key AND Status <> 'Complete'", array('key' => $this->key));
$this->CommentID = $DB->pselectOne("SELECT CommentID FROM participant_accounts \n WHERE OneTimePassword=:key AND Status <> 'Complete'", array('key' => $this->key));
$this->NumPages = $DB->pselectOne("SELECT COUNT(*) FROM instrument_subtests WHERE Test_name=:TN", array('TN' => $this->TestName));
if (empty($this->TestName) && empty($this->CommentID)) {
throw new Exception("Data has already been submitted.", 403);
}
$pageNum = null;
if (!empty($_REQUEST['pageNum'])) {
$pageNum = $_REQUEST['pageNum'];
}
if ($pageNum === 'finalpage') {
$this->Subtest = 'finalpage';
} else {
$this->Subtest = $DB->pselectOne("SELECT Subtest_name\n FROM instrument_subtests\n WHERE Test_name=:TN AND Order_number=:PN", array('TN' => $this->TestName, 'PN' => $pageNum));
}
$totalPages = $DB->pselectOne("SELECT COUNT(*)+1 from instrument_subtests WHERE Test_name=:TN", array('TN' => $this->TestName));
$this->NextPageNum = $this->getNextPageNum($pageNum);
$this->PrevPageNum = $this->getPrevPageNum($pageNum);
$this->CommentID = $this->getCommentID();
$this->tpl_data = array('nextpage' => $this->NextPageNum, 'prevpage' => $this->PrevPageNum, 'pageNum' => $pageNum ? $pageNum + 1 : 1, 'totalPages' => $totalPages, 'key' => $this->key);
}
开发者ID:frankbiospective,项目名称:Loris,代码行数:40,代码来源:survey.php
示例2: setUp
function setUp()
{
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize();
$this->DB = Database::singleton();
$this->DB->setFakeTableData("test_names", array(array('ID' => 1, 'Test_name' => 'ActiveTestByAge', 'Full_name' => 'Active Test 1', 'Sub_group' => 1, 'IsDirectEntry' => 0), array('ID' => 2, 'Test_name' => 'ActiveTestByAge2', 'Full_name' => 'Active Test 2', 'Sub_group' => 1, 'IsDirectEntry' => 0), array('ID' => 3, 'Test_name' => 'InactiveTest', 'Full_name' => 'Inactive Test 1', 'Sub_group' => 1, 'IsDirectEntry' => 0), array('ID' => 4, 'Test_name' => 'ActiveTestByVisit', 'Full_name' => 'Active Test by Visit 1', 'Sub_group' => 1, 'IsDirectEntry' => 0), array('ID' => 5, 'Test_name' => 'ActiveTestByVisit2', 'Full_name' => 'Active Test by Visit 2', 'Sub_group' => 1, 'IsDirectEntry' => 0), array('ID' => 6, 'Test_name' => 'ActiveTestByFirstVisit', 'Full_name' => 'Active Test by First Visit 2', 'Sub_group' => 1, 'IsDirectEntry' => 0), array('ID' => 7, 'Test_name' => 'ActiveTestByNotFirstVisit', 'Full_name' => 'Active Test by Not First Visit 2', 'Sub_group' => 1, 'IsDirectEntry' => 0)));
$this->DB->setFakeTableData("test_battery", array(array('ID' => 1, 'Test_name' => 'ActiveTestByAge', 'AgeMinDays' => 0, 'AgeMaxDays' => 100, 'Active' => 'Y', 'Stage' => 'Visit', 'SubprojectID' => 1, 'Visit_label' => null, 'CenterID' => null, 'firstVisit' => null), array('ID' => 2, 'Test_name' => 'ActiveTestByAge2', 'AgeMinDays' => 0, 'AgeMaxDays' => 100, 'Active' => 'Y', 'Stage' => 'Visit', 'SubprojectID' => 1, 'Visit_label' => null, 'CenterID' => '1', 'firstVisit' => null), array('ID' => 3, 'Test_name' => 'InactiveTest', 'AgeMinDays' => 0, 'AgeMaxDays' => 0, 'Active' => 'N', 'Stage' => 'Visit', 'SubprojectID' => 2, 'Visit_label' => 'V01', 'CenterID' => '1', 'firstVisit' => null), array('ID' => 4, 'Test_name' => 'ActiveTestByVisit', 'AgeMinDays' => 0, 'AgeMaxDays' => 0, 'Active' => 'Y', 'Stage' => 'Visit', 'SubprojectID' => 2, 'Visit_label' => 'V01', 'CenterID' => null, 'firstVisit' => null), array('ID' => 5, 'Test_name' => 'ActiveTestByVisit2', 'AgeMinDays' => 0, 'AgeMaxDays' => 0, 'Active' => 'Y', 'Stage' => 'Visit', 'SubprojectID' => 2, 'Visit_label' => 'V01', 'CenterID' => '1', 'firstVisit' => null), array('ID' => 6, 'Test_name' => 'ActiveTestByFirstVisit', 'AgeMinDays' => 0, 'AgeMaxDays' => 100, 'Active' => 'Y', 'Stage' => 'Visit', 'SubprojectID' => 1, 'Visit_label' => null, 'CenterID' => '1', 'firstVisit' => 'Y'), array('ID' => 7, 'Test_name' => 'ActiveTestByNotFirstVisit', 'AgeMinDays' => 0, 'AgeMaxDays' => 100, 'Active' => 'Y', 'Stage' => 'Visit', 'SubprojectID' => 1, 'Visit_label' => null, 'CenterID' => '1', 'firstVisit' => 'N')));
}
开发者ID:frankbiospective,项目名称:Loris,代码行数:9,代码来源:BatteryLookup_Test.php
示例3: testSetFakeData
function testSetFakeData()
{
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize();
$DB = Database::singleton();
$DB->setFakeTableData("Config", array(0 => array('ID' => 99999, 'ConfigID' => '123456', 'Value' => 'FKE1234')));
$allCandidates = $DB->pselect("SELECT * FROM Config", array());
$this->assertEquals($allCandidates, array(0 => array('ID' => 99999, 'ConfigID' => 123456, 'Value' => 'FKE1234')));
}
开发者ID:frankbiospective,项目名称:Loris,代码行数:10,代码来源:Database_Test.php
示例4: __construct
/**
* Validates the data which was passed in the request.
*
* @param string $method The HTTP method of the request
* @param array $data The array-encode JSON posted to
* the URL.
*/
function __construct($method, $data = array())
{
$this->AllowedMethods = array('POST');
$this->RequestData = $data;
if (!in_array($method, $this->AllowedMethods)) {
$this->header("HTTP/1.1 405 Method Not Allowed");
$this->header("Allow: " . join(", ", $this->AllowedMethods));
$this->safeExit(0);
}
$client = new \NDB_Client();
// Bypass session handling because we're trying to authenticate a session
$client->makeCommandLine();
$client->initialize(__DIR__ . "/../../../project/config.xml");
$this->HTTPMethod = $method;
$this->handleRequest();
}
开发者ID:spaiva,项目名称:Loris,代码行数:23,代码来源:Login.php
示例5: set_include_path
<?php
/**
* User: Stella
* Date: 15-08-15
*
* Project Statistics - Updating Counts From Each LORIS
*/
set_include_path(get_include_path() . ":../php/libraries:");
require_once __DIR__ . "/../vendor/autoload.php";
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize('../project/config.xml');
$db =& Database::singleton();
$config = NDB_Config::singleton();
$date = date("m_d_Y");
$output_file = "project_statistics_{$date}.csv";
$fp = fopen($output_file, 'w');
echo "PROJECT STATISTICS SCRIPT - {$date}\n\n";
echo "Data can be found in {$output_file}.\n\n";
$headers = array('Project', 'Number of Scanning - Visits', 'Number of Sites', 'Variable Count', 'Number of instruments', 'total number of visits (for all candidates)', 'number of candidates', 'GB of imaging data (raw and processed)', '# of scans');
$counter = 0;
// Where project's statistics will be stored
$project_statistics = array();
// Project name
$projectname = $config->getSetting('title');
// Number of Scanning - Visits
$number_scanning_visits = $db->pselect("select count(*) from session where Scan_done='Y'", array());
// Number of Sites
$number_sites = $db->pselect("select count(*) from psc WHERE CenterID <>1", array());
// Variable Count
开发者ID:frankbiospective,项目名称:Loris,代码行数:31,代码来源:generate_project_statistics_csv.php
示例6: set_include_path
*
* Usage:
* php data_dictionary_builder.php
*
* PHP Version 5
*
* @category Behavioural
* @package Main
* @author Loris Team <[email protected]>
* @license Loris License
* @link https://github.com/aces/Loris
*/
set_include_path(get_include_path() . ":../project/libraries:../php/libraries:");
require_once __DIR__ . "/../vendor/autoload.php";
$configFile = "../project/config.xml";
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize($configFile);
$DB = Database::singleton();
// define which configuration file we're using for this installation
//Get the entries we already have in the DB
getColumns("Select Name, ParameterTypeID from parameter_type", $DB, $parameter_types);
//Delete in the parameter_type table relating to
//parameter_type_category.Type = 'Instrument', without affecting other entries.
//get parameter_type_category.Type ='Instrument' ParamenterTypeCategoryIDs
getColumn("SELECT ParameterTypeCategoryID\n FROM parameter_type_category\n WHERE Type = 'Instrument'", $DB, $instrumentParameterTypeCategoryIDs);
$instrumentParameterTypeCategoryIDString = implode(', ', $instrumentParameterTypeCategoryIDs);
//get all 'Instrument' ParameterTypeIDs
getColumn("SELECT ParameterTypeID\n FROM parameter_type_category_rel\n WHERE ParameterTypeCategoryID\n IN ({$instrumentParameterTypeCategoryIDString})", $DB, $instrumentParameterTypeIDs);
$instrumentParameterTypeIDString = implode(', ', $instrumentParameterTypeIDs);
//delete all 'Instrument' entries from parameter_type_category_rel
开发者ID:frankbiospective,项目名称:Loris,代码行数:31,代码来源:data_dictionary_builder.php
示例7: ini_set
<?php
/* This is used by the stats page to get the list of scorable columns for an
* instrument via AJAX. It's used so that ScatterPlot-SVG.php can be run for
* any scorable in an instrument, dynamically */
ini_set('default_charset', 'utf-8');
require_once "Database.class.inc";
require_once 'NDB_Config.class.inc';
require_once 'NDB_Client.class.inc';
$config =& NDB_Config::singleton();
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize();
require_once "Utility.class.inc";
$cols = Utility::getScoreColsForInstrument($_REQUEST['instrument']);
if (strrpos($_REQUEST['instrument'], "_proband") === false) {
print "Candidate_Age\n";
}
foreach ($cols as $val) {
print "{$val}\n";
}
开发者ID:spaiva,项目名称:Loris,代码行数:21,代码来源:GetScoreLabels.php
示例8: header
<?php
$user =& User::singleton();
if (!$user->hasPermission('dataquery_view')) {
header("HTTP/1.1 403 Forbidden");
exit;
}
require_once __DIR__ . '/../../../vendor/autoload.php';
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize(__DIR__ . "/../../../project/config.xml");
$cdb = CouchDB::singleton();
$category = $_REQUEST['category'];
$results = $cdb->queryView("DQG-2.0", "datadictionary", array("reduce" => "false", "startkey" => "[\"{$category}\"]", "endkey" => "[\"{$category}\", \"ZZZZZZZZ\"]"));
print json_encode($results);
开发者ID:spaiva,项目名称:Loris,代码行数:15,代码来源:datadictionary.php
示例9: header
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/Loris/
*/
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
header("Access-Control-Allow-Credentials: true");
}
set_include_path(get_include_path() . ":../project/libraries:../php/libraries:");
require_once __DIR__ . "/../vendor/autoload.php";
ini_set('default_charset', 'utf-8');
ob_start('ob_gzhandler');
// Create an output buffer to capture console output, separately from the
// gzip handler.
ob_start();
// load the client
$client = new NDB_Client();
if ($client->initialize() == false) {
return false;
}
// require additional libraries
$TestName = isset($_REQUEST['test_name']) ? $_REQUEST['test_name'] : 'dashboard';
$subtest = isset($_REQUEST['subtest']) ? $_REQUEST['subtest'] : '';
// make local instances of objects
$config =& NDB_Config::singleton();
//--------------------------------------------------
/**
* Extracts a parameter from request in a safe way,
* and sets the $tpl_data to said request. If request does
* not contain parameter, will set the smarty variable to
* empty
*
开发者ID:spaiva,项目名称:Loris,代码行数:31,代码来源:main.php
示例10: header
* @package Document Repository
* @author Dave MacFarlane <[email protected]>
* @license Loris license
* @link https://github.com/aces/Loris-Trunk
*
*/
$user =& User::singleton();
if (!$user->hasPermission('document_repository_view') && !$user->hasPermission('document_repository_delete')) {
header("HTTP/1.1 403 Forbidden");
exit;
}
// Load config file and ensure paths are correct
set_include_path(get_include_path() . ":" . __DIR__ . "/../project/libraries:" . __DIR__ . "/../php/libraries");
// Ensures the user is logged in, and parses the config file.
require_once "NDB_Client.class.inc";
$client = new NDB_Client();
$client->initialize("../project/config.xml");
// Checks that config settings are set
$config =& NDB_Config::singleton();
$File = $_GET['File'];
// Make sure that the user isn't trying to break out of the $path by
// using a relative filename.
// No need to check for '/' since all downloads are relative to $basePath
if (strpos("..", $File) !== false) {
error_log("ERROR: Invalid filename");
header("HTTP/1.1 400 Bad Request");
exit(4);
}
$FullPath = __DIR__ . "/../user_uploads/{$File}";
if (!file_exists($FullPath)) {
error_log("ERROR: File {$FullPath} does not exist");
开发者ID:frankbiospective,项目名称:Loris,代码行数:31,代码来源:GetFile.php
示例11: set_include_path
* that follows the user in Loris.
*
* PHP Version 5
*
* @category Behavioural
* @package Loris
* @author Loris Team <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/Loris/
*/
set_include_path(get_include_path() . ":../project/libraries:../php/libraries:");
require_once __DIR__ . '/../vendor/autoload.php';
ini_set('default_charset', 'utf-8');
ob_start('ob_gzhandler');
require_once "NDB_Client.class.inc";
$client = new NDB_Client();
$client->initialize();
$config =& NDB_Config::singleton();
$paths = $config->getSetting('paths');
// create user object
$user =& User::singleton();
if (PEAR::isError($user)) {
die("Error creating user object: " . $user->getMessage());
}
$tpl_data['userID'] = $user->getData('UserID');
// set permissions
if ($user->hasPermission('bvl_feedback')) {
$tpl_data['has_permission'] = true;
}
// create candidate object if we have a candID
if (!empty($_REQUEST['candID'])) {
开发者ID:neuromandaqui,项目名称:loris,代码行数:31,代码来源:feedback_bvl_popup.php
注:本文中的NDB_Client类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论