1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300:
<?php
function template_show_list($list_id = null)
{
global $context;
$list_id = $list_id === null ? (!empty($context['default_list']) ? $context['default_list'] : '') : $list_id;
if (empty($list_id) || empty($context[$list_id]))
return;
$cur_list = &$context[$list_id];
if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top'))
template_create_list_menu($cur_list['list_menu'], 'top');
if (isset($cur_list['form']))
echo '
<form action="', $cur_list['form']['href'], '" method="post"', empty($cur_list['form']['name']) ? '' : ' name="' . $cur_list['form']['name'] . '" id="' . $cur_list['form']['name'] . '"', ' accept-charset="', $context['character_set'], '">';
if (!empty($cur_list['title']))
echo '
<div class="cat_bar">
<h3 class="catbg">
', $cur_list['title'], '
</h3>
</div>';
if (isset($cur_list['additional_rows']['after_title']))
{
echo '
<div class="information flow_hidden">';
template_additional_rows('after_title', $cur_list);
echo '
</div>';
}
if (isset($cur_list['additional_rows']['top_of_list']))
template_additional_rows('top_of_list', $cur_list);
if ((!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) || isset($cur_list['additional_rows']['above_column_headers']))
{
if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index']))
echo '
<div class="floatleft">
<div class="pagesection">', $cur_list['page_index'], '</div>
</div>';
if (isset($cur_list['additional_rows']['above_column_headers']))
template_additional_rows('above_column_headers', $cur_list);
}
echo '
<table class="table_grid" ', !empty($list_id) ? 'id="' . $list_id . '"' : '', ' ', !empty($cur_list['width']) ? ' style="width:' . $cur_list['width'] . '"' : '', '>';
$header_count = count($cur_list['headers']);
if (!($header_count < 2 && empty($cur_list['headers'][0]['label'])))
{
echo '
<thead>
<tr class="title_bar">';
foreach ($cur_list['headers'] as $col_header)
echo '
<th scope="col" id="header_', $list_id, '_', $col_header['id'], '" class="', $col_header['id'], empty($col_header['class']) ? '' : ' ' . $col_header['class'], '"', empty($col_header['style']) ? '' : ' style="' . $col_header['style'] . '"', empty($col_header['colspan']) ? '' : ' colspan="' . $col_header['colspan'] . '"', '>
', empty($col_header['href']) ? '' : '<a href="' . $col_header['href'] . '" rel="nofollow">', empty($col_header['label']) ? '' : $col_header['label'], empty($col_header['href']) ? '' : (empty($col_header['sort_image']) ? '</a>' : ' <span class="main_icons sort_' . $col_header['sort_image'] . '"></span></a>'), '
</th>';
echo '
</tr>
</thead>';
}
echo '
<tbody>';
if (empty($cur_list['rows']) && !empty($cur_list['no_items_label']))
echo '
<tr class="windowbg">
<td colspan="', $cur_list['num_columns'], '" class="', !empty($cur_list['no_items_align']) ? $cur_list['no_items_align'] : 'centertext', '">
', $cur_list['no_items_label'], '
</td>
</tr>';
elseif (!empty($cur_list['rows']))
{
foreach ($cur_list['rows'] as $id => $row)
{
echo '
<tr class="windowbg', empty($row['class']) ? '' : ' ' . $row['class'], '"', empty($row['style']) ? '' : ' style="' . $row['style'] . '"', ' id="list_', $list_id, '_', $id, '">';
if (!empty($row['data']))
foreach ($row['data'] as $row_id => $row_data)
echo '
<td class="', $row_id, empty($row_data['class']) ? '' : ' ' . $row_data['class'] . '', '"', empty($row_data['style']) ? '' : ' style="' . $row_data['style'] . '"', '>
', $row_data['value'], '
</td>';
echo '
</tr>';
}
}
echo '
</tbody>
</table>';
if ((!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) || isset($cur_list['additional_rows']['below_table_data']))
{
echo '
<div class="flow_auto">';
if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index']))
echo '
<div class="floatleft">
<div class="pagesection">', $cur_list['page_index'], '</div>
</div>';
if (isset($cur_list['additional_rows']['below_table_data']))
template_additional_rows('below_table_data', $cur_list);
echo '
</div>';
}
if (isset($cur_list['additional_rows']['bottom_of_list']))
template_additional_rows('bottom_of_list', $cur_list);
if (isset($cur_list['form']))
{
foreach ($cur_list['form']['hidden_fields'] as $name => $value)
echo '
<input type="hidden" name="', $name, '" value="', $value, '">';
if (isset($cur_list['form']['token']))
echo '
<input type="hidden" name="', $context[$cur_list['form']['token'] . '_token_var'], '" value="', $context[$cur_list['form']['token'] . '_token'], '">';
echo '
</form>';
}
if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom'))
template_create_list_menu($cur_list['list_menu'], 'bottom');
if (isset($cur_list['javascript']))
echo '
<script>
', $cur_list['javascript'], '
</script>';
}
function template_additional_rows($row_position, $cur_list)
{
foreach ($cur_list['additional_rows'][$row_position] as $row)
echo '
<div class="additional_row', empty($row['class']) ? '' : ' ' . $row['class'], '"', empty($row['style']) ? '' : ' style="' . $row['style'] . '"', '>
', $row['value'], '
</div>';
}
function template_create_list_menu($list_menu, $direction = 'top')
{
global $context;
$first = $context['right_to_left'] ? 'last' : 'first';
$last = $context['right_to_left'] ? 'first' : 'last';
if (!isset($list_menu['style']) || isset($list_menu['style']) && $list_menu['style'] == 'tabs')
{
echo '
<table style="margin-', $list_menu['position'], ': 10px; width: 100%;">
<tr>', $list_menu['position'] == 'right' ? '
<td></td>' : '', '
<td class="', $list_menu['position'], 'text">
<table>
<tr>
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_', $first, '"></td>';
foreach ($list_menu['links'] as $link)
{
if ($link['is_selected'])
echo '
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_active_', $first, '"></td>
<td class="', $direction == 'top' ? 'mirrortab' : 'maintab', '_active_back">
<a href="', $link['href'], '">', $link['label'], '</a>
</td>
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_active_', $last, '"></td>';
else
echo '
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_back">
<a href="', $link['href'], '">', $link['label'], '</a>
</td>';
}
echo '
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_', $last, '"></td>
</tr>
</table>
</td>', $list_menu['position'] == 'left' ? '
<td></td>' : '', '
</tr>
</table>';
}
elseif (isset($list_menu['style']) && $list_menu['style'] == 'buttons')
{
$links = array();
foreach ($list_menu['links'] as $link)
$links[] = '<a href="' . $link['href'] . '">' . $link['label'] . '</a>';
echo '
<table style="margin-', $list_menu['position'], ': 10px; width: 100%;">
<tr>', $list_menu['position'] == 'right' ? '
<td></td>' : '', '
<td class="', $list_menu['position'], 'text">
<table>
<tr>
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_', $first, '"></td>
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_back">', implode(' | ', $links), '</td>
<td class="', $direction == 'top' ? 'mirror' : 'main', 'tab_', $last, '"></td>
</tr>
</table>
</td>', $list_menu['position'] == 'left' ? '
<td></td>' : '', '
</tr>
</table>';
}
}
?>