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);
 }
Example #2
0
 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();
     }
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 /**
  * 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);
 }
Example #5
0
 /**
  * @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;
 }
Example #6
0
 /**
  * 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;
 }