Файл: sources/admin/cat.php
Строк: 81
<?php
if (!defined('VAPHP'))
{
die("Этот файл недоступен.");
}
class cat extends base
{
function cat()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['a_cat_header'];
$TMPL['admin_content'] .= <<<EndHTML
<script language="javascript">
function check(form_name, field_name, value)
{
var check_boxes = document.forms[form_name].elements[field_name];
var num_check_boxes = check_boxes.length;
if (!num_check_boxes)
{
check_boxes.checked = value;
}
else {
for(var i = 0; i < num_check_boxes; i++)
{
check_boxes[i].checked = value;
}
}
}
</script>
<p align=right><a href="{$TMPL['site_url']}/index.php?a=admin&b=new_cat" style="font-size:10pt; font-weight:bold">{$LNG['a_cat_new']}</a></p>
<form action="{$TMPL['site_url']}/index.php?a=admin&b=delete_cat" method="post" name="manage">
<table cellpadding="1" cellspacing="1" width="100%">
<tr align=center class="TableHeader">
<td></td>
<td>{$LNG['a_cat_id']}</td>
<td>{$LNG['a_cat_name']}</td>
<td>{$LNG['a_cat_sites']}</td>
<td colspan="2">{$LNG['a_cat_actions']}</td>
</tr>
EndHTML;
$alt = '';
$num = 0;
$result = $DB->query("SELECT id, name FROM {$CONF['sql_prefix']}_cat ORDER BY name ASC", __FILE__, __LINE__);
while (list($id, $name) = $DB->fetch_array($result))
{
list($num_sites) = $DB->fetch("SELECT COUNT(*) FROM {$CONF['sql_prefix']}_sites, {$CONF['sql_prefix']}_subcat WHERE {$CONF['sql_prefix']}_subcat.idcat='{$id}' and {$CONF['sql_prefix']}_subcat.id={$CONF['sql_prefix']}_sites.idsubcat", __FILE__, __LINE__);
$TMPL['admin_content'] .= <<<EndHTML
<tr class="lightbg{$alt}" align=center>
<td><input type="checkbox" name="id[]" value="{$id}" id="checkbox_{$num}" /></td>
<td>{$id}</td>
<td>{$name}</td>
<td>{$num_sites}</td>
<td><a href="{$TMPL['site_url']}/index.php?a=admin&b=edit_cat&id={$id}">{$LNG['a_cat_edit']}</a></td>
<td><a href="{$TMPL['site_url']}/index.php?a=admin&b=delete_cat&id={$id}">{$LNG['a_cat_delete']}</a></td>
</tr>
EndHTML;
if ($alt) { $alt = ''; }
else { $alt = 'alt'; }
$num++;
}
$TMPL['admin_content'] .= <<<EndHTML
</table><br>
<a href="javascript:void;" onclick="check('manage', 'id[]', true)">{$LNG['a_man_all']}</a> |
<a href="javascript:void;" onclick="check('manage', 'id[]', false)">{$LNG['a_man_none']}</a><br><br>
<input type="submit" class="ButtonNormal" value="{$LNG['a_man_del_sel']}" />
</form>
EndHTML;
}
}
?>