![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: vw_usr_log.php 137 2008-04-04 16:12:02Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/admin/vw_usr_log.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 $date_reg = date('Y-m-d'); 7 $start_date = intval($date_reg) ? new CDate(w2PgetParam($_REQUEST, 'log_start_date', date('Y-m-d'))) : null; 8 $end_date = intval($date_reg) ? new CDate(w2PgetParam($_REQUEST, 'log_end_date', date('Y-m-d'))) : null; 9 10 $df = $AppUI->getPref('SHDATEFORMAT'); 11 global $currentTabId, $cal_sdf; 12 if ($a = w2PgetParam($_REQUEST, 'a', '') == '') { 13 $a = '&tab=' . $currentTabId . '&showdetails=1'; 14 } else { 15 $user_id = w2PgetParam($_REQUEST, 'user_id', 0); 16 $a = '&a=viewuser&user_id=' . $user_id . '&tab=' . $currentTabId . '&showdetails=1'; 17 } 18 19 $AppUI->loadCalendarJS(); 20 ?> 21 <script language="JavaScript"> 22 function checkDate(){ 23 if (document.frmDate.log_start_date.value == '' || document.frmDate.log_end_date.value== ''){ 24 alert('<?php echo $AppUI->_('You must fill fields', UI_OUTPUT_JS) ?>'); 25 return false; 26 } 27 return true; 28 } 29 function setDate( frm_name, f_date ) { 30 fld_date = eval( 'document.' + frm_name + '.' + f_date ); 31 fld_real_date = eval( 'document.' + frm_name + '.' + 'log_' + f_date ); 32 if (fld_date.value.length>0) { 33 if ((parseDate(fld_date.value))==null) { 34 alert('The Date/Time you typed does not match your prefered format, please retype.'); 35 fld_real_date.value = ''; 36 fld_date.style.backgroundColor = 'red'; 37 } else { 38 fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd'); 39 fld_date.value = formatDate(parseDate(fld_date.value), '<?php echo $cal_sdf ?>'); 40 fld_date.style.backgroundColor = ''; 41 } 42 } else { 43 fld_real_date.value = ''; 44 } 45 } 46 </script> 47 48 <table align="center"> 49 <tr> 50 <td> 51 <h1><?php echo $AppUI->_('User Log'); ?></h1> 52 </td> 53 </tr> 54 </table> 55 56 <form action="index.php?m=admin<?php echo $a; ?>" method="post" name="frmDate"> 57 <table align="center" width="100%"> 58 <tr align="center"> 59 <td align="right" width="45%" ><?php echo $AppUI->_('Start Date'); ?></td> 60 <td width="55%" align="left"> 61 <input type="hidden" name="log_start_date" id="log_start_date" value="<?php echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : ''; ?>" /> 62 <input type="text" name="start_date" id="start_date" onchange="setDate('frmDate', 'start_date');" value="<?php echo $start_date ? $start_date->format($df) : ''; ?>" class="text" /> 63 <a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php echo $df ?>', 'frmDate', null, true)"> 64 <img src="<?php echo w2PfindImage('calendar.gif'); ?>" width="24" height="12" alt="<?php echo $AppUI->_('Calendar'); ?>" border="0" /></a> 65 </td> 66 </tr> 67 <tr align="center"> 68 <td align="right" width="45%"><?php echo $AppUI->_('End Date'); ?></td> 69 <td width="55%" align="left"> 70 <input type="hidden" name="log_end_date" id="log_end_date" value="<?php echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : ''; ?>" /> 71 <input type="text" name="end_date" id="end_date" onchange="setDate('frmDate', 'end_date');" value="<?php echo $end_date ? $end_date->format($df) : ''; ?>" class="text" /> 72 <a href="javascript: void(0);" onclick="return showCalendar('end_date', '<?php echo $df ?>', 'frmDate', null, true)"> 73 <img src="<?php echo w2PfindImage('calendar.gif'); ?>" width="24" height="12" alt="<?php echo $AppUI->_('Calendar'); ?>" border="0" /></a> 74 </td> 75 </tr> 76 </table> 77 <table align="center"> 78 <tr align="center"> 79 <td><input type="submit" class="button" value="<?php echo $AppUI->_('Submit'); ?>" onclick="return checkDate('start','end')" /></td> 80 </tr> 81 </table> 82 </form> 83 84 <?php 85 if (w2PgetParam($_REQUEST, 'showdetails', 0) == 1) { 86 $start_date = date('Y-m-d', strtotime(w2PgetParam($_REQUEST, 'log_start_date', date('Y-m-d')))); 87 $end_date = date('Y-m-d 23:59:59', strtotime(w2PgetParam($_REQUEST, 'log_end_date', date('Y-m-d')))); 88 89 $q = new DBQuery; 90 $q->addTable('user_access_log', 'ual'); 91 $q->addTable('users', 'u'); 92 $q->addTable('contacts', 'c'); 93 $q->addQuery('ual.*, u.*, c.*'); 94 $q->addWhere('ual.user_id = u.user_id'); 95 $q->addWhere('user_contact = contact_id '); 96 if ($user_id != 0) { 97 $q->addWhere('ual.user_id = ' . (int)$user_id); 98 } 99 $q->addWhere('ual.date_time_in >=\'' . $start_date . '\''); 100 $q->addWhere('ual.date_time_out <= \'' . $end_date . '\''); 101 $q->addGroup('ual.date_time_last_action DESC'); 102 $logs = $q->loadList(); 103 ?> 104 <table align="center" class="tbl" width="50%"> 105 <tr> 106 <th nowrap="nowrap" ><?php echo $AppUI->_('Name(s)'); ?></th> 107 <th nowrap="nowrap" ><?php echo $AppUI->_('Last Name'); ?></th> 108 <th nowrap="nowrap" ><?php echo $AppUI->_('Internet Address'); ?></th> 109 <th nowrap="nowrap" ><?php echo $AppUI->_('Date Time IN'); ?></th> 110 <th nowrap="nowrap" ><?php echo $AppUI->_('Date Time OUT'); ?></th> 111 </tr> 112 <?php foreach ($logs as $detail) { ?> 113 <tr> 114 <td align="center"><?php echo $detail['contact_first_name']; ?></td> 115 <td align="center"><?php echo $detail['contact_last_name']; ?></td> 116 <td align="center"><?php echo $detail['user_ip']; ?></td> 117 <td align="center"><?php echo $detail['date_time_in']; ?></td> 118 <td align="center"><?php echo $detail['date_time_out']; ?></td> 119 </tr> 120 <?php } ?> 121 </table> 122 <?php } ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 7 03:00:01 2009 | Cross-referenced by PHPXref 0.7 |