protected function GetControlHtml() { $intItemCount = $this->GetItemCount(); if (!$intItemCount) { return ''; } if ($this->intButtonMode == self::ButtonModeSet || $this->intButtonMode == self::ButtonModeList) { return $this->RenderButtonSet(); } elseif ($this->intRepeatColumns == 1) { $strToReturn = $this->RenderButtonColumn(); } else { $strToReturn = $this->RenderButtonTable(); } if ($this->strMaxHeight) { $objStyler = new QTagStyler(); $objStyler->SetCssStyle('max-height', $this->strMaxHeight, true); $objStyler->SetCssStyle('overflow-y', 'scroll'); $strToReturn = QHtml::RenderTag('div', $objStyler->RenderHtmlAttributes(), $strToReturn); } return $strToReturn; }
/** * 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; }