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


PHP WC_Challenge::getVar方法代码示例

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


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

示例1: getFormVote

 private function getFormVote(WC_Challenge $chall, $has_solved, $userid)
 {
     $fun = $edu = $dif = 0;
     if ($has_solved) {
         if (false !== ($vsr = GWF_VoteScoreRow::getByUID($chall->getVar('chall_vote_dif'), $userid))) {
             $dif = $vsr->getScore();
         }
         if (false !== ($vsr = GWF_VoteScoreRow::getByUID($chall->getVar('chall_vote_edu'), $userid))) {
             $edu = $vsr->getScore();
         }
         if (false !== ($vsr = GWF_VoteScoreRow::getByUID($chall->getVar('chall_vote_fun'), $userid))) {
             $fun = $vsr->getScore();
         }
     }
     $data = array('dif' => array(GWF_Form::INT, $dif, $this->module->lang('th_dif'), '', 2), 'edu' => array(GWF_Form::INT, $edu, $this->module->lang('th_edu'), '', 2), 'fun' => array(GWF_Form::INT, $fun, $this->module->lang('th_fun'), '', 2), 'vote' => array(GWF_Form::SUBMIT, $this->module->lang('btn_vote')));
     return new GWF_Form($this, $data);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:17,代码来源:ChallVotes.php

示例2: wcChallVotes

function wcChallVotes(WC_Challenge $chall, $section)
{
    $db = gdo_db();
    # Init back;
    $back = array();
    for ($i = 0; $i <= 10; $i++) {
        $back[$i] = array(0, 0);
    }
    $back[11] = array(0, 0.0);
    $total = 0;
    $count = 0;
    $vsr = GWF_TABLE_PREFIX . 'vote_score_row';
    $vsid = $chall->getVar('chall_vote_' . $section);
    $query = "SELECT vsr_score, COUNT(vsr_uid) FROM {$vsr} WHERE vsr_vsid={$vsid} GROUP BY(vsr_score) ORDER BY vsr_score ASC";
    //	var_dump($query);
    if (false === ($result = $db->queryRead($query))) {
        return $back;
    }
    while (false !== ($row = $db->fetchRow($result))) {
        $cnt = (int) $row[1];
        # 15 people
        $score = (int) $row[0];
        # voted N
        $back[$score] = array($cnt, $score * $cnt);
        $total += $score * $cnt;
        $count += $cnt;
    }
    $db->free($result);
    if ($count === 0) {
        $count = 1.0E-8;
    }
    for ($i = 0; $i <= 10; $i++) {
        //		$back[$i] = array($back[$i][0], $back[$i][1] / $total * 100);
        $back[$i] = array($back[$i][0], round($back[$i][0] / $count * 100, 2));
    }
    if ($count > 0) {
        $back[11] = array($count, round($total / $count * 10, 2));
    }
    //	var_dump($back);
    return $back;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:41,代码来源:chall_votes.php

示例3: getLimitedHREF

 public static function getLimitedHREF(WC_Challenge $chall, $length)
 {
     $challid = $chall->getVar('chall_id');
     $token = self::calcToken($chall, $length);
     return GWF_WEB_ROOT . 'index.php?mo=WeChall&me=MathSolutions&cid=' . $challid . '&length=' . $length . '&token=' . $token;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:6,代码来源:WC_MathChall.php

示例4: getForm

 private function getForm(WC_Challenge $chall)
 {
     $buttons = array('edit' => $this->module->lang('btn_edit'), 'reset' => $this->module->lang('btn_reset'), 'delete' => $this->module->lang('btn_delete'));
     $data = array('score' => array(GWF_Form::INT, $chall->getVar('chall_score'), $this->module->lang('th_chall_score')), 'title' => array(GWF_Form::STRING, $chall->getVar('chall_title'), $this->module->lang('th_chall_title')), 'tags' => array(GWF_Form::STRING, $chall->getVar('chall_tags'), $this->module->lang('th_chall_tags')), 'url' => array(GWF_Form::STRING, $chall->getVar('chall_url'), $this->module->lang('th_chall_url')), 'solution' => array(GWF_Form::STRING, '', $this->module->lang('th_chall_solution')), 'creators' => array(GWF_Form::STRING, $chall->getVar('chall_creator_name'), $this->module->lang('th_chall_creator_name')), 'case_i' => array(GWF_Form::CHECKBOX, $chall->isCaseI(), $this->module->lang('th_chall_case_i')), 'cmd' => array(GWF_Form::SUBMITS, $buttons));
     return new GWF_Form($this, $data);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:6,代码来源:ChallEdit.php


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