/** * Gets the current progress of a specific listing job * */ private function getListingProgressAction() { $jobId = $_POST['jobId']; $jobKey = 'ebay:list_products:id:' . $jobId; $prefix = 'ebay:list_products:' . $jobId . ':'; $keystore = Interspire_KeyStore::instance(); $percent = 0; $eta = ''; $progress = ''; $progressBasic = ''; if ($keystore->exists($jobKey)) { $offset = (int)$keystore->get($prefix . 'actual_processed'); $abort = (bool)$keystore->get($prefix . 'abort'); $error = (int)$keystore->get($prefix . 'error_count'); $total = (int)$keystore->get($prefix . 'estimated_total'); if ($total) { if ($offset) { $percent = round($offset / $total * 100); if ($percent > 100) { $percent = 100; } $per = (time() - (int)$keystore->get($prefix . 'started')) / $offset; $remaining = Store_DateTime::duration(($total - $offset) * $per, Store_DateTime::DURATION_MINUTES); $eta = "<br />" . GetLang('EbayListingETA', array( 'remaining' => $remaining, )); } $total = GetLang('of') . ' ' . number_format($total, 0, GetConfig('DecimalToken'), GetConfig('ThousandsToken')); } else { $total = ''; } $offset = number_format($offset, 0, GetConfig('DecimalToken'), GetConfig('ThousandsToken')); $error = number_format($error, 0, GetConfig('DecimalToken'), GetConfig('ThousandsToken')); $progress = GetLang('EbayListingProgress', array( 'offset' => $offset, 'total' => $total, 'error' => $error, 'eta' => $eta )); $progressBasic = GetLang('EbayListingProgressBasic', array( 'offset' => $offset, 'total' => $total, )); } else { $percent = 100; } ISC_JSON::output('', true, array('percent' => $percent, 'progress' => $progress, 'progressBasic' => $progressBasic)); }
public function ManageBackups($MsgDesc = "", $MsgStatus = "") { if(isset($_GET['complete'])) { $MsgStatus = MSG_SUCCESS; if($_GET['complete'] == "remote") { $MsgDesc = GetLang('RemoteBackupComplete'); } else { $MsgDesc = sprintf(GetLang('LocalBackupComplete'), $_GET['complete']); } } else if(isset($_GET['failed'])) { $MsgStatus = MSG_ERROR; if($_GET['failed'] == 'local') { $MsgDesc = GetLang('LocalBackupFailed'); } else { $MsgDesc = GetLang('RemoteBackupFailed'); } } if($MsgDesc != "") { $GLOBALS["Message"] = MessageBox($MsgDesc, $MsgStatus); } $dir = realpath(ISC_BACKUP_DIRECTORY); $dir = isc_substr($dir, isc_strpos($dir, realpath(ISC_BASE_PATH))); $backups = $this->_GetBackupList(); $GLOBALS['BackupGrid'] = ''; // Loop through all of the existing backups foreach($backups as $file => $details) { $GLOBALS['FileName'] = isc_html_escape($file); $GLOBALS['ModifiedTime'] = Store_DateTime::niceTime($details['mtime']); if(isset($details['directory'])) { $GLOBALS['FileSize'] = "N/A"; $GLOBALS['DownloadOpen'] = GetLang('OpenBackup'); $GLOBALS['BackupImage'] = "backup_folder"; $GLOBALS['BackupType'] = GetLang('BackupFolder'); $GLOBALS['ViewLink'] = "backups/" . $GLOBALS['FileName']; } else { $GLOBALS['FileSize'] = Store_Number::niceSize($details['size']); $GLOBALS['DownloadOpen'] = GetLang('DownloadBackup'); $GLOBALS['BackupImage'] = "backup"; $GLOBALS['BackupType'] = GetLang('BackupFile'); $GLOBALS['ViewLink'] = "index.php?ToDo=viewBackup&file=" . $GLOBALS['FileName']; } $GLOBALS["BackupGrid"] .= $this->template->render('backup.manage.row.tpl'); } if($GLOBALS['BackupGrid'] == "") { $GLOBALS['DisplayGrid'] = "none"; $GLOBALS["Message"] = MessageBox(GetLang('NoBackups'), MSG_SUCCESS); $GLOBALS["DisableDelete"] = "DISABLED"; } $this->template->display('backups.manage.tpl'); }
protected function getEbayListingNotifications() { $notifications = array(); // Show information about email integration tasks in progress $keystore = Interspire_KeyStore::instance(); $exports = $keystore->multiGet('ebay:list_products:id:*'); foreach ($exports as $exportId) { $prefix = 'ebay:list_products:' . $exportId . ':'; $offset = (int)$keystore->get($prefix . 'true_offset'); $abort = (bool)$keystore->get($prefix . 'abort'); $error = (int)$keystore->get($prefix . 'error_count'); $total = (int)$keystore->get($prefix . 'estimated_total'); $eta = ''; if ($total) { if ($offset) { $per = (time() - (int)$keystore->get($prefix . 'started')) / $offset; $remaining = Store_DateTime::duration(($total - $offset) * $per, Store_DateTime::DURATION_MINUTES); if ($remaining) { $eta = '<br />' . GetLang('Ebay_Notifications_InProgress_ETA', array( 'remaining' => $remaining, )); } } $total = GetLang('of') . ' ' . number_format($total, 0, GetConfig('DecimalToken'), GetConfig('ThousandsToken')); } else { $total = ''; } $offset = number_format($offset, 0, GetConfig('DecimalToken'), GetConfig('ThousandsToken')); $error = number_format($error, 0, GetConfig('DecimalToken'), GetConfig('ThousandsToken')); $template = $keystore->get($prefix . 'template_name'); $notice = ''; if ($abort) { $notice = GetLang('Ebay_Notifications_Abort', array( 'template' => $template, )); } else { $notice = GetLang('Ebay_Notifications_InProgress', array( 'offset' => $offset, 'total' => $total, 'error' => $error, 'eta' => $eta, 'template' => $template, )) . '<br /><a href="#" class="Ebay_Export_Abort" id="Ebay_Export_Abort_' . isc_html_escape($exportId) . '" title="' . isc_html_escape(GetLang('Ebay_Notifications_InProgress_Abort_Title')) . '">' . GetLang('Ebay_Notifications_InProgress_Abort_Label') . '</a>'; } if ($notice) { $notifications[] = $notice; } } return $notifications; }