Exemple #1
0
 /**
  * Send chain in response to form submit, button click or ajaxec() function for AJAX control output.
  */
 public function execute()
 {
     if (isset($_POST['ajax_submit']) || $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
         //if($this->app->jquery)$this->app->jquery->getJS($this->owner);
         if (headers_sent($file, $line)) {
             echo "<br/>Direct output (echo or print) detected on {$file}:{$line}. <a target='_blank' " . "href='http://agiletoolkit.org/error/direct_output'>Use \$this->add('Text') instead</a>.<br/>";
         }
         $x = $this->app->template->get('document_ready');
         if (is_array($x)) {
             $x = implode('', $x);
         }
         echo $this->_render();
         $this->app->hook('post-js-execute');
         exit;
     } else {
         throw $this->exception('js()->..->execute() must be used in response to form submission or AJAX operation only');
     }
 }