<?php
//FIXME generate UserData and Options Html Attributes
$data = array();
$optionsHtmlAttributes = array();
$availableUsersData = array();
foreach ($availableUsers as $user) {
    $availableUsersData[$user->extension][$user->id] = getFormatedUsername($user);
    $optionsHtmlAttributes[$user->id] = array('title' => $user->name);
}
ksort($availableUsersData);
$availableUsers = array();
foreach ( $availableUsersData as $extension => $data) {
    foreach ($data as $id => $userName) {
        
        $availableUsers[$id] = $userName;
    }
}
$data = array();
$data = $availableUsers;

//generate Html
$dropdownName = 'userDropdown';
$html=  CHtml::activeDropDownList(
            $tier,
            'userId',
            $data,
            array(
                'class'=> 'span1',
                'name'=>$dropdownName,
                'options'=>$optionsHtmlAttributes,
                'data-custom-contexthelp-key' => "QUEUE_AVAILABLE_MEMBER_CONTEXT_HELP",
                'style' => 'width:180px'
            )
        );
//output 
echo $html;
