protected function GetControlHtml()
{
if (!$this->objItemsArray || count($this->objItemsArray) == 0) {
return "";
}
if ($this->intTabIndex) {
$strTabIndex = sprintf('tabindex="%s" ', $this->intTabIndex);
} else {
$strTabIndex = "";
}
if ($this->strToolTip) {
$strToolTip = sprintf('title="%s" ', $this->strToolTip);
} else {
$strToolTip = "";
}
if ($this->strCssClass) {
$strCssClass = sprintf('class="%s" ', $this->strCssClass);
} else {
$strCssClass = "";
}
if ($this->strAccessKey) {
$strAccessKey = sprintf('accesskey="%s" ', $this->strAccessKey);
} else {
$strAccessKey = "";
}
$strStyle = $this->GetStyleAttributes();
if (strlen($strStyle) > 0) {
$strStyle = sprintf('style="%s" ', $strStyle);
}
$strCustomAttributes = $this->GetCustomAttributes();
if ($this->intCellPadding >= 0) {
$strCellPadding = sprintf('cellpadding="%s" ', $this->intCellPadding);
} else {
$strCellPadding = "";
}
if ($this->intCellSpacing >= 0) {
$strCellSpacing = sprintf('cellspacing="%s" ', $this->intCellSpacing);
} else {
$strCellSpacing = "";
}
// Generate Table HTML
$strToReturn = sprintf('<table id="%s" %s%sborder="0" %s%s%s%s%s>', $this->strControlId, $strCellPadding, $strCellSpacing, $strAccessKey, $strToolTip, $strCssClass, $strStyle, $strCustomAttributes);
if ($this->ItemCount > 0) {
// Figure out the number of ROWS for this table
$intRowCount = floor($this->ItemCount / $this->intRepeatColumns);
$intWidowCount = $this->ItemCount % $this->intRepeatColumns;
if ($intWidowCount > 0) {
$intRowCount++;
}
// Iterate through Table Rows
for ($intRowIndex = 0; $intRowIndex < $intRowCount; $intRowIndex++) {
$strToReturn .= '<tr>';
// Figure out the number of COLUMNS for this particular ROW
if ($intRowIndex == $intRowCount - 1 && $intWidowCount > 0) {
// on the last row for a table with widowed-columns, ColCount is the number of widows
$intColCount = $intWidowCount;
} else {
// otherwise, ColCount is simply intRepeatColumns
$intColCount = $this->intRepeatColumns;
}
// Iterate through Table Columns
for ($intColIndex = 0; $intColIndex < $intColCount; $intColIndex++) {
if ($this->strRepeatDirection == QRepeatDirection::Horizontal) {
$intIndex = $intColIndex + $this->intRepeatColumns * $intRowIndex;
} else {
$intIndex = floor($this->ItemCount / $this->intRepeatColumns) * $intColIndex + min($this->ItemCount % $this->intRepeatColumns, $intColIndex) + $intRowIndex;
}
if ($this->objItemsArray[$intIndex]->Selected) {
$strChecked = 'checked="checked" ';
} else {
$strChecked = "";
}
if ($this->blnEnabled) {
$strDisabledStart = '';
$strDisabledEnd = '';
$strDisabled = '';
} else {
$strDisabledStart = '<span disabled="disabled">';
$strDisabledEnd = '</span>';
$strDisabled = 'disabled="disabled" ';
}
if ($this->objItemsArray[$intIndex]->ItemStyle) {
$strLabelAttributes = $this->objItemsArray[$intIndex]->ItemStyle->GetAttributes();
$strCheckboxAttributes = $this->objItemsArray[$intIndex]->ItemStyle->GetNonStyleAttributes();
} else {
$strLabelAttributes = null;
$strCheckboxAttributes = null;
}
$this->strActionParameter = $intIndex;
$strActions = $this->GetActionAttributes();
if ($this->strTextAlign == QTextAlign::Left) {
$strToReturn .= sprintf('<td>%s<label for="%s_%s" %s>%s</label><input id="%s_%s" name="%s" value="%s" type="radio" %s%s%s%s%s%s />%s</td>', $strDisabledStart, $this->strControlId, $intIndex, $strLabelAttributes, $this->blnHtmlEntities ? QApplication::HtmlEntities($this->objItemsArray[$intIndex]->Name) : $this->objItemsArray[$intIndex]->Name, $this->strControlId, $intIndex, $this->strControlId, $intIndex, $strDisabled, $strChecked, $strActions, $strTabIndex, $strCheckboxAttributes, !$this->objItemsArray[$intIndex]->Enabled ? 'disabled="disabled"' : "", $strDisabledEnd);
} else {
$strToReturn .= sprintf('<td>%s<input id="%s_%s" name="%s" value="%s" type="radio" %s%s%s%s%s%s /><label for="%s_%s" %s>%s</label>%s</td>', $strDisabledStart, $this->strControlId, $intIndex, $this->strControlId, $intIndex, $strDisabled, $strChecked, $strActions, $strTabIndex, $strCheckboxAttributes, !$this->objItemsArray[$intIndex]->Enabled ? 'disabled="disabled"' : "", $this->strControlId, $intIndex, $strLabelAttributes, $this->blnHtmlEntities ? QApplication::HtmlEntities($this->objItemsArray[$intIndex]->Name) : $this->objItemsArray[$intIndex]->Name, $strDisabledEnd);
}
}
$strToReturn .= '</tr>';
}
}
$strToReturn .= '</table>';
return $strToReturn;
}