本文整理汇总了PHP中Parse\ParseQuery::ascending方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::ascending方法的具体用法?PHP ParseQuery::ascending怎么用?PHP ParseQuery::ascending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseQuery
的用法示例。
在下文中一共展示了ParseQuery::ascending方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* Lists all ProjectsAdmin entities.
*
* @Route("/index/{page}", name="admin_projects", defaults={ "page" = 1 })
* @Method("GET")
* @Template()
*/
public function indexAction($page)
{
$query = new ParseQuery('Project');
$query->ascending("label");
$query->limit(12);
$query->skip(12 * ($page - 1));
$entities = $query->find();
return array('entities' => $entities, 'hits' => ceil($query->count() / 12), 'page' => $page, 'csrf' => $this->get('form.csrf_provider'));
}
开发者ID:leonardobarrientosc,项目名称:4046-PUCV-ICC-FICHAS-OBRAS-CIVILES,代码行数:16,代码来源:ProjectsAdminController.php
示例2: tasks
public function tasks()
{
$results = array();
$object = array();
$queryCrop = new ParseQuery("Crop");
$queryCrop->select("cropName");
$queryCrop->ascending("cropName");
$object = $queryCrop->find();
foreach ($object as $value) {
array_push($results, $value->get('cropName'));
}
return view('tasks')->with("results", $results);
}
示例3: getCurrentUsers
function getCurrentUsers()
{
$query = new ParseQuery("Bikes");
$query->includeKey("currentUser");
$query->ascending("currentUser");
$query->exists("currentUser");
$query->limit(1000);
$results = $query->find();
$count = count($results);
$listOfCurrentUsers = array();
for ($i = 0; $i < $count; $i++) {
$name = $results[$i]->get("currentUser")->getUserName();
if (!in_array($name, $listOfCurrentUsers)) {
array_push($listOfCurrentUsers, $results[$i]->get("currentUser")->getUserName());
}
}
return $listOfCurrentUsers;
}
示例4: ParseQuery
} else {
//Database operations
$query = new ParseQuery("loss");
$query->equalTo("objectId", '7hOOm7UuHu');
$loss = $query->first();
$daily_loss = $loss->get('daily_loss');
$query = new ParseQuery("loan");
$query->equalTo("objectId", $_GET["cid"]);
$loan = $query->first();
$id = $loan->get("customer")->getObjectId();
$query = new ParseQuery("customer");
$query->equalTo("objectId", $id);
$customer = $query->first();
$query = new ParseQuery("grafiks");
$query->equalTo("loan", $loan);
$query->ascending("step");
$graphics = $query->find();
date_default_timezone_set('Asia/Ulaanbaatar');
$today = new DateTime();
$total_due = 0;
$total_paid = 0;
$total_loss = 0;
$total_left = 0;
$early_pay = 0;
foreach ($graphics as $graph) {
$pay_amount = $graph->get('pay_amount');
$total_due = $total_due + $pay_amount;
$paid_amount = $graph->get('paid_amount1');
$total_paid = $total_paid + $paid_amount;
$loss = $graph->get('loss_amount');
$total_loss = $total_loss + $loss;
示例5: cropdashboard
public function cropdashboard()
{
$crops = array();
$parseQuery = new ParseQuery("Crop");
$parseQuery->ascending("cropName");
//$parseQuery->select("[farmName, farmSize, farmer]");
$results = $parseQuery->find();
foreach ($results as $key => $crop) {
$crops[$key] = array();
array_push($crops[$key], $crop->get('cropName'));
array_push($crops[$key], $crop->get('cropDesc'));
array_push($crops[$key], "P " . $crop->get('price'));
array_push($crops[$key], $crop->get('daysBeforeHarvest') . " days");
}
return view('crops_dashboard')->with("crops", $crops);
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
$especQuery = new ParseQuery("Especialidade");
$especialidade = $especQuery->get($id);
$protoQuery = new ParseQuery("Protocolo");
$protoQuery->equalTo('especialidade', $especialidade);
$protoQuery->ascending('nome');
$protocolos = $protoQuery->find();
$anexoQuery = new ParseQuery("Anexo");
$anexoQuery->equalTo('especialidade', $especialidade);
$anexos = $anexoQuery->find();
return view('especialidade.show', compact('protocolos', 'especialidade', 'anexos'));
}
示例7: getNotificaciones
/**
* Devuelve todos los usuarios que se han interesado en alguna casa del
* $arrendador y que aun no se ha autorizado su contact. Los datos se devuelven
* en forma de relacion de la tabla UsuarioVeDatosCasa, contiene idInmueble
* (el inmueble que le intereso al usuario), idUsuario (el usuario interesado),
* y arrendador (el usuario dueño del inmueble).
* @param type $usuario
* @return type
*/
public static function getNotificaciones($usuario)
{
$queryArrendador = new ParseQuery("UsuarioVeDatosCasa");
//si el usuario puso en renta una casa, se le devuelve informacion al respecto
$queryArrendador->equalTo("arrendador", $usuario);
//$queryArrendador->equalTo("validado",false); //se le devuelven las que no estan validadas para que sepa que las tiene que validar
$queryArrendador->ascending("idInmueble");
//importante
$queryCliente = new ParseQuery("UsuarioVeDatosCasa");
//si el usuario solicito una casa y ya estan listos los datos se le envian
$queryCliente->equalTo("idUsuario", $usuario);
$queryCliente->equalTo("validado", true);
$mainQuery = ParseQuery::orQueries([$queryArrendador, $queryCliente]);
$mainQuery->descending("createdAt");
$res = $mainQuery->find();
$fin = count($res);
$inmuebleAct = null;
$nNoti = 0;
$notificaciones = [];
for ($i = 0; $i < $fin; $i++) {
$arrendador = $res[$i]->get("arrendador");
$arrendador->fetch();
$inm = $res[$i]->get("idInmueble");
$inm->fetch();
if ($arrendador == $usuario) {
//si el usuario es arrendador y tiene un cliente nuevo ***
if ($res[$i]->get("validado")) {
$user = $res[$i]->get("idUsuario");
$user->fetch();
$mensaje = "Ahora puedes ponerte en contacto con el usuario " . $user->get("username") . " que se interesa en la casa que esta en " . $inm->get("direccion") . ". <br>";
$mensaje .= "Puedes contactar al usuario con el correo: " . $user->get("email") . ".<br>";
//echo $mensaje;
$notificaciones[] = new Notificacion($mensaje, Notificacion::CONTACTO_NUEVO, $inm);
} else {
if ($inmuebleAct != null && $inm->getObjectId() === $inmuebleAct->getObjectId()) {
//no usar ==, se acaba el stack, usar === porque php es mamon
$nNoti++;
//si es otra notificacion del mismo inmueble, las agrupa mostrando solamente el numero de notificaciones de ese inmueble
continue;
}
//else ...
$mensaje = APIUsuario::generaNotificacionClientesPot($nNoti, $inmuebleAct);
if ($mensaje != null) {
$notificaciones[] = new Notificacion($mensaje, Notificacion::CLIENTE_POTENCIAL, $inmuebleAct);
}
$inmuebleAct = $inm;
$nNoti = 1;
}
} else {
$mensaje = "El usuario " . $arrendador->get("username") . " ha decidido ponerce en contacto contigo para la " . " negociacion de la casa que solicitaste que se encuentra en " . $inm->get("direccion") . " contactalo a este correo: " . $arrendador->get("email") . ". <br>";
//echo $mensaje;
$notificaciones[] = new Notificacion($mensaje, Notificacion::CONTACTO_ARRENDADOR, $inm);
}
}
$mensaje = APIUsuario::generaNotificacionClientesPot($nNoti, $inmuebleAct);
if ($mensaje != null) {
$notificaciones[] = new Notificacion($mensaje, Notificacion::CLIENTE_POTENCIAL, $inmuebleAct);
}
return $notificaciones;
}
示例8: ParseQuery
<?php
include 'incsession.php';
require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
ParseClient::initialize('OLEbxaLakkb6SVn5t7Qzbewdyy70LSwHp6PQYilb', '6DOD3bArSx2LgNCuE67GDVDPfi9HAKGmkrKLajL1', 'IVNd1TnoknddgQ2F2qCZf7FUPbBWLe21rz2rP1LN');
date_default_timezone_set('Asia/Taipei');
$guid = $_COOKIE['session_Mobile'];
$query2 = new ParseQuery("order");
$query2->ascending("createdAt");
$results2 = $query2->find();
$heightValue = 350 + count($results2) * 90;
$all_text = '<table width="80%" border="1"><tr><th scope="col">編號</th><th scope="col">日期</th><th scope="col">標題</th><th scope="col">運費</th><th scope="col">作者</th></tr>';
for ($i = count($results2); $i > 0; $i--) {
$parseObjectId = $results2[$i - 1]->getObjectId();
$parsetime = $results2[$i - 1]->getCreatedAt();
$taipeiTimeZone = new DateTimeZone('Asia/Taipei');
$parsetime->setTimezone($taipeiTimeZone);
$parsetime = $parsetime->format('m/d');
$parseTitle = $results2[$i - 1]->get("title");
$parseauthor = $results2[$i - 1]->get("author");
$parseprice = $results2[$i - 1]->get("price");
$parseIsDelete = $results2[$i - 1]->get("isDelete");
// 0新文章 1取消文章 2進行中 3完成
if ($parseIsDelete == 0) {
$all_text = "<tr>{$all_text}\n <td align='center'>{$i}</td>\n <td align='center'>{$parsetime}</td>\n <td align='center'><a href='detail.php?postId={$parseObjectId}'>{$parseTitle}</a></td> \n <td align='center'>{$parseprice} 元</td>\n <td align='center'>{$parseauthor}</td>\n </tr>";
} else {
if ($parseIsDelete == "1") {
$all_text = "<tr>{$all_text}\n <td align='center'>{$i}</td>\n <td align='center'> - </td>\n <td align='center'>(本文已被刪除)</td> \n <td align='center'> - </td>\n <td align='center'> - </td>\n </tr>";
示例9: testIncludeWhenOnlySomeObjectsHaveChildren
public function testIncludeWhenOnlySomeObjectsHaveChildren()
{
Helper::clearClass("Child");
Helper::clearClass("Parent");
$child = ParseObject::create('Child');
$child->set('foo', 'bar');
$child->save();
$this->saveObjects(4, function ($i) use($child) {
$parent = ParseObject::create('Parent');
$parent->set('num', $i);
if ($i & 1) {
$parent->set('child', $child);
}
return $parent;
});
$query = new ParseQuery('Parent');
$query->includeKey(['child']);
$query->ascending('num');
$results = $query->find();
$this->assertEquals(4, count($results), 'Did not return correct number of objects.');
$length = count($results);
for ($i = 0; $i < $length; $i++) {
if ($i & 1) {
$this->assertEquals('bar', $results[$i]->get('child')->get('foo'), 'Object should be fetched');
} else {
$this->assertEquals(null, $results[$i]->get('child'), 'Should not have child');
}
}
}
示例10: results
private function results()
{
global $wp_query, $post, $wtd_plugin, $wtd_connector;
$res_id = get_post_meta($post->ID, 'res_id', true);
$query = new ParseQuery("resort");
try {
$resort = $query->get($res_id);
// The object was retrieved successfully.
} catch (ParseException $ex) {
error_log($ex->getMessage());
}
$cat_id = get_query_var('wtds');
if (empty($cat_id) && isset($_GET['wtds'])) {
$cat_id = $_GET['wtds'];
}
// get parent category
$query = new ParseQuery('resortParentCategories');
$query->equalTo('cat_class', 'D');
$query->equalTo('resortObjectId', $resort);
$parent_cat = $query->find();
$parent_cat = $parent_cat[0];
// get category if its set
if (!empty($cat_id)) {
$query = new ParseQuery('resortCategory');
try {
$cat = $query->get($cat_id);
} catch (\Parse\ParseException $ex) {
var_dump($ex);
}
}
// parent restriction query
$parent_cat_query = new ParseQuery('resortParentCategories');
$parent_cat_query->equalTo('objectId', $parent_cat->getObjectId());
// subcategory query
$query = new ParseQuery('resortCategory');
$query->matchesQuery('parentResCatObjectId', $parent_cat_query);
$query->greaterThan('diningCnt', 0);
$query->ascending('name');
$categories = $query->find();
?>
<link rel="stylesheet" href="<?php
echo WTD_PLUGIN_URL . 'assets/css/wtd_activities_page.css?wtd_version=' . WTD_VERSION;
?>
" media="screen"/>
<div ng-app="diningApp" ng-controller="diningCtrl">
<div layout="row" layout-sm="column" layout-padding><?php
if ($wtd_plugin['dining_page_type'] == 3) {
?>
<ul layout="column"><?php
for ($i = 0; $i < count($categories); $i++) {
$category = $categories[$i];
$category_url_name = strtolower($parent_cat->get('name'));
$category_url_name = str_replace(' ', '-', $category_url_name);
$category_url_name = str_replace('/', '-', $category_url_name);
$subcategory_url_name = strtolower($category->get('name'));
$subcategory_url_name = str_replace(' ', '-', $subcategory_url_name);
$subcategory_url_name = str_replace(',', '', $subcategory_url_name);
$subcategory_url_name = str_replace('/', '-', $subcategory_url_name);
$url = site_url() . '/' . $post->post_name . '/whattodo/' . $category_url_name . '/' . $parent_cat->getObjectId() . '/' . $subcategory_url_name . '/' . $category->getObjectId() . '/';
?>
<li class="wtd_subcategory_menu_item <?php
echo $category->getObjectId() == $wp_query->query['wtds'] ? 'active' : '';
?>
">
<a href="<?php
echo $url;
?>
"><?php
echo $category->get('name');
?>
</a>
</li><?php
}
?>
</ul><?php
}
if ($wtd_plugin['dining_page_type'] == 2) {
$column_size = 100;
} else {
$column_size = 75;
}
?>
<div layout="row" layout-align="center start" ng-hide="progress == false" layout-padding flex="100">
<md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular>
</div>
<div layout="column" flex="<?php
echo $column_size;
?>
" flex-sm="100" ng-hide="progress == true">
<div layout="row" style="margin-bottom: 5px;">
<a id="parent_<?php
echo $post->ID;
?>
_header" href="<?php
echo get_post_permalink($post->ID);
?>
" class="wtd_pull_left"><?php
echo $post->post_title;
?>
</a><?php
//.........这里部分代码省略.........
示例11: ParseQuery
?>
</div>
<div id="a2"><?php
$object = new ParseQuery("events");
$object->ascending("date");
$object->limit(1);
$results = $object->find();
for ($i = 0; $i < count($results); $i++) {
$dataObject = $results[$i];
echo $dataObject->get('name');
}
?>
</div>
<div id="s1"><?php
$object = new ParseQuery("events");
$object->ascending("date");
$object->limit(1);
$results = $object->find();
for ($i = 0; $i < count($results); $i++) {
$dataObject = $results[$i];
echo $dataObject->get('message');
}
?>
</div>
<div id="countdown">
<script type="text/javascript">
$('#countdown').countdown('2015/12/10', function(event) {
$(this).html(event.strftime('%d days %H:%M:%S'));
});
</script>
示例12: ParseSessionStorage
require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseUser;
use Parse\ParseSessionStorage;
use Parse\ParseQuery;
use Parse\ParseObject;
ParseClient::initialize('bYE5q8xvJEiV2A2mtf0fgbQR8olNMQ2wfr05WYco', 'wZ5XfUCgQBZzFfQOwhWzP14W1fHfe6aj4qS76u0h', '3e8xtmuzrlpgAHNq7ho5Pe5tL9HrQFEgtJD2YVvQ');
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
ParseClient::setStorage(new ParseSessionStorage());
$currentUser = ParseUser::getCurrentUser();
$course = $_GET["course"];
if ($currentUser == null) {
header("Location: login.php?back=1&course={$course}");
} else {
$coursequery = new ParseQuery("Course");
$coursequery->equalTo("Title", $course);
$result = $coursequery->first();
$result->fetch();
$classquery = new ParseQuery("Class");
$classquery->equalTo("Course", $result);
$classquery->ascending("ClassNumber");
$class = $classquery->first();
$viewLater = new ParseObject("ViewLater");
$viewLater->set("User", $currentUser);
$viewLater->set("Course", $result);
$viewLater->set("NextClass", $class);
$viewLater->save();
header("Location: profile.php");
}
示例13: get_city
public function get_city()
{
$stateId = $this->uri->segment(4);
$state = new ParseObject("States", $stateId);
$cityQuery = new ParseQuery("City");
$cityQuery->ascending("Cities");
$cityQuery->equalTo("states", $state);
$results = $cityQuery->find();
if (!empty($results)) {
$cityInfo = [];
for ($i = 0; $i < count($results); $i++) {
$object = $results[$i];
$cityInfo[$object->getObjectId()] = $object->get('Cities');
}
echo json_encode($cityInfo);
} else {
echo 'none';
}
}
示例14: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
$protoQuery = new ParseQuery("Protocolo");
$protocolo = $protoQuery->get($id);
$especialidade = $protocolo->get('especialidade')->fetch();
$encaminhamentoQuery = new ParseQuery("Encaminhamento");
$encaminhamentoQuery->equalTo('protocolo', $protocolo);
$encaminhamentoQuery->ascending('ordem');
$encaminhamentos = $encaminhamentoQuery->find();
$encaminhamentoArray = array();
for ($i = 0; $i < count($encaminhamentos); $i++) {
$encaminhamento = $encaminhamentos[$i];
$condQuery = new ParseQuery("Condicao");
$condQuery->equalTo('encaminhamento', $encaminhamento);
$condQuery->ascending('ordem');
$condicoes = $condQuery->find();
$encaminhamentoArray[$i] = array('encaminhamento' => $encaminhamento, 'condicoes' => $condicoes);
}
$descritivoQuery = new ParseQuery("DescritivoMinimo");
$descritivoQuery->equalTo('protocolo', $protocolo);
$descritivoQuery->ascending('ordem');
$descritivos = $descritivoQuery->find();
return view('protocolo.show', compact('especialidade', 'protocolo', 'encaminhamentoArray', 'descritivos'));
}
示例15: testSavingChildrenInArray
public function testSavingChildrenInArray()
{
Helper::clearClass('Parent');
Helper::clearClass('Child');
$parent = ParseObject::create('Parent');
$child1 = ParseObject::create('Child');
$child2 = ParseObject::create('Child');
$child1->set('name', 'tyrian');
$child2->set('name', 'cersei');
$parent->setArray('children', [$child1, $child2]);
$parent->save();
$query = new ParseQuery('Child');
$query->ascending('name');
$results = $query->find();
$this->assertEquals(2, count($results));
$this->assertEquals('cersei', $results[0]->get('name'));
$this->assertEquals('tyrian', $results[1]->get('name'));
}