当前位置: 首页>>代码示例>>PHP>>正文


PHP JavaScriptHelper::toJsObject方法代码示例

本文整理汇总了PHP中JavaScriptHelper::toJsObject方法的典型用法代码示例。如果您正苦于以下问题:PHP JavaScriptHelper::toJsObject方法的具体用法?PHP JavaScriptHelper::toJsObject怎么用?PHP JavaScriptHelper::toJsObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JavaScriptHelper的用法示例。


在下文中一共展示了JavaScriptHelper::toJsObject方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: makeJsProperty

 protected function makeJsProperty($strProp, $strKey)
 {
     $objValue = $this->{$strProp};
     if (null === $objValue) {
         return '';
     }
     return $strKey . ': ' . JavaScriptHelper::toJsObject($objValue) . ', ';
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:8,代码来源:QCalendar.class.php

示例2: toJsObject

 public function toJsObject()
 {
     $a = array('value' => $this->strName, 'id' => $this->strValue);
     if ($this->strLabel) {
         $a['label'] = $this->strLabel;
     }
     if ($this->strItemGroup) {
         $a['category'] = $this->strItemGroup;
     }
     return JavaScriptHelper::toJsObject($a);
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:11,代码来源:QListItem.class.php

示例3: __set

 /**
  * PHP __set Magic method
  * @param string $strName Property Name
  * @param string $mixValue Property Value
  *
  * @throws Exception|QInvalidCastException
  */
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'DataSource':
             // Assign data to a DataSource from within the data binder function only.
             // Data should be array items that at a minimum contain a 'value' and an 'id'
             // They can also contain a 'label', which will be displayed in the popup menu only
             if ($this->blnUseAjax) {
                 $this->prepareAjaxList($mixValue);
             } else {
                 $this->Source = $mixValue;
             }
             break;
         case 'SelectedId':
             // Set this at creation time to initialize the selected id.
             // This is also set by the javascript above to keep track of subsequent selections made by the user.
             try {
                 $this->strSelectedId = QType::Cast($mixValue, QType::String);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'MustMatch':
             try {
                 $this->blnMustMatch = QType::Cast($mixValue, QType::Boolean);
                 $this->blnModified = true;
                 // Be sure control gets redrawn
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'Source':
             try {
                 if (is_array($mixValue) && count($mixValue) > 0 && $mixValue[0] instanceof QListItem) {
                     // figure out what item is selected
                     foreach ($mixValue as $objItem) {
                         if ($objItem->Selected) {
                             $this->strSelectedId = $objItem->Value;
                             $this->Text = $objItem->Name;
                         }
                     }
                 }
                 if ($this->MultipleValueDelimiter) {
                     $strBody = 'response(jQuery.ui.autocomplete.filter(' . JavaScriptHelper::toJsObject($mixValue) . ', this.element.data("curTerm")(this.element.get(0))))';
                     $mixValue = new QJsClosure($strBody, array('request', 'response'));
                 }
                 // do parent action too
                 parent::__set($strName, $mixValue);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'MultipleValueDelimiter':
             $a = $this->GetAllActions('QAutocomplete_SourceEvent');
             if (!empty($a)) {
                 throw new Exception('Must set MultipleValueDelimiter BEFORE calling SetDataBinder');
             }
             try {
                 $this->strMultipleValueDelimiter = QType::Cast($mixValue, QType::String);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'DisplayHtml':
             try {
                 $this->blnDisplayHtml = QType::Cast($mixValue, QType::Boolean);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:92,代码来源:QAutocompleteBase.class.php

示例4: CallJqUiMethod

 /**
  * Call a JQuery UI Method on the object. 
  * 
  * A helper function to call a jQuery UI Method. Takes variable number of arguments.
  * 
  * @param string $strMethodName the method name to call
  * @internal param $mixed [optional] $mixParam1
  * @internal param $mixed [optional] $mixParam2
  */
 protected function CallJqUiMethod($strMethodName)
 {
     $args = func_get_args();
     $strArgs = JavaScriptHelper::toJsObject($args);
     $strJs = sprintf('jQuery("#%s").%s(%s)', $this->getJqControlId(), $this->getJqSetupFunction(), substr($strArgs, 1, strlen($strArgs) - 2));
     // params without brackets
     QApplication::ExecuteJavaScript($strJs);
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:17,代码来源:QMenuGen.class.php

示例5: toJsObject

 /**
  * Default "toJsObject" handler
  * Specifies how the object should be displayed in JQuery UI lists and menus. Note that these lists use
  * value and label differently.
  *
  * value 	= The short form of what to display in the list and selection.
  * label 	= [optional] If defined, is what is displayed in the menu
  * id 		= Primary key of object.
  *
  * @return an array that specifies how to display the object
  */
 public function toJsObject()
 {
     return JavaScriptHelper::toJsObject(array('value' => $this->__toString(), 'id' => $this->intId));
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:15,代码来源:DleMailLogGen.class.php

示例6: toJsObject

 /**
  * Default "toJsObject" handler
  * Specifies how the object should be displayed in JQuery UI lists and menus. Note that these lists use
  * value and label differently.
  *
  * value 	= The short form of what to display in the list and selection.
  * label 	= [optional] If defined, is what is displayed in the menu
  * id 		= Primary key of object.
  *
  * @return an array that specifies how to display the object
  */
 public function toJsObject()
 {
     return JavaScriptHelper::toJsObject(array('value' => $this->__toString(), 'id' => array($this->intSuggestionId, $this->intContextId, $this->intUserId)));
 }
开发者ID:Jobava,项目名称:narro,代码行数:15,代码来源:NarroSuggestionVoteGen.class.php

示例7: 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", 
//.........这里部分代码省略.........
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:101,代码来源:QFormBase.class.php

示例8: RenderPlugins

 /**
  * Render plugin javascript
  * @return string
  */
 public function RenderPlugins()
 {
     $strJS = '';
     if (!empty($this->aFixedColumns)) {
         $this->AddPluginJavascriptFile("datatables", __PLUGIN_ASSETS__ . "/datatables/extras/FixedColumns/js/dataTables.fixedColumns.js");
         $strJS .= sprintf("{var oTable = jQuery('#%s').%s();\n", $this->getJqControlId(), $this->getJqSetupFunction());
         $strJS .= 'new $j.fn.DataTable.FixedColumns( oTable, ' . JavaScriptHelper::toJsObject($this->aFixedColumns) . '); };';
     }
     return $strJS;
 }
开发者ID:qcubed,项目名称:plugin_datatables,代码行数:14,代码来源:QDataTableBase.php

示例9: toJsObject

 /**
  * @deprecated since Qcubed 2.1.1. Please use QListItem
  * @return string
  */
 public function toJsObject()
 {
     trigger_error("QAutocompleteListItem has been deprecated. Please use QListItem", E_USER_NOTICE);
     return JavaScriptHelper::toJsObject(array("value" => $this->Name, "id" => $this->Value));
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:9,代码来源:QAutocompleteBase.class.php

示例10: QcubedGetBacktrace

/**
 * Returns a stringified version of a backtrace.
 * Set $blnShowArgs if you want to see a representation of the arguments. Note that if you are sending
 * in objects, this will unpack the entire structure and display its contents.
 * $intSkipTraces is how many back traces you want to skip. Set this to at least one to skip the
 * calling of this function itself.
 *
 * @param bool $blnShowArgs
 * @param int $intSkipTraces
 * @return string
 */
function QcubedGetBacktrace($blnShowArgs = false, $intSkipTraces = 1)
{
    if (!$blnShowArgs) {
        $b = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
    } else {
        $b = debug_backtrace(false);
    }
    $strRet = "";
    for ($i = $intSkipTraces; $i < count($b); $i++) {
        $item = $b[$i];
        $strFile = array_key_exists("file", $item) ? $item["file"] : "";
        $strLine = array_key_exists("line", $item) ? $item["line"] : "";
        $strClass = array_key_exists("class", $item) ? $item["class"] : "";
        $strType = array_key_exists("type", $item) ? $item["type"] : "";
        $strFunction = array_key_exists("function", $item) ? $item["function"] : "";
        $vals = [];
        if (!empty($item["args"])) {
            foreach ($item["args"] as $val) {
                $vals[] = JavaScriptHelper::toJsObject($val);
            }
        }
        $strArgs = implode(", ", $vals);
        $strRet .= sprintf("#%s %s(%s): %s%s%s(%s)\n", $i, $strFile, $strLine, $strClass, $strType, $strFunction, $strArgs);
    }
    return $strRet;
}
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:37,代码来源:error.inc.php

示例11: RenderScript

 public function RenderScript(QControl $objControl)
 {
     $strMessage = JavaScriptHelper::toJsObject($this->strMessage);
     return sprintf("alert(%s);", $strMessage);
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:5,代码来源:_actions.inc.php

示例12: SetButtonStyle

 /**
  * Applies CSS styles to a button that is already in the dialog.
  *
  * @param string $strButtonId Id of button to set the style on
  * @param array $styles Array of key/value style specifications
  */
 public function SetButtonStyle($strButtonId, $styles)
 {
     QApplication::ExecuteJavaScript(sprintf('$j("#%s").next().find("button[data-btnid=\'%s\']").css(%s)', $this->getJqControlId(), $strButtonId, JavaScriptHelper::toJsObject($styles)));
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:10,代码来源:QDialogBase.class.php

示例13: toJsObject

 /**
  * Default "toJsObject" handler
  * Specifies how the object should be displayed in JQuery UI lists and menus. Note that these lists use
  * value and label differently.
  *
  * value 	= The short form of what to display in the list and selection.
  * label 	= [optional] If defined, is what is displayed in the menu
  * id 		= Primary key of object.
  *
  * @return an array that specifies how to display the object
  */
 public function toJsObject()
 {
     return JavaScriptHelper::toJsObject(array('value' => $this->__toString(), 'id' => array($this->intObjectId, $this->intTermTaxonomyId)));
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:15,代码来源:WpTermRelationshipsGen.class.php

示例14: toJsObject

 public function toJsObject()
 {
     $strList = '';
     foreach ($this->arrContent as $objItem) {
         if (strlen($strList) > 0) {
             $strList .= ',';
         }
         $strList .= JavaScriptHelper::toJsObject($objItem);
     }
     return $strList;
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:11,代码来源:JavaScriptHelper.class.php


注:本文中的JavaScriptHelper::toJsObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。