Beispiel #1
0
    $totalPages = $pages->TotalPages;
    $lastPageFileName = "{$federationPath}/lastpage";
    $startPage = readStartPage($lastPageFileName);
    // iterate pages
    for ($pageNum = $startPage; $pageNum <= $totalPages; $pageNum++) {
        // create page dir
        $pagePath = "{$federationPath}/p{$pageNum}";
        createPath($pagePath);
        // iterate over documents of a federation
        echo "iterating page {$pageNum}\n";
        // get & save page
        $page = getSentDocuments($federationId, $accountId, $pageNum);
        file_put_contents("{$federationPath}/federation_p{$pageNum}_{$federationId}.json", json_encode($page));
        foreach ($page->Items as $item) {
            $documentId = $item->DocumentId;
            echo " > {$documentId} \n";
            $documentPath = "{$pagePath}/{$documentId}";
            createPath($documentPath);
            // iterate over details of a document
            $detail = getDocumentDetails($documentId);
            file_put_contents("{$documentPath}/documentDetail_{$documentId}.json", json_encode($detail));
            // copy detail XML
            $detailXML = getDetailXML($documentId);
            $detailXML = base64_decode($detailXML);
            file_put_contents("{$documentPath}/xml_{$documentId}.xml", $detailXML);
        }
        writeStartPage($lastPageFileName, $pageNum);
    }
}
//print_r($federations);
//print($file);

<table style='font-size:13px;'  class='table table-striped table-hover table-bordered' width=100%>
<thead>
<tr>
<th>Document Date</th>
<th>Subject</th>
<th>Reference Number</th>
<th>Document Information</th>
</tr>
</thead>
<tbody>
<?php 
    for ($i = 0; $i < $nm; $i++) {
        $row3 = $rs->fetch_assoc();
        $documentRow = getDocumentDetails($db, getDocumentId($db, $row3['reference_number']));
        ?>
	<tr>
	<td><?php 
        echo $documentRow['document_date'];
        ?>
</td>
	<td><a href='document_history.php?view=<?php 
        echo getDocumentId($db, $row3['reference_number']);
        ?>
'><?php 
        echo $documentRow['subject'];
        ?>
</a></td>
	<td><?php 
        echo $row3['reference_number'];
<th>Document Date</th>
<th>Subject</th>
<th>Reference Number</th>
<th>Action Taken</th>
<th>Action Date</th>
<th>Request Status</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<?php 
    $routing_Option = "<select  class='form-control'  name='reference_number' id='reference_number'>";
    $routing_Option .= "<option data-received='false'></option>";
    for ($i = 0; $i < $nm; $i++) {
        $row = $rs->fetch_assoc();
        $documentRow = getDocumentDetails($db, $row['reference_no']);
        $reference_number = calculateReferenceNumber($db, $documentRow, adjustControlNumber($row['reference_no']));
        if ($row['status'] == "PENDING" || $documentRow["status"] == "SENT" || $documentRow["status"] == "AWAITING REPLY" || $documentRow["status"] == "FOR: CLARIFICATION" && $row['status'] == "NEEDING CLARIFICATION") {
            ?>
<tr>
<td><?php 
            echo $documentRow['sending_office'];
            ?>
</td>
<td><?php 
            echo date("Y-m-d", strtotime($documentRow['document_date']));
            ?>
</td>
<td>

/** This is the second section which provides the routing targets for a particular routing action.
*  There are two options: one is to mark a routing action as being sent to all destinations, and another
* that specifies one or many destination, but not all
*/
function addRoutingStatus($setDb, $routing)
{
    $destination = $routing[0];
    $to_name = $routing[1];
    $action_id = $routing[2];
    $status = $routing[3];
    $routing_id = $routing[4];
    $remarks = $routing[5];
    $documentId = $routing[6];
    $alter_to = $routing[7];
    $alter_position = $routing[8];
    $code_key = $routing[9];
    $sql = "insert into routing_targets\n\t(destination_office,to_name,action_id, status, routing_id, remarks,alter_to,alter_position,keycode)\n\tvalues\n\t(\"" . $destination . "\",\"" . $to_name . "\",\"" . $action_id . "\",\"" . $status . "\",\"" . $routing_id . "\",\"" . $remarks . "\",\"" . $alter_to . "\",\"" . $alter_position . "\",'" . $code_key . "')";
    $rs = $setDb->query($sql);
    $routingTargetId = $setDb->insert_id;
    $docRow = getDocumentDetails($setDb, $documentId);
    if ($docRow['security'] == "unsecured" || $docRow['security'] == "divSecured") {
        if ($destination == "ALL OFFICERS") {
            if ($handle = opendir('data')) {
                while (false !== ($file = readdir($handle))) {
                    if ($file != "." && $file != "..") {
                        $msg = $action_id;
                        $filename = "data/" . $file;
                        // store new message in the file
                        file_put_contents($filename, $msg);
                        //				echo "$file\n";
                    }
                }
                closedir($handle);
            }
        } else {
            $msg = $action_id;
            $filename = "data/" . $destination . ".txt";
            // store new message in the file
            file_put_contents($filename, $msg);
        }
    } else {
        if ($docRow['security'] == "GMsecured") {
            if ($docRow['status'] == "SENT") {
                $sql = "select * from document_routing where reference_no='" . $documentId . "' order by request_date desc";
                $rs = $setDb->query($sql);
                $row = $rs->fetch_assoc();
                $sql2 = "select * from routing_targets where routing_id='" . $row['id'] . "' and status in ('PENDING') order by id desc";
                $rs2 = $setDb->query($sql2);
                $nm2 = $rs2->num_rows;
                for ($i = 0; $i < $nm2; $i++) {
                    //					echo $row2['destination_office']."<br>";
                    $row2 = $rs2->fetch_assoc();
                    $msg = $action_id;
                    $filename = "data/" . $row2['destination_office'] . ".txt";
                    // store new message in the file
                    file_put_contents($filename, $msg);
                }
            } else {
                if ($docRow['status'] == "FOR: GM APPROVAL") {
                    $msg = $action_id;
                    $filename = "data/OGM.txt";
                    // store new message in the file
                    file_put_contents($filename, $msg);
                } else {
                    if ($docRow['status'] == "FOR: CLARIFICATION") {
                        $msg = $action_id;
                        $filename = "data/" . $destination . ".txt";
                        // store new message in the file
                        file_put_contents($filename, $msg);
                    } else {
                        $msg = $action_id;
                        $filename = "data/" . $destination . ".txt";
                        // store new message in the file
                        file_put_contents($filename, $msg);
                    }
                }
            }
        }
    }
    return $routingTargetId;
}