Ejemplo n.º 1
0
 public function defaultAction()
 {
     // 获取参数
     $id = Request::getGET('global-id');
     // 校验题目
     $problemInfo = OjProblemInterface::getById(array('id' => $id));
     if (empty($problemInfo) || $problemInfo['hidden']) {
         $this->renderError('题目不存在!');
     }
     $remote = $problemInfo['remote'];
     $problemId = $problemInfo['problem_id'];
     $problemCode = $problemInfo['problem_code'];
     if ($remote) {
         $srcUrl = OjCommonHelper::getSrcUrl($remote, $problemId, $problemCode);
         $this->renderFramework(array('srcUrl' => $srcUrl, 'problemInfo' => $problemInfo), 'problem/detail_remote.php');
     } else {
         $this->renderFramework(array('problemInfo' => $problemInfo), 'problem/detail.php');
     }
 }
Ejemplo n.º 2
0
 public function ajaxUploadAction()
 {
     $field = 'file';
     $fileExt = Upload::getFileExt($field);
     $fileSize = Upload::getFilesize($field);
     $tmpFile = Upload::getTmpName($field);
     if (!in_array($fileExt, array('png', 'jpeg', 'jpg', 'gif', 'bmp'))) {
         $this->echoJson(1, '只允许jpg,jpeg,bmp,png,gif格式的图片!');
     }
     if ($fileSize > 102400) {
         $this->echoJson(1, '图片大小不能超过100KB!');
     }
     // 保存头像
     $cdnKey = Cdn::uploadLocalFile($tmpFile, $this->loginUserInfo['id'], $fileExt);
     UserCommonInterface::save(array('id' => $this->loginUserInfo['id'], 'head_img' => $cdnKey));
     // 删除原先的头像
     Cdn::delete($this->loginUserInfo['head_img']);
     $this->echoJson(0, 'Success!', array('src' => OjCommonHelper::getHeadUrl($cdnKey, $this->loginUserInfo['sex'])));
 }
Ejemplo n.º 3
0
 public function defaultAction()
 {
     // 获取参数
     $problemHash = Request::getGET('problem-hash');
     $globalId = array_search($problemHash, $this->contestInfo['problem_hash']);
     if (empty($globalId)) {
         $this->renderError('竞赛中无此题!');
     }
     // 获取题目
     $problemInfo = OjProblemInterface::getById(array('id' => $globalId));
     if (empty($problemInfo)) {
         $this->renderError('题目不存在!');
     }
     $remote = $problemInfo['remote'];
     $problemId = $problemInfo['problem_id'];
     $problemCode = $problemInfo['problem_code'];
     if ($remote) {
         $srcUrl = OjCommonHelper::getSrcUrl($remote, $problemId, $problemCode);
         $this->renderFramework(array('srcUrl' => $srcUrl, 'problemInfo' => $problemInfo), 'problem/detail_remote.php');
     } else {
         $this->renderFramework(array('problemInfo' => $problemInfo), 'problem/detail.php');
     }
 }
Ejemplo n.º 4
0
    ?>
</td>
            <td><?php 
    echo date('Y-m-d H:i:s', $setInfo['refresh_at']);
    ?>
</td>
            <td>
                <?php 
    echo $setInfo['hidden'] ? '<span class="green">自己可见</span>' : '<span class="red">公开</span>';
    ?>
            </td>
            <td><a href="//www.hqoj.net/user_my/?username=<?php 
    echo $userInfo['username'];
    ?>
"><?php 
    echo OjCommonHelper::getColorName($userInfo);
    ?>
</a></td>
            <td>
                <?php 
    if ($setInfo['listing_status']) {
        ?>
                    <a href="#" name="stick-cancel" set-id="<?php 
        echo $setInfo['id'];
        ?>
" >取消置顶</a>
                <?php 
    } else {
        ?>
                    <a href="#" name="stick" set-id="<?php 
        echo $setInfo['id'];
Ejemplo n.º 5
0
                <td><?php 
    echo $userInfo['motto'];
    ?>
</td>
                <td class="tc">
                    <a href="<?php 
    echo OjCommonHelper::getStatusUrl($userInfo['username'], -1, '', StatusVars::ACCEPTED);
    ?>
"><?php 
    echo $userInfo['solved_all'];
    ?>
</a>
                </td>
                <td class="tc">
                    <a href="<?php 
    echo OjCommonHelper::getStatusUrl($userInfo['username'], -1, '', -1);
    ?>
"><?php 
    echo $userInfo['submit_all'];
    ?>
</a>
                </td>
            </tr>
        <?php 
}
?>
    </tbody>
</table>


Ejemplo n.º 6
0
    echo $problemInfo['remote'];
    ?>
&type=2&keyword=<?php 
    echo $problemInfo['source'];
    ?>
"><?php 
    echo $problemInfo['source'];
    ?>
</a>
            </td>
            <td class="tc"><a href="<?php 
    echo OjCommonHelper::getStatusUrl('', $problemInfo['remote'], $problemInfo['problem_code'], StatusVars::ACCEPTED);
    ?>
"><?php 
    echo $problemInfo['solved'];
    ?>
</a></td>
            <td class="tc"><a href="<?php 
    echo OjCommonHelper::getStatusUrl('', $problemInfo['remote'], $problemInfo['problem_code'], -1);
    ?>
"><?php 
    echo $problemInfo['submit'];
    ?>
</a></td>
        </tr>
        <?php 
}
?>
    </tbody>
</table>
Ejemplo n.º 7
0
    ?>
<h5 class="mt10 f14">输出样例</h5>
<textarea class="textarea" readonly="true" style="font-family:Courier New,Courier,monospace; font-size: 12px; padding: 10px; width: 950px; height: 250px;resize:none;"><?php 
    echo $this->problemInfo['sample_output'];
    ?>
</textarea>
<?php 
}
?>

<?php 
if (!empty($this->problemInfo['source'])) {
    ?>
<h5 class="mt10 f14">分类</h5>
<div class="mt5 p10 bg-gray"><?php 
    echo OjCommonHelper::getSourceUrls($this->problemInfo);
    ?>
</div>
<?php 
}
?>

<?php 
if (!empty($this->problemInfo['hint'])) {
    ?>
<h5 class="mt10 f14">提示</h5>
<article><div class="mt5 p10 bg-gray"><?php 
    echo $this->problemInfo['hint'];
    ?>
</div></article>
<?php 
Ejemplo n.º 8
0
            <td><a href="/user_my/?username=<?php 
    echo $userInfo['username'];
    ?>
"><?php 
    echo OjCommonHelper::getColorName($userInfo);
    ?>
</a></td>
            <td class="tc"><a href="<?php 
    echo OjCommonHelper::getStatusUrl($userInfo['username'], $problemInfo['remote'], $problemInfo['problem_code'], StatusVars::ACCEPTED);
    ?>
"><?php 
    echo $problemInfo['solved'];
    ?>
</a></td>
            <td class="tc"><a href="<?php 
    echo OjCommonHelper::getStatusUrl($userInfo['username'], $problemInfo['remote'], $problemInfo['problem_code'], -1);
    ?>
"><?php 
    echo $problemInfo['submit'];
    ?>
</a></td>
        </tr>
        <?php 
}
?>
    </tbody>
</table>

<?php 
echo $this->html['pager'];
?>
Ejemplo n.º 9
0
                        </div>
                    <?php 
}
?>
                </td>
            </tr>
            <tr>
                <td class="col1">解决中</td>
                <td>
                    <?php 
foreach ($this->unSolvedProblemList as $problemInfo) {
    $remote = $problemInfo['remote'];
    $problemCode = $problemInfo['problem_code'];
    ?>
                        <div class="fl ml5 w60"><a href="<?php 
    echo OjCommonHelper::getStatusUrl($this->userInfo['username'], $remote, $problemCode, -1);
    ?>
"><?php 
    echo $remote ? StatusVars::$REMOTE_SCHOOL[$remote] : '';
    echo $problemCode;
    ?>
</a></div>
                    <?php 
}
?>
                </td>
            </tr>
        </tbody>
    </table>
</div>
Ejemplo n.º 10
0
<form id="form" class="widget-form">
    <div class="item">
        <label class="label w120">个性头像:</label>
        <img style="border: 1px solid #ddd;" id="pic-img" src="<?php 
echo OjCommonHelper::getHeadUrl($this->loginUserInfo['head_img'], $this->loginUserInfo['sex']);
?>
" width="100px" height="100px" />
        <a id="uploader-btn" href="#" return="false">[更换头像]</a>
        <span class="gray">&nbsp;只允许jpg,jpeg,bmp,png,gif格式,大小不超过100KB。</span>
    </div>
    <div class="item">
        <label class="label w120"><span class="red">* </span>昵称:</label>
        <input name="nickname" value="<?php 
echo $this->loginUserInfo['nickname'];
?>
" class="input w220" type="text" data-validation="length" data-validation-length="1-16" data-validation-error-msg="8个汉字或者16个英文字符以内" />
    </div>
    <div class="item">
        <label class="label w120">个性签名:</label>
        <input name="motto" value="<?php 
echo $this->loginUserInfo['motto'];
?>
" class="input w600" type="text" data-validation="length" data-validation-length="max100" />
    </div>
    <div class="item">
        <label class="w120 label"><span class="red">* </span>性别:</label>
        <label class="label"><input <?php 
echo $this->loginUserInfo['sex'] == 1 ? 'checked' : '';
?>
 value="1" name="sex" type="radio" class="radio" /> 男</label>
        <label class="label"><input <?php