Browse Source

Views integration now supports chado t/f booleans and uses the boolean field handler as a default for chado tables.

Lacey Sanderson 12 years ago
parent
commit
1546f674aa
1 changed files with 0 additions and 39 deletions
  1. 0 39
      tripal_views/views/handlers/views_handler_field_chado_tf_boolean.inc

+ 0 - 39
tripal_views/views/handlers/views_handler_field_chado_tf_boolean.inc

@@ -1,39 +0,0 @@
-<?php
-
-/**
- * @file
- * A handler to provide proper displays for booleans.
- *
- * Allows for display of true/false, yes/no, on/off.
- *
- * Definition terms:
- *   - output formats: An array where the first entry is displayed on boolean false
- *      and the second is displayed on boolean true. An example for sticky is:
- *      @code
- *      'output formats' => array(
- *        'sticky' => array('', t('Sticky')),
- *      ),
- *      @endcode
- *
- * @ingroup views_field_handlers
- * @ingroup tripal_core
- */
-class views_handler_field_chado_tf_boolean extends views_handler_field_boolean {
-
-  // Changes the rendered value: t='Yes' & f='No'
-  // Rendered value depends on type of value chosen in options
-  function render($values) {
-    $value = $values->{$this->field_alias};
-    if (!empty($this->options['not'])) {
-      $value = !$value;
-    }
-
-    if (isset($this->formats[$this->options['type']])) {
-      return preg_match('/t/', $value) ? $this->formats[$this->options['type']][0] : $this->formats[$this->options['type']][1];
-    }
-    else {
-      return preg_match('/t/', $value) ? $this->formats['yes-no'][0] : $this->formats['yes-no'][1];
-    }
-  }
-
-}