emaillog.blade.php
4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
use App\Jobs\KHRMSLib;
$wakka = new KHRMSLib();
if(isset($_GET['getpostdata']))
{
$aline=$wakka->LoadSingle("select * from hrms_emailqueue where id='".Input::get("getpostdata")."'");
$parts=unserialize($aline['data']);
if(is_array($parts['to']))$parts['to']=implode(" ",$parts['to']);
$aline['errors']=implode(" ",unserialize($aline['errors']));
echo "
<label>ID</label>$aline[id]<br>
<label>From</label>$parts[from]<br>
<label>To</label>$parts[to]<br>
<label>Subject</label>$parts[subject]<br>
<label>Message</label><div style='margin-left:25%;clear:right'>$parts[message]</div><br>
<label>Attach1</label>$parts[attach1]<br>
<label>Attach2</label>$parts[attach2]<br>
<label>Errors</label><div style='margin-left:25%;clear:right'>$aline[errors]</div><br>
<label>TryCount</label>$aline[trycount] <br>
<label>Status</label>$aline[status] <br>
<label>Created</label>$aline[created] <br>
<label>Completed</label>$aline[completed]<br> ";
return;
}
if(isset($_GET['logdate']))$logdate=$_GET['logdate'];
else $logdate=date('Y-m-d');
?>
<style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style>
<script>
function showExtraPost(varstr)
{
doAjax("admin/emaillog","getpostdata="+varstr,"dialoglog","admin_log","singlefail","GET");
$('#dialoglog').dialog('open');
return false;
}
$(document).ready(function()
{
if(!$('#dialoglog').length)
{
$("#dialoglog_c").html("<div id=dialoglog></div>");
$('#dialoglog').dialog({
autoOpen: false,
width: '70%',
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
}
waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000");
$('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
});
</script>
<div class="layout-app"><!-- row-app -->
<div class="row row-app">
<div class="col-md-12">
<div class="col-separator col-separator-first col-unscrollable box">
<div class=innerAll>
<div style="float:left;width:50%">Search <input id=filter name="filter" type="text"> Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo $logdate; ?>' onchange='menuAction("admin/emaillog?logdate="+this.value);' /> <a href=# onclick="menuAction('admin/emaillo');return false;">Reload</a></div>
<div style="float:left;width:50%">
<form method=get>Query: <input type=text name=query> <input type=submit class=button value=Search></form></div>
<div style="clear:both"></div>
<table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'>
<thead>
<tr>
<th>#</th>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th>Error</th>
<th>TryCount</th>
<th>Status</th>
<th>Created</th>
<th>Completed</th>
</tr>
</thead>
<?php
if(isset($_GET["query"]))$query=" data like '%".Input::get("query")."%' order by id desc limit 2000";
else $query=" created>='$logdate 00:00:00' and created<='$logdate 23:59:59' order by id desc ";
$alist=$wakka->LoadAll("select * from hrms_emailqueue where $query ");
$i=sizeof($alist);
foreach($alist as $aline)
{
$parts=unserialize($aline['data']);
if(is_array($parts['to']))$parts['to']=implode("<br>",$parts['to']);
$errstr='';try{$errstr=end(unserialize($aline['errors']));}catch(Exception $e){}
echo "
<tr onclick='showExtraPost($aline[id]);'>
<td title=$aline[id]>$i</td>
<td>$parts[from]</td>
<td><div style='max-width:250px;overflow:hidden'>$parts[to]</div></td>
<td>$parts[subject]</td>
<td><div style='max-width:250px;overflow:hidden'>".$errstr."</div></td>
<td>$aline[trycount]</td>
<td>$aline[status]</td>
<td>".date("Y-m-d_H:i:s",strtotime($aline['created'])-(Auth::user()->timezone*60))."</td>
<td>".date("Y-m-d_H:i:s",strtotime($aline['completed'])-(Auth::user()->timezone*60))."</td>
</tr>";
$i--;
}
?>
</table>
</div>
</div>
</div>
</div>
</div><!-- // END row-app -->
<div id=dialoglog_c></div>