本文整理汇总了PHP中HTML_Progress::setAnimSpeed方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Progress::setAnimSpeed方法的具体用法?PHP HTML_Progress::setAnimSpeed怎么用?PHP HTML_Progress::setAnimSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Progress
的用法示例。
在下文中一共展示了HTML_Progress::setAnimSpeed方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InitProgressBar
function InitProgressBar($increment = 1)
{
global $progress_bar;
$progress_bar = new HTML_Progress();
$progress_bar->setAnimSpeed(100);
//$progress_bar->setIncrement( (int)$increment );
//$progress_bar->setIndeterminate(true);
$progress_bar->setBorderPainted(true);
$ui =& $progress_bar->getUI();
$ui->setCellAttributes('active-color=#3874B4 inactive-color=#CCCCCC width=10');
$ui->setBorderAttributes('width=1 color=navy');
$ui->setStringAttributes('width=60 font-size=14 background-color=#FFFFFF align=center');
?>
<html>
<head>
<style type="text/css">
<!--
<?php
echo $progress_bar->getStyle();
?>
body {
background-color: #FFFFFF;
color: #FFFFFF;
font-family: Verdana, freesans;
}
a:visited, a:active, a:link {
color: yellow;
}
// -->
</style>
<script type="text/javascript">
<!--
<?php
echo $progress_bar->getScript();
?>
//-->
</script>
</head>
<body>
<div align="center">
<?php
echo $progress_bar->toHtml();
}
示例2:
<?php
/**
* Natural Horizontal with background images ProgressBar example.
* See also ProgressMaker usage with pre-set UI model 'BgImages'.
*
* @version $Id: bgimages.php,v 1.2 2005/07/25 10:25:30 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress
* @subpackage Examples
*/
require_once 'HTML/Progress.php';
$bar = new HTML_Progress();
$bar->setAnimSpeed(100);
$bar->setIncrement(10);
$bar->setBorderPainted(true);
$ui =& $bar->getUI();
$ui->setTab(' ');
$ui->setCellAttributes(array('active-color' => '#000084', 'inactive-color' => '#3A6EA5', 'width' => 25, 'spacing' => 0, 'background-image' => 'download.gif'));
$ui->setBorderAttributes('width=1 style=inset color=white');
$ui->setStringAttributes(array('width' => 60, 'font-size' => 10, 'background-color' => '#C3C6C3', 'align' => 'center', 'valign' => 'left'));
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>BgImages Progress example</title>
<style type="text/css">
<!--
示例3: sprintf
$contextFormat = $options['contextFormat'];
$file = $err['context']['file'];
$line = $err['context']['line'];
$func = $err['context']['class'];
$func .= $err['context']['type'];
$func .= $err['context']['function'];
$context = sprintf($contextFormat, $file, $line, $func);
printf($lineFormat . "<br />\n", ucfirst($err['level']), $err['message'], $context);
}
}
$logger['push_callback'] = '_pushCallback';
$logger['error_handler'] = '_errorHandler';
$options = array('lineFormat' => '<b>%1$s</b>: %2$s <hr>%3$s', 'contextFormat' => '<b>Function</b>: %3$s<br/><b>File</b>: %1$s<br/><b>Line</b>: %2$s');
$logger['handler']['display'] = array('conf' => $options);
$bar = new HTML_Progress($logger);
$e = $bar->setAnimSpeed('100');
// < - - - will generate an API exception
if (is_object($e)) {
if (is_a($e, 'PEAR_Error')) {
die('<h1>Catch PEAR_Error API exception</h1>' . $e->toString());
}
}
if (HTML_Progress::hasErrors()) {
$err = HTML_Progress::getError();
echo '<pre>';
print_r($err);
echo '</pre>';
die('<h1>Catch HTML_Progress exception</h1>');
}
$e = $bar->setAnimSpeed(10000);
// < - - - will generate an API error
示例4: createProgressBar
/**
* Creates a progress bar with options choosen on all wizard tabs.
*
* @since 1.1
* @access public
*/
function createProgressBar()
{
$progress = $this->exportValues();
$bar = new HTML_Progress();
$bar->setIdent('PB1');
$bar->setAnimSpeed(intval($progress['rAnimSpeed']));
if ($progress['model'] != '') {
$bar->setModel($progress['model'], 'iniCommented');
$bar->setIncrement(10);
$ui =& $bar->getUI();
} else {
$bar->setBorderPainted($progress['borderpainted'] == '1');
$bar->setStringPainted($progress['stringpainted'] == '1');
$ui =& $bar->getUI();
$structure = array();
/* Page 1: Progress attributes **************************************************/
if (strlen(trim($progress['progressclass'])) > 0) {
$structure['progress']['class'] = $progress['progressclass'];
}
if (strlen(trim($progress['progresssize']['bgcolor'])) > 0) {
$structure['progress']['background-color'] = $progress['progresssize']['bgcolor'];
}
if (strlen(trim($progress['progresssize']['width'])) > 0) {
$structure['progress']['width'] = $progress['progresssize']['width'];
}
if (strlen(trim($progress['progresssize']['height'])) > 0) {
$structure['progress']['height'] = $progress['progresssize']['height'];
}
$structure['progress']['auto-size'] = $progress['autosize'] == '1';
$ui->setProgressAttributes($structure['progress']);
$orient = $progress['shape'] == '1' ? HTML_PROGRESS_BAR_HORIZONTAL : HTML_PROGRESS_BAR_VERTICAL;
$ui->setOrientation($orient);
$ui->setFillWay($progress['way']);
/* Page 2: Cell attributes ******************************************************/
if (strlen(trim($progress['cellid'])) > 0) {
$structure['cell']['id'] = $progress['cellid'];
}
if (strlen(trim($progress['cellclass'])) > 0) {
$structure['cell']['class'] = $progress['cellclass'];
}
if (strlen(trim($progress['cellvalue']['min'])) > 0) {
$bar->setMinimum(intval($progress['cellvalue']['min']));
}
if (strlen(trim($progress['cellvalue']['max'])) > 0) {
$bar->setMaximum(intval($progress['cellvalue']['max']));
}
if (strlen(trim($progress['cellvalue']['inc'])) > 0) {
$bar->setIncrement(intval($progress['cellvalue']['inc']));
}
if (strlen(trim($progress['cellsize']['width'])) > 0) {
$structure['cell']['width'] = $progress['cellsize']['width'];
}
if (strlen(trim($progress['cellsize']['height'])) > 0) {
$structure['cell']['height'] = $progress['cellsize']['height'];
}
if (strlen(trim($progress['cellsize']['spacing'])) > 0) {
$structure['cell']['spacing'] = $progress['cellsize']['spacing'];
}
if (strlen(trim($progress['cellsize']['count'])) > 0) {
$ui->setCellCount(intval($progress['cellsize']['count']));
}
if (strlen(trim($progress['cellcolor']['active'])) > 0) {
$structure['cell']['active-color'] = $progress['cellcolor']['active'];
}
if (strlen(trim($progress['cellcolor']['inactive'])) > 0) {
$structure['cell']['inactive-color'] = $progress['cellcolor']['inactive'];
}
if (strlen(trim($progress['cellfont']['family'])) > 0) {
$structure['cell']['font-family'] = $progress['cellfont']['family'];
}
if (strlen(trim($progress['cellfont']['size'])) > 0) {
$structure['cell']['font-size'] = $progress['cellfont']['size'];
}
if (strlen(trim($progress['cellfont']['color'])) > 0) {
$structure['cell']['color'] = $progress['cellfont']['color'];
}
$ui->setCellAttributes($structure['cell']);
/* Page 3: Border attributes ****************************************************/
if (strlen(trim($progress['borderclass'])) > 0) {
$structure['border']['class'] = $progress['borderclass'];
}
if (strlen(trim($progress['borderstyle']['width'])) > 0) {
$structure['border']['width'] = $progress['borderstyle']['width'];
}
if (strlen(trim($progress['borderstyle']['style'])) > 0) {
$structure['border']['style'] = $progress['borderstyle']['style'];
}
if (strlen(trim($progress['borderstyle']['color'])) > 0) {
$structure['border']['color'] = $progress['borderstyle']['color'];
}
$ui->setBorderAttributes($structure['border']);
/* Page 4: String attributes ****************************************************/
if (strlen(trim($progress['stringid'])) > 0) {
$structure['string']['id'] = $progress['stringid'];
//.........这里部分代码省略.........
示例5:
if ($this->progress->getPercentComplete() == 1) {
$this->progress->setValue(0);
} else {
$this->progress->incValue();
}
}
}
//
// 2. defines the progress meter
//
$meter = new HTML_Progress();
$ui =& $meter->getUI();
$ui->setProgressAttributes(array('background-color' => '#e0e0e0'));
$ui->setStringAttributes(array('color' => '#996', 'background-color' => '#CCCC99'));
$ui->setCellAttributes(array('active-color' => '#996'));
$meter->setAnimSpeed(200);
$meter->setIncrement(10);
$meter->setStringPainted(true);
// get space for the string
$meter->setString("");
// but don't paint it
$meter->setIndeterminate(true);
// progress meter start in indeterminate mode
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FTP/Progress Observer example</title>
<style type="text/css">
<!--
示例6:
* @subpackage Examples
*/
require_once 'HTML/Progress.php';
$bar1 = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
$bar1->setAnimSpeed(20);
$bar1->setIdent('PB1');
$bar1->setIncrement(10);
$bar1->setBorderPainted(true);
$ui1 =& $bar1->getUI();
$ui1->setFillWay('natural');
$ui1->setCellCount(15);
$ui1->setCellAttributes('active-color=#970038 inactive-color=#FFDDAA width=50 height=13');
$ui1->setBorderAttributes('width=1 color=#000000');
$ui1->setStringAttributes(array('font-size' => 8, 'color' => '#FF0000', 'background-color' => '#C3C6C3', 'align' => 'center', 'valign' => 'bottom'));
$bar2 = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
$bar2->setAnimSpeed(20);
$bar2->setIdent('PB2');
$bar2->setIncrement(5);
$bar2->setBorderPainted(true);
$ui2 =& $bar2->getUI();
$ui2->setFillWay('reverse');
$ui2->setCellCount(15);
$ui2->setCellAttributes('active-color=#3874B4 inactive-color=#FFDDAA width=50 height=13');
$ui2->setBorderAttributes('width=1 style=dashed color=#000000');
$ui2->setStringAttributes(array('font-size' => 8, 'color' => 'navy', 'background-color' => '#C3C6C3', 'align' => 'center', 'valign' => 'bottom'));
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
示例7: or
$obj->sleep();
} else {
for ($i = 0; $i < $obj->_anim_speed * 1000; $i++) {
}
}
}
/*
Which version of html_progress: (stable)1.1 or (beta)1.2.0 RC1, RC2 or RC3
*/
$version = _methodExists('run') ? 1.2 : 1.1;
$progress = new HTML_Progress();
$observer = new logsUpload();
// prepare the progress meter to logs all upload operations
$progress->addListener($observer);
$progress->setIncrement(10);
$progress->setAnimSpeed(100);
$progress->setIndeterminate(true);
// progress bar run in indeterminate mode
$progress->setStringPainted(true);
// get space for the string
$progress->setBorderPainted(true);
$progress->setString("");
// but don't paint it
if ($version > 1.1) {
// set a progress handler required at least version 1.2.0RC3
$progress->setProgressHandler('myFunctionHandler');
}
$ui =& $progress->getUI();
$ui->setBorderAttributes('width=1 style=inset color=white');
$ui->setCellAttributes(array('active-color' => '#000084', 'inactive-color' => '#3A6EA5', 'width' => 25, 'spacing' => 0, 'background-image' => 'download.gif'));
$ui->setStringAttributes(array('width' => 60, 'font-size' => 10, 'background-color' => '#C3C6C3'));
示例8: die
// updates $bar2 because $bar1 has completed a full loop
$bar2->incValue();
$bar2->display();
}
default:
}
}
}
}
// 2. Creates ProgressBar
$bar1 = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
$bar1->setAnimSpeed(50);
$bar1->setIncrement(10);
$bar1->setIdent('PB1');
$bar2 = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
$bar2->setAnimSpeed(50);
$bar2->setIncrement(25);
$bar2->setIdent('PB2');
$bar2->setBorderPainted(true);
// 3. Creates and attach a listener
$observer = new Bar1Observer();
$ok = $bar1->addListener($observer);
if (!$ok) {
die("Cannot add a valid listener to progress bar !");
}
// 4. Changes look-and-feel of ProgressBar
$ui1 =& $bar1->getUI();
$ui1->setComment('Complex Observer ProgressBar example');
$ui1->setTabOffset(1);
$ui1->setProgressAttributes(array('background-color' => '#e0e0e0'));
$ui1->setStringAttributes(array('valign' => 'left', 'color' => 'red', 'background-color' => 'lightblue'));
示例9: myMethodHandler
class myClassHandler
{
function myMethodHandler($progressValue, &$bar)
{
if (fmod($progressValue, 10) == 0) {
echo "myMethodHandler -> progress value is = {$progressValue} <br/>\n";
}
$bar->sleep();
}
}
$obs = new myClassHandler();
$monitor = new HTML_Progress_Monitor('frmMonitor3', array('button' => array('style' => 'width:80px;')));
$progress = new HTML_Progress();
$progress->setUI('Progress_Default2');
// Attach a progress ui-model
$progress->setAnimSpeed(20);
$progress->setProgressHandler(array(&$obs, 'myMethodHandler'));
$monitor->setProgressElement($progress);
?>
<html>
<head>
<title>ProgressBar Monitor - Default renderer </title>
<style type="text/css">
<!--
.progressStatus {
color:#000000;
font-size:10px;
}
<?php
echo $monitor->getStyle();
?>
示例10:
<?php
require_once 'HTML/Progress.php';
$bar = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
$bar->setAnimSpeed(80);
$bar->setIdent('PB1');
$bar->setIncrement(10);
$bar->setBorderPainted(true);
$bar->setStringPainted(true);
// get space for the string
$bar->setString("");
// but don't paint it
$bar->setIndeterminate(true);
// progress start in indeterminate mode
$ui =& $bar->getUI();
$ui->setCellAttributes('active-color=#970038 inactive-color=#FFDDAA width=50 height=13');
$ui->setBorderAttributes('width=1 color=#000000');
$ui->setStringAttributes(array('font-size' => 8, 'color' => '#FF0000', 'background-color' => '#C3C6C3', 'align' => 'center', 'valign' => 'bottom'));
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>setIndeterminate example</title>
<style type="text/css">
<!--
<?php
echo $bar->getStyle();
?>
示例11: isset
$log = isset($event['log']) ? $event['log'] : "undefined event id.";
$val = isset($event['value']) ? $event['value'] : "unknown value";
$msg = "{$log} = {$val}";
} else {
$msg = $event;
}
if ($this->_out == 'file') {
error_log("{$msg} \n", 3, $this->_console);
} else {
print "{$msg} <br />\n";
}
}
}
// 2. Creates ProgressBar
$bar = new HTML_Progress();
$bar->setAnimSpeed(50);
$bar->setIncrement(5);
// 3. Creates and attach a listener
$observer = new MyObserver($_GET['out']);
$ok = $bar->addListener($observer);
if (!$ok) {
die("Cannot add a valid listener to progress bar !");
}
// 4. Changes look-and-feel of ProgressBar
$ui = $bar->getUI();
$ui->setComment('Simple Observer ProgressBar example');
?>
<html>
<head>
<title>Simple Observer ProgressBar example</title>
<style type="text/css">
示例12: array
break;
case 70:
$pic = 'picture3.jpg';
break;
default:
$pic = null;
}
if (!is_null($pic)) {
$obj->setCaption('upload <b>%file%</b> in progress ... Start at %percent%%', array('file' => $pic, 'percent' => $progressValue));
}
$bar =& $obj->getProgressElement();
$bar->sleep();
// slow animation because we do noting else
}
}
$monitor = new HTML_Progress_Monitor('frmMonitor5', array('title' => 'Upload your pictures', 'start' => 'Upload', 'cancel' => 'Stop', 'button' => array('style' => 'width:80px;')));
$monitor->setProgressHandler(array('my2ClassHandler', 'my1Method'));
$progress = new HTML_Progress();
$progress->setUI('Progress_ITDynamic');
$progress->setAnimSpeed(50);
$monitor->setProgressElement($progress);
$tpl =& new HTML_Template_ITX('../templates');
$tpl->loadTemplateFile('itdynamic_monitor.html');
$tpl->setVariable(array('qf_style' => "body {font-family: Verdana, Arial; } \n" . $monitor->getStyle(), 'qf_script' => $monitor->getScript()));
$renderer =& new HTML_QuickForm_Renderer_ITDynamic($tpl);
$renderer->setElementBlock(array('buttons' => 'qf_buttons'));
$monitor->accept($renderer);
// Display progress uploader dialog box
$tpl->show();
$monitor->run();
echo '<p><< <a href="../index.html">Back examples TOC</a></p>';
示例13: array
$colors = array('#FFFFFF' => 'white', '#0000FF' => 'blue', '#7B7B88' => '#7B7B88');
$form->addElement('select', 'color', 'border color:', $colors);
$defaultValues['border'] = 'solid';
$defaultValues['color'] = '#7B7B88';
$form->setDefaults($defaultValues);
if ($form->validate()) {
$arr = $form->getElementValue('border');
$border = $arr[0];
$arr = $form->getElementValue('color');
$color = $arr[0];
} else {
$border = $defaultValues['border'];
$color = $defaultValues['color'];
}
$bar = new HTML_Progress();
$bar->setAnimSpeed(200);
$bar->setIncrement(10);
$bar->setBorderPainted(true);
$bar->setStringPainted(true);
// get space for the string
$bar->setString('');
// but don't paint it
$bar->setProgressHandler('myFunctionHandler');
$ui =& $bar->getUI();
$ui->setCellAttributes('active-color=#7B7B88 inactive-color=#D0D0D0 width=10');
$ui->setBorderAttributes(array('width' => 2, 'color' => $color, 'style' => $border));
$ui->setStringAttributes(array('width' => 320, 'font-size' => 10, 'align' => 'left', 'valign' => 'bottom', 'background-color' => '#D0D0D0'));
$ui->setProgressAttributes('width=320');
$tpl->setVariable("L_STYLESHEET", $bar->getStyle());
$tpl->setVariable("L_JAVASCRIPT", $ui->getScript());
$tpl->setVariable("L_PROGRESS_BAR", $bar->toHtml());
示例14:
<?php
require_once 'HTML/Progress.php';
$bar = new HTML_Progress();
$bar->setAnimSpeed(250);
$bar->setIncrement(10);
$ui =& $bar->getUI();
$ui->setStringAttributes('valign=bottom align=center width=90 height=30');
$ui->setOrientation(HTML_PROGRESS_POLYGONAL);
$ui->setCellAttributes(array('width' => 15, 'height' => 15, 'active-color' => 'red', 'inactive-color' => 'orange'));
$ui->setCellCoordinates(6, 4);
// Rectangle 6x4
?>
<html>
<head>
<title>setCellCoordinates example</title>
<style type="text/css">
<!--
<?php
echo $bar->getStyle();
?>
// -->
</style>
<script type="text/javascript">
<!--
<?php
echo $ui->getScript();
?>
//-->
</script>
</head>