/** * Method render * Render the page * @access public * @return string * @since 1.0.0 */ public function render() { if ($this->render == null) { throw new NewException("Render object not set for the page " . $this->page . " (Please set the variable \$this->render in class " . $this->class_name . ")", 0, getDebugBacktrace(1)); } else { $html = ""; if (!$this->getPageIsCaching()) { $js_to_render = ""; for ($i = 0; $i < sizeof($this->add_to_render_begining); $i++) { $to_render = ""; if (gettype($this->add_to_render_begining[$i]) == "object" && method_exists($this->add_to_render_begining[$i], "render")) { $to_render .= $this->add_to_render_begining[$i]->render(); } else { $to_render .= $this->add_to_render_begining[$i]; } $to_render .= "\n"; if ($this->add_to_render_begining[$i]->isJavascriptObject()) { $js_to_render .= $to_render; } else { $html .= $to_render; } } if ($js_to_render != "") { $html .= WebSitePhpObject::getJavascriptTagOpen(); $html .= $js_to_render; $html .= WebSitePhpObject::getJavascriptTagClose(); } } if (gettype($this->render) == "object" && method_exists($this->render, "render")) { $html .= $this->render->render(); } else { $html .= $this->render; } if (!$this->getPageIsCaching()) { $html .= "\n"; $js_to_render = ""; $add_to_render = $this->getEndAddedObjects(); $nb_end_added_object = sizeof($add_to_render); for ($i = 0; $i < sizeof($add_to_render); $i++) { $to_render = ""; if (gettype($add_to_render[$i]) == "object" && method_exists($add_to_render[$i], "render")) { $to_render .= $add_to_render[$i]->render(); } else { $to_render .= $add_to_render[$i]; } $to_render .= "\n"; if ($add_to_render[$i]->isJavascriptObject()) { $js_to_render .= $to_render; } else { $html .= $to_render; } if ($this->getNbEndAddedObjects() > $nb_end_added_object) { $add_to_render = $this->getEndAddedObjects(); $nb_end_added_object = $this->getNbEndAddedObjects(); } } if ($js_to_render != "") { $html .= WebSitePhpObject::getJavascriptTagOpen(); $html .= $js_to_render; $html .= WebSitePhpObject::getJavascriptTagClose(); } } if (DEBUG) { $html_debug = ""; for ($i = 0; $i < sizeof($this->log_debug_str); $i++) { $html_debug .= $this->log_debug_str[$i] . "<br/>\n"; } if ($html_debug != "") { $log_debug_level = rand(1000000, 99999999999.0); $html .= "<div style=\"background-color:white;color:black;padding:5px;margin:10px;border:1px solid black;margin-bottom:0px;\" id=\"wsp-log-debug-title" . $log_debug_level . "\"><img src='" . $this->getCDNServerURL() . "wsp/img/drag_arrow_16x16.png' align='absmiddle'/> <b>DEBUG Page " . $this->getPage() . ".php:</b> <span style='float:right;cursor:pointer;' onclick=\"\$('#wsp-log-debug-title" . $log_debug_level . "').hide();\$('#wsp-log-debug" . $log_debug_level . "').hide();\"><img src='" . $this->getCDNServerURL() . "wsp/img/close.gif' align='absmiddle'/></span></div>"; $html .= "<div style=\"background-color:white;color:black;padding:5px;margin:10px;border:1px solid black;margin-top:0px;\" id=\"wsp-log-debug" . $log_debug_level . "\">" . $html_debug . "</div>"; $html .= "<script type='text/javascript'>function loagDebugZoneFollowDrag() { \$('#wsp-log-debug" . $log_debug_level . "').css('top', \$('#wsp-log-debug-title" . $log_debug_level . "').position().top+\$('#wsp-log-debug-title" . $log_debug_level . "').height()+20);\$('#wsp-log-debug" . $log_debug_level . "').css('left', \$('#wsp-log-debug-title" . $log_debug_level . "').position().left);} \$('#wsp-log-debug-title" . $log_debug_level . "').draggable({start: function( event, ui ) {\$('#wsp-log-debug" . $log_debug_level . "').css('position', 'absolute');\$('#wsp-log-debug-title" . $log_debug_level . "').css('width', \$('#wsp-log-debug" . $log_debug_level . "').css('width'))}, drag: function( event, ui ) {loagDebugZoneFollowDrag();}, stop: function( event, ui ) {loagDebugZoneFollowDrag();}});\$('#wsp-log-debug" . $log_debug_level . "').resizable({start: function( event, ui ){\$('#wsp-log-debug" . $log_debug_level . "').css('overflow', 'auto');}, resize: function( event, ui ) {\$('#wsp-log-debug-title" . $log_debug_level . "').css('width', \$('#wsp-log-debug" . $log_debug_level . "').css('width'));}});</script>"; } } if ($this->getPageIsCaching()) { return $html; } else { return str_replace("{#BASE_URL#}", BASE_URL, str_replace("{#CDN_BASE_URL#}", $this->getCDNServerURL(), str_replace("{#QUOTE#}", "\"", str_replace("{#SIMPLE_QUOTE#}", "'", $html)))); } } }