1) ? $ids[$offset - 1] : ''; $menu['CURRENT'] = $ids[$offset]; $menu['NEXT'] = !empty($ids[$offset + 1]) ? $ids[$offset + 1] : ''; } return $menu; } function menu($module, $offset, $isAuditEnabled, $saveAndContinue = false) { $html_text = ""; if ($offset < 0) { $offset = 0; } //this check if require in cases when you visit the edit view before visiting that modules list view. //you can do this easily either from home or activies or sitemap. $stored_vcr_query = SugarVCR::retrieve($module); if (!empty($_REQUEST['record']) and !empty($stored_vcr_query) and isset($_REQUEST['offset']) and (empty($_REQUEST['isDuplicate']) or $_REQUEST['isDuplicate'] == 'false')) { // bug 15893 - only show VCR if called as an element in a set of records //syncing with display offset; $offset++; $action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : 'CreateView'); //$html_text .= "\n"; //$html_text .= "\n"; $html_text .= "\n"; $list_URL = 'index.php?action=index&module=' . $module; $current_page = floor($offset / 20) * 20; $list_URL .= '&offset=' . $current_page; $menu = SugarVCR::play($module, $offset); if ($saveAndContinue) { if (!empty($menu['NEXT'])) { $return_action = 'CreateView'; $return_id = $menu['NEXT']; $list_URL = 'index.php?action=CreateView&module=' . $module . '&record=' . $return_id . '&offset=' . ($offset + 1); $list_link = ""; }else $list_link = ""; }else $list_link = ""; $previous_link = ""; $next_link = ""; if (!empty($menu['PREV'])) { //$previous_link = "".SugarThemeRegistry::current()->getImage("previous","alt='".$GLOBALS['app_strings']['LNK_LIST_PREVIOUS']."' border='0' align='absmiddle'").' '.$GLOBALS['app_strings']['LNK_LIST_PREVIOUS'].""; $href = "index.php?module=$module&action=$action&offset=" . ($offset - 1) . "&record=" . $menu['PREV']; $previous_link = ""; } else $previous_link = ""; if (!empty($menu['NEXT'])) { //$next_link = "".$GLOBALS['app_strings']['LNK_LIST_NEXT'].' '.SugarThemeRegistry::current()->getImage("next","alt='".$GLOBALS['app_strings']['LNK_LIST_NEXT']."' border='0' align='absmiddle'").""; $href = "index.php?module=$module&action=$action&offset=" . ($offset + 1) . "&record=" . $menu['NEXT']; $next_link = ""; } else $next_link = ""; if (!empty($_SESSION[$module . 'total'])) { $count = $offset . ' ' . $GLOBALS['app_strings']['LBL_LIST_OF'] . ' ' . $_SESSION[$module . 'total']; if (!empty($GLOBALS['sugar_config']['disable_count_query']) && ( ($_SESSION[$module . 'total'] - 1) % $GLOBALS['sugar_config']['list_max_entries_per_page'] == 0 )) { $count .= '+'; } } else { $count = $offset; } $html_text .= ""; $html_text .= "
" . $list_link . "    " . $previous_link . "  (" . $count . ")  " . $next_link . "  
"; //"; } return $html_text; } function record($module, $offset) { $GLOBALS['log']->debug('SUGARVCR is recording more records'); $start = max(0, $offset - VCRSTART); $index = $start; $db = DBManagerFactory::getInstance(); $result = $db->limitQuery(SugarVCR::retrieve($module), $start, ($offset + VCREND), false); $index++; $ids = array(); while (($row = $db->fetchByAssoc($result)) != null) { $ids[$index] = $row['id']; $index++; } //now that we have the array of ids, store this in the session $_SESSION[$module . 'QUERY_ARRAY'] = $ids; return $ids; } function recordIDs($module, $rids, $offset, $totalCount) { $index = $offset; $index++; $ids = array(); foreach ($rids as $id) { $ids[$index] = $id; $index++; } //now that we have the array of ids, store this in the session $_SESSION[$module . 'QUERY_ARRAY'] = $ids; $_SESSION[$module . 'total'] = $totalCount; } function erase($module) { unset($_SESSION[$module . 'QUERY_ARRAY']); } }