Skip to content

Instantly share code, notes, and snippets.

@EGreg
Created March 16, 2015 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EGreg/ee5c61b35a4d98e05298 to your computer and use it in GitHub Desktop.
Save EGreg/ee5c61b35a4d98e05298 to your computer and use it in GitHub Desktop.
Groups/location Controller
<?php
function Groups_location_response_column($params)
{
$user = Users::loggedInUser();
if (!$user) {
Q_Response::redirect("Groups/groups");
}
$miles = array();
foreach (Q_Config::expect('Places', 'nearby', 'miles') as $m) {
$miles[$m] = $m === 1 ? "$m mile" : "$m miles";
}
$defaultMiles = Q_Config::expect('Places', 'nearby', 'defaultMiles');
if ($stream = Streams::fetchOne($user->id, $user->id, "Places/user/location")) {
$defaultMiles = $stream->getAttribute('miles', $defaultMiles);
}
$img = Q_Html::img('img/colorful/location.png', '');
$title = "<span id='Groups_location_title' class='Groups_location'>
$img My Location
</span>";
Q_Response::setSlot('title', $title);
return Q::view("Groups/columns/location.php", compact('miles', 'defaultMiles'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment