function renderProgress() { jpimport('core.cube'); jpimport('helpers.backup', true); $cube =& JoomlapackCUBE::getInstance(); $array = $cube->getCUBEArray(); return JoomlapackHelperBackup::getBackupProcessHTML($array); }
function renderProgress() { jpimport('core.cube'); jpimport('helpers.backup', true); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, '--- Entering renderProgress()'); $cube =& JoomlapackCUBE::getInstance(); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, '--- renderProgress() got CUBE Instance'); $array = $cube->getCUBEArray(); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, '--- renderProgress() got CUBE Array'); return JoomlapackHelperBackup::getBackupProcessHTML($array); }
/** * Gets the HTML for the pretty backup process pane * * @param array $array The CUBE Array */ function getBackupProcessHTML($array) { if (count($array) <= 0) { $domain = 'finale'; } else { $domain = $array['Domain']; $step = $array['Step']; $substep = $array['Substep']; } // Find current domain's index switch ($domain) { case 'init': $currentDomainIndex = 0; break; case 'installer': $currentDomainIndex = 1; break; case 'PackDB': $currentDomainIndex = 3; break; case 'Packing': $currentDomainIndex = 4; break; case 'finale': default: $currentDomainIndex = 6; break; } // Now, make an array indicating in what state each domain is $domainDisplayArray = array(); $domainDisplayArray[] = JoomlapackHelperBackup::_makeStepArrayEntry(JText::_('BACKUP_LABEL_DOMAIN_PACKDB'), 3, $currentDomainIndex, false); $domainDisplayArray[] = JoomlapackHelperBackup::_makeStepArrayEntry(JText::_('BACKUP_LABEL_DOMAIN_PACKING'), 4, $currentDomainIndex, false); $domainDisplayArray[] = JoomlapackHelperBackup::_makeStepArrayEntry(JText::_('BACKUP_LABEL_DOMAIN_FINISHED'), 5, $currentDomainIndex, false); $gridHTML = ''; foreach ($domainDisplayArray as $dispArray) { $class = $dispArray['class'] == '' ? '' : 'class="' . $dispArray['class'] . '"'; $imageLink = $dispArray['pic'] == '' ? '' : '<img src="' . JURI::base() . 'components/com_joomlapack/assets/images/' . $dispArray['pic'] . '" />'; $gridHTML .= "\t\t\t<tr {$class}>\n"; $gridHTML .= "\t\t\t\t<td>{$imageLink}</td>\n"; $gridHTML .= "\t\t\t\t<td>" . $dispArray['label'] . "</td>\n"; $gridHTML .= "\t\t\t</tr>\n"; } // Create the last response information jimport('joomla.utilities.date'); $dateNow = new JDate('now'); $user =& JFactory::getUser(); $userTZ = $user->getParam('timezone', 0); $dateNow->setOffset($userTZ); $lastResponseLabel = JText::_('BACKUP_TEXT_LASTRESPONSE'); $lastResponseStamp = $dateNow->toFormat('%H:%M:%S') . ' GMT' . ($userTZ == 0 ? '' : ($userTZ > 0 ? '+' . $userTZ : $userTZ)); $out = <<<ENDXXX1 \t<div class="sitePack"> \t\t<table class="stepstable" align="center"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t\t<th width="16"></th> \t\t\t\t\t<th></th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> \t\t{$gridHTML} \t\t\t</tbody> \t\t</table> \t\t \t\t<div class="status"> \t\t\t<p id="JPStep">{$step}</p> \t\t\t<p id="JPSubstep">{$substep}</p> \t\t</div> \t\t \t\t<div class="jplastresponse"> \t\t\t<p>{$lastResponseLabel} {$lastResponseStamp}</p> \t\t</div> \t</div> ENDXXX1; return $out; }
} else { $action = 'step'; $message = ''; } ?> <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <title>JoomlaPack Progress Indicator</title> <link rel="stylesheet" type="text/css" href="<?php echo JURI::base(); ?> components/com_joomlapack/assets/css/joomlapack.css" /> </head> <body> <?php jpimport('helpers.backup', true); echo JoomlapackHelperBackup::getBackupProcessHTML($array); ?> <script type="text/javascript" language="Javascript"> window.parent.handleRequest('<?php echo $action; ?> ','<?php echo $message; ?> '); </script> </body> </html>