emaillog.blade.php 4.23 KB
<?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>