data = $data;
$html_var = strtoupper($html_var);
$this->xtpl = new XTemplate($file);
$this->xtpl->assign('MOD', $GLOBALS['mod_strings']);
$this->xtpl->assign('APP', $GLOBALS['app_strings']);
$this->xtpl->assign('BG_HILITE', $hilite_bg);
$this->xtpl->assign('ORDER_BY', $data['pageData']['urls']['orderBy']);
$this->processPagination();
$this->xtpl->parse($this->nav_block);
$this->processArrows($data['pageData']['ordering']);
$oddRow = false;
if($this->xtpl->exists($this->pro_nav_block)) $this->xtpl->parse($this->pro_nav_block);
$this->xtpl->assign('CHECKALL', "");
foreach($data['data'] as $id=>$row) {
$this->xtpl->assign($html_var, $row);
if(!empty($data['pageData']['tag'][$id])) {
$this->xtpl->assign('TAG', $data['pageData']['tag'][$id]);
}
$this->xtpl->assign('ROW_COLOR', ($oddRow) ? 'oddListRow' : 'evenListRow');
$this->xtpl->assign('BG_COLOR', ($oddRow) ? $odd_bg : $even_bg);
$oddRow = !$oddRow;
if($this->xtpl->exists($this->pro_block)) $this->xtpl->parse($this->pro_block);
// if($this->xtpl->exists($this->os_block)) $this->xtpl->parse($this->os_block);
$prerow = " ";
$this->xtpl->assign('PREROW', $prerow);
$this->xtpl->parse($this->row_block);
}
}
/**
* Assigns the sort arrows in the tpl
*
* @param ordering array data that contains the ordering info
*
*/
function processArrows($ordering) {
$pathParts = pathinfo(SugarThemeRegistry::current()->getImageURL('arrow.gif',false));
list($width,$height) = getimagesize($pathParts['dirname'].'/'.$pathParts['basename']);
$this->xtpl->assign('arrow_start', " xtpl->assign('arrow_end', "' width='$width' height='$height' align='absmiddle' alt=".translate('LBL_SORT').">");
$arrow_order = (strcmp($ordering['sortOrder'], 'ASC'))?'_up': '_down';
$this->xtpl->assign($ordering['orderBy'].'_arrow', $arrow_order);
}
/**
* Assigns the pagination links at the top and bottom of the listview
*
*/
function processPagination() {
global $app_strings;
//_pp($this->data['pageData']);
if(empty($this->data['pageData']['urls']['prevPage'])) {
$startLink = SugarThemeRegistry::current()->getImage("start_off", "border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_START'])." ".$app_strings['LNK_LIST_START'];
$prevLink = SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_PREVIOUS'])." ".$app_strings['LNK_LIST_PREVIOUS'];
}
else {
// if($this->multi_select_popup) {// nav links for multiselect popup, submit form to save checks.
// $start_link = "".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_START'])." ".$app_strings['LNK_LIST_START']."";
// $previous_link = "".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_PREVIOUS'])." ".$app_strings['LNK_LIST_PREVIOUS']."";
// }
// elseif($this->shouldProcess) {
// // TODO: make popups / listview check saving the same
// $start_link = "".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_START'])." ".$app_strings['LNK_LIST_START']."";
// $previous_link = "".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_PREVIOUS'])." ".$app_strings['LNK_LIST_PREVIOUS']."";
// }
// else {
$startLink = "data['pageData']['urls']['startPage']}\" >".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_START'])." ".$app_strings['LNK_LIST_START']."";
$prevLink = "data['pageData']['urls']['prevPage']}\" >".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_PREVIOUS'])." ".$app_strings['LNK_LIST_PREVIOUS']."";
// }
}
if(!$this->data['pageData']['offsets']['totalCounted']) {
$endLink = $app_strings['LNK_LIST_END']." ".SugarThemeRegistry::current()->getImage("end_off","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_END']);
}
else {
// if($this->multi_select_popup) { // nav links for multiselect popup, submit form to save checks.
// $end_link = "".$app_strings['LNK_LIST_END']." ".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_END'])."";
// $next_link = "".$app_strings['LNK_LIST_NEXT']." ".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_NEXT'])."";
// }
// elseif($this->shouldProcess) {
// $end_link = "".$app_strings['LNK_LIST_END']." ".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_END'])."";
// $next_link = "".$app_strings['LNK_LIST_NEXT']." ".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_NEXT'])."";
// }
// else {
$endLink = "data['pageData']['urls']['endPage']}\" >".$app_strings['LNK_LIST_END']." ".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_END'])."";
// }
}
if(empty($this->data['pageData']['urls']['nextPage'])){
$nextLink = $app_strings['LNK_LIST_NEXT']." ".SugarThemeRegistry::current()->getImage("next_off","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_NEXT']);
}else{
$nextLink = "data['pageData']['urls']['nextPage']}\" >".$app_strings['LNK_LIST_NEXT']." ".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$app_strings['LNK_LIST_NEXT'])."";
}
if($this->export) $export_link = $this->buildExportLink();
else $export_link = '';
if($this->mailMerge)$merge_link = $this->buildMergeLink();
else $merge_link = '';
if($this->multiSelect) $selected_objects_span = $this->buildSelectedObjectsSpan();
else $selected_objects_span = '';
$htmlText = "
$export_link$merge_link$selected_objects_span | \n" . "".$startLink." ".$prevLink." (".($this->data['pageData']['offsets']['current'] + 1) ." - ".($this->data['pageData']['offsets']['current'] + $this->rowCount) . " ".$app_strings['LBL_LIST_OF']." ".$this->data['pageData']['offsets']['total']; if(!$this->data['pageData']['offsets']['totalCounted']){ $htmlText .= '+'; } $htmlText .=") ".$nextLink." "; if($this->data['pageData']['offsets']['totalCounted']){ $htmlText .= $endLink; } $htmlText .=" |