当前位置: 首页>>代码示例>>PHP>>正文


PHP ParseQuery::greaterThan方法代码示例

本文整理汇总了PHP中Parse\ParseQuery::greaterThan方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseQuery::greaterThan方法的具体用法?PHP ParseQuery::greaterThan怎么用?PHP ParseQuery::greaterThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parse\ParseQuery的用法示例。


在下文中一共展示了ParseQuery::greaterThan方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLastXTraffic

/**
 * @param $x [days ago to show]
 * @return mixed [associative array with period, labels, data]
 */
function getLastXTraffic($x)
{
    //Initialize PArse in PHP
    ParseClient::initialize('P60EfTUuOZoeZyD2qSLpOrc8DWwUk2YjEqU2HY1R', 's3b2cfGtQhSFYM16ZIJQ7yXioTjt35Um5mn9SyP8', '3jz6CONqt5psS4UlGu3RB28ldIw311Iv2I8eA3Mh');
    $query = new ParseQuery("Reading");
    //Parse Object
    //filter the result (maximum 31 days)
    if ($x < 32) {
        $period = date('Y-m-d\\TH:i:s.u\\Z', strtotime("-" . $x . "day"));
        //set period in Parse format
    } else {
        //if else set to one week by default
        $period = date('Y-m-d\\TH:i:s.u\\Z', strtotime("-7 day"));
        //set period in Parse format
        $x = 7;
    }
    $results = array();
    $query->greaterThan("createdAt", $period);
    //Select all the reading done after those date
    $results = $query->find();
    //Run query
    $weeklyTraffic = array();
    $currentDay = $results[0]->getCreatedAt()->format('d');
    //register the day, will use it as a checker
    $weeklyTraffic[$currentDay] = 0;
    //Set this day with 0 view already
    $labelsString = "";
    $data = "";
    for ($i = 0; $i < count($results); $i++) {
        if ($currentDay == $results[$i]->getCreatedAt()->format('d')) {
            //here we have element to store in current array's day
            $weeklyTraffic[$results[$i]->getCreatedAt()->format('d') . ""] = $weeklyTraffic[$results[$i]->getCreatedAt()->format('d') . ""] + 1;
        } else {
            /*
             * Prepare strings for x axis in javascript
             */
            $labelsString .= "'" . $currentDay . "',";
            //made the string ready in json
            $data .= "'" . $weeklyTraffic[$currentDay] . "',";
            //made the string ready in json
            //set new day into the array
            $weeklyTraffic[$results[$i]->getCreatedAt()->format('d') . ""] = 1;
            $currentDay = $results[$i]->getCreatedAt()->format('d');
            //set new currentday with the one actually in use
        }
    }
    //set last results
    $labelsString .= "'" . $currentDay . "',";
    //made the string ready in json with the last element
    $data .= "'" . $weeklyTraffic[$currentDay] . "',";
    //made the string ready in json with the last element
    // Set the array in order to return it
    $vars['period'] = $x;
    $vars['labels'] = $labelsString;
    $vars['data'] = $data;
    return $vars;
}
开发者ID:pinair,项目名称:Marketips,代码行数:61,代码来源:analytics.php

示例2: ParseQuery

$LastSyncTime = 0;
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;
开发者ID:phakphumi,项目名称:News,代码行数:31,代码来源:totable.php

示例3: testOrQueries

 public function testOrQueries()
 {
     $this->provideTestObjects(10);
     $subQuery1 = new ParseQuery("TestObject");
     $subQuery1->lessThan("foo", "bar2");
     $subQuery2 = new ParseQuery("TestObject");
     $subQuery2->greaterThan("foo", "bar5");
     $mainQuery = ParseQuery::orQueries([$subQuery1, $subQuery2]);
     $results = $mainQuery->find();
     $length = count($results);
     $this->assertEquals(6, $length, 'Did not return correct number of objects.');
     for ($i = 0; $i < $length; $i++) {
         $this->assertTrue($results[$i]->get("foo") < "bar2" || $results[$i]->get("foo") > "bar5", 'Did not return the correct object.');
     }
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:15,代码来源:ParseQueryTest.php

示例4: testOrQueries

 public function testOrQueries()
 {
     $this->provideTestObjects(10);
     $subQuery1 = new ParseQuery('TestObject');
     $subQuery1->lessThan('foo', 'bar2');
     $subQuery2 = new ParseQuery('TestObject');
     $subQuery2->greaterThan('foo', 'bar5');
     $mainQuery = ParseQuery::orQueries([$subQuery1, $subQuery2]);
     $results = $mainQuery->find();
     $length = count($results);
     $this->assertEquals(6, $length, 'Did not return correct number of objects.');
     for ($i = 0; $i < $length; ++$i) {
         $this->assertTrue($results[$i]->get('foo') < 'bar2' || $results[$i]->get('foo') > 'bar5', 'Did not return the correct object.');
     }
 }
开发者ID:aglo35,项目名称:vr_beta,代码行数:15,代码来源:ParseQueryTest.php

示例5: catch

        $result = $queryAdd->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.
    }
    //////////////////////////////////////////////////////////////////////
    //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) {
开发者ID:phakphumi,项目名称:News,代码行数:31,代码来源:output.php

示例6: ParseQuery

use Parse\ParseQuery;
/**
 * Same code from analytics.php Should need a ajax-Php function in order to call those methods...
 * Copied the code for quickness
 */
$x = $_GET['q'];
ParseClient::initialize('P60EfTUuOZoeZyD2qSLpOrc8DWwUk2YjEqU2HY1R', 's3b2cfGtQhSFYM16ZIJQ7yXioTjt35Um5mn9SyP8', '3jz6CONqt5psS4UlGu3RB28ldIw311Iv2I8eA3Mh');
$query = new ParseQuery("Reading");
if ($x < 32) {
    $period = date('Y-m-d\\TH:i:s.u\\Z', strtotime("-" . $x . "day"));
} else {
    $period = date('Y-m-d\\TH:i:s.u\\Z', strtotime("-7 day"));
    $x = 7;
}
$results = array();
$query->greaterThan("createdAt", $period);
$query->limit(10000);
$results = $query->find();
$weeklyTraffic = array();
$currentDay = $results[0]->getCreatedAt()->format('d');
$weeklyTraffic[$currentDay] = 0;
$labelsString = "";
$data = "";
for ($i = 0; $i < count($results); $i++) {
    if ($currentDay == $results[$i]->getCreatedAt()->format('d')) {
        $weeklyTraffic[$results[$i]->getCreatedAt()->format('d') . ""] = $weeklyTraffic[$results[$i]->getCreatedAt()->format('d') . ""] + 1;
    } else {
        /*
         * Prepare strings for x axis in javascript
         */
        $labelsString .= $currentDay . ',';
开发者ID:pinair,项目名称:Marketips,代码行数:31,代码来源:infoTraffic.php

示例7: ParseQuery

                 if ($_SESSION['notification']) {
                     $query = new ParseQuery("ChatLogs");
                     $query->greaterThan('createdAt', date_format($new[0]->getCreatedAt(), 'Y-m-d\\TH:i:s.u\\Z'));
                     $inbox = count($query->find());
                     $query = new ParseQuery("NiceThing");
                     $query->greaterThan('createdAt', $new[0]->getCreatedAt());
                     $query->equalTo("refered_user", $user);
                     $new = count($query->find());
                     $_SESSION['notification'] = false;
                 } else {
                     $query = new ParseQuery("ChatLogs");
                     $query->equalTo('reciever', $user->getObjectId());
                     $query->greaterThan('createdAt', $_SESSION['last_date']);
                     $inbox = count($query->find());
                     $query = new ParseQuery("NiceThing");
                     $query->greaterThan('createdAt', $_SESSION['last_date']);
                     $query->equalTo("refered_user", $user);
                     $new = count($query->find());
                 }
                 $query = new ParseQuery("NiceThing");
                 $query->equalTo("User", $user);
                 $favorite = $query->find();
                 $sum_fav = 0;
                 foreach ($favorite as $fav) {
                     $sum_fav += count($fav->get('likes'));
                 }
                 echo $template->render(array('title' => 'Dashboard', 'user' => $user, 'nav' => 1, 'nicethings' => $nicethings, 'last3' => $lastthreethings, 'originated' => $originated, 'inbox' => $inbox, 'new' => $new, 'favorite' => $sum_fav));
             }
         }
     }
 }
开发者ID:louk,项目名称:One-Nice-Thing,代码行数:31,代码来源:index.php

示例8: 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 
//.........这里部分代码省略.........
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:101,代码来源:wtd_parse_dining_page.class.php

示例9: ParseQuery

        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="css/iftaCss.css">
        <?php 
require './vendor/autoload.php';
require './dataTableInfo.php';
use Parse\ParseClient;
use Parse\ParseQuery;
ParseClient::initialize('wbBrSDOUcBhQnbIwxrHDwpXTOu2YXzROiSynhtmH', 'cBgdYmWxTiK3rUTChtDVhYEyBuvRT8WlUAtxK4Cj', 'fi2UFS8TwmEzx4oKtsrv567TG4nuZV94GSj2ruYF');
?>
    </head>
    <body>
        <div class="container">
            <table class="table table-hover">
            <?php 
$orderQuery = new ParseQuery($TABLE_ORDER);
$orderQuery->greaterThan($ORDER_ID, 1);
$result = $orderQuery->find();
$count = 1;
foreach ($result as $r) {
    echo '<tr><td>' . $count++ . '</td><td>';
    echo 'Order Id :' . $r->get($ORDER_ID) . '<br>';
    echo 'Product Name :' . $r->get($PRODUCT) . '<br>';
    echo 'Quantity :' . $r->get($QUANTITY) . '<br>';
    echo 'Customer :' . $r->get($CUSTOMER) . '<br>';
    echo 'Customer Address :' . $r->get($CUSTOMER_ADDRESS) . '<br>';
    echo 'Market Name :' . $r->get($MARKET_NAME) . '<br>';
    echo 'Delevary Date :' . $r->get($DELIVARY_DATE) . '<br>';
    echo '</td></tr>';
}
?>
                </table>
开发者ID:adorgoalp,项目名称:parse-website-tutorial-basic,代码行数:31,代码来源:index.php


注:本文中的Parse\ParseQuery::greaterThan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。