/** * Loads an html document into a word document and downloads it to the client * @param string $path The path to the html document */ public static function HtmlToWord($path) { ob_start(); require_once $path; $document_script = ob_get_contents(); ob_end_clean(); if (RequestManager::IsAjaxRequest()) { RequestManager::ScriptResponseHeader(); echo 'jQuery("' . addslashes(str_replace(array("\r", "\n"), '', trim($document_script))) . '").wordExport()'; } else { echo '<script>jQuery("' . addslashes(str_replace(array("\r", "\n"), '', trim($document_script))) . '").wordExport()</script>'; } }
/** * Danger Notify Bootstrap * @param string $msg */ public static function Danger($msg) { if (RequestManager::IsAjaxRequest()) { RequestManager::ScriptResponseHeader(); ?> jQuery.Notify("<?php echo $msg; ?> ", "error") <?php } else { ?> <script>jQuery.Notify("<?php echo $msg; ?> ", "error")</script> <?php } }
/** * Prompt Triple Bootstrap Dialog * @param string $input_msg1 Dialog message label for input #1 * @param string $input_msg2 Dialog message label for input #2 * @param string $input_msg3 Dialog message label for input #3 * @param string $callback Dialog javascript callback handler on button click * @return void */ public static function PromptTriple($input_msg1, $input_msg2, $input_msg3, $callback = "function(){}") { if (RequestManager::IsAjaxRequest()) { RequestManager::ScriptResponseHeader(); ?> Dialog.PromptTriple("<?php echo $input_msg1; ?> ", "<?php echo $input_msg2; ?> ", "<?php echo $input_msg3; ?> ", <?php echo $callback; ?> ) <?php die; } else { ?> <script>Dialog.PromptTriple("<?php echo $input_msg1; ?> ", "<?php echo $input_msg2; ?> ", "<?php echo $input_msg3; ?> ", <?php echo $callback; ?> )</script> <?php } }
/** * Sets a server custom event listener for the client. * @param string $code The js code to be executed on the open event * @param object e The internal js callback param of the event * return void */ public function setClientServerEvent($event_name, $code) { if (RequestManager::IsAjaxRequest()) { RequestManager::ScriptResponseHeader(); ?> <?php echo $this->varname; ?> .addEventListener("<?php echo $event_name; ?> ", function(e) { <?php echo $code; ?> }, false); <?php } else { ?> <script> <?php echo $this->varname; ?> .addEventListener("<?php echo $event_name; ?> ", function(e) { <?php echo $code; ?> }, false); </script> <?php } }