<?php
$model = cmsCore::getModel('content');
$sql = «SELECT data2, title, gran, mine, content, part2, executor, tdby, kol, COUNT(*) count FROM cms_con_kipa GROUP BY title HAVING(title) >1 ORDER BY `cms_con_kipa`.`title` »;
$result = $model->db->query($sql);
///echo $res['data2']; echo $res['title']; echo $res['count']."<br>";
?>
<?php if ($items){ ?>
<div class=«content_list table <?php echo $ctype['name']; ?>_list»>
<table>
<thead>
<tr><table id=«toExcel» class=«uitable»>
<button onclick=«exceller()»>Сохранить файл EXCEL</button>
<script>
function exceller() {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html xmlns:o=«urn:schemas-microsoft-com:office:office» xmlns:x=«urn:schemas-microsoft-com:office:excel» xmlns=«www.w3.org/TR/TR/html40»><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></xml><![endif]--></head><body><table>{table}</table></body></html>',
base64 = function(str) {
return window.btoa(unescape(encodeURIComponent(str)))
},
format = function(s, c) {
return s.replace(/{(\w+)}/g, function(m, p) {
return c[p];
})
}
var toExcel = document.getElementById(«toExcel»).innerHTML;
var ctx = {
worksheet: name || '',
table: toExcel
};
var link = document.createElement(«a»);
link.download = «export.xls»;
link.href = uri + base64(format(template, ctx))
link.click();
}
</script>
<tr height=«20» style=«height:15.0pt»>
<td colspan=«1» style=«border-width: 1px; border-style: solid; border-color: rgb(143, 139, 139);»><span style=«font-size: 8pt;»><span style=«font-weight: bold; font-size: 8pt;»>Дата</td>
<td colspan=«1» style=«border-width: 1px; border-style: solid; border-color: rgb(143, 139, 139);»<span style=«font-size: 8pt;»><span style=«font-weight: bold; font-size: 8pt;»><center>Серийный номер</center></td>
<td colspan=«1» style=«border-width: 1px; border-style: solid; border-color: rgb(143, 139, 139);»<span style=«font-size: 8pt;»><span style=«font-weight: bold; font-size: 8pt;»><center>ДУБЛЬ</center></td>
</tr>
<?php
foreach ($result as $res){
echo '<tr>';
echo "<td>{$res['data2']}</td>";
echo "<td>{$res['title']}</td>";
echo "<td>{$res['count']}</td>";
echo '</tr>';
} echo '<tr>';
?>
<?php if (isset($fields['photo']) && $fields['photo']['is_in_list']){ ?>
<th> </th>
<?php } ?>
<?php if ($ctype['is_rating']){ ?>
<th><?php echo LANG_RATING; ?></th>
<?php } ?>
<?php foreach($fields as $name => $field){ ?>
<?php if ($field['is_system'] || !$field['is_in_list']) { unset($fields[$name]); continue; } ?>
<?php if ($field['groups_read'] && !$user->isInGroups($field['groups_read'])) { unset($fields[$name]); continue; } ?>
<?php
if (!isset($field['options']['label_in_list'])) {
$label_pos = 'none';
} else {
$label_pos = $field['options']['label_in_list'];
}
?>
<?php } ?>
</tr>
</thead>
<tbody>
<?php foreach($items as $item){ ?>
<tr<?php if (!empty($item['is_vip'])){ ?> class=«is_vip»<?php } ?>>
<?php if (isset($fields['photo']) && $fields['photo']['is_in_list']){ ?>
<?php } ?>
<?php if (!empty($item['rating_widget'])){ ?>
<td class=«rating»>
<?php echo $item['rating_widget']; ?>
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
<br>
</table>
</div>
<?php } else {
if(!empty($ctype['labels']['many'])){
echo sprintf(LANG_TARGET_LIST_EMPTY, $ctype['labels']['many']);
} else {
echo LANG_LIST_EMPTY;
}
}