<?php


class CustomColumn extends MantisColumn {
	public $title = 'column_test';
	public $column = 'column_test';
	
	public $source_field = 'source_custom_field_name';
	
	function display( BugData $p_bug, $p_columns_target ){
		$t_field_id = custom_field_get_id_from_name( $this->source_field );
		$t_value= custom_field_get_value( $t_field_id, $p_bug->id );
		echo '<a href="http://example.com?val=' . $t_value . '">' . $t_value . '</a>';
	}
}


class template_column_testPlugin extends MantisPlugin {
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

        function register() {
                $this->name = 'template_column_test';    # Proper name of plugin
                $this->description = 'template_column_test';    # Short description of the plugin
                
                $this->version = '1.0';     # Plugin version string
                $this->requires = array(    # Plugin dependencies, array of basename => version pairs
                    'MantisCore' => '1.3.0',  #   Should always depend on an appropriate version of MantisBT
                    );
                
                $this->author = 'carlos proensa';         # Author/team name
                $this->contact = '';        # Author/team e-mail address
                $this->url = '';            # Support webpage
        }
		
	function hooks( )
	{
		$hooks = array(
			'EVENT_FILTER_COLUMNS' => 'register_column',
		);

		return $hooks;
	}
	
	function register_column( $p_event ) {
		return array ( 'CustomColumn' );
	}
		
}
