<div class="archived assessments">
						<span><b>Assessment Reports</b></span>
						<table id="assessment-reports-tbl" class="table table-bordered table-striped">
						<?php 
    ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 'On');
    echo findFileRowsForUser('pdf-assessment-reports', $user_login);
    ?>
						</table>
					</div>
					<div class="archived reports">
						<span><b>Action Plans</b></span>
						<table id="action-plans-tbl" class="table table-bordered table-striped">
						<?php 
    echo findFileRowsForUser('pdf-action-plans', $user_login);
    ?>
						</table>
					</div>

					<h3>Create an Archive Set</h3>
					<p>Using the button below you can create a PDF archive of the current Assessment Report 
						and Action Plan. These PDFs can be viewed or downloaded on future visits to this site.</p>
					<p>
						<span id="archive-ar" class="btn btn-default">Archive the Current Assessment Report</span>
						<span id="archive-ap" class="btn btn-default">Archive the Current Action Plan</span>
					</p>
					

					<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
					
					
					<div class="archived assessments">
						<span><b>Assessment Reports</b></span>
						<table id="assessment-reports-tbl" class="table table-bordered table-striped">
						<?php 
    ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 'On');
    echo findFileRowsForUser('pdf-assessment-reports', 'all-users');
    ?>
						</table>
					</div>
					<div class="archived reports">
						<span><b>Action Plans</b></span>
						<table id="action-plans-tbl" class="table table-bordered table-striped">
						<?php 
    echo findFileRowsForUser('pdf-action-plans', 'all-users');
    ?>
						</table>
					</div>

					<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

					
					<div id="delete-AR-dialog" title="Delete Archive File">
						<div class="confirm-text">Are you sure you want to delete this file?
							<br><br>Once deleted, this cannot be undone.
						</div>
						<div class="result"></div>
					</div>
					
					<div id="delete-AP-dialog" title="Delete Archive File">
Exemple #3
0
<?php 
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 'On');
//On or Off
// Get userlogin from query string
$endDir = $_GET['endDir'];
$userName = $_GET['userName'];
//==============
// find files in filesystem (used for pdf archives)
//==============
findFileRowsForUser($endDir, $userName);
// << this is where the magic happens
function findFileRowsForUser($endDir, $userName)
{
    // $endDir = pdf-assessment-reports | pdf-action-plans | etc
    // username = WP username, ie 'slaven'
    $basePath = '/var/www/osnap.org/public_html/';
    $webDir = 'wp-content/themes/osnap.1.0/';
    $path = $basePath . $webDir . $endDir;
    $regex = '/^' . $userName . '.*\\.(pdf)$/';
    $fileList = findfile($path, $regex);
    if ($endDir == 'pdf-assessment-reports') {
        $spanClass = 'delete-AR-pdf';
    } else {
        $spanClass = 'delete-AP-pdf';
    }
    echo '<tbody>';
    foreach ($fileList as &$file) {
        echo '<tr><td>';
        echo '<a href="/' . $webDir . $endDir . '/' . $file . '">' . $file . '</a>';