protected function GetItemHtml($objItem, $intIndex, $strTabIndex, $blnWrapLabel) { $objLabelStyles = new QTagStyler(); if ($this->objItemStyle) { $objLabelStyles->Override($this->objItemStyle); // default style } if ($objItemStyle = $objItem->ItemStyle) { $objLabelStyles->Override($objItemStyle); // per item styling } $objStyles = new QTagStyler(); $objStyles->SetHtmlAttribute('type', 'radio'); $objStyles->SetHtmlAttribute('value', $intIndex); $objStyles->SetHtmlAttribute('name', $this->strControlId); $strIndexedId = $this->strControlId . '_' . $intIndex; $objStyles->SetHtmlAttribute('id', $strIndexedId); if ($strTabIndex) { $objStyles->TabIndex = $strTabIndex; // Use parent control tabIndex, which will cause the browser to take them in order of drawing } if (!$this->Enabled) { $objStyles->Enabled = false; } $strLabelText = $this->GetLabelText($objItem); if ($objItem->Selected) { $objStyles->SetHtmlAttribute('checked', 'checked'); } $objStyles->SetHtmlAttribute("autocomplete", "off"); // recommended bugfix for firefox in certain situations if (!$blnWrapLabel) { $objLabelStyles->SetHtmlAttribute('for', $strIndexedId); } $this->OverrideItemAttributes($objItem, $objStyles, $objLabelStyles); $strHtml = QHtml::RenderLabeledInput($strLabelText, $this->strTextAlign == QTextAlign::Left, $objStyles->RenderHtmlAttributes(), $objLabelStyles->RenderHtmlAttributes(), $blnWrapLabel); return $strHtml; }
/** * There is a little bit of a conundrum here. If there is text assigned to the checkbox, we wrap * the checkbox in a label. However, in this situation, its unclear what to do with the class and style * attributes that are for the checkbox. We are going to let the developer use the label styler to make * it clear what their intentions are. * @return string */ protected function RenderLabelAttributes() { $objStyler = new QTagStyler(); $attributes = $this->GetHtmlAttributes(null, null, ['title']); // copy tooltip to wrapping label $objStyler->SetAttributes($attributes); $objStyler->Override($this->getCheckLabelStyler()); if (!$this->Enabled) { $objStyler->AddCssClass('disabled'); // add the disabled class to the label for styling } if (!$this->Display) { $objStyler->Display = false; } return $objStyler->RenderHtmlAttributes(); }
/** * Return the HTML for the given item. * * @param QListItem $objItem * @param integer $intIndex * @param string $strTabIndex * @param boolean $blnWrapLabel * @return string */ protected function GetItemHtml(QListItem $objItem, $intIndex, $strTabIndex, $blnWrapLabel) { $objLabelStyles = new QTagStyler(); if ($this->objItemStyle) { $objLabelStyles->Override($this->objItemStyle); // default style } if ($objItemStyle = $objItem->ItemStyle) { $objLabelStyles->Override($objItemStyle); // per item styling } $objStyles = new QTagStyler(); $objStyles->SetHtmlAttribute('type', 'checkbox'); $objStyles->SetHtmlAttribute('name', $this->strControlId . '[]'); $objStyles->SetHtmlAttribute('value', $intIndex); $strIndexedId = $objItem->Id; $objStyles->SetHtmlAttribute('id', $strIndexedId); if ($strTabIndex) { $objStyles->TabIndex = $strTabIndex; } if (!$this->Enabled) { $objStyles->Enabled = false; } $strLabelText = $objItem->Label; if (empty($strLabelText)) { $strLabelText = $objItem->Name; } if ($this->blnHtmlEntities) { $strLabelText = QApplication::HtmlEntities($strLabelText); } if ($objItem->Selected) { $objStyles->SetHtmlAttribute('checked', 'checked'); } if (!$blnWrapLabel) { $objLabelStyles->SetHtmlAttribute('for', $strIndexedId); } $objStyles->AddCssClass('qc-tableCell'); $objLabelStyles->AddCssClass('qc-tableCell'); $strHtml = QHtml::RenderLabeledInput($strLabelText, $this->strTextAlign == QTextAlign::Left, $objStyles->RenderHtmlAttributes(), $objLabelStyles->RenderHtmlAttributes(), $blnWrapLabel); return $strHtml; }