Пример #1
0
 /**
  * Registers CSS and JS.
  * This method is invoked right before the control rendering, if the control is visible.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if ($this->getPage()->getClientSupportsJavaScript()) {
         $this->registerStyleSheet();
         $this->registerClientScript();
     }
 }
Пример #2
0
 /**
  * Registers the checkbox to receive postback data during postback.
  * This is necessary because a checkbox if unchecked, when postback,
  * does not have direct mapping between post data and the checkbox name.
  *
  * This method overrides the parent implementation and is invoked before render.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if ($this->getEnabled(true)) {
         $this->getPage()->registerRequiresPostData($this);
     }
 }
Пример #3
0
 /**
  * Registers CSS and JS.
  * This method is invoked right before the control rendering, if the control is visible.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     $this->getActiveView();
     // determine the active view
     $this->registerStyleSheet();
 }
Пример #4
0
 /**
  * Sets Enctype of the form on the page.
  * This method overrides the parent implementation and is invoked before render.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if (($form = $this->getPage()->getForm()) !== null) {
         $form->setEnctype('multipart/form-data');
     }
     $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize());
     if ($this->getEnabled(true)) {
         $this->getPage()->registerRequiresPostData($this);
     }
 }
Пример #5
0
 /**
  * Performs databinding to populate data items from data source.
  * This method is invoked by {@link dataBind()}.
  * You may override this function to provide your own way of data population.
  * @param Traversable the bound data
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     $controlID = $this->getControlToPaginate();
     if (($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !$targetControl instanceof TDataBoundControl) {
         throw new TConfigurationException('pager_controltopaginate_invalid', $controlID);
     }
     if ($targetControl->getAllowPaging()) {
         $this->_pageCount = $targetControl->getPageCount();
         $this->getControls()->clear();
         $this->setPageCount($targetControl->getPageCount());
         $this->setCurrentPageIndex($targetControl->getCurrentPageIndex());
         $this->buildPager();
     } else {
         $this->_pageCount = 0;
     }
 }
Пример #6
0
 /**
  * Registers CSS and JS.
  * This method is invoked right before the control rendering, if the control is visible.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     $this->registerStyleSheet();
     $this->registerSliderClientScript();
 }
Пример #7
0
 /**
  * Ensures any pending databind is performed.
  * This method overrides the parent implementation.
  * @param TEventParameter event parameter
  */
 public function onPreRender($param)
 {
     $this->_prerendered = true;
     $this->ensureDataBound();
     parent::onPreRender($param);
 }
Пример #8
0
 /**
  * Overrides parent implementation by registering necessary Javascripts for validation.
  * @param TEventParameter the event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     $page = $this->getPage();
     if ($this->isClientScriptEnabled() && !$page->isScriptFileRegistered('validator')) {
         $dependencies = array('base', 'dom', 'validator');
         $path = $this->Application->getResourceLocator()->getJsPath() . '/';
         foreach ($dependencies as $file) {
             $page->registerScriptFile($file, $path . $file . '.js');
         }
         $script = "\n\t\t\tif(typeof(Prado) == 'undefined')\n\t\t\t\talert(\"Unable to find Prado javascript library '{$path}base.js'.\");\n\t\t\telse if(Prado.Version != 2.0) \n\t\t\t\talert(\"Prado javascript library version 2.0 required.\");\n\t\t\telse if(typeof(Prado.Validation) == 'undefined')\n\t\t\t\talert(\"Unable to find validation javascript library '{$path}validator.js'.\");\t\t\t\t\n\t\t\telse\n\t\t\t\tPrado.Validation.AddForm('{$page->Form->ClientID}');\t\t\t\t\n\t\t\t";
         $page->registerEndScript('TValidator', $script);
     }
     //update the Css class for the controls
     $idPath = $this->getControlToValidate();
     if (strlen($idPath)) {
         $this->updateControlCssClass($this->getTargetControl($idPath));
     }
 }
Пример #9
0
 /**
  * Checks for API keys
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if ("" == $this->getPublicKey()) {
         throw new TConfigurationException('recaptcha_publickey_unknown');
     }
     if ("" == $this->getPrivateKey()) {
         throw new TConfigurationException('recaptcha_privatekey_unknown');
     }
     // need to register captcha fields so they will be sent back also in callbacks
     $page = $this->getPage();
     $page->registerRequiresPostData($this->getChallengeFieldName());
     $page->registerRequiresPostData($this->getResponseFieldName());
 }
Пример #10
0
 /**
  * Registers CSS and JS.
  * This method is invoked right before the control rendering, if the control is visible.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     $this->getActiveView();
     // determine the active view
     $this->registerStyleSheet();
     $page = $this->getPage();
     $page->registerRequiresPostData($this);
     $page->registerRequiresPostData($this->getClientID() . "_1");
 }
Пример #11
0
 public function onPreRender($writer)
 {
     parent::onPreRender($writer);
     $this->registerClientScripts();
 }
Пример #12
0
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if (!$this->getPage()->getIsCallback()) {
         $this->registerStyleSheet();
         $this->registerClientScript();
     }
 }