function pano_quest_settings_page()
{
    $quests = get_quests();
    $semantic = WP_PLUGIN_URL . '/panomanager/css/semantic.css';
    $new_quest_url = admin_url() . "admin.php?page=new_quest_settings";
    $edit_quest_url = admin_url() . "admin.php?page=edit_quest_settings";
    ?>

<!-- style sheet so our admin page looks nice -->
<link rel="stylesheet" type="text/css" href="<?php 
    echo $semantic;
    ?>
"/>
<p>Manage your quests!</p>
<hr>

<?php 
    if (isset($_GET['settings-saved'])) {
        ?>
<div class="updated"><p>Settings updated successfully.</p></div>
<?php 
    }
    ?>

<h2>Quests</h2>
<table class="ui table segment">
  <tr>
    <th>Quest</th>
    <th>Description</th>
    <th>Language Code</th>
    <th>Pano</th>
    <th>Edit</th>
    <th>Delete</th>
  </tr>
  <?php 
    foreach ($quests as $quest) {
        ?>

    <tr>
        <td><?php 
        echo $quest->name;
        ?>
</td>
        <td><?php 
        echo $quest->description;
        ?>
</td>
        <td><?php 
        echo $quest->language_code;
        ?>
</td>
        <td><?php 
        echo $quest->pano_name;
        ?>
</td>
        <td><a class="ui blue icon button" href="<?php 
        echo $edit_quest_url;
        ?>
&id=<?php 
        echo $quest->quest_id;
        ?>
" style="padding: 7px">Edit</a></td>
        <td>
            <form method="post" action="admin-post.php" id="delete_quest_form<?php 
        echo $quest->quest_id;
        ?>
">
                <!-- pano processing hook -->
                <input type="hidden" name="action" value="delete_quest" />
                <input type="hidden" name="quest_id" value="<?php 
        echo $quest->quest_id;
        ?>
" />

                <input type="submit" class="ui blue icon button" value="Delete" style="padding: 7px" >
            </form>
        </td>
    </tr>

  <?php 
    }
    ?>
</table>
<a class="ui blue icon button" href="<?php 
    echo $new_quest_url;
    ?>
" style="padding: 7px">New Quest</a>

</div>

<?php 
}
Esempio n. 2
0
function create_quest($quest)
{
}
// Get the questors
function get_questors($quest_id)
{
    $sel = "SELECT p.player_id, p.uname \n        from players p join questers q on p.player_id = q._player_id \n        where quest_id = :quest_id";
    //$questers = query($sel, array(":quest_id"=>array($quest_id, PDO::PARAM_INT)));
    if (DEBUG) {
        $questers = array(array('player_id' => 10, 'uname' => 'glassbox'));
    }
    return $questers;
}
$quest_id = in('quest_id');
$quest_accepted = in('quest_accepted');
$quests = null;
// When accepting a quest, simply display that quest.
if ($quest_accepted) {
    $quest_id = $quest_accepted;
}
// Process the single quest view is quest_id isn't null, otherwise get all quests.
$quests = format_quests(get_quests($quest_id));
if (count($quests) == 1) {
    $quest = reset($quests);
    $tpl = 'quests.single_quest.tpl';
} else {
    $tpl = 'quests.tpl';
}
$parts = array('quest' => $quest, 'quests' => $quests, 'quest_accepted' => $quest_accepted);
$options = array('quickstat' => 'player');
display_page($tpl, 'Quests', $parts, $options);