Example #1
0
 public function foo($z)
 {
     global $constructCount;
     ++$constructCount;
     $w2 = 2;
     newobj()->g(newobj(), 7, 8, $w2 = $this->foo(newobj()));
 }
Example #2
0
 public function foo($z)
 {
     $w1 = 1;
     $w2 = 2;
     newobj()->g("hi", $w1, 7, 8, $w2 = $this->foo(newobj()));
 }
Example #3
0
function getDataParticipation($contestID)
{
    // get contest name
    $contestName = FALSE;
    setContestName($contestID, $contestName);
    $score = "score";
    if (useFfscore()) {
        $score = "cached_ffScore";
    }
    $foreignSchool = getForeignSchoolConstraints();
    $query = "\n    SELECT \n         (SELECT COUNT(`team`.ID) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID)\n      as nbTeamsAll,\n         (SELECT COUNT(`team`.ID) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy + `team`.cached_nbGirl = 1)\n      as nbTeamsSingle,\n         (SELECT COUNT(`team`.ID) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy = 0\n         AND `team`.cached_nbGirl = 1)\n      as nbTeamsGirl,\n         (SELECT COUNT(`team`.ID) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy = 1\n         AND `team`.cached_nbGirl = 0)\n      as nbTeamsBoy,\n         (SELECT COUNT(`team`.ID) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy = 1\n         AND `team`.cached_nbGirl = 1)\n      as nbTeamsMixed,\n         (SELECT COUNT(`contestant`.ID) \n         FROM `contestant`, `team` \n         WHERE `contestant`.teamID = `team`.ID\n         AND `team`.cached_officialForContestID = :contestID)\n      as nbParticipants,\n         (SELECT COUNT(`contestant`.ID) \n         FROM `contestant`, `team` \n         WHERE `contestant`.teamID = `team`.ID\n         AND `team`.cached_officialForContestID = :contestID\n         AND `contestant`.genre = 1)\n      as nbParticipantsGirl,\n         (SELECT SUM(`team`.{$score}) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID)\n      as sumScoreAll,\n         (SELECT SUM(`team`.{$score}) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy + `team`.cached_nbGirl = 1)\n      as sumScoreSingle,\n         (SELECT SUM(`team`.{$score}) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy = 0\n         AND `team`.cached_nbGirl = 1)\n      as sumScoreGirl,\n         (SELECT SUM(`team`.{$score}) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy = 1\n         AND `team`.cached_nbGirl = 0)\n      as sumScoreBoy,\n         (SELECT SUM(`team`.{$score}) \n         FROM `team` \n         WHERE `team`.cached_officialForContestID = :contestID\n         AND `team`.cached_nbBoy = 1\n         AND `team`.cached_nbGirl = 1)\n      as sumScoreMixed,\n         (SELECT COUNT(`school`.ID) \n         FROM `school`  \n         WHERE EXISTS (\n            SELECT * FROM `group` \n            WHERE `group`.schoolID = `school`.ID\n            AND EXISTS (\n               SELECT * FROM `team`\n               WHERE `team`.groupID = `group`.ID\n               AND `team`.cached_officialForContestID = :contestID\n               )))\n      as nbSchools\n      ";
    $options = array(":contestID" => $contestID);
    $stmt = db()->prepare($query);
    $stmt->execute($options);
    $results = $stmt->fetch(PDO::FETCH_OBJ);
    if ($results === FALSE) {
        return newerror("no teams participated");
    }
    $descr = newobj(array("contestID" => $contestID, "contestName" => $contestName));
    foreach ($results as $key => $value) {
        $descr->{$key} = $value;
    }
    return $descr;
}
Example #4
0
 public function foo($z)
 {
     $w2 = 2;
     newobj()->g(newobj(), 7, 8, $w2 = $this->foo(newobj()));
 }