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


PHP Contest::factory方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->view->error_message = "You need to login to change the contest.";
         return;
     }
     $contest = $this->_request->get("contest");
     $contestM = Contest::factory($contest);
     if (!$contestM->authenticateUser($auth->getIdentity())) {
         $this->view->error_message = "You have not been granted access to this contest. This might be a restricted contest.";
         return;
     }
     $session = new Zend_Session_Namespace(webconfig::$session_namespace);
     $session->contestid = $contest;
     $session->contestname = "Custom Contest";
     $this->_redirect("/");
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:18,代码来源:ContestsController.php

示例2: getContestState

 public function getContestState($contestname)
 {
     $contest = Contest::factory((string) $contestname);
     if (empty($contest)) {
         return "before";
     }
     $start = $contest->getContestTime();
     $end = $contest->getContestEndTime();
     $current = time();
     if ($current < $start) {
         return "before";
     }
     if ($current < $end) {
         return "ongoing";
     }
     if (!$contest->isResultDeclared()) {
         return "pending_result";
     }
     return "after";
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:20,代码来源:ContestModel.php

示例3: indexAction

 public function indexAction()
 {
     $page = $this->getRequest()->get("page");
     $contest = Contest::factory(webconfig::getContestId());
     if (!$contest) {
         return;
     }
     $xp = $contest->getXPath();
     $res = $xp->query("/contest/frontend/page[@id='{$page}']/@href");
     $href = $res->item(0)->nodeValue;
     if (substr($href, 0, 5) == "http:" or substr($href, 0, 6) == "https:") {
         $this->_redirect($href);
     }
     $file = config::getFilename("data/contests/" . $res->item(0)->nodeValue);
     if (!is_file($file)) {
         echo "Please edit '{$file}' to view this page.";
     } else {
         echo file_get_contents($file);
     }
 }
开发者ID:rajatkhanduja,项目名称:opc,代码行数:20,代码来源:PagesController.php

示例4: exit

if (!is_file(get_file_name("data/problems/{$id}/index.html"))) {
    echo "data/problems/{$id}/index.html does not exist. Aborting right now.\n";
    exit(1);
}
if (empty($nick)) {
    $nick = readline("Enter a nickname for the problem: ");
}
$element = $dom->createComment("nickname is also stored for informative purposes only.");
$root->appendChild($element);
$element = $dom->createElement("nick", $nick);
$root->appendChild($element);
if (empty($contest)) {
    $contest = 'general';
}
require_once "lib/contest.inc";
$c = Contest::factory($contest);
if (empty($c)) {
    die("That contest does not exist.\n");
}
if (empty($numcases)) {
    $numcases = 0 + readline("Number of testcases: ");
}
for ($i = 0; $i < $numcases; $i++) {
    $testcase = $dom->createElement("test");
    $def = "data/problems/{$id}/{$namespace}{$i}.in";
    if (!is_file(get_file_name($def))) {
        die("{$def}: not found\n");
    }
    $element = $dom->createElement("inputpath", $def);
    $testcase->appendChild($element);
    $def = "data/problems/{$id}/{$namespace}{$i}.out";
开发者ID:rajatkhanduja,项目名称:opc,代码行数:31,代码来源:addproblem.php


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