/**
 * Builds ext-js rich table to display matrix results
 *
 *
 * return tlExtTable
 *
 */
function buildMatrix(&$guiObj, &$argsObj)
{
    // th_first_name,th_last_name,th_email
    // IMPORTANT DEVELOPER NOTICE
    // Column order is same that present on query on getAllUsersForGrid()
    //
    // Where col_id is not specified, col_id will be generated this way: 'id_' . $v['title_key'].
    // Example: id_th_first_name.
    //
    // 'tlType' => TestLinkType: will be analized and mapped accordingly on tlExtTable::buildColumns()
    //
    $columns = array(array('title_key' => 'th_login', 'col_id' => 'handle', 'width' => 100), array('title_key' => 'th_first_name', 'width' => 150), array('title_key' => 'th_last_name', 'width' => 150), array('title_key' => 'th_email', 'width' => 150), array('title_key' => 'th_role', 'width' => 150), array('title_key' => 'th_locale', 'width' => 150), array('title_key' => 'th_active', 'type' => 'oneZeroImage', 'width' => 50), array('title' => 'disableUser', 'tlType' => 'disableUser', 'width' => 150), array('hidden' => true, 'title' => 'hidden_role_id', 'col_id' => 'role_id'), array('hidden' => true, 'title' => 'hidden_user_id', 'col_id' => 'user_id'), array('hidden' => true, 'title' => 'hidden_login', 'col_id' => 'login'), array('hidden' => true, 'title' => 'hidden_is_special', 'col_id' => 'is_special'));
    $lbl = init_labels(array('th_login' => null, 'th_first_name' => null, 'th_last_name' => null, 'th_email' => null));
    $loop2do = count($guiObj->matrix);
    for ($zdx = 0; $zdx < $loop2do; $zdx++) {
        $guiObj->matrix[$zdx]['handle'] = '<a href="' . $argsObj->basehref . 'lib/usermanagement/usersEdit.php?doAction=edit&user_id=' . $guiObj->matrix[$zdx]['user_id'] . '">' . $guiObj->matrix[$zdx]['login'] . "</a>";
    }
    $matrix = new tlExtTable($columns, $guiObj->matrix, 'tl_users_list');
    // => addCustomBehaviour(columnType, );
    $matrix->addCustomBehaviour('oneZeroImage', array('render' => 'oneZeroImageRenderer'));
    $matrix->moreViewConfig = " ,getRowClass: function(record, index) {" . " var x = record.get('role_id');" . " return('roleCode'+x); " . " } ";
    $matrix->setImages($guiObj->images);
    $matrix->allowMultiSort = false;
    $matrix->sortDirection = 'DESC';
    $matrix->showToolbar = true;
    $matrix->toolbarShowAllColumnsButton = true;
    unset($columns);
    return $matrix;
}