aboutsummaryrefslogtreecommitdiff
path: root/muamba.handlers.inc
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-11-06 14:21:34 -0200
committerSilvio Rhatto <rhatto@riseup.net>2011-11-06 14:21:34 -0200
commit9fe2bfe328145ac630d18929c0197c98402381f1 (patch)
treec10aaab3bbfb0f5fd84f1242e5443d8d6502f2e0 /muamba.handlers.inc
parent857fad8877a7ea9c19a1488e3ce9ed53276dbada (diff)
downloadmuamba-9fe2bfe328145ac630d18929c0197c98402381f1.tar.gz
muamba-9fe2bfe328145ac630d18929c0197c98402381f1.tar.bz2
Refactoring muamba_check_availability() and adding new views handlers
Diffstat (limited to 'muamba.handlers.inc')
-rw-r--r--muamba.handlers.inc56
1 files changed, 56 insertions, 0 deletions
diff --git a/muamba.handlers.inc b/muamba.handlers.inc
index e67ed80..d634d6c 100644
--- a/muamba.handlers.inc
+++ b/muamba.handlers.inc
@@ -30,3 +30,59 @@ class views_handler_filter_muamba_status extends views_handler_filter_in_operato
}
}
}
+
+/**
+ * Field handler for muamba transaction status.
+ */
+class views_handler_field_muamba_available extends views_handler_field {
+ /**
+ * Implements views_handler_field#query().
+ *
+ * @see views_php_views_pre_execute()
+ */
+ function query() {
+ // Provide an field alias but don't actually alter the query.
+ $this->field_alias = 'views_muamba_available_' . $this->position;
+ }
+
+ /**
+ * Renders the field.
+ *
+ * @todo
+ * Return also "Yes, you requested this item"
+ */
+ function render($values) {
+ if (muamba_check_availability($values->nid)) {
+ return t('Yes');
+ }
+
+ return t('No');
+ }
+}
+
+/**
+ * Field handler for muamba transaction status.
+ *
+ * @todo
+ */
+class views_handler_field_muamba_actions extends views_handler_field {
+ /**
+ * Implements views_handler_field#query().
+ *
+ * @see views_php_views_pre_execute()
+ */
+ function query() {
+ // Provide an field alias but don't actually alter the query.
+ $this->field_alias = 'views_muamba_actions_' . $this->position;
+ }
+
+ /**
+ * Renders the field.
+ *
+ * @todo
+ */
+ function render($values) {
+ dpm($values);
+ return "TODO";
+ }
+}