/**
  * 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'));
 }
 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);
 }
Example #3
0
 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;
 }
Example #4
0
 } 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;
 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);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     ParseClient::initialize(env('PARSE_ID', 'f**k'), env('PARSE_REST', 'f**k'), env('PARSE_MASTER', 'f**k'));
     $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'));
 }
Example #7
0
 /**
  * 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;
 }
Example #8
0
<?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>";
Example #9
0
 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');
         }
     }
 }
        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 
            if (!empty($parent_cat_id)) {
                $category_url_name = strtolower($parent_cat->get('name'));
                $category_url_name = str_replace(' ', '-', $category_url_name);
                $url = site_url() . '/' . $wtd_plugin['url_prefix'] . '/' . $post->post_name . '/whattodo/' . $category_url_name . '/' . $parent_cat->getObjectId() . '/';
                ?>
						        <span class="wtd_bread_separator">&gt;</span>
						        <a id="parent_<?php 
                echo $parent_cat->getObjectId();
                ?>
_header" class="wtd_pull_left" href="<?php 
                echo $url;
                ?>
"><?php 
                echo $parent_cat->get('name');
                ?>
						        </a><?php 
            }
            if ($wtd_plugin['dining_page_type'] == 2) {
                ?>
						        <span class="wtd_bread_separator">&gt;</span>
						        <select class="wtd_subcategory_navigator">
							        <option>Select Subcategory</option><?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() . '/';
                    $selected = '';
                    if ($cat_id == $category->getObjectId()) {
                        $selected = ' selected="selected"';
                    }
                    echo '<option value="' . $url . '" ' . $selected . '>' . $category->get('name') . '</option>';
                }
                ?>
						        </select><?php 
            } elseif (!empty($cat_id)) {
                ?>
						        <span class="wtd_bread_separator">&gt;</span>
						        <span class="wtd_current_cat"><?php 
                echo $cat->name;
                ?>
</span><?php 
            }
            ?>
				        </div>
				        <script>
					        jQuery('.wtd_subcategory_navigator').change(function(){
						        var val = jQuery('.wtd_subcategory_navigator option:selected').val();
						        if(val)
							        window.location = val;
					        });
				        </script>
				        <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding>
					        <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular>
				        </div>
				        <div id="wtd_listing_sc_container" layout="column" layout-align="start start"></div>
			        </div>
		        </div>
	        </div><?php 
            $wtd_base_request = $wtd_connector->get_base_request();
            $wtd_base_request['resorts'] = array($res_id);
            $wtd_base_request['page'] = 1;
            $subcat_id = "";
            if (!empty($cat)) {
                $subcat_id = $cat->getObjectId();
            }
            if (!empty($subcat_id)) {
                $wtd_base_request['category_id'] = $subcat_id;
            }
            ?>
            <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script>
            <script src="<?php 
            echo WTD_PLUGIN_URL;
            ?>
/assets/js/parse_init.js"></script>
            <script>
                var wtd_categories = <?php 
            echo json_encode($this->wtd_categories);
            ?>
;
                var wtd_base_request = <?php 
            echo json_encode($wtd_base_request);
            ?>
;
                var cat_id = '<?php 
            echo $cat_id;
            ?>
';
                var subcat_id = '<?php 
            echo $subcat_id;
            ?>
';
                var wtd_parse_page = 1;
                var cur_category = '<?php 
            echo $cat_id;
            ?>
';
            </script>
	        <script src="<?php 
            echo WTD_PLUGIN_URL;
            ?>
/assets/js/pages/dining.js"></script><?php 
            wtd_copyright();
        }
Example #11
0
?>
 </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>
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");
}
Example #13
0
 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';
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     ParseClient::initialize(env('PARSE_ID', 'f**k'), env('PARSE_REST', 'f**k'), env('PARSE_MASTER', 'f**k'));
     $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'));
 }
Example #15
0
 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'));
 }
Example #16
0
     $arr = $userArray[$i]->get('users');
     $ustr = $user->getObjectId() . $_POST['user'];
     $ustr1 = $_POST['user'] . $user->getObjectId();
     if (gettype(strpos(implode("", $arr), $ustr)) == "integer" || gettype(strpos(implode("", $arr), $ustr1)) == "integer") {
         $chatId = $userArray[$i]->getObjectId();
     }
 }
 $query = new ParseQuery("Chat");
 $query->equalTo('objectId', $chatId);
 $chat = $query->first();
 if ($chat) {
     $response = new Response();
     $query = new ParseQuery("ChatLogs");
     $query->equalTo('Chat', $chat);
     $query->includeKey('speaker');
     $query->ascending('createdAt');
     $chatters = $query->find();
     $msgArray = array();
     $spkArray = array();
     $dateArray = array();
     $imgArray = array();
     for ($i = 0; $i < count($chatters); $i++) {
         array_push($msgArray, $chatters[$i]->get('message'));
         array_push($spkArray, $chatters[$i]->get('speaker')->get('first'));
         array_push($imgArray, $chatters[$i]->get('speaker')->get('avatar'));
         array_push($dateArray, date_format($chatters[$i]->getCreatedAt(), 'F jS \\a\\t g:ia'));
     }
     $response->success = true;
     $response->type = 1;
     $response->data = $msgArray;
     $response->chat = $chat->getObjectId();
 public function first($className, $equalToArray = array(), $ascending = null, $descending = null, $skip = null, $includeArray = array())
 {
     $query = new ParseQuery($className);
     if ($equalToArray) {
         foreach ($equalToArray as $key => $value) {
             $query->equalTo($key, $value);
         }
     }
     if ($ascending) {
         $query->ascending($ascending);
     }
     if ($descending) {
         $query->descending($descending);
     }
     if ($skip) {
         $query->skip($skip);
     }
     if ($includeArray) {
         foreach ($includeArray as $include) {
             $query->includeKey($include);
         }
     }
     return $query->first();
 }
Example #18
0
 public function testGeoBoxSmallNearDateLine()
 {
     $nearWestOfDateLine = new ParseGeoPoint(0, 175);
     $nearWestObject = ParseObject::create('TestObject');
     $nearWestObject->set('location', $nearWestOfDateLine);
     $nearWestObject->set('name', 'near west');
     $nearWestObject->set('order', 1);
     $nearWestObject->save();
     $nearEastOfDateLine = new ParseGeoPoint(0, -175);
     $nearEastObject = ParseObject::create('TestObject');
     $nearEastObject->set('location', $nearEastOfDateLine);
     $nearEastObject->set('name', 'near east');
     $nearEastObject->set('order', 2);
     $nearEastObject->save();
     $farWestOfDateLine = new ParseGeoPoint(0, 165);
     $farWestObject = ParseObject::create('TestObject');
     $farWestObject->set('location', $farWestOfDateLine);
     $farWestObject->set('name', 'far west');
     $farWestObject->set('order', 3);
     $farWestObject->save();
     $farEastOfDateLine = new ParseGeoPoint(0, -165);
     $farEastObject = ParseObject::create('TestObject');
     $farEastObject->set('location', $farEastOfDateLine);
     $farEastObject->set('name', 'far east');
     $farEastObject->set('order', 4);
     $farEastObject->save();
     $southwestOfDateLine = new ParseGeoPoint(-10, 170);
     $northeastOfDateLine = new ParseGeoPoint(10, -170);
     $query = new ParseQuery('TestObject');
     $query->withinGeoBox('location', $southwestOfDateLine, $northeastOfDateLine);
     $query->ascending('order');
     try {
         $query->find();
         $this->assertTrue(false, 'Query should fail for crossing the date line.');
     } catch (ParseException $e) {
     }
 }
Example #19
0
 public function doBeacCompQuery()
 {
     $companyQuery = new ParseQuery("Companies");
     $companyQuery->ascending("name");
     $compResults = $companyQuery->find();
     $companyInfo = [];
     for ($i = 0; $i < count($compResults); $i++) {
         $object = $compResults[$i];
         $companyInfo[$object->getObjectId()] = $object->get('name');
     }
     return $companyInfo;
 }