本文整理汇总了PHP中Parse\ParseQuery::descending方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::descending方法的具体用法?PHP ParseQuery::descending怎么用?PHP ParseQuery::descending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::descending方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQuery
public function getQuery()
{
$query = new ParseQuery(Constant::$CLIENT_CONTACT_INFO_CLASS_NAME);
// $query->equalTo(Constant::$KEY_FIRST_NAME, $firstName);
$query->descending("createdAt");
$results = $query->find();
return $results;
}
示例2: traerNoticiasSeccion
public function traerNoticiasSeccion($seccion)
{
$query = new ParseQuery("noticias");
$query->descending("fecha");
$query->equalTo("seccion", $seccion);
$results = $query->find();
return $results;
}
示例3: showHome
public function showHome(Request $request)
{
$current_user = ParseUser::getCurrentUser();
if (!$current_user) {
return redirect()->route('login');
}
$query = ParseUser::query();
$current_user = $query->get($current_user->getObjectId());
Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
$query = new ParseQuery("ChatRoom");
$query->equalTo('members', $current_user);
try {
$chatRooms = $query->find();
$query = new ParseQuery("Messages");
$query->containedIn("chatRoom", $chatRooms);
$query->descending('createdAt');
$query->includeKey('chatRoom');
$query->includeKey('user');
$query->limit(20);
$messages = $query->find();
$data = [];
foreach ($messages as $message) {
$chatRoom = $message->get('chatRoom');
$event = $chatRoom->get('event');
$evQuery = new ParseQuery('Events');
$evQuery->includeKey('group');
$event = $evQuery->get($event->getObjectId());
$group = $event->get('group');
$relation = $message->getRelation("asset");
$aqry = $relation->getQuery();
$assets = $aqry->find();
$temp = ['group' => $group, 'event' => $event, 'chatRoom' => $chatRoom, 'message' => ['msg' => $message, 'assets' => $assets], 'user' => $message->get('user')];
$data[] = $temp;
}
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
echo $ex->getMessage();
}
$renderData = $this->getRenderData($request);
$renderData['user'] = $current_user;
$renderData['activeBarTab'] = "dashboard";
$renderData['data'] = $data;
return view('home', $renderData);
}
示例4: get_events
public function get_events($credentials)
{
ParseClient::initialize($credentials->app_id, $credentials->rest_key, $credentials->master_key);
$query = new ParseQuery("Events");
$query->descending("createdAt");
$result = $query->find();
$events = array();
foreach ($result as $event) {
$eventObj = new stdClass();
$eventObj->id = $event->getObjectId();
$eventObj->name = $event->get("name");
$eventObj->description = $event->get("description");
$thumbnail = $event->get("thumbnail");
$eventObj->image = $thumbnail->getURL();
$eventObj->date = $event->getCreatedAt();
array_push($events, $eventObj);
}
return $events;
}
示例5: enviarAtualizacao
/**
* Envia push de atualizaçao.
*
* @return Response
*/
public function enviarAtualizacao()
{
try {
ParseClient::initialize('YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0', 'zNGQwg11i4fQRhGUCZIR777A8VRWjCqe3BQeZgDI', '4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o');
$session = Cache::get('sessionToken', 'default');
$usuario = ParseUser::become($session);
$texto = Input::get('texto');
$atualizacaoQuery = new ParseQuery("Atualizacao");
$atualizacaoQuery->descending("numero");
$ultimaAtualizacao = $atualizacaoQuery->first();
$novoNumero = $ultimaAtualizacao->get('numero') + 1;
$novaAtualizacao = new ParseObject("Atualizacao");
$novaAtualizacao->set('numero', $novoNumero);
$novaAtualizacao->set('usuario', $usuario);
$novaAtualizacao->set('texto', $texto);
$novaAtualizacao->save();
// $fields = array('Accept'=>'application/json',
// 'X-Parse-Application-Id' => 'YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0',
// 'X-Parse-Master-Key' => '4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o');
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, 'https://api.parse.com/1/jobs/jobTeste');
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
// curl_setopt($ch, CURLOPT_HEADER, $fields);
// curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// // curl_setopt(CURLOPT_USERPWD, 'XXXXXX');
// $result = curl_exec($ch);
// curl_close($ch);
// $cmd='curl -X POST \
// -H \"X-Parse-Application-Id: YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0\" \
// -H \"X-Parse-Master-Key: 4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o\" \
// -H \"Content-Type: application/json\" \
// -d \"{\"plan\":\"paid\"}\" \
// https://api.parse.com/1/jobs/jobTeste';
// Log::info($cmd);
// exec($cmd,$result);
Log::info("CHEGUEI NEGAO");
// Log::info($result);
return 200;
} catch (ParseException $error) {
return $error;
}
}
示例6: ParseQuery
if ($LastSyncTime == 0) {
$query = new ParseQuery("PRIVILEGE");
$query->equalTo("DEL", 0);
$query->descending("POST_TS");
try {
$result = $query->find();
// The object was retrieved successfully.
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
}
} elseif ($LastSyncTime > 0) {
$query = new ParseQuery("PRIVILEGE");
$query->equalTo("DEL", 0);
$query->greaterThan($LastSyncTime);
$query->descending("POST_TS");
try {
$result = $query->find();
// The object was retrieved successfully.
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
}
}
if (count($result) > 0) {
if (count($result) > 0) {
$toSend = array();
for ($c = 0; $c < count($result); $c++) {
//$toSend[$c] = json_decode($result[$c]->get("data"), true);
$toSend[$c]["POST_TS"] = $result[$c]->get("POST_TS") ? $result[$c]->get("POST_TS") : 0;
$toSend[$c]["PRIVI_TS"] = $result[$c]->get("PRIVI_TS") ? $result[$c]->get("PRIVI_TS") : 0;
示例7: ParseQuery
} else {
//Se utilizador estiver a continuar curso
$enrollquery = new ParseQuery("Enrolled");
$enrollquery->equalTo("User", $currentUser);
$enrollquery->equalTo("Course", $course);
$enrolled = $enrollquery->first();
$enrolled->fetch();
$class = $enrolled->get("NextClass");
$class->fetch();
$classnumber = $class->get("ClassNumber");
$classquery->equalTo("ClassNumber", $classnumber);
$class = $classquery->first();
}
$commentsQuery = new ParseQuery("Comment");
$commentsQuery->equalTo("Class", $class);
$commentsQuery->descending("createdAt");
$comments = $commentsQuery->find();
$doubtsQuery = new ParseQuery("Doubt");
$doubtsQuery->equalTo("Class", $class);
$doubts = $doubtsQuery->find();
$lastclass = intval($classnumber) == intval($lastclassnumber);
?>
<div class="col-md-12">
<span style="<font-size: small"><a href="index.php">Home</a> > <a href="courses.php">Cursos</a> > <a href="course.php?course=<?php
echo $courseTitle;
?>
"> <?php
echo $courseTitle;
?>
</a> > <a href="class.php?course=<?php
echo $courseTitle;
示例8: do_update
public function do_update(array $params = [])
{
$mark = array();
for ($x = 0; $x < count($_POST['title']); $x++) {
$tag = new ParseObject("BrandTag");
$tag->set("xCoordinate", (double) $_POST['x'][$x]);
$tag->set("yCoordinate", (double) $_POST['y'][$x]);
$tag->set("tagName", $_POST['title'][$x]);
$tag->save();
$query = new ParseQuery("BrandTag");
$query->descending("createdAt");
$object = $query->first();
$idq = $object->getObjectId();
$mark[] = array('__type' => 'Pointer', 'className' => 'BrandTag', 'objectId' => '' . $idq . '');
}
$brandName = $_POST['brandName'];
$id = $_POST['id'];
$query = new ParseQuery("BrandPost");
$query->equalTo("objectId", $id);
$question = $query->first();
$question->setArray("tagArray", $mark);
$question->set("brandName", $brandName);
$question->set("content", $_POST['content']);
if (isset($_POST['items'])) {
$it = array();
foreach ($_POST['items'] as $item) {
$it[] = array('__type' => 'Pointer', 'className' => 'BrandItem', 'objectId' => '' . $item . '');
$question->setArray("brandItems", $it);
}
}
if (isset($_FILES['image']) && !empty($_FILES['image'])) {
if (($_FILES["image"]["type"] == "image/png" || $_FILES["image"]["type"] == "image/gif" || $_FILES["image"]["type"] == "image/jpg" || $_FILES["image"]["type"] == "image/jpeg") && $_FILES["image"]["size"] < 10000000) {
$size = getimagesize($_FILES['image']['tmp_name']);
$file = ParseFile::createFromData(file_get_contents($_FILES['image']['tmp_name']), $_FILES['image']['name']);
$file->save();
$question->set("postImage", $file);
}
}
$question->save();
redirect(ADMIN_URL . 'brand_post');
$this->template = false;
}
示例9: testOrderByUpdatedAtDesc
public function testOrderByUpdatedAtDesc()
{
$numbers = [3, 1, 2];
$objects = [];
$this->saveObjects(3, function ($i) use($numbers, &$objects) {
$obj = ParseObject::create("TestObject");
$obj->set('number', $numbers[$i]);
$objects[] = $obj;
return $obj;
});
$objects[1]->set('number', 4);
$objects[1]->save();
$query = new ParseQuery("TestObject");
$query->descending('updatedAt');
$results = $query->find();
$this->assertEquals(3, count($results), 'Did not return correct number of objects.');
$expected = [4, 2, 3];
for ($i = 0; $i < 3; $i++) {
$this->assertEquals($expected[$i], $results[$i]->get('number'), 'Did not return the correct object.');
}
}
示例10: ParseQuery
$query->equalTo("customer", $customer);
$loans = $query->find();
//render a template
echo $template->render(array('title' => $title, 'loans' => $loans));
} else {
if (empty($_GET["cid"])) {
$template = $twig->loadTemplate('dashboard.html');
$query = new ParseQuery("loan");
$query->notEqualTo("status", 0);
$results = $query->find();
//render a template
echo $template->render(array('title' => 'Самбар', 'loans' => $results));
} else {
if ($_GET["cid"] == 2) {
$query = new ParseQuery("loan_types");
$query->descending("createdAt");
$results = $query->find();
$template = $twig->loadTemplate('add_loan.html');
//render a template
echo $template->render(array('title' => 'Шинэ зээл', 'loan_types' => $results));
} else {
if ($_GET["cid"] == 3) {
$template = $twig->loadTemplate('setting.html');
$query = new ParseQuery("loss");
$query->equalTo("status", 1);
$loss = $query->first();
$query = new ParseQuery("loan_types");
$query->equalTo("status", 1);
$types = $query->find();
$query = new ParseQuery("loan_rates");
$query->equalTo("status", 1);
示例11: json_encode
<?php
require 'vendor/autoload.php';
use Parse\ParseClient;
ParseClient::initialize('dmQvhxGKjh4X6P5nxzNffRnabjcGUisTeDojvEAU', 'u78LiI8n82MUqWayzDQmg3QTNK3bAMIa1wt6cgD9', '8UKXvRKkfT37TlYNuzNeaVhvmQv8mLzWniKCzTvp');
use Parse\ParseObject;
use Parse\ParseQuery;
$q = new ParseQuery("Students");
$q->descending('createdAt');
$r = $q->find();
$total_data = array();
foreach ($r as $value) {
$name = $value->get("Name");
$fathername = $value->get("FatherName");
$dob = $value->get("DateOfBirth");
$group = $value->get("Group");
$xclass = $value->get("Class");
$school_id = $value->get("SchoolID");
$data = array("Name" => $name, "FatherName" => $fathername, "DOB" => $dob, "Group" => $group, "Class" => $xclass, "SchoolID" => $school_id);
array_push($total_data, $data);
}
echo json_encode($total_data);
//}
//catch (ParseException $ex) {
//}
示例12: catch
// The object was retrieved successfully.
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
}
//////////////////////////////////////////////////////////////////////
//do this if app wasn't runing first time COMMENT JOE//
} elseif ($LastSyncTime > 0) {
$queryAdd->greaterThan("POST_TS", $LastSyncTime);
$queryAdd->descending("POST_TS");
$queryAdd->equalTo("DEL", 0);
$queryDel->equalTo("DEL", 1);
$queryDel->descending("POST_TS");
//$queryDel->limit(15);
$queryEdit->greaterThan("OLD_POST_TS", 0);
$queryEdit->descending("OLD_POST_TS");
//$queryEdit->limit(15);
try {
$result = $queryAdd->find();
$resultDel = $queryDel->find();
$resultEdit = $queryEdit->find();
// The object was retrieved successfully.
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
}
}
/////////////////////////////////////////////////////////////////////
if (count($result) > 0 || count($resultDel) > 0) {
if (count($result) > 0) {
$toSend = array();
示例13: user_register_report
function user_register_report($first, $last, $pass, $email, $report_id)
{
$response = new Response();
$name = $first . "_" . $last;
$user = new ParseUser();
$user->set("username", strtolower($name));
$user->set("email", $email);
$user->set("password", $pass);
try {
$user->signUp();
$_SESSION['user'] = $user;
$_SESSION['notification'] = true;
$query = new ParseQuery("_Session");
$query->equalTo("user", $user);
$query->includeKey("user");
$query->descending("createdAt");
$query->limit(1);
$new = $query->find(true);
$_SESSION['last_date'] = date_format($new[0]->getCreatedAt(), 'Y-m-d\\TH:i:s.u\\Z');
echo add_user_report($report_id, $user);
} catch (ParseException $ex) {
$response->success = false;
$response->message = 'Error: Failed to register: ' . $error;
echo json_encode($response);
}
}
示例14: ParseQuery
<?php
require 'init.php';
use Parse\ParseQuery;
$query = new ParseQuery("Episode");
$query->descending("epId");
$heldeeps = $query->find();
$count = count($heldeeps);
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<title>Heldeep Banger Finder</title>
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="css/tooltipster.css" />
<link rel="stylesheet" href="css/style.css">
<meta charset="UTF-8">
<meta name="description" content="An easy way to find bangers from all the Heldeeps.">
<meta name="author" content="Vincent Bello">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
示例15: testOrderByUpdatedAtDesc
public function testOrderByUpdatedAtDesc()
{
$numbers = [3, 1, 2];
$objects = [];
foreach ($numbers as $k => $number) {
$obj = ParseObject::create('TestObject');
$obj->set('number', $number);
$obj->save();
$objects[] = $obj;
// wait for storing different updatedAt
sleep(1);
}
$objects[1]->set('number', 4);
$objects[1]->save();
$query = new ParseQuery('TestObject');
$query->descending('updatedAt');
$results = $query->find();
$this->assertEquals(3, count($results), 'Did not return correct number of objects.');
$expected = [4, 2, 3];
for ($i = 0; $i < 3; ++$i) {
$this->assertEquals($expected[$i], $results[$i]->get('number'), 'Did not return the correct object.');
}
}