本文整理汇总了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;
}
示例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> </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> </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";
}