コード例 #1
0
function &export_character(&$char)
{
    global $URI_BASE;
    // Modify the header for the appropriate content type, and to force
    // a download prompt with the appropriate filename (in most browsers).
    header("Content-type: text/xml", true);
    header("Content-Disposition: attachment; filename=" . $char->cname . ".xml", true);
    $out = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
    $out .= "<!DOCTYPE character PUBLIC \"-//rpgprofiler.net//DTD 3EProfiler 1.0//EN\"\n";
    $out .= "  \"http://www.rpgprofiler.net/2003/3EProfiler.dtd\">\n";
    $out .= "<character xmlns=\"http://www.rpgprofiler.net/2003/3EProfiler\">\n";
    $out .= "  <source>{$URI_BASE}</source>\n";
    $out .= "  <cname>" . $char->cname . "</cname>\n";
    $out .= "  <template>" . get_sheet_name($char->template_id) . "</template>\n";
    $out .= "  <public>" . $char->public . "</public>\n";
    $out .= "  <data>\n";
    $data = $char->GetData();
    while (list($key, $val) = @each($data)) {
        $out .= "    <node name=\"{$key}\">{$val}</node>\n";
    }
    $out .= "  </data>\n";
    $out .= "</character>\n";
    return $out;
}
コード例 #2
0
ファイル: char.php プロジェクト: ediosyncratic/rpg-profile
if ($character->campaign_id != null && $character->campaign_id > 0) {
    $campaign = new Campaign($character->campaign_id);
} else {
    if ($pending_campaign != null) {
        $campaign = new Campaign((int) $pending_campaign['campaign_id']);
    }
}
// Draw the page.
$title = 'Character Permissions';
$cname = $character->cname;
$is_public = $character->public == 'y';
$is_inactive = $character->inactive == 'y';
$is_owner = $character->owner == $sid->GetUserName();
$profiles = $character->GetProfiles();
$templates = generate_template_array();
$current_template = get_sheet_name($character->template_id);
$exp_formats = get_export_scripts();
$imp_formats = get_import_scripts();
draw_page('char.php');
////////////////////////////////////////////////////////////////////////
// Helper functions.
// Remove a character from the current campaign they are in.
function apply_leave_campaign(&$character)
{
    return $character->SetCampaign(null);
}
// Apply to Join the specified campaign
function apply_join_campaign(&$character, $campaign_id)
{
    $campaign = new Campaign($campaign_id);
    if (!$campaign->open) {
コード例 #3
0
ファイル: preview.php プロジェクト: ediosyncratic/rpg-profile
<?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);
コード例 #4
0
            $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>
        <ul class="character">
            <li>
                <ul class="characterattribute">
                    <li><strong>Player</strong></li>
                    <li><strong>Name</strong></li>
                    <?php 
        if ($summaryAvailable) {
            foreach ($summaryTitles as $title) {
                ?>