protected function renderBody() { $contents = parent::renderBody(); $options = TJavascript::toList(array('revert' => $this->getRevert())); $script = "new Draggable('{$this->ClientID}', {$options});"; $contents .= TJavascript::render($script); return $contents; }
protected function getClientScriptOptions() { $options = parent::getClientScriptOptions(); $accepts = preg_split("/\\s*,\\s* /", $this->getAcceptCssClass()); $options['accept'] = TJavascript::toArray($accepts); $options['hoverclass'] = $this->getHoverCssClass(); return $options; }
public function onPreRender($param) { parent::onPreRender($param); $this->publishStyleAssets(); $cs = $this->getPage()->getClientScript(); $class = $this->getClientClassName(); $options = TJavascript::encode($this->getClientScriptOptions()); $script = "new {$class}({$options})"; $cs->registerEndScript($this->getClientID() . 'dialog', $script); }
function onLoad($param) { if (!$this->Page->IsCallBack) { $count = array(); $data = $this->getCommentData(); foreach ($data as $r) { if (!isset($count[$r->block_id])) { $count[$r->block_id] = 0; } $count[$r->block_id]++; } $js = "var comment_count = " . TJavascript::encode($count) . ";\n"; $this->Page->ClientScript->registerBeginScript('count', $js); $this->comments->dataSource = $data; $this->comments->dataBind(); } }
/** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. */ protected function addAttributesToRender($writer) { parent::addAttributesToRender($writer); $cs = $this->getPage()->getClientScript(); if ($this->getGhosting() == TDraggableGhostingOptions::SuperGhosting) { $cs->registerPradoScript('dragdropextra'); } else { $cs->registerPradoScript('dragdrop'); } $writer->addAttribute('id', $this->getClientID()); $options = TJavascript::encode($this->getPostBackOptions()); $class = $this->getClientClassName(); $code = "new {$class}('{$this->getClientId()}', {$options}) "; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); }
protected function renderClientScriptOptions() { $updateOptions = $this->getClientScriptOptions(); $callbackOptions = $this->getCallbackOptions(); return TJavascript::toList($updateOptions, $callbackOptions); }
/** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. */ protected function addAttributesToRender($writer) { parent::addAttributesToRender($writer); $writer->addAttribute('id', $this->getClientID()); $options = TJavascript::encode($this->getPostBackOptions()); $cs = $this->getPage()->getClientScript(); $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); }
protected function renderJs() { $ID = $this->ClientID; $result = self::RESULT_PANEL_ID; $option['tokens'] = $this->renderTokens(); $options = TJavascript::toList($option); //$this->renderTokens(); $js = "new Prado.AutoCompleter('{$ID}', '{$ID}:{$result}', {$options});"; $this->Page->registerEndScript($ID, $js); }
public function to_array($v) { return TJavascript::toArray($v); }
/** * @return Array of active control options */ public function toArray() { $ret = $this->_options === null ? array() : $this->_options; foreach ($this->_control->getValidEvents() as $event) { if ($this->_control->hasEventHandler('on' . $event)) { $ret[$event] = new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(" . TJavascript::encode($this->_control->getUniqueID()) . ", " . TJavascript::encode($event) . ", event, ui, this); }"); } } return $ret; }
public function setOnSlide($javascript) { $code = TJavascript::quoteJsLiteral("function (value) { {$javascript} }"); $this->setFunction('onSlide', $code); }
/** * Generate the stub code. * @return string callback client stub code. */ public function generate($info = null) { $IDs = TJavascript::toArray($this->callback_inputs); $script = <<<EOD Prado.AJAX.Callback.Server = '{$this->url}/{$info->class}'; Prado.AJAX.Callback.IDs = {$IDs}; EOD; return $script; }
/** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. Also registers language specific global * settings for the first used date picker. */ protected function addAttributesToRender($writer) { $cs = $this->getPage()->getClientScript(); if (self::$_first) { $code = "jQuery(document).ready(function(){jQuery.datepicker.setDefaults(jQuery.datepicker.regional['{$this->getCurrentCulture()}']);});"; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); self::$_first = false; } parent::addAttributesToRender($writer); $options = TJavascript::encode($this->getOptions()->toArray()); $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); }
/** * Gets the post back options for this textbox. * @return array */ protected function getPostBackOptions() { $options['ID'] = $this->getClientID(); $options['EventTarget'] = $this->getUniqueID(); $options['accept'] = TJavascript::encode($this->getAcceptCssClass()); $options['hoverclass'] = $this->getHoverCssClass(); return $options; }
/** * Appends the callback javascript statement to the input button html. * @return string TActiveButton html output. */ public function render() { $contents = parent::render(); $js = $this->Page->getCallbackReference($this, null, null, $this->getRequestOptions()); $script = $this->Page->getClientEventScript($this, "click", $js); $contents .= TJavascript::render($script); return $contents; }