Exemple #1
0
function draw_sheet_public(&$char)
{
    global $INCLUDE_PATH, $READONLY, $SHOWSAVE, $DATA, $TITLE, $CHARID;
    $READONLY = true;
    $SHOWSAVE = false;
    $DATA = $char->GetData();
    $TITLE = "" . htmlspecialchars($char->cname) . " (Readonly)";
    $CHARID = (int) $char->id;
    header("Cache-Control: no-store, no-cache, must-revalidate");
    // Include the sheet globals.
    include_once "{$INCLUDE_PATH}/engine/sheet_globals.php";
    // Include the template.
    include_once "{$INCLUDE_PATH}/sheets/" . get_sheet_path((int) $char->template_id);
    exit;
}
<?php

// preview.php
// Shows a preview of an empty character sheet.
// Accepts two GET arguments:
//   tpl: numeric id of a sheet template.
//   readonly: if specified (does not need to be set) the sheet is set to
//             readonly mode.
include_once "config.php";
include_once "{$INCLUDE_PATH}/system.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
// Validate inputs and instantiate the global data.
$READONLY = isset($_GET['readonly']);
$tpl = (int) $_GET['tpl'];
$DATA = array();
$SHOWSAVE = false;
$TITLE = get_sheet_name($tpl);
// Include the sheet globals.
include_once "{$INCLUDE_PATH}/engine/sheet_globals.php";
// Include the template.
include_once "{$INCLUDE_PATH}/sheets/" . get_sheet_path($tpl);
<!-- Character List -->
<?php 
if (count($campaign->GetCharacters()) > 0) {
    $templateCharacters = array();
    foreach ($campaign->GetCharacters() as $character) {
        $char = new Character($character['id']);
        $temp = $templateCharacters[$char->template_id];
        if ($temp == null) {
            $temp = array();
        }
        array_push($temp, $char);
        $templateCharacters[$char->template_id] = $temp;
    }
    foreach ($templateCharacters as $key => $characters) {
        $sheet = "{$INCLUDE_PATH}/sheets/" . get_sheet_path($key);
        $sheet = preg_replace("/\\.php/", "-Summary.php", $sheet);
        $summaryAvailable = false;
        if (file_exists($sheet)) {
            include $sheet;
            $summaryAvailable = true;
        }
        ?>
        <h3><?php 
        echo get_sheet_name($key);
        if (!$summaryAvailable) {
            ?>
<span class="notice">No summary sheet available.</span><?php 
        }
        ?>
</h3>