Esempio n. 1
0
            $_SESSION['devID'] = $user;
            $devID = $user;
            $g->queryId = $user;
        }
        if (isset($proj)) {
            $_SESSION['projID'] = $proj;
            $projID = $proj;
        }
    }
    if ($projID != "") {
        $g->pfilter = true;
    }
    if ($devID != "") {
        $g->ufilter = true;
    }
    $dates = StartDate();
    $p->mark("Pre Project Walker");
    $proj = ProjectWalker($devID, false, $projID);
    //SaveCSV("c:\ipc1.csv");
    $g->projTable = $projTable;
    $g->projTableAttr = $projTableAttr;
    $g->name = $_COOKIE['userfullname'];
    $g->userid = $_COOKIE['username'];
    $g->colList = $numWeeks * 2 + 2;
    $g->cellStyle = explode(",", $tdAttr);
    $g->perf = $p->show('Pre Display');
    $tmpl->assign('g', $g);
    $tmpl->display('matrix.tpl');
} else {
    header('Location: login.php');
}
function SaveCSV($fname)
{
    global $numWeeks;
    global $projTable;
    global $track_errors;
    global $php_errormsg;
    ini_set("track_errors", true);
    $holdWeeks = $numWeeks;
    $fname = str_replace("\\", "\\\\", $fname);
    debug($fname);
    $csvFile = @fopen($fname, "w");
    if ($csvFile) {
        $numWeeks = 16;
        $dates = StartDate();
        ProjectWalker("", true, "");
        foreach ($projTable as $projRow) {
            $str = implode(",", $projRow);
            fwrite($csvFile, $str . "\n");
        }
        fclose($csvFile);
        $status = "ok";
    } else {
        if (strpos($php_errormsg, "Permission denied") === false) {
            // errormessages always say "failed to open stream: "
            $statArr = explode("stream: ", $php_errormsg);
            $status = $statArr[1];
        } else {
            $status = "File may be in use (eg by excel)";
        }
    }
    $numWeeks = $holdWeeks;
    ini_set("track_errors", false);
    return $status;
}