本文整理汇总了PHP中R::exportAll方法的典型用法代码示例。如果您正苦于以下问题:PHP R::exportAll方法的具体用法?PHP R::exportAll怎么用?PHP R::exportAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::exportAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postRankings
function postRankings($classId, $rankings)
{
$class = R::load(SHOWCLASS, $classId);
if (!$class->id) {
return null;
}
$participations = R::exportAll($class->ownParticipation);
if ($participations == null) {
return null;
}
foreach ($rankings as $key => $value) {
$riderId = $value->id;
$rank = $value->rank;
if ($riderId == null || $rank == null) {
return null;
}
$rider = R::load(USER, $riderId);
if (!$rider->id) {
continue;
}
foreach ($participations as $participationGetter) {
$participation = R::load(PARTICIPATION, $participationGetter[ID]);
if ($participation->rider_id == $riderId) {
$participation->rank = $rank;
R::store($participation);
break;
}
}
}
return R::store($class);
}
示例2: index
function index($f3)
{
$D = \R::find($this->model_name(), 'ORDER BY displayname ASC');
if ($D) {
$f3->set('data', \R::exportAll($D));
} else {
$f3->set('data', '');
}
show_page($f3, $this->template_name() . '.index');
}
示例3: getList
/**
* Return all records for a type
* @param string $type Database table
* @return string JSON All of the records and their contents
* @throws API\Exceptions\APIException No records found, 404
*/
public static function getList($type)
{
$beans = R::find($type);
$response = R::exportAll($beans);
if (sizeof($response) > 0) {
return new JSON(array("data" => $response));
} else {
throw new APIException("No " . $type . " records found.", 404);
}
}
示例4: index
function index($f3)
{
$D = \R::findOne('tools', 'name=?', array($f3->get('PARAMS.name')));
if ($D) {
$exportTmp = \R::exportAll($D);
$f3->set('data', $exportTmp[0]);
} else {
$f3->set('data', '');
}
show_page($f3, $this->template_name() . '.index');
}
示例5: testbook
function testbook()
{
global $app;
try {
$book = R::findAll('book');
// var_dump($book);
echo json_encode(R::exportAll($book));
} catch (Exception $e) {
$app->response()->status(400);
$app->response()->header('X-Status-Reason', $e->getMessage());
}
}
示例6: getIndice
function getIndice($idsubmenu)
{
//$indices = R::findAll( 'indice', "submenu_id = ?", array($idsubmenu));
//$indices = R::find( 'indice', "submenu_id = ? ORDER BY id DESC", array($idsubmenu));
//$indices = R::find( 'indices', "submenu_id = ?", array($idsubmenu));
//echo $indices;
//return $indices->export();
$indices = R::find('indice', ' submenu_id = ? ORDER BY titulo ASC', array($idsubmenu));
//$indices = R::load( 'indice', 1 );
//return $indices->exportAll;
return R::exportAll($indices);
}
示例7: get_BasicInfo
public function get_BasicInfo($ProductId)
{
try {
$product = R::find('product', 'id=?', array($ProductId));
if (!isset($product) || empty($product)) {
throw new RecordNotFoundException("Record not found, id:" . $ProductId);
}
echo ResponseJsonHandler::normalizeJsonResponse(R::exportAll($product));
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}
示例8: info
function info($f3)
{
$toolgroups = \R::findAll('toolgroups', 'ORDER BY sort_priority DESC, displayname ASC');
foreach ($toolgroups as $key => $element) {
$toolgroups[$key]->with("ORDER BY displayname ASC")->ownTools;
}
$f3->set('toolgroups', \R::exportAll($toolgroups));
$user = \R::findOne('users', 'username=?', array($this->username));
$f3->set('user', $user);
$trainings = \R::find('trainings', 'users_id=?', array($user->id));
$f3->set('trainings', $trainings ? reset($trainings)->build_lookup($trainings) : false);
show_page($f3, 'user');
}
示例9: index
function index($f3)
{
$tools = \R::find('tools');
$D = \R::findAll('toolgroups', 'ORDER BY sort_priority DESC, displayname ASC');
foreach ($D as $key => $element) {
$D[$key]->with("ORDER BY displayname ASC")->ownTools;
}
$f3->set('toolgroups', \R::exportAll($D));
$trainings = \R::find('trainings');
$f3->set('trainings', $trainings ? reset($trainings)->build_lookup($trainings) : false);
$users = \R::find('users', 'active=1 ORDER BY usergroup ASC, displayname ASC');
$f3->set('usergroups', $users ? reset($users)->group($users) : $users);
show_page($f3, 'trainings.index', true);
}
示例10: get
function get($clientid = NULL, $id = NULL)
{
if ($clientid != NULL) {
$client = R::load('client', $clientid);
if ($id === NULL) {
return $client->with(' ORDER BY pos ASC ')->ownMenu;
} else {
return $client->ownMenu[$id];
}
} else {
$menu = R::load("menu", $id);
return R::exportAll($menu);
}
}
示例11: edit_form
function edit_form($f3)
{
// Get Toolgroup Options
$D = \R::findAll('toolgroups', 'ORDER BY sort_priority DESC, displayname ASC');
$f3->set('toolgroups', \R::exportAll($D));
// Get Training Levels
$f3->set('training_levels', $f3->exists('data.training_levels') ? json_decode($f3->get('data.training_levels')) : $f3->get('TRAINING_LEVELS'));
// Get Location Options
$D = \R::findAll('locations', 'ORDER BY displayname ASC');
$f3->set('locations', \R::exportAll($D));
foreach ($f3->get('locations') as $i => $location) {
$f3->set('locations.' . $i . '.active', isset($this->D->sharedLocationsList[$locations['id']]));
}
parent::edit_form($f3);
}
示例12: testCopyRecursion
/**
* Test whether recursion happens
*/
public function testCopyRecursion()
{
$document = R::dispense('document');
$id = R::store($document);
$document->ownDocument[] = $document;
R::store($document);
$duplicate = R::dup($document);
R::store($duplicate);
$duplicate = R::load('document', $id);
asrt((int) $document->document_id, $id);
asrt((int) $duplicate->document_id, $id);
// Export variant
$duplicate = R::exportAll($document);
asrt((int) $duplicate[0]['document_id'], $id);
}
示例13: getbyid
function getbyid($id)
{
global $app;
try {
$article = R::findOne('articles', 'id=?', array($id));
if ($article) {
echo json_encode(R::exportAll($article));
} else {
throw new ResourceNotFoundException();
}
} catch (ResourceNotFoundException $e) {
$app->response()->status(404);
} catch (Exception $e) {
$app->response()->status(400);
$app->response()->header('X-Status-Reason', $e->getMessage());
}
}
示例14: post
public function post()
{
try {
/*$requestBody = $app->request->getBody();
$requestJson = json_decode($requestBody, true);*/
$requestJson = RequestBodyHandler::getJsonBody($this->_app);
RequestBodyHandler::verifyJsonBody($requestJson, array("ProductId", "Comment", "ConsumerId"));
$obj = R::dispense('productcomment');
$obj->productid = $requestJson->ProductId;
$obj->comment = $requestJson->Comment;
$obj->consumerid = $requestJson->ConsumerId;
$obj->lastmodifiedtime = now();
$id = R::store($obj);
$response = R::find('productcomment', 'id=?', array($id));
echo ResponseJsonHandler::normalizeJsonResponse(R::exportAll($response));
//sendSuccess(json_encode(R::exportAll($obj)), 201);
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}
示例15: function
$app->get('/schoolContract', function () use($app) {
$sql = "select agent.oname as oname, contract.price as price, school.* from contract" . " join agent on agent.aid = contract.aid join school on school.id = contract.sid";
try {
$result = R::getAll($sql);
$data = R::convertToBeans('contract', $result);
success(R::exportAll($data));
} catch (RedBeanPHP\RedException\SQL $e) {
fail($e);
}
});
$app->get('/student/:id', function ($id) use($app) {
$sql = "select school.name as sname, user.* from school join user on user.sid='" . $id . "'";
try {
$result = R::getAll($sql);
$data = R::convertToBeans('user', $result);
success(R::exportAll($data));
} catch (RedBeanPHP\RedException\SQL $e) {
fail($e);
}
});
$app->get('/', function () use($app) {
header("Location: intro.php");
die;
});
function setUnique($bean, $arr)
{
$bean->setMeta("buildcommand.unique", array($arr));
}
function safeStore($obj)
{
try {