/home/suroeste/public_html/gorbus.transportessuroeste.com/reservas/_lib/lib/php
Edit: /home/suroeste/public_html/gorbus.transportessuroeste.com/reservas/_lib/lib/php/sc_progress_bar.php (8155B)
operation = 'initialize';
$this->step_count = 0;
$this->step_total = 0;
$this->pb_message = '';
$this->pb_title = '';
$this->download_link = '';
$this->download_md5 = '';
$this->return_url = '';
$this->return_option = '';
$this->complete = false;
$this->buttons = array();
$this->saveState();
} // initialize
public function setDebug($debug) {
$this->debug = $debug;
} // setDebug
public function createProgressbarMd5() {
$this->pb_md5 = md5(rand(1, 99999) . microtime());
} // createProgressbarMd5
public function setRoot($dir) {
$this->file_root = $dir;
} // setRoot
public function setDir($dir) {
$this->file_path = $dir;
} // setDir
public function setProgressbarMd5($md5) {
$this->pb_md5 = $md5;
} // setProgressbarMd5
public function setProgressbarMessage($message) {
$this->pb_message = $message;
} // setProgressbarMessage
public function setProgressbarTitle($title) {
$this->pb_title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
} // setProgressbarTitle
public function setButtons($buttons) {
$this->buttons = $buttons;
} // setButtons
public function setDownloadLink($link) {
$this->download_link = $link;
} // setDownloadLink
public function setDownloadMd5($md5) {
$this->download_md5 = $md5;
} // setDownloadMd5
public function setReturnUrl($url) {
$this->return_url = $url;
} // setReturnUrl
public function setReturnOption($option) {
$this->return_option = $option;
} // setReturnOption
public function setTotalSteps($total) {
$this->step_total = $total;
} // setTotalSteps
public function addSteps($count) {
$this->operation = 'addSteps';
$this->step_count += $count;
$this->saveState();
} // addSteps
public function getProgressbarMd5() {
return $this->pb_md5;
} // getProgressbarMd5
public function completed() {
$this->operation = 'completed';
$this->complete = true;
$this->saveState();
} // completed
public function getJavascript() {
$jsCode = <<
debug) {
$jsCode .= <<file_path}sc_pb_{$this->pb_md5}.txt",
method: "GET",
dataType: "json",
cache:false
}).done(function(data, textStatus, jqXHR) {
JS;
if ($this->debug) {
$jsCode .= <<= data.steps) {
progress = 99;
}
else {
progress = Math.round((data.count / data.steps) * 100);
if (100 <= progress) {
progress = 99;
}
}
\$("#pb_bar-{$this->pb_md5}").progressbar("value", progress);
\$("#pb_perc-{$this->pb_md5}").html(progress + "%");
\$("#pb_msg-{$this->pb_md5}").html(data.message);
setTimeout(scPB_update, 100);
}
else {
\$("#pb_bar-{$this->pb_md5}").progressbar("value", 100);
\$("#pb_perc-{$this->pb_md5}").html("100%");
\$("#pb_msg-{$this->pb_md5}").html(data.message);
document.Fview.action = data.link;
document.Fdown.nm_name_doc.value = data.md5;
scPB_enableButton("{$this->buttons['view']['id']}");
scPB_enableButton("{$this->buttons['download']['id']}");
}
}).fail(function(jqXHR, textStatus, errorThrown) {
JS;
if ($this->debug) {
$jsCode .= <<pb_md5}").progressbar({
classes: {
"ui-progressbar": "scExportBar scExportBarRest",
"ui-progressbar-value": "scExportBarDone",
"ui-progressbar-complete": "scExportBarDone"
}
});
scPB_disableButton("{$this->buttons['view']['id']}");
scPB_disableButton("{$this->buttons['download']['id']}");
scPB_update();
});
JS;
return $jsCode;
} // getJavascript
public function getHtml() {
$htmlCode = <<
| {$this->pb_title} |
|
|
|
|
{$this->buttons['view']['code']}
{$this->buttons['download']['code']}
{$this->buttons['back']['code']}
|
|
|
HTML;
return $htmlCode;
} // getHtml
public function getIframeParams() {
$postParams = array();
$ignore = array('nm_proc_barr');
foreach ($_POST as $name => $value) {
if (!in_array($name, $ignore)) {
$postParams[] = "$name=".htmlspecialchars($value , ENT_QUOTES, 'UTF-8');
}
}
$postParams[] = "pbmd5={$this->pb_md5}";
return implode('&', $postParams);
} // getIframeParams
private function saveState() {
$json = array(
'steps' => $this->step_total,
'count' => $this->step_count,
'message' => $this->pb_message,
'link' => $this->download_link,
'md5' => $this->download_md5,
'returnUrl' => $this->return_url,
'returnOption' => $this->return_option,
'complete' => $this->complete,
);
@file_put_contents("{$this->file_root}{$this->file_path}sc_pb_{$this->pb_md5}.txt", json_encode($json));
$this->saveDebugInfo();
} // saveState
private function saveDebugInfo() {
if (!$this->debug) {
return;
}
$debug = <<file_root}
file_path={$this->file_path}
pb_md5={$this->pb_md5}
pb_message={$this->pb_message}
pb_title={$this->pb_title}
download_link={$this->download_link}
download_md5={$this->download_md5}
return_url={$this->return_url}
return_option={$this->return_option}
step_count={$this->step_count}
step_total={$this->step_total}
complete={$this->complete}
operation={$this->operation}
-------------------------
EOT;
@file_put_contents("{$this->file_root}{$this->file_path}sc_pb_{$this->pb_md5}_debug.txt", $debug, FILE_APPEND);
} // saveDebugInfo
} // scProgressBar
?>