Created
March 16, 2015 16:47
-
-
Save EGreg/ee5c61b35a4d98e05298 to your computer and use it in GitHub Desktop.
Groups/location Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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