From 9fe2bfe328145ac630d18929c0197c98402381f1 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 6 Nov 2011 14:21:34 -0200 Subject: Refactoring muamba_check_availability() and adding new views handlers --- muamba.handlers.inc | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'muamba.handlers.inc') 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"; + } +} -- cgit v1.2.3