当前位置: 首页>>代码示例>>PHP>>正文


PHP Entry::canCreateDeck方法代码示例

本文整理汇总了PHP中Entry::canCreateDeck方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::canCreateDeck方法的具体用法?PHP Entry::canCreateDeck怎么用?PHP Entry::canCreateDeck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entry的用法示例。


在下文中一共展示了Entry::canCreateDeck方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkDeckAuth

function checkDeckAuth($event, $player, $deck = NULL)
{
    if (!Player::isLoggedIn()) {
        loginRequired();
        return false;
    }
    $loginname = Player::loginName();
    if (is_null($deck)) {
        // Creating a deck.
        $entry = new Entry($event, $player);
        $auth = $entry->canCreateDeck($loginname);
    } else {
        // Updating a deck.
        $auth = $deck->canEdit($loginname);
    }
    if ($auth) {
        return true;
    } else {
        authFailed();
    }
    return false;
}
开发者ID:jamuraa,项目名称:gatherling,代码行数:22,代码来源:deck.php

示例2: deckForm

function deckForm($deck = NULL)
{
    $mode = is_null($deck) ? "Create Deck" : "Update Deck";
    if (!is_null($deck)) {
        $player = $deck->playername;
        $event = $deck->eventname;
    } else {
        $player = isset($_POST['player']) ? $_POST['player'] : $_GET['player'];
        $event = isset($_POST['player']) ? $_POST['event'] : $_GET['event'];
    }
    $auth = false;
    if (is_null($deck)) {
        // Creating a deck.
        $entry = new Entry($event, $player);
        $auth = $entry->canCreateDeck($_SESSION['username']);
    } else {
        // Updating a deck.
        $auth = $deck->canEdit($_SESSION['username']);
    }
    if (!$auth) {
        authFailed();
        return;
    }
    $vals = array();
    if (!is_null($deck)) {
        foreach ($deck->maindeck_cards as $card => $amt) {
            $line = $amt . " " . $card . "\n";
            $vals['contents'] = $vals['contents'] . $line;
        }
        foreach ($deck->sideboard_cards as $card => $amt) {
            $line = $amt . " " . $card . "\n";
            $vals['sideboard'] = $vals['sideboard'] . $line;
        }
        $vals['desc'] = $deck->notes;
        $vals['archetype'] = $deck->archetype;
        $vals['name'] = $deck->name;
    }
    echo "<form action=\"deck.php\" method=\"post\">\n";
    echo "<table align=\"center\" style=\"border-width: 0px;\">\n";
    echo "<tr><td valign=\"top\"><b>Directions:</td>\n";
    echo "<td style=\"color: #000000\">To enter your deck, please give it ";
    echo "a name and select an archetype from the drop-down menu below. If ";
    echo "you do not specify and archetype, your deck will be labeled as ";
    echo "\"rogue.\" To enter cards, save your deck a a .txt file using the ";
    echo "official MTGO client, and then copy and paste the maindeck and ";
    echo "sideboard into the appropriate text boxes. ";
    echo "<font color=\"#FF0000\">Do not use a format such as \"1x Card\". ";
    echo "The parser will not accept this structure. The correct pattern is ";
    echo "\"1 Card\".</font></td></tr>\n";
    echo "<tr><td>&nbsp;</td></tr>\n";
    echo "<tr><td><b>Name</td>\n<td>";
    echo "<input type=\"text\" name=\"name\" value=\"{$vals['name']}\" ";
    echo "size=\"40\"></td></tr>\n";
    if (!is_null($deck)) {
        echo "<input type=\"hidden\" name=\"id\" value=\"{$deck->id}\">\n";
    }
    echo "<tr><td><b>Archetype</td>\n<td>";
    archetypeDropMenu($vals['archetype']);
    echo "</td></tr>\n";
    echo "<tr><td valign=\"top\"><b>Main Deck</td>\n<td>";
    echo "<textarea rows=\"20\" cols=\"60\" name=\"contents\">";
    echo "{$vals['contents']}</textarea></td></tr>\n";
    echo "<tr><td valign=\"top\"><b>Sideboard</td>\n<td>";
    echo "<textarea rows=\"10\" cols=\"60\" name=\"sideboard\">";
    echo "{$vals['sideboard']}</textarea></td></tr>\n";
    //echo "<tr><td valign=\"top\"><b>Comments</td>\n<td>";
    //echo "<textarea rows=\"10\" cols=\"60\" name=\"notes\">";
    //echo "{$vals['desc']}</textarea></td></tr>\n";
    echo "<tr><td>&nbsp;</td></tr>\n";
    echo "<tr><td colspan=\"2\" align=\"center\">\n";
    echo "<input type=\"submit\" name=\"mode\" value=\"{$mode}\">\n";
    echo "<input type=\"hidden\" name=\"player\" value=\"{$player}\">";
    echo "<input type=\"hidden\" name=\"event\" value=\"{$event}\">";
    echo "</td></tr></table></form>\n";
}
开发者ID:OldVig,项目名称:gatherling,代码行数:75,代码来源:deck.php


注:本文中的Entry::canCreateDeck方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。