| 1 |
<?php
|
| 2 |
|
| 3 |
// $Header: /cvsroot/tikiwiki/tiki/tiki-theme_control.php,v 1.10.2.4 2005/09/28 21:24:27 amette Exp $
|
| 4 |
|
| 5 |
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
|
| 6 |
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
| 7 |
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
| 8 |
|
| 9 |
// Initialization
|
| 10 |
require_once ('tiki-setup.php');
|
| 11 |
|
| 12 |
include_once ('lib/themecontrol/tcontrol.php');
|
| 13 |
include_once ('lib/categories/categlib.php');
|
| 14 |
|
| 15 |
if ($feature_theme_control != 'y') {
|
| 16 |
$smarty->assign('msg', tra("This feature is disabled").": feature_theme_control");
|
| 17 |
|
| 18 |
$smarty->display("error.tpl");
|
| 19 |
die;
|
| 20 |
}
|
| 21 |
|
| 22 |
if ($tiki_p_admin != 'y') {
|
| 23 |
$smarty->assign('msg', tra("You do not have permission to use this feature"));
|
| 24 |
|
| 25 |
$smarty->display("error.tpl");
|
| 26 |
die;
|
| 27 |
}
|
| 28 |
|
| 29 |
$categories = $categlib->get_all_categories();
|
| 30 |
$smarty->assign('categories', $categories);
|
| 31 |
|
| 32 |
$list_styles = $tikilib->list_styles();
|
| 33 |
$smarty->assign_by_ref('styles',$list_styles);
|
| 34 |
|
| 35 |
if (isset($_REQUEST['assigcat'])) {
|
| 36 |
if (isset($_REQUEST['categId'])) {
|
| 37 |
check_ticket('theme-control');
|
| 38 |
$tcontrollib->tc_assign_category($_REQUEST['categId'], $_REQUEST['theme']);
|
| 39 |
} else {
|
| 40 |
$smarty->assign('msg', tra("Please create a category first"));
|
| 41 |
|
| 42 |
$smarty->display("error.tpl");
|
| 43 |
die;
|
| 44 |
}
|
| 45 |
}
|
| 46 |
|
| 47 |
if (isset($_REQUEST["delete"])) {
|
| 48 |
if (isset($_REQUEST["categ"])) {
|
| 49 |
check_ticket('theme-control');
|
| 50 |
foreach (array_keys($_REQUEST["categ"])as $cat) {
|
| 51 |
$tcontrollib->tc_remove_cat($cat);
|
| 52 |
}
|
| 53 |
}
|
| 54 |
}
|
| 55 |
|
| 56 |
if (!isset($_REQUEST["sort_mode"])) {
|
| 57 |
$sort_mode = 'name_asc';
|
| 58 |
} else {
|
| 59 |
$sort_mode = $_REQUEST["sort_mode"];
|
| 60 |
}
|
| 61 |
|
| 62 |
if (!isset($_REQUEST["offset"])) {
|
| 63 |
$offset = 0;
|
| 64 |
} else {
|
| 65 |
$offset = $_REQUEST["offset"];
|
| 66 |
}
|
| 67 |
|
| 68 |
$smarty->assign_by_ref('offset', $offset);
|
| 69 |
|
| 70 |
if (isset($_REQUEST["find"])) {
|
| 71 |
$find = $_REQUEST["find"];
|
| 72 |
} else {
|
| 73 |
$find = '';
|
| 74 |
}
|
| 75 |
|
| 76 |
$smarty->assign('find', $find);
|
| 77 |
|
| 78 |
$smarty->assign_by_ref('sort_mode', $sort_mode);
|
| 79 |
$channels = $tcontrollib->tc_list_categories($offset, $maxRecords, $sort_mode, $find);
|
| 80 |
|
| 81 |
$cant_pages = ceil($channels["cant"] / $maxRecords);
|
| 82 |
$smarty->assign_by_ref('cant_pages', $cant_pages);
|
| 83 |
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
|
| 84 |
|
| 85 |
if ($channels["cant"] > ($offset + $maxRecords)) {
|
| 86 |
$smarty->assign('next_offset', $offset + $maxRecords);
|
| 87 |
} else {
|
| 88 |
$smarty->assign('next_offset', -1);
|
| 89 |
}
|
| 90 |
|
| 91 |
// If offset is > 0 then prev_offset
|
| 92 |
if ($offset > 0) {
|
| 93 |
$smarty->assign('prev_offset', $offset - $maxRecords);
|
| 94 |
} else {
|
| 95 |
$smarty->assign('prev_offset', -1);
|
| 96 |
}
|
| 97 |
|
| 98 |
$smarty->assign_by_ref('channels', $channels["data"]);
|
| 99 |
|
| 100 |
ask_ticket('theme-control');
|
| 101 |
|
| 102 |
// Display the template
|
| 103 |
$smarty->assign('mid', 'tiki-theme_control.tpl');
|
| 104 |
$smarty->display("tiki.tpl");
|
| 105 |
|
| 106 |
?>
|