/** * Display the spool list grid * * Method will build and return the spool list grid HTML * * @access public * @return string The spool list HTML */ public function showSpoolListGrid() { $total = $this->getAccountingSpoolCount(); /** * If we have no jobs then display nothing */ if ($total == 0) { return ''; } // Show a list of products in a table $page = 0; $start = 0; $numPages = 0; $GLOBALS['Nav'] = ""; if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } // Limit the number of orders returned if ($page < 1) { $page = 1; } $start = ($page - 1) * ISC_ACCOUNTING_SPOOLS_PER_PAGE; $numPages = ceil($total / ISC_ACCOUNTING_SPOOLS_PER_PAGE); $list = $this->getAccountingSpoolList($start, ISC_ACCOUNTING_SPOOLS_PER_PAGE); // Add the "(Page x of n)" label if ($total > ISC_ACCOUNTING_SPOOLS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($total, ISC_ACCOUNTING_SPOOLS_PER_PAGE, $page, 'index.php?ToDo=getJobAccountingSettingsSpoolList&module=' . $this->getid()); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $grid = ''; $GLOBALS['QuickBooksModuleID'] = $this->getid(); foreach ($list as $spoolid => $spool) { $desc = parent::buildAccountingSpoolDescription($spool); $url = parent::buildAccountingSpoolURL($spool); $links = ''; if (strtolower($spool['accountingspooltype']) == 'account') { $GLOBALS['JobDisabled'] = 'disabled="1"'; $GLOBALS['JobURL'] = $desc; $status = GetLang('Pending'); } else { $GLOBALS['JobDisabled'] = ''; $GLOBALS['JobURL'] = '<a href="' . $url . '" target="_blank">' . $desc . '</a>'; if ($spool['accountingspooldisabled']) { if ((int) $spool['accountingspoolerrno'] !== 0) { $status = GetLang('Failed'); if ($spool['accountingspoolerrmsg']) { $status .= '<br />' . isc_html_escape($desc['accountingspoolerrmsg']); } } else { $status = GetLang('Disabled'); $links .= ' <a href="#" onclick="reenableQBCheckboxes(\'' . $spoolid . '\'); return false;">' . GetLang('Reenable') . '</a>'; } } else { $status = GetLang('Pending'); $links .= ' <a href="#" onclick="disableQBCheckboxes(\'' . $spoolid . '\'); return false;">' . GetLang('Disable') . '</a>'; } $links .= ' <a href="#" onclick="deleteQBCheckboxes(\'' . $spoolid . '\'); return false;">' . GetLang('Delete') . '</a>'; } $GLOBALS['JobName'] = $spoolid; $GLOBALS['JobType'] = $spool['accountingspooltype']; $GLOBALS['JobImage'] = $GLOBALS['ShopPath'] . '/modules/accounting/quickbooks/images/' . $spool['accountingspooltype'] . '.gif'; $GLOBALS['JobStatus'] = $status; $GLOBALS['JobLinks'] = $links; $grid .= $this->ParseTemplate("module.quickbooks.spoollistitem", true); } return $grid; }