| 1 |
marcusb-guest |
79 |
<?php
|
| 2 |
|
|
|
| 3 |
|
|
// $Header: /cvsroot/tikiwiki/tiki/tiki-g-monitor_workitems.php,v 1.9.2.2 2006/01/27 01:48:05 georger_br 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 |
|
|
require_once ('tiki-setup.php');
|
| 9 |
|
|
|
| 10 |
|
|
include_once ('lib/Galaxia/ProcessMonitor.php');
|
| 11 |
|
|
|
| 12 |
|
|
if ($feature_workflow != 'y') {
|
| 13 |
|
|
$smarty->assign('msg', tra("This feature is disabled").": feature_workflow");
|
| 14 |
|
|
|
| 15 |
|
|
$smarty->display("error.tpl");
|
| 16 |
|
|
die;
|
| 17 |
|
|
}
|
| 18 |
|
|
|
| 19 |
|
|
if ($tiki_p_admin_workflow != 'y') {
|
| 20 |
|
|
$smarty->assign('msg', tra("Permission denied"));
|
| 21 |
|
|
|
| 22 |
|
|
$smarty->display("error.tpl");
|
| 23 |
|
|
die;
|
| 24 |
|
|
}
|
| 25 |
|
|
|
| 26 |
|
|
// Filtering data to be received by request and
|
| 27 |
|
|
// used to build the where part of a query
|
| 28 |
|
|
// filter_active, filter_valid, find, sort_mode,
|
| 29 |
|
|
// filter_process
|
| 30 |
|
|
$where = '';
|
| 31 |
|
|
$wheres = array();
|
| 32 |
|
|
|
| 33 |
|
|
if (isset($_REQUEST['filter_instance']) && $_REQUEST['filter_instance'])
|
| 34 |
|
|
$wheres[] = "gw.instanceId=" . $_REQUEST['filter_instance'] . "";
|
| 35 |
|
|
|
| 36 |
|
|
if (isset($_REQUEST['filter_process']) && $_REQUEST['filter_process'])
|
| 37 |
|
|
$wheres[] = "gp.pId=" . $_REQUEST['filter_process'] . "";
|
| 38 |
|
|
|
| 39 |
|
|
if (isset($_REQUEST['filter_activity']) && $_REQUEST['filter_activity'])
|
| 40 |
|
|
$wheres[] = "ga.activityId=" . $_REQUEST['filter_activity'] . "";
|
| 41 |
|
|
|
| 42 |
|
|
if (isset($_REQUEST['filter_user']) && $_REQUEST['filter_user'])
|
| 43 |
|
|
$wheres[] = "user='" . $_REQUEST['filter_user'] . "'";
|
| 44 |
|
|
|
| 45 |
|
|
$where = implode(' and ', $wheres);
|
| 46 |
|
|
|
| 47 |
|
|
if (!isset($_REQUEST["sort_mode"])) {
|
| 48 |
|
|
$sort_mode = 'orderId_asc';
|
| 49 |
|
|
} else {
|
| 50 |
|
|
$sort_mode = $_REQUEST["sort_mode"];
|
| 51 |
|
|
}
|
| 52 |
|
|
|
| 53 |
|
|
if (!isset($_REQUEST["offset"])) {
|
| 54 |
|
|
$offset = 0;
|
| 55 |
|
|
} else {
|
| 56 |
|
|
$offset = $_REQUEST["offset"];
|
| 57 |
|
|
}
|
| 58 |
|
|
|
| 59 |
|
|
$smarty->assign_by_ref('offset', $offset);
|
| 60 |
|
|
|
| 61 |
|
|
if (isset($_REQUEST["find"])) {
|
| 62 |
|
|
$find = $_REQUEST["find"];
|
| 63 |
|
|
} else {
|
| 64 |
|
|
$find = '';
|
| 65 |
|
|
}
|
| 66 |
|
|
|
| 67 |
|
|
$smarty->assign('find', $find);
|
| 68 |
|
|
$smarty->assign('where', $where);
|
| 69 |
|
|
$smarty->assign_by_ref('sort_mode', $sort_mode);
|
| 70 |
|
|
|
| 71 |
|
|
$items = $processMonitor->monitor_list_workitems($offset, $maxRecords, $sort_mode, $find, $where);
|
| 72 |
|
|
$smarty->assign('cant', $items['cant']);
|
| 73 |
|
|
|
| 74 |
|
|
$cant_pages = ceil($items["cant"] / $maxRecords);
|
| 75 |
|
|
$smarty->assign_by_ref('cant_pages', $cant_pages);
|
| 76 |
|
|
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
|
| 77 |
|
|
|
| 78 |
|
|
if ($items["cant"] > ($offset + $maxRecords)) {
|
| 79 |
|
|
$smarty->assign('next_offset', $offset + $maxRecords);
|
| 80 |
|
|
} else {
|
| 81 |
|
|
$smarty->assign('next_offset', -1);
|
| 82 |
|
|
}
|
| 83 |
|
|
|
| 84 |
|
|
if ($offset > 0) {
|
| 85 |
|
|
$smarty->assign('prev_offset', $offset - $maxRecords);
|
| 86 |
|
|
} else {
|
| 87 |
|
|
$smarty->assign('prev_offset', -1);
|
| 88 |
|
|
}
|
| 89 |
|
|
|
| 90 |
|
|
$smarty->assign_by_ref('items', $items["data"]);
|
| 91 |
|
|
|
| 92 |
|
|
$all_procs = $items = $processMonitor->monitor_list_processes(0, -1, 'name_desc', '', '');
|
| 93 |
|
|
$smarty->assign_by_ref('all_procs', $all_procs["data"]);
|
| 94 |
|
|
|
| 95 |
|
|
if (isset($_REQUEST['filter_process']) && $_REQUEST['filter_process']) {
|
| 96 |
|
|
$where = ' pId=' . $_REQUEST['filter_process'];
|
| 97 |
|
|
} else {
|
| 98 |
|
|
$where = '';
|
| 99 |
|
|
}
|
| 100 |
|
|
|
| 101 |
|
|
$all_acts = $processMonitor->monitor_list_activities(0, -1, 'name_desc', '', $where);
|
| 102 |
|
|
$smarty->assign_by_ref('all_acts', $all_acts["data"]);
|
| 103 |
|
|
|
| 104 |
|
|
$sameurl_elements = array(
|
| 105 |
|
|
'offset',
|
| 106 |
|
|
'sort_mode',
|
| 107 |
|
|
'where',
|
| 108 |
|
|
'find',
|
| 109 |
|
|
'filter_user',
|
| 110 |
|
|
'filter_activity',
|
| 111 |
|
|
'filter_process',
|
| 112 |
|
|
'filter_instance',
|
| 113 |
|
|
'pid',
|
| 114 |
|
|
'filter_process'
|
| 115 |
|
|
);
|
| 116 |
|
|
|
| 117 |
|
|
$types = $processMonitor->monitor_list_activity_types();
|
| 118 |
|
|
$smarty->assign_by_ref('types', $types);
|
| 119 |
|
|
|
| 120 |
|
|
$smarty->assign('stats', $processMonitor->monitor_stats());
|
| 121 |
|
|
|
| 122 |
|
|
$smarty->assign('users', $processMonitor->monitor_list_wi_users());
|
| 123 |
|
|
ask_ticket('g-monitor-workitems');
|
| 124 |
|
|
|
| 125 |
|
|
$smarty->assign('mid', 'tiki-g-monitor_workitems.tpl');
|
| 126 |
|
|
$smarty->display("tiki.tpl");
|
| 127 |
|
|
|
| 128 |
|
|
?>
|