QControlBase::RenderOutput PHP Method

RenderOutput() protected method

protected RenderOutput ( $strOutput, $blnDisplayOutput, $blnForceAsBlockElement = false )
    protected function RenderOutput($strOutput, $blnDisplayOutput, $blnForceAsBlockElement = false)
    {
        // First, let's mark this control as being rendered and is ON the Page
        $this->blnRendering = false;
        $this->blnRendered = true;
        $this->blnOnPage = true;
        // Determine whether or not $strOutput is considered a XHTML "Block" Element
        if ($blnForceAsBlockElement || $this->blnIsBlockElement) {
            $blnIsBlockElement = true;
        } else {
            $blnIsBlockElement = false;
        }
        // Check for Visibility
        if (!$this->blnVisible) {
            $strOutput = '';
        }
        $strStyle = '';
        if ($this->strPosition && $this->strPosition != QPosition::NotSet) {
            $strStyle .= sprintf('position:%s;', $this->strPosition);
        }
        if (!$this->blnDisplay) {
            $strStyle .= 'display:none;';
        } else {
            if ($blnIsBlockElement) {
                $strStyle .= 'display:inline;';
            }
        }
        if (strlen(trim($this->strLeft)) > 0) {
            $strLeft = null;
            try {
                $strLeft = QType::Cast($this->strLeft, QType::Integer);
            } catch (QInvalidCastException $objExc) {
            }
            if (is_null($strLeft)) {
                $strStyle .= sprintf('left:%s;', $this->strLeft);
            } else {
                $strStyle .= sprintf('left:%spx;', $this->strLeft);
            }
        }
        if (strlen(trim($this->strTop)) > 0) {
            $strTop = null;
            try {
                $strTop = QType::Cast($this->strTop, QType::Integer);
            } catch (QInvalidCastException $objExc) {
            }
            if (is_null($strTop)) {
                $strStyle .= sprintf('top:%s;', $this->strTop);
            } else {
                $strStyle .= sprintf('top:%spx;', $this->strTop);
            }
        }
        switch ($this->objForm->CallType) {
            case QCallType::Ajax:
                // If we have a ParentControl and the ParentControl has NOT been rendered, then output
                // as standard HTML
                if ($this->objParentControl && ($this->objParentControl->Rendered || $this->objParentControl->Rendering)) {
                    if ($strStyle) {
                        $strStyle = sprintf('style="%s"', $strStyle);
                    }
                    if ($blnIsBlockElement) {
                        $strOutput = sprintf('<div id="%s_ctl" %s>%s</div>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                    } else {
                        $strOutput = sprintf('<span id="%s_ctl" %s>%s</span>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                    }
                    //						$strOutput = sprintf('<ins id="%s_ctl" style="%stext-decoration:inherit;">%s</ins>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                    //						$strOutput = sprintf('<q id="%s_ctl" style="%s">%s</q>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                } else {
                    // Otherwise, we are rendering as a top-level AJAX response
                    // Surround Output HTML around CDATA tags
                    $strOutput = QString::XmlEscape($strOutput);
                    $strOutput = sprintf('<control id="%s">%s</control>', $this->strControlId, $strOutput);
                    //					QApplication::ExecuteJavaScript(sprintf('qcodo.registerControl("%s"); ', $this->strControlId), true);
                    //					QApplication::ExecuteJavaScript(sprintf('qc.regC("%s"); ', $this->strControlId), true);
                    //					$strScript = $this->GetEndScript();
                    //					if ($strScript)
                    //						QApplication::ExecuteJavaScript($strScript);
                    if ($this->blnWrapperModified && $this->blnVisible) {
                        //							QApplication::ExecuteJavaScript(sprintf('qcodo.getWrapper("%s").style.cssText = "%s"; ', $this->strControlId, $strStyle));
                        QApplication::ExecuteJavaScript(sprintf('qc.getW("%s").style.cssText = "%stext-decoration:inherit;"; ', $this->strControlId, $strStyle));
                    }
                }
                break;
            default:
                if ($strStyle) {
                    $strStyle = sprintf('style="%s"', $strStyle);
                }
                //					$strOutput = sprintf('<div id="%s_ctl" style="%s">%s</div>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                //					$strOutput = sprintf('<ins id="%s_ctl" style="%stext-decoration:inherit;">%s</ins>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                if ($blnIsBlockElement) {
                    $strOutput = sprintf('<div id="%s_ctl" %s>%s</div>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                } else {
                    $strOutput = sprintf('<span id="%s_ctl" %s>%s</span>%s', $this->strControlId, $strStyle, $strOutput, $this->GetNonWrappedHtml());
                }
                break;
        }
        // Output or Return
        if ($blnDisplayOutput) {
            print $strOutput;
        } else {
            return $strOutput;
        }
    }