function buyDeckvStyle($deckSN, $vStyle, $userId, $sMethod) { //possibly change $deckSN to receive $deckId, more proper? if (getOwnershipDeckVstyle($deckSN, $vStyle, $userId) == FALSE) { if (getMoneyBalances($vStyle, $sMethod, $userId) == 'sufficient') { setOwnershipvStyle($deckSN, $vStyle, $userId); setMoneyBalances($vStyle, $sMethod, $userId); incrStat('ttlpvstyl', $userId); return "success"; } else { if (setMoneyBalances($vStyle, $sMethod, $userId) != 'sufficient') { return "Insufficient funds"; } } } else { if (getOwnershipDeckVstyle($deckSN, $vStyle, $userId) == TRUE) { return "already owned"; } } }
onClick="buyVstyle('<?php echo $cvset; ?>','<?php echo getDeckInfo($cvset, 'id'); ?>','<?php echo $userID; ?>','gc', 'audioE')" > <a href="#2"> Audio Flashcards: Learn English. <span class="text-info">Click to buy for <?php echo getPrice('audioE', 'gc');?> Gold</span> </a> </li><?php }?> </li><!-- END MEDIUM AUDIO FLASHCARDS--> <!--***************HARD AUDIO MODE OWNED OR NOT OWNED*************--> <li><? if(getOwnershipDeckVstyle($cvset,'audioK',$userID)==TRUE && getDeckInfo($cvset, 'audioK')==1){?> <li role="presentation" class="<?php if($vstyle == 'audioK'){echo "";}?>" onClick="vsChange('vStyle','audioK')" > <a href="#3"> Audio Flashcards: Learn Kanji <span class="badge"><small><i>Lv.<?= $vsLvAHard; if($vsLvAHard==$mxDkLv){echo " (Max)";}?></i></small></span> </a> </li><? }else if(getOwnershipDeckVstyle($cvset,'audioK',$userID)==FALSE && getDeckInfo($cvset, 'audioK')==1){?> <li role="presentation" class="vsBuy" onClick="buyVstyle('<?php echo $cvset; ?>','<?php echo getDeckInfo($cvset, 'id'); ?>','<?php echo $userID; ?>','gc', 'audioK')" > <a href="#3"> Audio Flashcards: Learn Kanji. Click to buy <span class="text-default"><?php echo getPrice('audioK', 'gc');?> Gold </a> </li><?php }?> </li><!--END HARD MODE AUDIO--> </ul> </div>
$pkanjiRE = getPrice('kanjiRE', 'gc'); $pkanjiH = getPrice('kanjiH', 'gc'); $pkanjiE = getPrice('kanjiE', 'gc'); $pengKR = getPrice('engKR', 'gc'); $pengH = getPrice('engH', 'gc'); $pengK = getPrice('engK', 'gc'); $paudioR = getPrice('audioR', 'gc'); $paudioE = getPrice('audioE', 'gc'); $paudioK = getPrice('audioK', 'gc'); //Set Cell Contents $ownsRE = getDeckInfoFromId($value, 'kanjiRE') ? getOwnershipDeckVstyle($key, 'kanjiRE', $pid) : ''; $ownsE = getDeckInfoFromId($value, 'kanjiE') ? getOwnershipDeckVstyle($key, 'kanjiE', $pid) : ''; $ownsH = getDeckInfoFromId($value, 'kanjiH') ? getOwnershipDeckVstyle($key, 'kanjiH', $pid) : ''; $ownsAudR = getDeckInfoFromId($value, 'audioR') ? getOwnershipDeckVstyle($key, 'audioR', $pid) : ''; $ownsAudE = getDeckInfoFromId($value, 'audioE') ? getOwnershipDeckVstyle($key, 'audioE', $pid) : ''; $ownsAudK = getDeckInfoFromId($value, 'audioK') ? getOwnershipDeckVstyle($key, 'audioK', $pid) : ''; //$ownsE = (isHKid($value) == FALSE ? getOwnershipDeckVstyle($key,'kanjiE',$pid) : ''); //$ownsH = (isHKid($value) == FALSE ? getOwnershipDeckVstyle($key,'kanjiH',$pid) : ''); if ($ownsRE == TRUE) { // If own this decks KanjiRE $clvRE = getSkill($sDeck . '_kanjiRE_lv', $pid); $percRE = $clvRE == 1 ? 0 : round($clvRE / $deckMxLv * 100, 0); $finRE = $percRE == 100 ? "success sparkley" : ($percRE <= 25 && $percRE != 0 ? "warning" : ($percRE == 0 ? "danger" : "")); //Style it based off their progress } if ($ownsE == TRUE) { // If own this decks KanjiRE $clvE = getSkill($sDeck . '_kanjiE_lv', $pid); $percE = $clvE == 1 ? 0 : round($clvE / $deckMxLv * 100, 0); $finE = $percE == 100 ? "success sparkley" : ($percE <= 25 && $percE != 0 ? "warning" : ($percE == 0 ? "danger" : "")); //Style it based off their progress
if (getOwnershipDeckVstyle($cvset, 'kanjiH', $userID) == TRUE && $cvset != 'hirkat' && $cvset != 'katakana') { ?> <li role="presentation" class="<?php if ($vstyle == 'kanjiH') { echo "active"; } ?> " onClick="vsChange('vStyle','kanjiH')" ><a href="#3"><span class="label label-danger">Hard</span> Get Kanji, Guess Reading <span class="badge"><small><i>Lv.<?php echo $vsLvHard; if ($vsLvHard == $mxDkLv) { echo " (Max)"; } ?> </i></small></span></a></li><?php } else { if (getOwnershipDeckVstyle($cvset, 'kanjiH', $userID) == FALSE && $cvset != 'hirkat' && $cvset != 'katakana') { ?> <li role="presentation" class="vsBuy" onClick="buyVstyle('<?php echo $cvset; ?> ','<?php echo getDeckInfo($cvset, 'id'); ?> ','<?php echo $userID; ?> ','dmd', 'kanjiH')" ><a href="#3">Buy <span class="label label-danger">Hard</span> Get Kanji, Guess Reading for <?php echo getPrice('kanjiH', 'dmd'); ?> DMD here!</a></li><?php }