本文整理汇总了PHP中WC_Challenge::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Challenge::getByID方法的具体用法?PHP WC_Challenge::getByID怎么用?PHP WC_Challenge::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Challenge
的用法示例。
在下文中一共展示了WC_Challenge::getByID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes', true))) {
return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes'));
}
if (false === ($chall = WC_Challenge::getByID(Common::getGet('cid', 0)))) {
return $this->module->error('err_chall');
}
require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
if (false !== Common::getPost('vote')) {
return $this->onVote($chall) . $this->templateVotes($chall);
}
return $this->templateVotes($chall);
}
示例2: execute
public function execute()
{
if (false === ($chall = WC_Challenge::getByID(Common::getGet('cid')))) {
return $this->module->error('err_chall');
}
if (false !== Common::getPost('edit')) {
return $this->onEdit($chall) . $this->templateEdit($chall);
}
if (false !== Common::getPost('reset')) {
return $this->onReset($chall) . $this->templateEdit($chall);
}
if (false !== Common::getPost('delete')) {
return $this->onDelete($chall);
}
return $this->templateEdit($chall);
}
示例3: execute
public function execute()
{
if (false === ($chall = WC_Challenge::getByID(Common::getGetString('cid')))) {
return $this->module->error('err_chall');
}
$user = GWF_User::getStaticOrGuest();
$token = Common::getGetString('token');
$length = Common::clamp(Common::getGetInt('length'), 1);
require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
require_once GWF_CORE_PATH . 'module/WeChall/WC_MathChall.php';
if (!WC_ChallSolved::hasSolved($user->getID(), $chall->getID())) {
if (!WC_MathChall::checkToken($chall, $length, $token)) {
return $this->module->error('err_token');
}
}
return $this->templateSolutions($chall, $user, $length, $token);
}
示例4: templateOutput
public function templateOutput($date, $amt)
{
require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
$table = GDO::table('WC_ChallSolved');
if (false === ($result = $table->selectAll('*', "csolve_date>='{$date}'", 'csolve_date DESC', NULL, $amt))) {
return '';
}
$back = '';
foreach ($result as $row) {
if (false === ($user = GWF_User::getByID($row['csolve_uid']))) {
continue;
}
if (false === ($chall = WC_Challenge::getByID($row['csolve_cid']))) {
continue;
}
$row['username'] = $user->getVar('user_name');
$row['challname'] = $chall->getVar('chall_title');
$row['solvecount'] = $chall->getVar('chall_solvecount');
$row['curl'] = $chall->getVar('chall_url');
$row = array_map(array(__CLASS__, 'escapeCSV'), $row);
$back .= implode('::', $row) . PHP_EOL;
}
return $back;
}
示例5: getChallenge
/**
* @return WC_Challenge
*/
public function getChallenge()
{
return WC_Challenge::getByID($this->getChallID());
}
示例6: templateSolvers
public function templateSolvers($cid)
{
if (false === ($chall = WC_Challenge::getByID($cid))) {
return $this->module->error('err_chall');
}
}