Exemplo n.º 1
0
/** getCurrentAlerts($json_encode = FALSE)
 * get a list of the current system alerts
 * @param BOOL $json_encode do we json encode and print to screen? (called via ajax)
 * @return array $return on success false otherwise
 */
function getCurrentAlerts($json_encode = FALSE)
{
    //: Tests
    if (is_bool($json_encode) === FALSE) {
        $json_encode = (bool) FALSE;
    }
    //: Test to see if TableManager can be referenced
    $declared_classes = get_declared_classes();
    if (!in_array("TableManager", $declared_classes)) {
        include_once BASE . "/basefunctions/baseapis/TableManager.php";
    }
    //: End
    //: End
    //: Function Content
    $manager = new TableManager("alerts");
    $where = (string) $manager->quoteString("`alerts`.`deleted`=?", (int) 0);
    $where .= $manager->quoteString(" AND `alerts`.`time_start`<=?", strtotime(date("Y-m-d") . " 00:00:00"));
    $where .= $manager->quoteString(" AND `alerts`.`time_end`>=?", strtotime(date("Y-m-d") . " 23:59:00"));
    $manager->setWhere($where);
    $manager->setOrderBy(array("column" => "`alerts`.`time_start`", "direction" => "ASC"));
    if (($return = $manager->selectMultiple()) === FALSE) {
        return FALSE;
    }
    if (isset($_SESSION) && array_key_exists("userid", $_SESSION) && $_SESSION["userid"]) {
        $mycapsSegments = new TableManager("mycaps_segments");
        $mycapsSegments->setWhere($mycapsSegments->quoteString("`mycaps_segments`.`userid`=?", (int) $_SESSION["userid"]) . $mycapsSegments->quoteString(" AND `mycaps_segments`.`finalized`=?", 0));
        $segment = $mycapsSegments->selectSingle();
        // print("<pre>");print_r($segment);print("</pre>");
        if (date("U") > (int) $segment["enddate"] + 86400) {
            $return[]["message"] = "Your CAPS is overdue";
        }
    }
    if ($json_encode === TRUE) {
        print "var ret=" . json_encode($return);
        return FALSE;
    }
    return $return;
    //: End
}
Exemplo n.º 2
0
function exportFleetScoreUpdates()
{
    require_once BASE . 'basefunctions/baseapis/PHPExcel/php-excel.class.php';
    $manager = new TableManager("fleet_scores");
    $data = __sanitizeData($_GET);
    $where = (string) "1=1";
    if (isset($data["fleet"]) && $data["fleet"]) {
        $where .= $manager->quoteString(" AND `fleetid`=?", (int) $data["fleet"]);
    }
    if (isset($data["start"]) && $data["start"]) {
        $where .= $manager->quoteString(" AND `date`>=?", (int) unixDate($data["start"]));
    }
    if (isset($data["end"]) && $data["end"]) {
        $where .= $manager->quoteString(" AND `date`<=?", (int) unixDate($data["end"]));
    }
    $manager->setWhere($where);
    $manager->setOrderBy(array("column" => "date"));
    $records = $manager->selectMultiple();
    $rows = returnFleetTruckCount();
    $xlsdata = (array) array();
    $fleetdayobj = new fleetDayHandler();
    $tempfleetlist = $fleetdayobj->getIncomeFleets();
    $fleetlist = array();
    foreach ($tempfleetlist as $tempkey => $tempval) {
        $fleetlist[$tempval["id"]] = $tempval;
    }
    unset($tempfleetlist);
    unset($fleetdayobj);
    $row = (array) array("Date", "Fleet", "Income budget", "Income", "Contribution budget", "Contribution", "Truck count", "Kms", "Ave. Kms per truck", "Budget Ave. Kms per truck");
    $xlsdata[] = $row;
    foreach ($records as $val) {
        $row = (array) array(date("Y-m-d", $val["date"]), $fleetlist[$val["fleetid"]]["name"], $val["budget"], $val["income"], $val["budgetcontrib"], $val["contrib"], $rows[$val["fleetid"]]["count"], $val["kms"], round($val["kms"] / (isset($rows[$val["fleetid"]]) && isset($rows[$val["fleetid"]]["count"]) ? $rows[$val["fleetid"]]["count"] : 1), 2), round($val["budkms"] / (isset($rows[$val["fleetid"]]) && isset($rows[$val["fleetid"]]["count"]) ? $rows[$val["fleetid"]]["count"] : 1), 2));
        $xlsdata[] = $row;
    }
    $xls = new Excel_XML('UTF-8', TRUE);
    $xls->addArray($xlsdata);
    $xls->generateXML('fleet_score_data');
}
Exemplo n.º 3
0
/** testUserRecordForHistory($userid)
 * test a user record for a userhistory record that matches today
 * @author Feighen Oosterbroek
 * @author feighen@manlinegroup.com
 * @param int $userid which user are we testing against
 * @return array result
 */
function testUserRecordForHistory($userid)
{
    $manager = new TableManager("userhistory");
    $manager->setWhere($manager->quoteString("`userhistory`.`userid`=?", $userid));
    $manager->setOrderBy(array("column" => "`userhistory`.`date`", "direction" => "DESC"));
    $history = $manager->selectMultiple();
    /** Explanation
     * one of 3 potential tests need to match
     * 1) today is between from and to date
     * 2) date added is today with no from to dates
     * 3) last added item to match
     */
    $hist = (array) array();
    if ($history) {
        $dateU = date("U");
        foreach ($history as $key => $val) {
            if ($val["fromdate"] || $val["todate"]) {
                ## item 1
                if ($dateU >= $val["fromdate"] && $dateU < $val["todate"]) {
                    $hist = $val;
                    break;
                } elseif ($val["todate"] == 0 && $dateU >= $val["fromdate"]) {
                    $hist = $val;
                    break;
                } elseif ($val["fromdate"] == 0 && $dateU < $val["todate"]) {
                    $hist = $val;
                    break;
                } else {
                    $hist["actionid"] = 0;
                }
            } elseif (date("Y-m-d") == date("Y-m-d", $val["date"])) {
                ## item 2
                $hist = $val;
                break;
            }
        }
        if (!$hist) {
            ## item 3
            $keys = array_keys($history);
            $hist = $history[$keys[0]];
        }
    }
    return $hist;
}
Exemplo n.º 4
0
/** getCurrentAlerts($json_encode = FALSE)
 * get a list of the current system alerts
 * @param BOOL $json_encode do we json encode and print to screen? (called via ajax)
 * @return array $return on success false otherwise
 */
function getCurrentAlerts($json_encode = FALSE)
{
    //: Tests
    if (is_bool($json_encode) === FALSE) {
        $json_encode = (bool) FALSE;
    }
    //: Test to see if TableManager can be referenced
    $declared_classes = get_declared_classes();
    if (!in_array("TableManager", $declared_classes)) {
        include_once BASE . "/basefunctions/baseapis/TableManager.php";
    }
    //: End
    //: End
    //: Function Content
    $manager = new TableManager("alerts");
    $where = (string) $manager->quoteString("`alerts`.`deleted`=?", (int) 0);
    $where .= $manager->quoteString(" AND `alerts`.`time_start`<=?", strtotime(date("Y-m-d") . " 00:00:00"));
    $where .= $manager->quoteString(" AND `alerts`.`time_end`>=?", strtotime(date("Y-m-d") . " 23:59:00"));
    $manager->setWhere($where);
    $manager->setOrderBy(array("column" => "`alerts`.`time_start`", "direction" => "ASC"));
    if (($return = $manager->selectMultiple()) === FALSE) {
        return FALSE;
    }
    if ($json_encode === TRUE) {
        print "var ret=" . json_encode($return);
        return FALSE;
    }
    return $return;
    //: End
}
Exemplo n.º 5
0
function editDriver()
{
    // Preparation {
    $drivers = new Drivers();
    $driveractive = (bool) true;
    $actions = array(1 => "Warning", 2 => "Final Warning", 3 => "Dismissed");
    if ($_GET["driverid"]) {
        $driverid = $_GET["driverid"];
        $driver = $drivers->getRow(array("where" => "id=" . $driverid));
        $driverbirthday = date("d", $driver["birthday"]);
        $driverbirthmonth = date("m", $driver["birthday"]);
        $driveractive = $driver["deleted"] == 0 ? true : false;
    }
    $fleetmanobj = new TableManager("users");
    $fleetmanobj->setQueryColumns(array("users" => array("personid", "isfleetman", "deleted"), "profile" => array("id", "firstname", "profile.lastname", "department_id")));
    $fleetmanobj->setQueryFrom(array("left join" => array(0 => array("table" => array("abbr" => "profile", "table" => "user_profiles"), "on" => "`users`.`user_profiles_id`=`profile`.`id`"))));
    $fleetmanobj->setOrderBy(array("column" => array("`profile`.`firstname`", "`profile`.`firstname`"), "direction" => array("DESC", "DESC")));
    $fleetmanobj->setWhere("`users`.`deleted`=0 AND `users`.`isfleetman`=1");
    $fleetmans = $fleetmanobj->selectMultiple();
    $fleets = sqlPull(array("table" => "fleets", "where" => "deleted=0"));
    if ($driver["id"]) {
        $actionstaken = sqlPull(array("table" => "driver_actions", "where" => "driverid=" . $driver["id"], "sort" => "createddate"));
    }
    $pdpdate = date("d/m/Y", $driver["pdpdate"]);
    $actionimages = array(1 => BASE . "/images/iconwarn.png", 2 => BASE . "/images/iconfinalwarn.png", 3 => BASE . "/images/icondismissed.png");
    // }
    maxineTop("Driver Form");
    print "<form method=post id='driverform' name='driverform' action='index.php?mode=maxine/index&action=commitdriver'>";
    // Buttons {
    openHeader();
    maxineButton("Submit", "driverform.submit();", 2);
    maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=driverslist\");", 2);
    closeHeader();
    // }
    print "<div class='tray' style='height:500px;'>";
    if ($driver) {
        print "<input type=hidden name=conf[driverid] value=" . $driverid . ">";
    }
    // Left Column {
    print "<div style='width:400px; float:left; margin-left:20px;'>";
    // Personal Details {
    openSubbar(400);
    print "Personal Details";
    closeSubbar();
    print "<table class='standard content1' style='width:400px;'>";
    print "<tr><td align='center' width=40%>";
    print "First Name";
    print "</td><td width=60%>";
    print "<input name=conf[firstname] value='" . $driver["firstname"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Last Name";
    print "</td><td>";
    print "<input name=conf[lastname] value='" . $driver["lastname"] . "' style='width:200px;'>";
    print "</td></tr>";
    // Birthday {
    print "<tr><td align='center'>";
    print "Birthday";
    print "</td><td>";
    // Day {
    print "<select id='dayselect' name='conf[birthday]' style='width:70px; color:BLACK; z-index:500;'>";
    for ($day = 1; $day < 32; $day++) {
        print "<option " . ($driverbirthday == $day ? "selected" : "") . ">" . $day . "</option>";
    }
    print "</select>";
    // }
    // {
    print "<select id='monthselect' name='conf[birthmonth]' style='width:134px; color:BLACK;'>";
    for ($month = 1; $month < 13; $month++) {
        print "<option value=" . $month . " " . ($driverbirthmonth == $month ? "selected" : "") . ">" . date("F", mktime(0, 0, 0, $month, 1, 2000)) . "</option>";
    }
    print "</select>";
    // }
    print "</td></tr>";
    // }
    print "<tr><td align='center'>";
    print "ID Number";
    print "</td><td>";
    print "<input name=conf[idno] value='" . $driver["idno"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Cellphone";
    print "</td><td>";
    print "<input name=conf[cell] value='" . $driver["cell"] . "' style='width:200px;'>";
    print "</td></tr>";
    print "</table>";
    // }
    // Company Details {
    openSubbar(400);
    print "Employment Details";
    closeSubbar();
    print "<table class='standard content1' style='width:400px;'>";
    print "<tr><td align='center' width=40%>";
    print "Staff Number";
    print "</td><td width=60%>";
    print "<input name=conf[staffno] value='" . $driver["staffno"] . "' style='width:200px;'>";
    print "</td></tr>";
    // Fleet managers {
    print "<tr><td align='center'>";
    print "Fleet Manager";
    print "</td><td>";
    print "<select id='fleetselect' name='conf[fleetmanid]' style='width:204px; color:BLACK;'>";
    print "<option value=0>- Please Select -</option>";
    if ($fleetmans) {
        foreach ($fleetmans as $fleetmankey => $fleetman) {
            print "<option value=" . $fleetman["personid"] . " " . ($driver["fleetmanid"] == $fleetman["personid"] ? "selected" : "") . ">";
            print $fleetman["firstname"] . " " . $fleetman["lastname"];
            print "</option>";
        }
    }
    print "</select>";
    print "</td></tr>";
    // }
    // Fleet {
    print "<tr><td align='center'>";
    print "Fleet";
    print "</td><td>";
    print "<select id='fleetselect' name='conf[fleetid]' style='width:204px; color:BLACK;'>";
    print "<option value=0>- Please Select -</option>";
    if ($fleets) {
        foreach ($fleets as $fleetkey => $fleetval) {
            print "<option value=" . $fleetval["id"] . " " . ($driver["fleetid"] == $fleetval["id"] ? "selected" : "") . ">" . $fleetval["name"] . "</option>";
        }
    }
    print "</select>";
    print "</td></tr>";
    // }
    // PDP Expiry checkbox and date{
    print "<tr><td align='center'>";
    print "PDP Expires?";
    print "</td><td align='center'>";
    print "<input type='checkbox' name='conf[pdpexpires]' value='1' " . ($driver["pdpexpires"] == 1 ? "checked" : "") . " onClick='showPdpDate();'>";
    print "</td></tr>";
    print "<tr id='pdpdaterow' style='" . ($driver["pdpexpires"] == 0 ? "display:none;" : "") . "'><td align='center'>";
    print "PDP Expiry";
    print "</td><td align='center'>";
    print "<input id='pdpdate' name='conf[pdpdate]' value='" . $pdpdate . "' readonly style='width:160px;'>";
    print "<img src='" . BASE . "/images/calendar.png' onClick='displayDatePicker(\"conf[pdpdate]\", this, \"dmy\", \"\");'>";
    print "</td></tr>";
    // }
    print "<tr><td align='center'>";
    print "Active";
    print "</td><td align='center'>";
    print "<input type=checkbox name='conf[active]' " . ($driveractive ? "checked" : "") . ">";
    print "</td></tr>";
    print "</table>";
    // }
    print "</div>";
    // }
    // Right Column {
    print "<div style='float:right; margin-right:20px; width:400px;'>";
    openSubbar(400);
    print "Actions Taken";
    closeSubbar();
    print "<table class='standard' style='width:400px;'>";
    if ($actionstaken) {
        print "<input type=hidden id='faultid' name=conf[faultid]>";
        // Headings {
        print "<tr class='heading'><td align='center' width=10%>";
        print "Ticket";
        print "</td><td align='center' colspan=2 width=40%>";
        print "Action";
        print "</td><td align='center' width=45%>";
        print "Date";
        print "</td><td width=5%>";
        print "</td></tr>";
        // }
        foreach ($actionstaken as $actionkey => $actionval) {
            print "<tr class='content1'><td align='center'>";
            print $actionval["sourceid"];
            print "</td><td align='center'>";
            print $actions[$actionval["action"]] . " ";
            print "</td><td align='LEFT'>";
            print "<img src='" . $actionimages[$actionval["action"]] . "'";
            print "</td><td align='center'>";
            print date("d M Y", $actionval["createddate"]);
            print "</td><td align='center'>";
            if ($actionval["source"] == 1) {
                print "<img src='" . BASE . "/images/note.png' onClick='editEquipFault(" . $actionval["sourceid"] . ")' >";
            }
            print "</td></tr>";
        }
    } else {
        print "<tr class='content1'><td align='center'>";
        print "No Actions against driver.";
        print "</td></tr>";
    }
    print "</table>";
    print "</div>";
    // }
    print "</div>";
    maxineBottom();
    print "</form>";
    // Javascript {
    print "<script>\n\t\t\t\t\n\t\t\tfunction editDriverFault(faultid) {\n\t\t\t\tdocument.getElementById('faultid').value\t= faultid;\n\t\t\t\t\n\t\t\t\tdocument.getElementById('driverform').action\t= 'index.php?mode=maxine/index&action=editdriverfault';\n\t\t\t\tdocument.getElementById('driverform').submit();\n\t\t\t}\n\t\t\t\n\t\t\tfunction editEquipFault(faultid) {\n\t\t\t\tdocument.getElementById('faultid').value\t= faultid;\n\t\t\t\t\n\t\t\t\tdocument.getElementById('driverform').action\t= 'index.php?mode=maxine/index&action=editequipfault';\n\t\t\t\tdocument.getElementById('driverform').submit();\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tfunction showPdpDate() {\n\t\t\t if(document.getElementById('pdpdaterow').style.display == '') {\n\t\t\t \tdocument.getElementById('pdpdaterow').style.display = 'none';\n\t\t\t } else {\n\t\t\t \tdocument.getElementById('pdpdaterow').style.display = '';\n\t\t\t }\n\t\t\t}\n\t\t\t</script>";
    // }
}
Exemplo n.º 6
0
function editUserForm()
{
    $users = new Users();
    // Data Prep {
    $isit = $_SESSION["isit"];
    if ($_POST["conf"]) {
        $conf = $_POST["conf"];
        $user = $users->getRow(array("where" => "personid=" . $conf["personid"], "children" => true));
        $passtip = "If nothing is entered, password will remain the same.";
    } else {
        $passtip = "This is a compulsory field";
        $user["oninout"] = 1;
    }
    if ($conf["personid"]) {
        $birthday = sqlPull(array("table" => "userdates", "where" => "userid=" . $conf["personid"] . " AND datetype='birthday'", "onerow" => "1"));
        $bday = date("d", $birthday["date"]);
        $bmonth = date("m", $birthday["date"]);
    }
    $depts = sqlPull(array("table" => "m3_departments", "where" => "1=1"));
    $rightsgroups = sqlPull(array("table" => "rights_groups", "where" => "1=1"));
    $profiles = new TableManager("user_profiles");
    $profiles->setWhere("deleted=0");
    $profiles->setOrderBy(array("column" => array("firstname", "lastname"), "direction" => array("ASC", "ASC")));
    $profiles->setQueryColumns(array("user_profiles" => array("id", "firstname", "lastname")));
    $profilelist = $profiles->selectMultiple();
    // }
    maxineTop("User Form");
    print "<form id='userform' name='userform' action='/Maxine/?commituser' method='post'>";
    // Buttons {
    openHeader();
    //print("<img src='".TOPBUTTONS."/buttonuserhistory.png' onClick='userform.action=\"index.php?mode=maxine/index&action=manageuserdates\"; userform.submit();'>");
    maxineButton("Submit", "testDetails(); userform.submit();", 2);
    maxineButton("Delete", "userform.action=\"/Maxine/?deleteuser\"; userform.submit();", 2);
    maxineButton("Back", "goTo(\"/Maxine/?listusers\");", 2);
    closeHeader();
    // }
    print "<div class='tray' style='height:600px;'>";
    // Input {
    print "<input type=hidden name='conf[personid]' value=" . $user["personid"] . ">";
    // Left Hand Side {
    print "<div style='width:400px; margin-left:20px; float:left;'>";
    // Personal Details {
    openSubbar(400);
    print "Personal Details";
    closeSubbar();
    print "<table class='standard content1' style='width:400px;'>";
    print "<tr><td width=30% align='center'>";
    print "User Name";
    print "</td><td width=70%>";
    print "<input name=conf[username] value='" . $user["username"] . "' style='width: 100%; background-color: " . MAXINEBACK . "; border-width: 1px;' title='This will automatically be convered to lower case.'>";
    print "</td></tr>";
    /*
    print("<tr><td align='center'>");
    print("First Name");
    print("</td><td>");
    print("<input name=conf[firstname] value='".$user["firstname"]."'  style='width: 100%; background-color: ".MAXINEBACKALT."; border-width: 1px;'>");
    print("</td></tr>");
    
    print("<tr><td align='center'>");
    print("Last Name");
    print("</td><td>");
    print("<input name=conf[lastname] value='".$user["lastname"]."' style='width: 100%; background-color: ".MAXINEBACK."; border-width: 1px;'>");
    print("</td></tr>");
    */
    print "<tr><td align='center'>";
    print "Position";
    print "</td><td>";
    print "<input name=conf[position] value='" . $user["position"] . "'  style='width: 100%; background-color: " . MAXINEBACKALT . "; border-width: 1px;'>";
    print "</td></tr>";
    print "</table>";
    // }
    // Contact Details {
    openSubbar(400);
    print "Contact Details";
    closeSubbar();
    print "<table class='standard content1' style='width:400px;'>";
    print "<tr><td align='center' width=30%>";
    print "Office Extension";
    print "</td><td width=70%>";
    print "<input name=conf[extension] value='" . $user["extension"] . "' style='width: 100%; background-color: " . MAXINEBACK . "; border-width: 1px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Cell Number";
    print "</td><td>";
    print "<input name=conf[cell] value='" . $user["cell"] . "' style='width: 100%; background-color: " . MAXINEBACKALT . "; border-width: 1px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Email";
    print "</td><td>";
    print "<input name=conf[email] value='" . $user["email"] . "' style='width: 100%; background-color: " . MAXINEBACK . "; border-width: 1px;' onblur=\"if (this.value && ((validateEmailAddress(this)) === false)) {alert('Please ensure that the email address you have entered is a valid email address.'); this.value='';}\">";
    print "</td></tr>";
    print "</table>";
    // }
    // Misc {
    openSubbar(400);
    print "Miscellaneous";
    closeSubbar();
    print "<table class='standard content1' style='width:400px;'>";
    // Password {
    print "<tr><td align='center' width=30%>";
    print "Password";
    print "</td><td width=70%>";
    print "<input type=password name='conf[password]' style='width:200px; margin-top:2px;' title='" . $passtip . "'>";
    print "</td></tr>";
    // }
    // Profile {
    print "<tr><td align='center' width=30%>";
    print "User Profile";
    print "</td><td width=70%>";
    print "<select name=\"conf[user_profiles_id]\">";
    print "<option value=\"0\">Please select...</option>";
    foreach ($profilelist as $profilekey => $profileval) {
        print "<option " . ($user["user_profiles_id"] == $profileval["id"] ? "selected" : "") . " value=\"" . $profileval["id"] . "\">";
        print $profileval["firstname"] . " " . $profileval["lastname"];
        print "</option>";
    }
    print "</select>";
    print "</td></tr>";
    // }
    print "</table>";
    // }
    print "</div>";
    // }
    // Right Hand Side {
    print "<div style='width:400px; margin-right:20px; float:right;'>";
    if ($isit == 1) {
        // Flags {
        openSubbar(400);
        print "Flags";
        closeSubbar();
        print "<table class='standard content1' style='width:400px;'>";
        print "<tr><td width=70% align='center'>";
        print "Allow Login";
        print "</td><td width=30% align='center'>";
        print "<input type=checkbox name=conf[canlogin] " . ($user["canlogin"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Show on In Out board";
        print "</td><td align='center'>";
        print "<input type=checkbox name=conf[oninout] " . ($user["oninout"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Manager";
        print "</td><td align='center'>";
        print "<input type=checkbox name=conf[ismanager] " . ($user["ismanager"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Supervisor";
        print "</td><td align='center'>";
        print "<input type=checkbox name=conf[issuper] " . ($user["issuper"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Fleet Manager";
        print "</td><td align='center'>";
        print "<input type='checkbox' name=conf[isfleetman] " . ($user["isfleetman"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "IT";
        print "</td><td align='center'>";
        print "<input type=checkbox name=conf[isit] " . ($user["isit"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Generic User";
        print "</td><td align='center'>";
        print "<input type=checkbox name=conf[isgeneric] " . ($user["isgeneric"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Place";
        print "</td><td align='center'>";
        print "<input type=checkbox name=conf[isplace] " . ($user["isplace"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Fleets Performance";
        print "</td><td align='center'>";
        print "<input type='checkbox' name=conf[isfleetper] " . ($user["isfleetper"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "<tr><td align='center'>";
        print "Damages, Shortages & Incidents";
        print "</td><td align='center'>";
        print "<input type='checkbox' name=conf[isdamage] " . ($user["isdamage"] == 1 ? "checked" : "") . ">";
        print "</td></tr>";
        print "</table>";
        // }
        // Groups {
        openSubbar(400);
        print "Access Groups";
        closeSubbar();
        print "<table class='standard content1' style='width:400px'>";
        foreach ($rightsgroups as $grpkey => $grpval) {
            // Individual preparation {
            $userrights = null;
            if ($conf["personid"]) {
                $userrights = $user['rights_users'][$grpval['id']];
            }
            $sel = (string) "";
            if ($userrights) {
                $sel = 'checked="checked"';
            }
            // }
            print "<tr><td align='center' width=70% title='" . $grpval["description"] . "'>";
            print $grpval["name"];
            print "</td><td width=30% align='center'>";
            print "<input type='checkbox' name=conf[groups][" . $grpval["id"] . "] value=1 " . $sel . ">";
            print "</td></tr>";
        }
        print "</table>";
        // }
    } else {
        print "Flags and Access Groups";
        print "Please contact IT to change these settings";
    }
    print "</div";
    // }
    // }
    print "</div";
    print "</form>";
    maxineBottom();
    // Javascript {
    print "<script type=\"text/javascript\">\n\t\t\t\t\tfunction testDetails() {return false;}\n\t\t\t\t\tfunction goThrough() {alert('20');}\n\t\t\t\t\t/** validateEmailAddress(obj)\n\t\t\t\t\t* @param obj object HTML element reference\n\t\t\t\t\t* @return true on success false otherwise\n\t\t\t\t\t*/\n\t\t\t\t\tfunction validateEmailAddress(obj) {\n\t\t\t\t\tvar val = obj.value;\n\t\t\t\t\tvar replaced = obj.value.toString().replace('/\\s/', '');\n\t\t\t\t\tif (!val || !replaced) {return false;}\n\t\t\t\t\tif (val.match(/^(.+)@([^@]+)\$/)) {return true;}\n\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t</script>";
    // }
}