Exemplo n.º 1
0
function found_competition($fullname)
{
    global $maxcompnum, $competitionsbyname, $competitionsbyid;
    $comp = 0;
    $path_parts = pathinfo($fullname);
    if (array_key_exists($path_parts['dirname'], $competitionsbyname)) {
        $comp = $competitionsbyname[$path_parts['dirname']];
    } else {
        // Create a new competition
        $comp = new Competition();
        // Set the new id
        $maxcompnum = $maxcompnum + 1;
        $comp->id = $maxcompnum;
        // And the path
        $comp->path = $path_parts['dirname'];
        $comp->createname();
        $competitionsbyname[$comp->path] = $comp;
        $competitionsbyid[$comp->id] = $comp;
    }
    $comp->found = 'true';
    //echo "<p>Found $fullname. <br/>".$comp->Dump()."</p>";
}