<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

/**
 * Description
 *
 * @author Igor Ratsun
 */
class Rtgc_textarea extends \Abstract_rtgc_callback
{

    protected $options = array(
        'class'     => 'input-xxlarge',
        'rows'      => '10',
        'maxlength' => '512',
    );

    public function __construct($opt = array())
    {
        $this->set_options($opt);
    }

    public function column($value = '', $data = array())
    {
        return $value;
    }

    public function field($name = '', $value = NULL)
    {
        return '<textarea class="' . $this->options['class'] . '" rows="' . $this->options['rows'] . '" maxlength="' . $this->options['maxlength'] . '" name="' . $name . '">' . $value . '</textarea>';
    }

    public function set_options($opt = array())
    {
        if (is_array($opt)) {
            $this->options = array_merge($this->options, $opt);
        }
        
        return $this;
    }

}
