本文整理汇总了PHP中Walker类的典型用法代码示例。如果您正苦于以下问题:PHP Walker类的具体用法?PHP Walker怎么用?PHP Walker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Walker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: expand
function expand(Environment $env, $code)
{
$walker = new Walker();
$forms = buildForms($code);
return array_map(function ($form) use($walker, $env) {
return $walker->expand($env, $form);
}, $forms);
}
开发者ID:igorw,项目名称:ilias,代码行数:8,代码来源:macro-expand.php
示例2: expand
/**
* @test
* @dataProvider provideExpand
*/
public function expand($expected, $sexpr, array $macros = [])
{
$walker = new Walker();
$env = Environment::standard();
foreach ($macros as $name => $pair) {
list($argsSexpr, $bodySexpr) = $pair;
$macroArgs = $this->parseSexpr($argsSexpr);
$macroBody = $this->parseSexpr($bodySexpr);
$env[$name] = new SpecialOp\MacroOp($macroArgs, $macroBody);
}
$form = $this->parseSexpr($sexpr);
$expanded = $walker->expand($env, $form);
$this->assertEquals($expected, $expanded->getAst());
}
开发者ID:igorw,项目名称:ilias,代码行数:18,代码来源:WalkerTest.php
示例3: forgot_password
public function forgot_password()
{
$type = Input::get('type');
$email = Input::get('email');
if ($type == 1) {
// Walker
$walker_data = Walker::where('email', $email)->first();
if ($walker_data) {
$walker = Walker::find($walker_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$walker->password = Hash::make($new_password);
$walker->save();
// send email
$settings = Settings::where('key', 'email_forgot_password')->first();
$pattern = $settings->value;
$pattern = str_replace('%password%', $new_password, $pattern);
$subject = "Your New Password";
email_notification($walker->id, 'walker', $pattern, $subject);
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
} else {
$owner_data = Owner::where('email', $email)->first();
if ($owner_data) {
$owner = Owner::find($owner_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$owner->password = Hash::make($new_password);
$owner->save();
$settings = Settings::where('key', 'email_forgot_password')->first();
$pattern = $settings->value;
$pattern = str_replace('%password%', $new_password, $pattern);
$subject = "Your New Password";
email_notification($owner->id, 'owner', $pattern, $subject);
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
}
}
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:60,代码来源:ApplicationController.php
示例4: walk
public function walk()
{
$walked = [];
//walk know pathes
foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) {
if (isset($this->data[$path->item])) {
if ($path->type == 'container') {
//create walker for container
$walker = new Walker();
$walker->migration = $this->migration;
$walker->map = $this->map;
$walker->data =& $this->data[$path->item];
$walker->curPath = $this->curPath . $path->item . '/';
$walker->mapPath = $path;
$walker->mapPathParent = $this->mapPath;
$walker->migtarionLog = $this->migtarionLog;
$walker->walk();
} elseif ($path->type == 'object') {
//start parse path data
$this->startObjectParse($path->object_id, $this->data[$path->item]);
}
}
$walked[$path->item] = true;
}
//check unparsed paths
foreach ($this->data as $key => &$data) {
//skip parsed and attribtes
if ($key == '@attributes' || !empty($walked[$key])) {
continue;
}
//search object for parse
$object = Migration\Object::get([['code', $key], ['migration_id', $this->migration->id]]);
if ($object) {
//parse as object
$this->startObjectParse($object, $data);
} else {
//create new map path for configure unknown path
$this->mapPath = new Migration\Map\Path();
$this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0;
$this->mapPath->path = $this->curPath;
$this->mapPath->item = $key;
$this->mapPath->migration_map_id = $this->map->id;
$this->mapPath->save();
}
}
}
开发者ID:krvd,项目名称:cms-Inji,代码行数:46,代码来源:Walker.php
示例5: display_element
/**
* Taken from WordPress's Walker_Comment::display_element()
*
* This function is designed to enhance Walker::display_element() to
* display children of higher nesting levels than selected inline on
* the highest depth level displayed. This prevents them being orphaned
* at the end of the comment list.
*
* Example: max_depth = 2, with 5 levels of nested content.
* 1
* 1.1
* 1.1.1
* 1.1.1.1
* 1.1.1.1.1
* 1.1.2
* 1.1.2.1
* 2
* 2.2
*
* @see Walker_Comment::display_element()
* @see Walker::display_element()
* @see wp_list_comments()
*/
public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
{
if (!$element) {
return;
}
$id_field = $this->db_fields['id'];
$id = $element->{$id_field};
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
// If we're at the max depth, and the current element still has children, loop over those and display them at this level
// This is to prevent them being orphaned to the end of the list.
if ($max_depth <= $depth + 1 && isset($children_elements[$id])) {
foreach ($children_elements[$id] as $child) {
$this->display_element($child, $children_elements, $max_depth, $depth, $args, $output);
}
unset($children_elements[$id]);
}
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:40,代码来源:class.wpcom-json-api-list-comments-endpoint.php
示例6: foreach
/**
* This modifies the default display_element() function to "flatten" any replies that exceed the max_depth.
*
* This function is taken from the Walker_Comment class in WordPress core.
*
* @see Walker::display_element()
*
* @param object $element Data object.
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args An array of arguments. @see wp_list_comments()
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
{
// Do nothing if $element is false...
if (!$element) {
return;
}
$id_field = $this->db_fields['id'];
$id = $element->{$id_field};
// Run the standard display_element() function now...
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
// If we're at the max depth, and the current element still has children, loop over those and display them at
// this level. This is to prevent them being orphaned to the end of the comment list.
if ($max_depth <= $depth + 1 && isset($children_elements[$id])) {
foreach ($children_elements[$id] as $child) {
$this->display_element($child, $children_elements, $max_depth, $depth, $args, $output);
}
unset($children_elements[$id]);
}
}
开发者ID:mistergjh,项目名称:nouveau,代码行数:34,代码来源:WalkerComments.php
示例7: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->info('Working');
$date1 = date('Y-m-d h:i:s');
$this->info($date1);
$date = date_create($date1);
$msgtime = $date->add(new DateInterval('P0Y0M0DT0H30M0S'))->format('Y-m-d H:i:s');
$requests = Requests::where('later', 1)->where('is_started', 0)->where('request_start_time', '<=', $msgtime)->get();
if ($requests->count() > 0) {
$this->info('hola');
foreach ($requests as $request) {
$provider = Walker::where('id', $request->confirmed_walker)->first();
$owner = Owner::where('id', $request->owner_id)->first();
$message = "You have a ride scheduled in 30 mins from now. Client name is {$owner->first_name} {$owner->last_name} and phone no. is {$owner->phone}";
$this->info($request->id);
$this->info($message);
send_notifications($provider->id, 'provider', 'Ride in 30 min', $message);
$request->later = 0;
$request->save();
}
}
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:27,代码来源:SchedulePush.php
示例8: userTripDetail
public function userTripDetail()
{
$id = Request::segment(3);
$owner_id = Session::get('user_id');
$request = Requests::find($id);
if ($request->owner_id == $owner_id) {
$locations = WalkLocation::where('request_id', $id)->orderBy('id')->get();
$start = WalkLocation::where('request_id', $id)->orderBy('id')->first();
$end = WalkLocation::where('request_id', $id)->orderBy('id', 'desc')->first();
$map = "https://maps-api-ssl.google.com/maps/api/staticmap?size=249x249&style=feature:landscape|visibility:off&style=feature:poi|visibility:off&style=feature:transit|visibility:off&style=feature:road.highway|element:geometry|lightness:39&style=feature:road.local|element:geometry|gamma:1.45&style=feature:road|element:labels|gamma:1.22&style=feature:administrative|visibility:off&style=feature:administrative.locality|visibility:on&style=feature:landscape.natural|visibility:on&scale=2&markers=shadow:false|scale:2|icon:http://d1a3f4spazzrp4.cloudfront.net/receipt-new/[email protected]|{$start->latitude},{$start->longitude}&markers=shadow:false|scale:2|icon:http://d1a3f4spazzrp4.cloudfront.net/receipt-new/[email protected]|{$end->latitude},{$end->longitude}&path=color:0x2dbae4ff|weight:4";
foreach ($locations as $location) {
$map .= "|{$location->latitude},{$location->longitude}";
}
$start_location = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?latlng={$start->latitude},{$start->longitude}"), TRUE);
$start_address = $start_location['results'][0]['formatted_address'];
$end_location = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?latlng={$end->latitude},{$end->longitude}"), TRUE);
$end_address = $end_location['results'][0]['formatted_address'];
$walker = Walker::find($request->confirmed_walker);
$walker_review = WalkerReview::where('request_id', $id)->first();
if ($walker_review) {
$rating = round($walker_review->rating);
} else {
$rating = 0;
}
return View::make('web.userTripDetail')->with('title', 'My Trips')->with('request', $request)->with('start_address', $start_address)->with('end_address', $end_address)->with('start', $start)->with('end', $end)->with('map_url', $map)->with('walker', $walker)->with('rating', $rating);
} else {
echo "false";
}
}
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:29,代码来源:WebUserController.php
示例9: display_element
/**
* Traverse elements to create list from elements.
*
* Calls parent function in wp-includes/class-wp-walker.php
*/
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
if (!$element) {
return;
}
//Add indicators for top level menu items with submenus
$id_field = $this->db_fields['id'];
if ($depth == 0 && !empty($children_elements[$element->{$id_field}])) {
$element->classes[] = 'mega-with-sub';
}
if (!empty($children_elements[$element->{$id_field}])) {
$element->classes[] = 'item-parent';
}
Walker::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
开发者ID:FameThemes,项目名称:st-mega-menu,代码行数:20,代码来源:class-megamenu.php
示例10: schedule_request
public function schedule_request()
{
$time = date("Y-m-d H:i:s");
$query = "SELECT id,owner_id,current_walker,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where status = 0 and is_cancelled = 0";
$results = DB::select(DB::raw($query));
foreach ($results as $result) {
$settings = Settings::where('key', 'provider_timeout')->first();
$timeout = $settings->value;
if ($result->diff >= $timeout) {
// Archiving Old Walker
RequestMeta::where('request_id', '=', $result->id)->where('walker_id', '=', $result->current_walker)->update(array('status' => 2));
$request_meta = RequestMeta::where('request_id', '=', $result->id)->where('status', '=', 0)->orderBy('created_at')->first();
// update request
if (isset($request_meta->walker_id)) {
// assign new walker
Requests::where('id', '=', $result->id)->update(array('current_walker' => $request_meta->walker_id, 'request_start_time' => date("Y-m-d H:i:s")));
// Send Notification
$walker = Walker::find($request_meta->walker_id);
$owner_data = Owner::find($result->owner_id);
$msg_array = array();
$msg_array['request_id'] = $result->id;
$msg_array['id'] = $request_meta->walker_id;
if ($walker) {
$msg_array['token'] = $walker->token;
}
$msg_array['client_profile'] = array();
$msg_array['client_profile']['name'] = $owner_data->first_name . " " . $owner_data->last_name;
$msg_array['client_profile']['picture'] = $owner_data->picture;
$msg_array['client_profile']['bio'] = $owner_data->bio;
$msg_array['client_profile']['address'] = $owner_data->address;
$msg_array['client_profile']['phone'] = $owner_data->phone;
$title = "New Request";
$message = $msg_array;
send_notifications($request_meta->walker_id, "walker", $title, $message);
} else {
// request ended
Requests::where('id', '=', $result->id)->update(array('current_walker' => 0, 'status' => 1));
$settings = Settings::where('key', 'sms_request_unanswered')->first();
$pattern = $settings->value;
$pattern = str_replace('%id%', $result->id, $pattern);
sms_notification(1, 'admin', $pattern);
// send email
$settings = Settings::where('key', 'email_request_unanswered')->first();
$pattern = $settings->value;
$pattern = str_replace('%id%', $result->id, $pattern);
$pattern = str_replace('%url%', web_url() . "/admin/request/map/" . $result->id, $pattern);
$subject = "New Request Unansweres";
email_notification(1, 'admin', $pattern, $subject);
}
}
}
}
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:52,代码来源:DogController.php
示例11: create_manual_request
public function create_manual_request()
{
$latitude = Input::get('latitude');
$longitude = Input::get('longitude');
$d_latitude = Input::get('d_latitude');
$d_longitude = Input::get('d_longitude');
$type = Input::get('type');
$provider = Input::get('provider');
$user_id = Session::get('user_id');
$time = date("Y-m-d H:i:s");
$provider_details = Walker::where('id', '=', $provider)->first();
$user = Owner::where('id', '=', $user_id)->first();
$request = new Requests();
$request->owner_id = $user_id;
$request->request_start_time = $time;
$request->confirmed_walker = $provider;
if ($d_longitude != '' && $d_latitude != '') {
$request->D_latitude = $d_latitude;
$request->D_longitude = $d_longitude;
}
$request->current_walker = $provider;
$request->status = 1;
$request->save();
$reqid = $request->id;
$request_service = new RequestServices();
$request_service->type = $type;
$request_service->request_id = $request->id;
$request_service->save();
$owner = Owner::find($user_id);
$owner->latitude = $latitude;
$owner->longitude = $longitude;
$owner->save();
$walkerlocation = new WalkLocation();
$walkerlocation->request_id = $request->id;
$walkerlocation->distance = 0.0;
$walkerlocation->latitude = $latitude;
$walkerlocation->longitude = $longitude;
$walkerlocation->save();
if ($request->save()) {
$current_request = Requests::where('id', '=', $reqid)->first();
return Redirect::to('/user/request-trip');
}
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:43,代码来源:WebProviderController.php
示例12: check_banking
public function check_banking()
{
$token = Input::get('token');
$walker_id = Input::get('id');
$is_admin = $this->isAdmin($token);
if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($walker_data->token_expiry) || $is_admin) {
// do
$default_banking = Config::get('app.default_payment');
$resp = array();
$resp['default_banking'] = $default_banking;
$walker = Walker::where('id', $walker_id)->first();
if ($walker->merchant_id != NULL) {
$resp['walker']['merchant_id'] = $walker->merchant_id;
}
$response_array = array('success' => true, 'details' => $resp);
$response_code = 200;
}
}
$response = Response::json($response_array, $response_code);
return $response;
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:23,代码来源:WalkerController.php
示例13: forgot_password
public function forgot_password()
{
$type = Input::get('type');
$email = Input::get('email');
if ($type == 1) {
// Walker
$walker_data = Walker::where('email', $email)->first();
if ($walker_data) {
$walker = Walker::find($walker_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$walker->password = Hash::make($new_password);
$walker->save();
/* $subject = "Your New Password";
$email_data = array();
$email_data['password'] = $new_password;
send_email($walker->id, 'walker', $email_data, $subject, 'forgotpassword'); */
$settings = Settings::where('key', 'admin_email_address')->first();
$admin_email = $settings->value;
$login_url = web_url() . "/provider/signin";
$pattern = array('name' => $walker->first_name . " " . $walker->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
$subject = "Your New Password";
email_notification($walker->id, 'walker', $pattern, $subject, 'forgot_password', "imp");
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
} else {
$owner_data = Owner::where('email', $email)->first();
if ($owner_data) {
$owner = Owner::find($owner_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$owner->password = Hash::make($new_password);
$owner->save();
/* $subject = "Your New Password";
$email_data = array();
$email_data['password'] = $new_password;
send_email($owner->id, 'owner', $email_data, $subject, 'forgotpassword'); */
$settings = Settings::where('key', 'admin_email_address')->first();
$admin_email = $settings->value;
$login_url = web_url() . "/user/signin";
$pattern = array('name' => $owner->first_name . " " . $owner->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
$subject = "Your New Password";
email_notification($owner->id, 'owner', $pattern, $subject, 'forgot_password', "imp");
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
}
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:69,代码来源:ApplicationController.php
示例14: payment_details
//.........这里部分代码省略.........
$query = $query->where('request.is_completed', '=', 1);
} else {
$query = $query->where('request.is_cancelled', '=', 1);
}
} else {
$query = $query->where(function ($que) {
$que->where('request.is_completed', '=', 1)->orWhere('request.is_cancelled', '=', 1);
});
}
/* $walks = $query->select('request.request_start_time', 'walker_type.name as type', 'request.ledger_payment', 'request.card_payment', 'owner.first_name as owner_first_name', 'owner.last_name as owner_last_name', 'walker.first_name as walker_first_name', 'walker.last_name as walker_last_name', 'owner.id as owner_id', 'walker.id as walker_id', 'request.id as id', 'request.created_at as date', 'request.*', 'request.is_walker_arrived', 'request.payment_mode', 'request.is_completed', 'request.is_paid', 'request.is_walker_started', 'request.confirmed_walker'
, 'request.status', 'request.time', 'request.distance', 'request.total', 'request.is_cancelled');
$walks = $walks->paginate(10); */
$walks = $query->select('request.request_start_time', 'walker_type.name as type', 'request.ledger_payment', 'request.card_payment', 'owner.first_name as owner_first_name', 'owner.last_name as owner_last_name', 'walker.first_name as walker_first_name', 'walker.last_name as walker_last_name', 'owner.id as owner_id', 'walker.id as walker_id', 'request.id as id', 'request.created_at as date', 'request.is_started', 'request.is_walker_arrived', 'request.payment_mode', 'request.is_completed', 'request.is_paid', 'request.is_walker_started', 'request.confirmed_walker', 'request.promo_id', 'request.promo_code', 'request.status', 'request.time', 'request.distance', 'request.total', 'request.is_cancelled', 'request.promo_payment');
$walks = $walks->orderBy('id', 'DESC')->paginate(10);
$query = DB::table('request')->leftJoin('owner', 'request.owner_id', '=', 'owner.id')->leftJoin('walker', 'request.confirmed_walker', '=', 'walker.id')->leftJoin('walker_type', 'walker.type', '=', 'walker_type.id');
if (Input::get('start_date') && Input::get('end_date')) {
$query = $query->where('request_start_time', '>=', $start_time)->where('request_start_time', '<=', $end_time);
}
if (Input::get('walker_id') && Input::get('walker_id') != 0) {
$query = $query->where('request.confirmed_walker', '=', $walker_id);
}
if (Input::get('owner_id') && Input::get('owner_id') != 0) {
$query = $query->where('request.owner_id', '=', $owner_id);
}
$completed_rides = $query->where('request.is_completed', 1)->count();
$query = DB::table('request')->leftJoin('owner', 'request.owner_id', '=', 'owner.id')->leftJoin('walker', 'request.confirmed_walker', '=', 'walker.id')->leftJoin('walker_type', 'walker.type', '=', 'walker_type.id');
if (Input::get('start_date') && Input::get('end_date')) {
$query = $query->where('request_start_time', '>=', $start_time)->where('request_start_time', '<=', $end_time);
}
if (Input::get('walker_id') && Input::get('walker_id') != 0) {
$query = $query->where('request.confirmed_walker', '=', $walker_id);
}
if (Input::get('owner_id') && Input::get('owner_id') != 0) {
$query = $query->where('request.owner_id', '=', $owner_id);
}
$cancelled_rides = $query->where('request.is_cancelled', 1)->count();
$query = DB::table('request')->leftJoin('owner', 'request.owner_id', '=', 'owner.id')->leftJoin('walker', 'request.confirmed_walker', '=', 'walker.id')->leftJoin('walker_type', 'walker.type', '=', 'walker_type.id');
if (Input::get('start_date') && Input::get('end_date')) {
$query = $query->where('request_start_time', '>=', $start_time)->where('request_start_time', '<=', $end_time);
}
if (Input::get('walker_id') && Input::get('walker_id') != 0) {
$query = $query->where('request.confirmed_walker', '=', $walker_id);
}
if (Input::get('owner_id') && Input::get('owner_id') != 0) {
$query = $query->where('request.owner_id', '=', $owner_id);
}
$card_payment = $query->where('request.is_completed', 1)->sum('request.card_payment');
$query = DB::table('request')->leftJoin('owner', 'request.owner_id', '=', 'owner.id')->leftJoin('walker', 'request.confirmed_walker', '=', 'walker.id')->leftJoin('walker_type', 'walker.type', '=', 'walker_type.id');
if (Input::get('start_date') && Input::get('end_date')) {
$query = $query->where('request_start_time', '>=', $start_time)->where('request_start_time', '<=', $end_time);
}
if (Input::get('walker_id') && Input::get('walker_id') != 0) {
$query = $query->where('request.confirmed_walker', '=', $walker_id);
}
if (Input::get('owner_id') && Input::get('owner_id') != 0) {
$query = $query->where('request.owner_id', '=', $owner_id);
}
$credit_payment = $query->where('request.is_completed', 1)->sum('request.ledger_payment');
$cash_payment = $query->where('request.payment_mode', 1)->sum('request.total');
if (Input::get('submit') && Input::get('submit') == 'Download_Report') {
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');
$handle = fopen('php://output', 'w');
$settings = Settings::where('key', 'default_distance_unit')->first();
$unit = $settings->value;
if ($unit == 0) {
$unit_set = 'kms';
} elseif ($unit == 1) {
$unit_set = 'miles';
}
fputcsv($handle, array('ID', 'Date', 'Type of Service', 'Provider', 'Owner', 'Distance (' . $unit_set . ')', 'Time (Minutes)', 'Payment Mode', 'Earning', 'Referral Bonus', 'Promotional Bonus', 'Card Payment'));
foreach ($walks as $request) {
$pay_mode = "Card Payment";
if ($request->payment_mode == 1) {
$pay_mode = "Cash Payment";
}
fputcsv($handle, array($request->id, date('l, F d Y h:i A', strtotime($request->request_start_time)), $request->type, $request->walker_first_name . " " . $request->walker_last_name, $request->owner_first_name . " " . $request->owner_last_name, sprintf2($request->distance, 2), sprintf2($request->time, 2), $pay_mode, sprintf2($request->total, 2), sprintf2($request->ledger_payment, 2), sprintf2($request->promo_payment, 2), sprintf2($request->card_payment, 2)));
}
fputcsv($handle, array());
fputcsv($handle, array());
fputcsv($handle, array('Total Trips', $completed_rides + $cancelled_rides));
fputcsv($handle, array('Completed Trips', $completed_rides));
fputcsv($handle, array('Cancelled Trips', $cancelled_rides));
fputcsv($handle, array('Total Payments', sprintf2($credit_payment + $card_payment, 2)));
fputcsv($handle, array('Card Payment', sprintf2($card_payment, 2)));
fputcsv($handle, array('Credit Payment', $credit_payment));
fclose($handle);
$headers = array('Content-Type' => 'text/csv');
} else {
/* $currency_selected = Keywords::where('alias', 'Currency')->first();
$currency_sel = $currency_selected->keyword; */
$currency_sel = Config::get('app.generic_keywords.Currency');
$walkers = Walker::paginate(10);
$owners = Owner::paginate(10);
$payment_default = ucfirst(Config::get('app.default_payment'));
$title = ucwords(trans('customize.payment_details'));
/* 'Payments' */
return View::make('payment')->with('title', $title)->with('page', 'payments')->with('walks', $walks)->with('owners', $owners)->with('walkers', $walkers)->with('completed_rides', $completed_rides)->with('cancelled_rides', $cancelled_rides)->with('card_payment', $card_payment)->with('install', $install)->with('currency_sel', $currency_sel)->with('cash_payment', $cash_payment)->with('credit_payment', $credit_payment)->with('payment_default', $payment_default);
}
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:101,代码来源:AdminController.php
示例15: eta
public function eta()
{
$secret = Input::get('secret');
$token = Input::get('token');
$owner_id = Input::get('id');
$validator = Validator::make(array('secret' => $secret, 'token' => $token, 'owner_id' => $owner_id), array('secret' => 'required|integer', 'token' => 'required', 'owner_id' => 'required|integer'));
if ($validator->fails()) {
$error_messages = $validator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
$is_admin = $this->isAdmin($token);
if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($owner_data->token_expiry) || $is_admin) {
// Do necessary operations
$request = Requests::where('security_key', $secret)->first();
if ($request) {
if ($request->is_started == 0) {
$walker = Walker::find($request->confirmed_walker);
$distance = 0;
} else {
$walker = WalkLocation::where('request_id', $request->id)->orderBy('created_at', 'desc')->first();
$distance = WalkLocation::where('request_id', $request->id)->max('distance');
}
$settings = Settings::where('key', 'default_distance_unit')->first();
$unit = $settings->value;
if ($unit == 0) {
$unit_set = 'kms';
} elseif ($unit == 1) {
$unit_set = 'miles';
}
$distance = convert($distance, $unit);
$response_array = array('success' => true, 'latitude' => $walker->latitude, 'longitude' => $walker->longitude, 'destination_latitude' => $request->D_latitude, 'destination longitude' => $request->D_longitude, 'distance' => (string) $distance, 'unit' => $unit_set);
$response_code = 200;
} else {
$response_array = array('success' => false, 'error' => 'Request ID Not Found', 'error_code' => 408);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
$response_code = 200;
}
} else {
if ($is_admin) {
/* $var = Keywords::where('id', 2)->first();
$response_array = array('success' => false, 'error' => '' . $var->keyword . ' ID not Found', 'error_code' => 410); */
$response_array = array('success' => false, 'error' => '' . Config::get('app.generic_keywords.User') . ' ID not Found', 'error_code' => 410);
} else {
$response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
}
$response_code = 200;
}
}
$response = Response::json($response_array, $response_code);
return $response;
}
开发者ID:felipemarques8,项目名称:goentregas,代码行数:57,代码来源:DogController.php
示例16: walk
/**
* Overrides Walker:walk to set depth argument
*
* @since 1.2
*
* @param array $elements elements to display
* @param array $args
* @return string
*/
function walk($elements, $args = array())
{
return parent::walk($elements, -1, $args);
}
开发者ID:JoryHogeveen,项目名称:polylang,代码行数:13,代码来源:walker-list.php
示例17: payment_type
public function payment_type()
{
$token = Input::get('token');
$owner_id = Input::get('id');
$request_id = Input::get('request_id');
$cash_or_card = Input::get('cash_or_card');
$validator = Validator::make(array('token' => $token, 'owner_id' => $owner_id, 'cash_or_card' => $cash_or_card, 'request_id' => $request_id), array('token' => 'required', 'owner_id' => 'required|integer', 'cash_or_card' => 'required', 'request_id' => 'required'));
if ($validator->fails()) {
$error_messages = $validator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
$payments = array();
/* $payments['none'] = ""; */
$def_card = 0;
$is_admin = $this->isAdmin($token);
if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($owner_data->token_expiry) || $is_admin) {
if ($cash_or_card != 1) {
$card_count = Payment::where('owner_id', '=', $owner_id)->count();
if ($card_count <= 0) {
$response_array = array('success' => false, 'error' => "Please add card first for payment.", 'error_code' => 417);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
}
// Do necessary operations
$owner = Owner::find($owner_id);
$payment_data = Payment::where('owner_id', $owner_id)->orderBy('is_default', 'DESC')->get();
foreach ($payment_data as $data1) {
$default = $data1->is_default;
if ($default == 1) {
$def_card = $data1->id;
$data['is_default_text'] = "default";
} else {
$data['is_default_text'] = "not_default";
}
$data['id'] = $data1->id;
$data['owner_id'] = $data1->owner_id;
$data['customer_id'] = $data1->customer_id;
$data['last_four'] = $data1->last_four;
$data['card_token'] = $data1->card_token;
$data['card_type'] = $data1->card_type;
$data['card_id'] = $data1->card_token;
$data['is_default'] = $default;
array_push($payments, $data);
}
if ($request = Requests::find($request_id)) {
$request->payment_mode = $cash_or_card;
$request->save();
$walker = Walker::where('id', $request->confirmed_walker)->first();
if ($walker) {
$msg_array = array();
$msg_array['unique_id'] = 3;
$response_array = array('success' => true, 'id' => $owner->id, 'first_name' => $owner->first_name, 'last_name' => $owner->last_name, 'phone' => $owner->phone, 'email' => $owner->email, 'picture' => $owner->picture, 'bio' => $owner->bio, 'address' => $owner->address, 'state' => $owner->state, 'country' => $owner->country, 'zipcode' => $owner->zipcode, 'login_by' => $owner->login_by, 'social_unique_id' => $owner->social_unique_id, 'device_token' => $owner->device_token, 'device_type' => $owner->device_type, 'token' => $owner->token, 'default_card_id' => $def_card, 'payment_type' => $request->payment_mode, 'is_referee' => $owner->is_referee, 'promo_count' => $owner->promo_count, 'payments' => $payments);
$response_array['unique_id'] = 3;
$response_code = 200;
$msg_array['owner_data'] = $response_array;
$title = "Payment Type Change";
$message = $msg_array;
if ($request->confirmed_walker == $request->current_walker) {
send_notifications($request->confirmed_walker, "walker", $title, $message);
}
} else {
$response_array = array('success' => false, 'error' => 'Driver Not Found', 'error_code' => 408);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Request ID Not Found', 'error_code' => 408);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
$response_code = 200;
}
} else {
if ($is
|
请发表评论