aboutsummaryrefslogtreecommitdiff
path: root/muamba.handlers.inc
blob: d634d6c5a8c14b3cede0762d923fdb188f26092e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php

/**
 * @file
 * Contains the muamba transaction status views field handler.
 */

/**
 * Field handler for muamba transaction status.
 */
class views_handler_field_muamba_status extends views_handler_field {
  /**
   * Renders the field.
   */
  function render($values) {
    if (isset($values->muamba_status)) {
      return muamba_statuses($values->muamba_status);
    }
  }
}

/**
 * Filter by transaction status
 */
class views_handler_filter_muamba_status extends views_handler_filter_in_operator {
  function get_value_options() {
    if (!isset($this->value_options)) {
      $this->value_title   = t('Transaction status');
      $this->value_options = muamba_statuses();
    }
  }
}

/**
 * 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";
  }
}