Beispiel #1
0
 /**
  * Returns a HTML script tag which includes the jquery.js engine into the web page.
  * to ensure HTML5 compatability for MSIE.
  * @return string An HTML script tag.
  */
 public function getJQuery()
 {
     $s = Swift::getInstance();
     return $this->createJavaScriptTag($s->config('app_url') . "/Swift/includes/js/jquery/jquery-1.10.2.min.js");
 }
Beispiel #2
0
 /**
  * Outputs the SwiftForm HTML to the page.
  * @param string $style The style type for displaying the SwiftForm (plain, list, table). Default: plain. (Optional)
  * @return string The HTML source code for the SwiftForm.
  */
 public function renderForm($style = 'plain')
 {
     if ($this->m_form_container_id) {
         $form_out .= "<div id=\"" . $this->m_form_container_id . "\">";
     }
     if ($this->m_form_ajax) {
         $swift = Swift::getInstance();
         $swift_jq = $swift->createJQuery();
         $form_out .= $swift_jq->createAjaxCallback('ajax_callback_' . $this->m_form_id, $this->m_form_container_id, 'html');
         $form_out .= $swift_jq->createAjaxFunction('ajax_' . $this->m_form_id, $this->m_form_action, $this->m_form_method, $this->m_field_ids, 'ajax_callback_' . $this->m_form_id);
     }
     $form_out .= "<form";
     if ($this->m_form_name) {
         $form_out .= " name=\"" . $this->m_form_name . "\"";
     }
     if ($this->m_form_id) {
         $form_out .= " id=\"" . $this->m_form_id . "\"";
     }
     if ($this->m_form_action && !$this->m_form_ajax) {
         $form_out .= " action=\"" . $this->m_form_action . "\"";
     }
     if ($this->m_form_method && !$this->m_form_ajax) {
         $form_out .= " method=\"" . $this->m_form_method . "\"";
     }
     if ($this->m_form_enctype) {
         $form_out .= " enctype=\"" . $this->m_form_enctype . "\"";
     }
     $form_out .= ">\n";
     if ($style == 'table') {
         $form_out .= "<table>";
     } else {
         if ($style == 'list') {
             $form_out .= "<ul>";
         }
     }
     for ($i = 0; $i < count($this->m_fields); $i++) {
         if ($style == 'table') {
             $form_out .= "<tr>";
             $form_out .= "<td>" . $this->m_labels[$i] . "</td>";
             $form_out .= "<td>" . $this->m_fields[$i] . "</td>";
             $form_out .= "</tr>";
         } else {
             if ($style == 'plain') {
                 $form_out .= $this->m_labels[$i];
                 $form_out .= $this->m_fields[$i];
                 $form_out .= "</br>";
             } else {
                 if ($style == 'list') {
                     $form_out .= "<li>" . $this->m_labels[$i] . " " . $this->m_fields[$i] . "</li>";
                 }
             }
         }
     }
     if ($style == 'table') {
         $form_out .= "</table>";
     } else {
         if ($style == 'list') {
             $form_out .= "</ul>";
         }
     }
     $form_out .= "</form>\n";
     if ($this->m_form_container_id) {
         $form_out .= "</div>";
     }
     echo $form_out;
 }
Beispiel #3
0
 /**
  * Loads the provided $view file from inside the directory provided by the app_view_dir setting
  * and loads all variables inside the $data array.
  * @param string $view The filename of a view to render/load.
  * @param Array $data Array of variables to load in the public scope for the $view. (Default: null)
  * @param boolean $minify Minimize and compress all HTML and JavaScript output from the $view. (Default: false)
  */
 public function render($view, $data = null, $minify = false)
 {
     $path = $this->m_config->get('app_view_dir') . '/' . $view;
     if (isset($data)) {
         $result = array_merge($this->m_view_data->getAll(), $data);
         $this->m_view_data->setAll($result);
     }
     $all_data = $this->getAllViewData();
     extract($all_data);
     if ($minify) {
         ob_start();
         require $path;
         $buffer = ob_get_clean();
         $swift = Swift::getInstance();
         $sm = $swift->createMinify();
         echo $sm->minifyString($buffer);
     } else {
         require $path;
     }
 }
Beispiel #4
0
 /**
  * Returns a HTML script tag which includes the jquery.js engine into the web page.
  * to ensure HTML5 compatability for MSIE.
  * @return string An HTML script tag.
  */
 public function getJQuery()
 {
     $s = Swift::getInstance();
     $sh = $s->createHtml();
     return $sh->getJQuery();
 }