Esempio n. 1
0
function printCandidateList()
{
    $candidates = new Candidates();
    // Preparation {
    $conf = $_POST["conf"];
    $where = "";
    if ($conf["searchtype"] == 1) {
        $where = "statusid = " . $conf["statusid"];
    } else {
        if ($conf["searchtype"] == 2) {
            $where = "statusid > 0";
        } else {
            if ($conf["searchtype"] == 3) {
                $where = "statusid = 0";
            } else {
                if ($conf["searchtype"] == 4) {
                    $where = "statusid = -1";
                } else {
                    $where = "1=1";
                }
            }
        }
    }
    $where .= " AND c.deleted = 0";
    $candidatelist = $candidates->getRowSet(array("where" => $where, 'children' => true));
    $statuslist = sqlPull(array("table" => "candidate_status", "where" => "1=1"));
    $style = "style='border-style: none none solid none; border-width: 1px;'";
    // }
    print "<table width=100% height=100% cellspacing=0 style='border-color: BLACK; border-style: solid; border-width: 1px;'>";
    print "<tr bgcolor='#DDDDDD'><td align='center' height=1px colspan=5 " . $style . ">";
    print "Candidate List";
    print "</td></tr>";
    print "<tr><td align='center' width=15% " . $style . ">";
    print "Name";
    print "</td><td align='center' width=15% " . $style . ">";
    print "ID Number";
    print "</td><td align='center' width=15% " . $style . ">";
    print "Contact Number";
    print "</td><td align='center' width=15% " . $style . ">";
    print "Status";
    print "</td><td align='center' width=40% " . $style . ">";
    print "Notes";
    print "</td></tr>";
    foreach ($candidatelist as $candidatekey => $candidateval) {
        // Individual Preparation {
        $notelist = $candidateval['candidate_notes'];
        $notecount = count($notelist);
        if ($candidateval["statusid"] == null) {
            $status = -10;
        } else {
            $status = $candidateval["statusid"];
        }
        // }
        print "<tr><td align='center' " . $style . ">";
        print $candidateval["firstname"] . " " . $candidateval["lastname"];
        print "</td><td align='center' " . $style . ">";
        print $candidateval["idno"];
        print "</td><td align='center' " . $style . ">";
        print $candidateval["contactno"];
        print "</td><td align='center' " . $style . ">";
        print $candidateval['status'] ? $candidateval['status'] : 'Failed';
        print "</td><td align='center' " . $style . ">";
        if ($notecount > 0) {
            print "<table>";
            foreach ($notelist as $note0key => $noteval) {
                print "<tr><td>";
                print "<b>" . date("d/M/Y", $noteval["date"]) . "</b> " . $noteval["note"];
                print "</td></tr>";
            }
            print "</table>";
        } else {
            print "No Notes";
        }
        print "</td></tr>";
    }
    print "<tr><td height=100%;>";
    print "</td></tr>";
    print "</table>";
    // Javascript {
    print "<script type=\"text/javascript\">window.print();</script>";
    // }
    sleep(10);
    goHere("index.php?mode=maxine/index&action=candidatereports");
}