| 1 |
<?php
|
| 2 |
|
| 3 |
// $Header: /cvsroot/tikiwiki/tiki/tiki-list_trackers.php,v 1.12.2.4 2005/05/17 21:04:28 marclaporte 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/trackers/trackerlib.php');
|
| 13 |
|
| 14 |
if ($feature_trackers != 'y') {
|
| 15 |
$smarty->assign('msg', tra("This feature is disabled").": feature_trackers");
|
| 16 |
$smarty->display("error.tpl");
|
| 17 |
die;
|
| 18 |
}
|
| 19 |
|
| 20 |
if ($tiki_p_view_trackers != 'y') {
|
| 21 |
$smarty->assign('msg', tra("You do not have permission to use this feature"));
|
| 22 |
$smarty->display("error.tpl");
|
| 23 |
die;
|
| 24 |
}
|
| 25 |
|
| 26 |
if (!isset($_REQUEST["trackerId"])) {
|
| 27 |
$_REQUEST["trackerId"] = 0;
|
| 28 |
}
|
| 29 |
|
| 30 |
$smarty->assign('trackerId', $_REQUEST["trackerId"]);
|
| 31 |
|
| 32 |
if ($_REQUEST["trackerId"]) {
|
| 33 |
$info = $trklib->get_tracker($_REQUEST["trackerId"]);
|
| 34 |
} else {
|
| 35 |
$info = array();
|
| 36 |
|
| 37 |
$info["name"] = '';
|
| 38 |
$info["description"] = '';
|
| 39 |
}
|
| 40 |
|
| 41 |
$smarty->assign('name', $info["name"]);
|
| 42 |
$smarty->assign('description', $info["description"]);
|
| 43 |
|
| 44 |
if (!isset($_REQUEST["sort_mode"])) {
|
| 45 |
$sort_mode = 'created_desc';
|
| 46 |
} else {
|
| 47 |
$sort_mode = $_REQUEST["sort_mode"];
|
| 48 |
}
|
| 49 |
|
| 50 |
if (!isset($_REQUEST["offset"])) {
|
| 51 |
$offset = 0;
|
| 52 |
} else {
|
| 53 |
$offset = $_REQUEST["offset"];
|
| 54 |
}
|
| 55 |
|
| 56 |
$smarty->assign_by_ref('offset', $offset);
|
| 57 |
|
| 58 |
if (isset($_REQUEST["find"])) {
|
| 59 |
$find = $_REQUEST["find"];
|
| 60 |
} else {
|
| 61 |
$find = '';
|
| 62 |
}
|
| 63 |
|
| 64 |
$smarty->assign('find', $find);
|
| 65 |
|
| 66 |
$smarty->assign_by_ref('sort_mode', $sort_mode);
|
| 67 |
$channels = $trklib->list_trackers($offset, $maxRecords, $sort_mode, $find);
|
| 68 |
|
| 69 |
$temp_max = count($channels["data"]);
|
| 70 |
for ($i = 0; $i < $temp_max; $i++) {
|
| 71 |
if ($userlib->object_has_one_permission($channels["data"][$i]["trackerId"], 'tracker')) {
|
| 72 |
$channels["data"][$i]["individual"] = 'y';
|
| 73 |
|
| 74 |
$channels["data"][$i]["individual_tiki_p_view_trackers"] = 'y';
|
| 75 |
|
| 76 |
if ($tiki_p_admin == 'y'
|
| 77 |
|| $userlib->object_has_permission($user, $channels["data"][$i]["trackerId"], 'tracker', 'tiki_p_admin_trackers')) {
|
| 78 |
$channels["data"][$i]["individual_tiki_p_view_trackers"] = 'y';
|
| 79 |
}
|
| 80 |
} else {
|
| 81 |
$channels["data"][$i]["individual"] = 'n';
|
| 82 |
}
|
| 83 |
}
|
| 84 |
|
| 85 |
$cant_pages = ceil($channels["cant"] / $maxRecords);
|
| 86 |
$smarty->assign_by_ref('cant_pages', $cant_pages);
|
| 87 |
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
|
| 88 |
|
| 89 |
if ($channels["cant"] > ($offset + $maxRecords)) {
|
| 90 |
$smarty->assign('next_offset', $offset + $maxRecords);
|
| 91 |
} else {
|
| 92 |
$smarty->assign('next_offset', -1);
|
| 93 |
}
|
| 94 |
|
| 95 |
// If offset is > 0 then prev_offset
|
| 96 |
if ($offset > 0) {
|
| 97 |
$smarty->assign('prev_offset', $offset - $maxRecords);
|
| 98 |
} else {
|
| 99 |
$smarty->assign('prev_offset', -1);
|
| 100 |
}
|
| 101 |
|
| 102 |
$section = 'trackers';
|
| 103 |
include_once('tiki-section_options.php');
|
| 104 |
|
| 105 |
$smarty->assign_by_ref('channels', $channels["data"]);
|
| 106 |
ask_ticket('list-trackers');
|
| 107 |
|
| 108 |
// Display the template
|
| 109 |
$smarty->assign('mid', 'tiki-list_trackers.tpl');
|
| 110 |
$smarty->display("tiki.tpl");
|
| 111 |
|
| 112 |
?>
|