<?php

$name = 'phoneKey[' . $data->name . '][' . $column->name . ']';
$htmlOptions = array('name' => $name);
$htmlOptions["id"] = str_replace(".", "_", $htmlOptions["name"]);
$htmlOptions["id"] = str_replace("[", "_", $htmlOptions["id"]);
$htmlOptions["id"] = str_replace("]", "", $htmlOptions["id"]);
$htmlOptions["id"] = str_replace(" ", "_", $htmlOptions["id"]);

if ($column->name == 'number_data') {
    $attrWithoutDataField = array('no', '', '0', 'X05', 'XO8', 'X10', 'X12');
    if ($data->function == 'X03') {
        echo CHtml::activeDropDownList($data, $column->name, $this->getAllQueues(), $htmlOptions);
    } else if ($data->function == 'X13') {
        echo CHtml::activeDropDownList($data, $column->name, $this->getAllCallGroup(), $htmlOptions);
    } else {
        if (in_array($data->function, $attrWithoutDataField)) {
            $htmlOptions['disabled'] = 'disabled';
        }
        echo CHtml::activeTextField($data, $column->name, $htmlOptions);
    }
} else if ($column->name == 'label') {
    if ($data->function == 'no' || empty($data->function)) {
        $htmlOptions['disabled'] = 'disabled';
    }
    echo CHtml::activeTextField($data, $column->name, $htmlOptions);
} else {
    echo CHtml::activeTextField($data, $column->name, $htmlOptions);
}
