本文整理汇总了PHP中Parse\ParseUser::query方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseUser::query方法的具体用法?PHP ParseUser::query怎么用?PHP ParseUser::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseUser
的用法示例。
在下文中一共展示了ParseUser::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newCalendarEvent
public function newCalendarEvent($day, Request $request)
{
$current_user = ParseUser::getCurrentUser();
try {
$query = ParseUser::query();
$current_user = $query->get($current_user->getObjectId());
$query = new ParseQuery("Groups");
$query->equalTo('user', $current_user);
$groups = $query->find();
} catch (ParseException $ex) {
echo $ex->getMessage();
die;
}
$dt = new \DateTime('now');
//$dt->setTimezone(new \DateTimeZone('America/Los_Angeles'));
$tm = strtotime($day);
$dt->setTimestamp($tm);
Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
Html\Assets::addLink(Html\Link::Script(elixir('scripts/newgroup.js')));
Html\Assets::addLink(Html\Link::Script('/scripts/newCalendarEvent.js'));
$renderData = $this->getRenderData($request);
$renderData['user'] = $current_user;
$renderData['navTitle'] = 'New Event';
$renderData['groups'] = $groups;
$renderData['day'] = $dt->format('m/d/Y');
$renderData['st'] = $dt->format('Y-m-d');
return view('newCalendarEvent', $renderData);
}
示例2: getExperts
public function getExperts()
{
$q = ParseUser::query();
$q->equalTo("role", "tripexpert");
$currentUser = ParseUser::getCurrentUser();
if ($currentUser) {
$tripExperts = $q->find();
return view('admin.viewExperts')->with('tripExperts', $tripExperts)->with('currentUser', $currentUser);
} else {
return view('admin.viewExperts');
}
}
示例3: get_user_data
public function get_user_data($username, $credentials)
{
ParseClient::initialize($credentials->app_id, $credentials->rest_key, $credentials->master_key);
$query = ParseUser::query();
$query->equalTo('username', $username);
$result = $query->find();
$user = $result[0];
$data = new stdClass();
$data->fullName = $user->get("fullName");
$data->avatar = $user->get("avatar");
$data->title = $user->get("title");
return $data;
}
示例4: enviarPush
/**
Envia la notificacion a cierto usuario
**/
function enviarPush()
{
$_strName = $_POST['nombreUsuario'];
$_strMenssage = $_POST['send'];
// Find users near a given username
$userQuery = ParseUser::query();
$userQuery->equalTo("username", $_strName);
// Find devices associated with these users
$pushQuery = ParseInstallation::query();
$pushQuery->matchesQuery('Usuarios', $userQuery);
// Send push notification to query
ParsePush::send(array("where" => $pushQuery, "data" => array("alert" => "{$_strMenssage}")));
}
示例5: add
function add()
{
// validators
$this->form_validation->set_error_delimiters($this->config->item('error_delimeter_left'), $this->config->item('error_delimeter_right'));
$this->form_validation->set_rules('user_id', lang('reservations input user_id'), 'trim');
$this->form_validation->set_rules('team_id', lang('reservations input team_id'), 'trim');
$this->form_validation->set_rules('match_data[date]', lang('reservations input date'), 'required|trim');
$this->form_validation->set_rules('match_data[time]', lang('reservations input time'), 'required|trim');
$this->form_validation->set_rules('match_data[duration]', lang('reservations input duration'), 'required|trim|numeric');
if ($this->form_validation->run() == true) {
$data = $this->input->post();
// save the new user
$reservation = new ParseObject("Reservation");
$relationOwner = $reservation->getRelation("userId");
$queryOwner = ParseUser::query();
$owner = $queryOwner->get("btPTAhtpvo");
$relationOwner->add($owner);
$relationStatus = $reservation->getRelation("status");
$queryStatus = new ParseQuery("ReservationStatus");
$status = $queryStatus->get("KIzDQVJrAV");
$relationStatus->add($status);
$reservation->setAssociativeArray("reservationData", $data['match_data']);
try {
$reservation->save();
$this->session->set_flashdata('message', 'New object created with objectId: ' . $reservation->getObjectId());
redirect($this->_redirect_url);
} catch (ParseException $ex) {
// Execute any logic that should take place if the save fails.
// error is a ParseException object with an error code and message.
$this->session->set_flashdata('error', 'Failed to create new object, with error message: ' . $ex->getMessage());
}
// return to list and display message
}
// setup page header data
// setup page header data
$this->set_title(sprintf(lang('reservations title reservations'), $this->settings->site_name));
$this->set_subtitle(lang('reservations subtitle add_reservation'));
$data = $this->includes;
// set content data
$content_data = array('cancel_url' => $this->_redirect_url, 'user' => null, 'password_required' => true);
// load views
$data['content'] = $this->load->view('reservations/form', $content_data, true);
$this->load->view($this->template, $data);
}
示例6: doUserQuery
public function doUserQuery()
{
$currentUser = ParseUser::getCurrentUser();
$userQuery = ParseUser::query();
$userQuery->equalTo("creator", $currentUser);
$userResults = $userQuery->find();
$userInfo = [];
for ($i = 0; $i < count($userResults); $i++) {
$object = $userResults[$i];
$isOutletAssigned = $object->get('isOutletAssigned');
$outletCheck = $object->get('outlet');
$outletName = "";
if ($isOutletAssigned) {
$outletCheck->fetch();
$outletName = $outletCheck->get("outletName");
}
$roleCheck = $object->get('role');
$roleCheck->fetch();
$roleName = $roleCheck->get("name");
$userInfo[] = ['adminfName' => $object->get('firstName'), 'adminlName' => $object->get('lastName'), 'adminMail' => $object->get('email'), 'adminId' => $object->getObjectId(), 'adminPerm' => $roleName, 'outletName' => $outletName];
}
return $userInfo;
}
示例7: dtestCountUsers
public function dtestCountUsers()
{
ParseTestHelper::clearClass(ParseUser::$parseClassName);
$ilya = new ParseUser();
$ilya->setUsername('ilya');
$ilya->setPassword('password');
$ilya->signUp();
$kevin = new ParseUser();
$kevin->setUsername('kevin');
$kevin->setPassword('password');
$kevin->signUp();
$james = new ParseUser();
$james->setUsername('james');
$james->setPassword('password');
$james->signUp();
$query = ParseUser::query();
$result = $query->count();
$this->assertEquals(3, $result);
}
示例8: get_user_from_token
public function get_user_from_token($token)
{
$query = ParseUser::query();
$query->equalTo('remember_token', $token);
$result = $query->find();
$user = $result[0];
return $user->getObjectId();
}
示例9: processFBLogin
public function processFBLogin(Request $request)
{
$fb = new Facebook(['app_id' => config('facebook.app_id'), 'app_secret' => config('facebook.app_secret'), 'default_graph_version' => 'v2.2']);
$redirect_url = $request->getSchemeAndHttpHost() . '/fblogin';
$code = $request->input('code');
$helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
if (!$accessToken->isLongLived()) {
$oAuth2Client = $fb->getOAuth2Client();
// Exchanges a short-lived access token for a long-lived one
$accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
}
$fb->setDefaultAccessToken($accessToken);
$response = $fb->get('/me?fields=id,name,email');
$plainOldArray = $response->getDecodedBody();
//if user exist sign them in otherwise sign them up
$query = ParseUser::query();
$query->equalTo("username", 'FB:' . $plainOldArray['id']);
$results = $query->find();
if (count($results) === 1) {
$user = ParseUser::logIn('FB:' . $plainOldArray['id'], config('facebook.upwd'));
$user->set('social', "facebook:" . $accessToken);
return $this->determineRoute($request);
} else {
$user = new ParseUser();
$user->set("username", 'FB:' . $plainOldArray['id']);
$user->set("password", config('facebook.upwd'));
$user->set("email", "FB_" . $plainOldArray['email']);
$user->set("name", $plainOldArray['name']);
$user->set("realEmail", $plainOldArray['email']);
$user->set("social", "facebook:" . $accessToken);
try {
$user->signUp();
return $this->determineRoute($request);
} catch (ParseException $ex) {
var_dump("Save Error");
// Show the error message somewhere and let the user try again.
echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
var_dump($plainOldArray['email']);
var_dump($accessToken);
die;
}
}
} catch (FacebookRequestException $ex) {
// When Facebook returns an error
echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
die;
} catch (\Exception $ex) {
// When validation fails or other local issues
//var_dump($plainOldArray['email']);
//var_dump($accessToken);
echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
die;
}
if (!empty($accessToken)) {
// Logged in.
//$access_token = $helper->getAccessToken();
echo "LOGGED IN";
die;
} else {
if ($helper->getError()) {
header('HTTP/1.0 401 Unauthorized');
echo "Error: " . $helper->getError() . "\n";
echo "Error Code: " . $helper->getErrorCode() . "\n";
echo "Error Reason: " . $helper->getErrorReason() . "\n";
echo "Error Description: " . $helper->getErrorDescription() . "\n";
exit;
} else {
return redirect()->route('login');
}
}
}
示例10: verifyUser
public function verifyUser(Request $request)
{
$user = new ParseUser();
$userQuery = ParseUser::query();
try {
$user = ParseUser::logIn($request->input('userName'), $request->input('userPass'));
$currentUser = ParseUser::getCurrentUser();
if (!$currentUser->get('isAdmin')) {
\Session::put('message', 0);
return redirect('/login');
} else {
$request->session()->put('username', $request->input('userName'));
return redirect('/maintenance');
}
} catch (ParseException $e) {
\Session::put('message', -1);
return redirect('/login');
}
}
示例11: editGroup
public function editGroup($groupid, 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', ''));
Html\Assets::addLink(Html\Link::Script(elixir('scripts/newgroup.js')));
$query = new ParseQuery("Groups");
try {
$group = $query->get($groupid);
// The object was retrieved successfully.
$relation = $group->getRelation('members');
$query = $relation->getQuery();
$members = $query->find();
$renderData = $this->getRenderData($request);
$renderData['user'] = $current_user;
$renderData['group'] = $group;
$renderData['members'] = $members;
return view('editgroup', $renderData);
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
echo $ex->getMessage();
}
}
示例12: doAdminEditQuery
public function doAdminEditQuery($userId)
{
# code...
$query = ParseUser::query();
$query->equalTo("objectId", $userId);
$results = $query->find();
$perm_info = [];
$admin_info = [];
for ($i = 0; $i < count($results); $i++) {
$object = $results[$i];
$permCheck = $object->get("role");
$permCheck->fetch();
$perm_info[$permCheck->getObjectId()] = $permCheck->get('name');
$admin_info[] = ['userfName' => $object->get('firstName'), 'userId' => $object->getObjectId(), 'userlName' => $object->get('lastName'), 'userMail' => $object->get('email'), 'userPass' => $object->get('password')];
}
return $admin_info;
}
示例13: showCalendar
public function showCalendar(Request $request, $date = null)
{
$current_user = ParseUser::getCurrentUser();
if (!$current_user) {
return redirect()->route('login');
}
$dt = new \DateTime('now');
//$dt->setTimezone(new \DateTimeZone('America/Los_Angeles'));
$st = $request->input('st');
if (!empty($st)) {
$tm = strtotime($st);
$dt->setTimestamp($tm);
}
$query = ParseUser::query();
$current_user = $query->get($current_user->getObjectId());
Html\Assets::addLink(Html\Link::Css('/vendor/responsive-calendar/0.9/css/responsive-calendar.css'));
Html\Assets::addLink(Html\Link::Css(elixir('css/default.css')));
Html\Assets::addLink(Html\Link::Script('/vendor/responsive-calendar/0.9/js/responsive-calendar.min.js'));
Html\Assets::addLink(Html\Link::Script(elixir('scripts/calendar.js')));
Html\Assets::addMetaTag(Html\Meta::Tag('description', ''));
$renderData = $this->getRenderData($request);
$renderData['user'] = $current_user;
$renderData['showdate'] = $dt;
$renderData['activeBarTab'] = "calendar";
return view('calendar', $renderData);
}
示例14: Events
public function Events(Request $request)
{
$current_user = ParseUser::getCurrentUser();
try {
$query = ParseUser::query();
$current_user = $query->get($current_user->getObjectId());
$query = new ParseQuery("Groups");
//$query->equalTo('user', $current_user);
$query->equalTo('members', $current_user);
$groups = $query->find();
$dGroups = array();
foreach ($groups as $group) {
$temp = array();
$relation = $group->getRelation("events");
$query = $relation->getQuery();
$query->addAscending('date');
$events = $query->find();
foreach ($events as $event) {
//make sure event has date set
if (!empty($event->get('date'))) {
$temp = ['objectId' => $event->getObjectId(), 'createdAt' => $event->getCreatedAt()->format('Y-m-d H:i:s'), 'name' => $event->get('name'), 'date' => $event->get('date')->format('Y-m-d H:i:s'), 'inviteCode' => $event->get('inviteCode'), 'invites' => $event->get('invites')];
$dGroups[$event->get('date')->format('Y-m-d')][] = $temp;
$dtemp = ['name' => $event->get('name'), 'id' => $event->getObjectId()];
$ddEvents[$event->get('date')->format('Y-m-d')]['dayEvents'][] = $dtemp;
$ddEvents[$event->get('date')->format('Y-m-d')]['number'] = !empty($ddEvents[$event->get('date')->format('Y-m-d')]['number']) ? $ddEvents[$event->get('date')->format('Y-m-d')]['number'] + 1 : 1;
$ddEvents[$event->get('date')->format('Y-m-d')]['badgeClass'] = "badge-warning";
$ddEvents[$event->get('date')->format('Y-m-d')]['url'] = route('calendarDayView', ['day' => $event->get('date')->format('Y-m-d')]);
}
}
}
ksort($dGroups);
$ret = ['status' => "success", 'data' => ['events' => $dGroups, 'dsEvents' => $ddEvents]];
return response()->json($ret);
} catch (ParseException $ex) {
$ret = ['status' => 'fail', 'error' => $ex->getMessage()];
return response()->json($ret);
}
}
示例15: getUserList
/**
* Retrive a list of parse users
*/
public function getUserList()
{
$query = ParseUser::query();
$query->exists("username");
$query->notEqualTo("objectId", $_SESSION['userId']);
$results = $query->find();
return $results;
}