コード例 #1
0
 public static function getInstance()
 {
     if (!self::$instance) {
         $className = __CLASS__;
         self::$instance = new $className();
     }
     return self::$instance;
 }
コード例 #2
0
<?php

//ini_set('display_errors',1);
//error_reporting(E_ALL);
include_once "header.php";
include_once "ProblemCodesFactory.php";
include_once "ProblemCodesManager.php";
include_once "ProblemDescriptionFactory.php";
include_once "ProblemDescriptionManager.php";
$contestCode = "CON1";
//this can be passed from a previous page
$problemCodesManager = ProblemCodesFactory::getInstance()->getProblemCodesManager();
$problemCodes = $problemCodesManager->getProblemCodes($contestCode);
$problemDescriptionManagerObj = ProblemDescriptionFactory::getInstance()->getProblemDescriptionManager();
$i = 0;
while ($i < count($problemCodes)) {
    $problemDetails[$i] = $problemDescriptionManagerObj->getProblemDetails($problemCodes[$i], "MINI");
    $i++;
}
$footer = $smarty->fetch("templates/footer.tpl");
$smarty->assign("footer", $footer);
$smarty->assign("problemDetails", $problemDetails);
$smarty->display('ContestPage.tpl');