'.__('You don\'t have enough privileges to access this area!').'');
}
require SIMBIO.'simbio_GUI/table/simbio_table.inc.php';
require SIMBIO.'simbio_GUI/paging/simbio_paging.inc.php';
require SIMBIO.'simbio_GUI/form_maker/simbio_form_element.inc.php';
require SIMBIO.'simbio_DB/datagrid/simbio_dbgrid.inc.php';
require MDLBS.'reporting/report_dbgrid.inc.php';
$page_title = 'Staff Activity Report';
$reportView = false;
if (isset($_GET['reportView'])) {
$reportView = true;
}
if (!$reportView) {
?>
setSQLColumn('u.realname AS \''.__('Real Name').'\'',
'u.username AS \''.__('Login Username').'\'',
'u.user_id AS \''.__('Bibliography Data Entry').'\'',
'u.user_id AS \''.__('Item Data Entry').'\'',
'u.user_id AS \''.__('Member Data Entry').'\'',
'u.user_id AS \''.__('Peminjaman').'\'',
'u.user_id AS \''.__('Pengembalian').'\'',
'u.user_id AS \''.__('Perpanjang').'\'');
$reportgrid->setSQLorder('realname ASC');
// is there any search
$criteria = 'user_id IS NOT NULL ';
$reportgrid->setSQLCriteria($criteria);
$start_date = '2000-01-01';
if (isset($_GET['startDate'])) {
$start_date = $_GET['startDate'];
}
$until_date = date('Y-m-d');
if (isset($_GET['untilDate'])) {
$until_date = $_GET['untilDate'];
}
// callbacks
function showBiblioEntries($obj_db, $array_data)
{
global $start_date, $until_date;
$_count_q = $obj_db->query('SELECT COUNT(log_id) FROM system_log WHERE log_location=\'bibliography\' AND log_type=\'staff\'
AND log_msg LIKE \'%insert bibliographic data%\' AND id=\''.$array_data['2'].'\' AND TO_DAYS(log_date) BETWEEN TO_DAYS(\''.$start_date.'\') AND TO_DAYS(\''.$until_date.'\')');
$_count_d = $_count_q->fetch_row();
return $_count_d[0];
}
function showItemEntries($obj_db, $array_data)
{
global $start_date, $until_date;
$_count_q = $obj_db->query('SELECT COUNT(log_id) FROM system_log WHERE log_location=\'bibliography\' AND log_type=\'staff\'
AND log_msg LIKE \'%insert item data%\' AND id=\''.$array_data['3'].'\' AND TO_DAYS(log_date) BETWEEN TO_DAYS(\''.$start_date.'\') AND TO_DAYS(\''.$until_date.'\')');
$_count_d = $_count_q->fetch_row();
return $_count_d[0];
}
function showMemberEntries($obj_db, $array_data)
{
global $start_date, $until_date;
$_count_q = $obj_db->query('SELECT COUNT(log_id) FROM system_log WHERE log_location=\'membership\' AND log_type=\'staff\'
AND log_msg LIKE \'%add new member%\' AND id=\''.$array_data['4'].'\' AND TO_DAYS(log_date) BETWEEN TO_DAYS(\''.$start_date.'\') AND TO_DAYS(\''.$until_date.'\')');
$_count_d = $_count_q->fetch_row();
return $_count_d[0];
}
function showCirculation_Loan($obj_db, $array_data)
{
global $start_date, $until_date;
$_user = $obj_db->escape_string($array_data[0]);
$_count_q = $obj_db->query('SELECT COUNT(log_id) FROM system_log WHERE log_location=\'circulation\' AND log_type=\'member\'
AND (log_msg LIKE \''.$_user.'%new loan%\') AND TO_DAYS(log_date) BETWEEN TO_DAYS(\''.$start_date.'\') AND TO_DAYS(\''.$until_date.'\')');
$_count_d = $_count_q->fetch_row();
return $_count_d[0];
}
function showCirculation_Return($obj_db, $array_data)
{
global $start_date, $until_date;
$_user = $obj_db->escape_string($array_data[0]);
$_count_q = $obj_db->query('SELECT COUNT(log_id) FROM system_log WHERE log_location=\'circulation\' AND log_type=\'member\'
AND (log_msg LIKE \''.$_user.'%return item%\' OR \''.$_user.'%Quick Return%\') AND TO_DAYS(log_date) BETWEEN TO_DAYS(\''.$start_date.'\') AND TO_DAYS(\''.$until_date.'\')');
$_count_d = $_count_q->fetch_row();
return $_count_d[0];
}
function showCirculation_Extends($obj_db, $array_data)
{
global $start_date, $until_date;
$_user = $obj_db->escape_string($array_data[0]);
$_count_q = $obj_db->query('SELECT COUNT(log_id) FROM system_log WHERE log_location=\'circulation\' AND log_type=\'member\'
AND (log_msg LIKE \''.$_user.'%extend loan%\') AND TO_DAYS(log_date) BETWEEN TO_DAYS(\''.$start_date.'\') AND TO_DAYS(\''.$until_date.'\')');
$_count_d = $_count_q->fetch_row();
return $_count_d[0];
}
// columns modification settings
$reportgrid->column_width = array(0 => '10%', 1 => '10%');
$reportgrid->modifyColumnContent(2, 'callback{showBiblioEntries}');
$reportgrid->modifyColumnContent(3, 'callback{showItemEntries}');
$reportgrid->modifyColumnContent(4, 'callback{showMemberEntries}');
$reportgrid->modifyColumnContent(5, 'callback{showCirculation_Loan}');
$reportgrid->modifyColumnContent(6, 'callback{showCirculation_Return}');
$reportgrid->modifyColumnContent(7, 'callback{showCirculation_Extends}');
// put the result into variables
echo $reportgrid->createDataGrid($dbs, $table_spec, 20);
echo '';
$content = ob_get_clean();
// include the page template
require SB.'/admin/'.$sysconf['admin_template']['dir'].'/printed_page_tpl.php';
}