本文整理汇总了PHP中JavaScriptHelper::TerminateScript方法的典型用法代码示例。如果您正苦于以下问题:PHP JavaScriptHelper::TerminateScript方法的具体用法?PHP JavaScriptHelper::TerminateScript怎么用?PHP JavaScriptHelper::TerminateScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavaScriptHelper
的用法示例。
在下文中一共展示了JavaScriptHelper::TerminateScript方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RenderEnd
/**
* Renders the end of the form, including the closing form and body tags.
* Renders the html for hidden controls.
* @param bool $blnDisplayOutput should the output be returned or directly printed to screen.
*
* @return null|string
* @throws QCallerException
*/
public function RenderEnd($blnDisplayOutput = true)
{
// Ensure that RenderEnd() has not yet been called
switch ($this->intFormStatus) {
case QFormBase::FormStatusUnrendered:
throw new QCallerException('$this->RenderBegin() was never called');
case QFormBase::FormStatusRenderBegun:
break;
case QFormBase::FormStatusRenderEnded:
throw new QCallerException('$this->RenderEnd() has already been called');
break;
default:
throw new QCallerException('FormStatus is in an unknown status');
}
$strHtml = '';
// This will be the final output
/**** Render any controls that get automatically rendered ****/
foreach ($this->GetAllControls() as $objControl) {
if ($objControl->AutoRender && !$objControl->Rendered) {
$strRenderMethod = $objControl->PreferredRenderMethod;
$strHtml .= $objControl->{$strRenderMethod}(false) . _nl();
}
}
/**** Prepare Javascripts ****/
// Clear included javascript array since we are completely redrawing the page
$this->strIncludedJavaScriptFileArray = array();
$strControlIdToRegister = array();
$strEventScripts = '';
// Add form level javascripts and libraries
$strJavaScriptArray = $this->ProcessJavaScriptList($this->GetFormJavaScripts());
QApplication::AddJavaScriptFiles($strJavaScriptArray);
$strFormJsFiles = QApplication::RenderFiles();
// Render the form-level javascript files separately
// Go through all controls and gather up any JS or CSS to run or Form Attributes to modify
foreach ($this->GetAllControls() as $objControl) {
if ($objControl->Rendered || $objControl->ScriptsOnly) {
$strControlIdToRegister[] = $objControl->ControlId;
/* Note: GetEndScript may cause the control to register additional commands, or even add javascripts, so those should be handled after this. */
if ($strControlScript = $objControl->GetEndScript()) {
$strControlScript = JavaScriptHelper::TerminateScript($strControlScript);
// Add comments for developer version of output
if (!QApplication::$Minimize) {
// Render a comment
$strControlScript = _nl() . _nl() . sprintf('/*** EndScript -- Control Type: %s, Control Name: %s, Control Id: %s ***/', get_class($objControl), $objControl->Name, $objControl->ControlId) . _nl() . _indent($strControlScript);
}
$strEventScripts .= $strControlScript;
}
}
// Include the javascripts specified by each control.
if ($strScriptArray = $this->ProcessJavaScriptList($objControl->JavaScripts)) {
QApplication::AddJavaScriptFiles($strScriptArray);
}
// Include any StyleSheets? The control would have a
// comma-delimited list of stylesheet files to include (if applicable)
if ($strScriptArray = $this->ProcessStyleSheetList($objControl->StyleSheets)) {
QApplication::AddStyleSheets(array_keys($strScriptArray));
}
// Form Attributes?
if ($objControl->FormAttributes) {
QApplication::ExecuteControlCommand($this->strFormId, 'attr', $objControl->FormAttributes);
foreach ($objControl->FormAttributes as $strKey => $strValue) {
if (!array_key_exists($strKey, $this->strFormAttributeArray)) {
$this->strFormAttributeArray[$strKey] = $strValue;
} else {
if ($this->strFormAttributeArray[$strKey] != $strValue) {
$this->strFormAttributeArray[$strKey] = $strValue;
}
}
}
}
}
// Add grouping commands to events (Used for deprecated drag and drop, but not removed yet)
foreach ($this->objGroupingArray as $objGrouping) {
$strGroupingScript = $objGrouping->Render();
if (strlen($strGroupingScript) > 0) {
$strGroupingScript = JavaScriptHelper::TerminateScript($strGroupingScript);
$strEventScripts .= $strGroupingScript;
}
}
/*** Build the javascript block ****/
// Start with variable settings and initForm
$strEndScript = sprintf('qc.initForm("%s"); ', $this->strFormId);
// Register controls
if ($strControlIdToRegister) {
$strEndScript .= sprintf("qc.regCA(%s); \n", JavaScriptHelper::toJsObject($strControlIdToRegister));
}
// Design mode event
if (defined('__DESIGN_MODE__') && __DESIGN_MODE__ == 1) {
// attach an event listener to the form to send context menu selections to the designer dialog for processing
$strEndScript .= sprintf('$j("#%s").on("contextmenu", "[id]",
function(event) {
$j("#qconnectoreditdlg").trigger("qdesignerclick",
//.........这里部分代码省略.........