aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muamba.handlers.inc22
1 files changed, 16 insertions, 6 deletions
diff --git a/muamba.handlers.inc b/muamba.handlers.inc
index d634d6c..7a1c3f3 100644
--- a/muamba.handlers.inc
+++ b/muamba.handlers.inc
@@ -47,16 +47,26 @@ class views_handler_field_muamba_available extends views_handler_field {
/**
* Renders the field.
- *
- * @todo
- * Return also "Yes, you requested this item"
*/
function render($values) {
- if (muamba_check_availability($values->nid)) {
- return t('Yes');
+ global $user;
+ $available = muamba_check_availability($values->nid);
+
+ if ($values->users_node_uid == $user->uid) {
+ return t('You own the item');
+ }
+ elseif (!$available) {
+ $transaction = muamba_current_transactions($values->nid, $user->uid);
+
+ if ($transaction['uid'] == $user->uid) {
+ return t('You requested');
+ }
+ else {
+ return t('No');
+ }
}
- return t('No');
+ return t('Yes');
}
}