Пример #1
0
/** returnFleetTruckCount()
 * get all fleets truck count
 * @return array on success false otherwise
 */
function returnFleetTruckCount()
{
    require_once BASE . "/basefunctions/baseapis/TableManager.php";
    $manager = new TableManager("fleet_truck_count");
    $manager->setCustomIndex("fleet_id");
    return $manager->selectMultiple();
}
Пример #2
0
function maxineTop($title = "")
{
    // Prep {
    ## User Data
    $mycapsSegments = new TableManager("users");
    $mycapsSegments->setWhere($mycapsSegments->quoteString("`users`.`personid`=?", (int) $_SESSION["userid"]));
    $user = $mycapsSegments->selectSingle();
    //$user				= sqlPull(array("table"=>"users", "where"=>"personid=".$_SESSION["userid"], "select"=>"firstname, lastname, user_profiles_id", "onerow"=>1));
    $smsaccess = testRights($_SESSION["userid"], "sms001");
    ## myCAPS segment check
    if (isset($_SESSION["userid"]) && $_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();
    }
    ## Profile Data
    if ($user) {
        $user_profiles = new TableManager("user_profiles");
        ## Test for fortune column
        $cols = $user_profiles->getColumns();
        if (in_array("fortune", $cols) === FALSE) {
            $sql = (string) "ALTER TABLE `user_profiles` ADD COLUMN `fortune` TINYINT(1) NOT NULL DEFAULT 0, ADD INDEX (`fortune`);";
            if ($user_profiles->runSql($sql) === FALSE) {
                $errors = $user_profiles->getErrors();
                echo "<div class=\"error\">mySQL statement encountered an error. Last error was:<br />" . $errors[count($errors) - 1] . "</div>";
                return FALSE;
            }
        }
        $user_profiles->setWhere($user_profiles->quoteString("`user_profiles`.`id`=?", $user["user_profiles_id"]));
        $profile = $user_profiles->selectSingle();
    }
    ## Alerts
    $manager = new TableManager("alerts");
    $manager->setWhere($manager->quoteString("`alerts`.`deleted`=?", (int) 0) . $manager->quoteString(" AND `alerts`.`time_start`<=?", strtotime(date("Y-m-d") . " 00:00")) . $manager->quoteString(" AND `alerts`.`time_end`>=?", strtotime(date("Y-m-d") . " 23:59")));
    $manager->setCustomIndex("id");
    $alerts = $manager->selectMultiple();
    ## Theme
    $themes = new TableManager("themes");
    $themes->setQueryColumns(array("themes" => array("*")));
    $themes->setQueryFrom(array("left join" => array(0 => array("table" => array("abbr" => "user_profiles", "table" => "user_profiles"), "on" => "`themes`.`id`=`user_profiles`.`theme_id`"), 1 => array("table" => array("abbr" => "users", "table" => "users"), "on" => "`user_profiles`.`id`=`users`.`user_profiles_id`"))));
    $where = (string) "(ISNULL(`themes`.`deleted`)";
    $where .= $themes->quoteString(" OR `themes`.`deleted`=?)", 0);
    if ($_SESSION["userid"]) {
        $where .= $themes->quoteString(" AND `users`.`personid`=?", (int) $_SESSION["userid"]);
    } else {
        $where .= $themes->quoteString(" AND `themes`.`id`=?", (int) 1);
    }
    $themes->setWhere($where);
    $theme = $themes->selectSingle();
    $backgroundImage = (string) BASE . "images/new/themes/" . $theme["background-image"];
    $_SESSION["backgroundRepeat"] = (string) BASE . "images/new/themes/" . $theme["background-repeater"];
    $size = getimagesize($backgroundImage);
    $_SESSION["bgImageSize"] = $size;
    // }
    print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>";
    print "<html>";
    // Header Info {
    print "<head>";
    print "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />" . PHP_EOL;
    print "<link href='" . BASE . "/images/favicon.ico' rel='SHORTCUT ICON' />" . PHP_EOL;
    //print("<link href='".BASE."/basefunctions/scripts/manlinecss.php' rel='stylesheet' type='text/css' />");
    print "<link href='" . BASE . "/basefunctions/scripts/manline.css' media='all' rel='stylesheet' type='text/css' />" . PHP_EOL;
    print "<script type='text/javascript' language='javascript' src='" . BASE . "/basefunctions/scripts/manline.js'></script>";
    $headTitle = (string) "Maxweb";
    if ($title) {
        $headTitle .= " - " . $title;
    }
    print "<title>" . $headTitle . "</title>" . PHP_EOL;
    print "</head>";
    // }
    print "<body id=\"windowBody\" style='background-image:url(\"" . $backgroundImage . "\");'>";
    //print("<form action='#' method='post'>");
    // Header 1 {
    print "<h1>";
    print "<img alt=\"Maxweb Logo\" id=\"maxwebLogo\" src='" . BASE . "/images/new/logo.png' style=\"height:58px;margin-top:2px;width:299px;\">";
    print "<span style='float:right; text-align:right;'>";
    $links = (array) array("Home" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=home", "id" => "home"), "Documents" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=viewdocuments", "id" => "Documents"), "Gallery" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=viewgallery", "id" => "Gallery"), "InOut" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=inoutboard", "id" => "InOut"), "Max" => array("class" => "headerA", "href" => "http://login.max.manline.co.za", "id" => "Max", "target" => "_blank"), "Zimbra" => array("class" => "headerA", "href" => "http://mail.manline.co.za", "id" => "Zimbra", "target" => "_blank"));
    foreach ($links as $text => $data) {
        echo "<a class=\"" . $data["class"] . "\" href=\"" . $data["href"] . "\" id=\"" . $data["id"] . "\" " . (isset($data["target"]) ? "target=\"" . $data["target"] . "\" " : "") . "title=\"" . $text . "\"></a>" . PHP_EOL;
    }
    print "</span>";
    print "</h1>";
    // }
    // Header 2 {
    $messages = (array) array();
    if (isset($profile) && $profile) {
        if (!$profile["staffno"] || !$profile["department_id"] || !$profile["jobtitle"] || !$profile["location"]) {
            $messages[] = "Your profile information is incomplete.";
        }
    }
    if (isset($segment)) {
        if (date("U") > (int) $segment["enddate"] + 86400) {
            $messages[] = "Your CAPS is overdue";
        }
    }
    if (isset($alerts) && $alerts) {
        foreach ($alerts as $val) {
            $messages[] = $val["message"];
        }
    }
    ## Profile Data
    if ($messages) {
        informationBar($messages);
    }
    print "<h2>";
    print "<span style='width:10px; height:51px; background-image:url(\"" . BASE . "/images/new/menubarleft.png\"); float:left;'></span>";
    print "<span style='width:850px; height:36px; background-image:url(\"" . BASE . "/images/new/menubarmid.png\"); float:left; padding-top:15px;'>";
    // Left Span - Quick Navigation {
    print "<span style='float:left; margin-top:-5px;'>";
    ## Menu
    // $items[] = array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/", "text"=>"", "title"=>"");
    $items = (array) array();
    if ($user) {
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=mycapslist2", "text" => "myCAPS", "title" => "click to go to your CAPs");
    }
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=showm3", "text" => "Public M3", "title" => "View public M3 Graphs");
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=dockeeperfront", "text" => "Customer Documents", "title" => "View Documents required by Customers");
    if ($user) {
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=m3sys", "text" => "M3", "title" => "View M3 Graphs");
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=displaymydash", "text" => "Personal Dashboard", "title" => "Click to view your personal dashboard");
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=greenmileinput", "text" => "Green Mile Controls", "title" => "Click to update Green Mile Details");
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=ratescalc2", "text" => "Rates Calculator", "title" => "Click to view the rates calculator");
        if ($user["isit"] || $user["ismanager"]) {
            $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=nineblockinput", "text" => "9 Blocker", "title" => "Click to view your 9 Blocker");
            $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=listalerts", "text" => "Alerts", "title" => "Click to list all alerts");
            $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=edituserpool", "text" => "User Pools", "title" => "Click to view and edit User Pools");
        }
        $items[] = array("text" => "Faults System", "children" => array(array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=equipfaults", "text" => "Equipment Faults", "title" => "Click to view equipment faults"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=uflist", "text" => "Unit Faults", "title" => "Click to view unit faults"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=faultsys", "text" => "Fault Logging", "title" => "Log a new fault")));
        $items[] = array("text" => "Personnel Tools", "children" => array(array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=learnerlist", "text" => "Learner", "title" => "Click to view a list of learners"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=candmenu", "text" => "Candidates", "title" => "Click to view list of candidates"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=driverslist", "text" => "Drivers", "title" => "Click to view list of drivers"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=listusers", "text" => "Users", "title" => "Click to view user list")));
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=updateprofile", "text" => "Edit Your Profile", "title" => "Click to edit your profile");
    }
    /** Cameras link affects
    				  4 = > Jonathan Spencer
    				  5 = > Bradley Roberts
    				  141 = > Jerome Govender
    				  168 = > Lwazi Ally
    				  186 = > Ndumiso Langa
    				*/
    if (in_array($_SESSION["userid"], array(4, 5, 141, 168, 186))) {
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/cameras/", "text" => "Manline CCTV", "title" => "Click to view the cameras");
    }
    if ($_SESSION["isadmin"] || $smsaccess > 0) {
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=smssystem", "text" => "Send an SMS", "title" => "Click to use the SMS system");
    }
    if ($_SESSION["isit"] == 1) {
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=rightscontrol", "text" => "Access Rights", "title" => "Click to set user access rights");
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=loggingreport", "text" => "Logging Report", "title" => "Click to view the logging report");
        if ($_SESSION["isadmin"]) {
            $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=smssystem", "text" => "Send an SMS", "title" => "Click to use the SMS system");
        }
        $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=sandbox", "text" => "Sandbox", "title" => "Click to go to the coding sandbox");
        //$items[] = array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/index.php?mode=maxine/index&action=encoder", "text"=>"Text Encoder", "title"=>"Click to view the text encoder");
        //$items[] = array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/index.php?mode=maxine/index&action=truckfinder", "text"=>"Truck Finder", "title"=>"Click to view the truck finder");
        $items[] = array("text" => "Scaffolding", "children" => array(array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=documents", "text" => "Documents", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=gallery", "text" => "Gallery", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=galleryItems", "text" => "Gallery Items", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=newspaper_articles", "text" => "Newspaper Articles", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=pages", "text" => "Pages", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=themes", "text" => "Themes", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=type", "text" => "Type", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=user_profiles", "text" => "User Profiles", "title" => "Click to list all items")));
    }
    /* $items[] = array("text"=>"Corporate Clothing", "children"=>array(
    				array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/documents/Ladies Clothing Catalogue.pdf", "text"=>"Ladies", "title"=>"Click to download ladies clothing catalogue"),
    				array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/documents/Mens Clothing Catalogue.pdf", "text"=>"Mens", "title"=>"Click to download mens clothing catalogue")
    			)); */
    $items[] = array("href" => "/Maxine/documents/ManlinePriceList.pdf", "text" => "Corporate Clothing", "title" => "Click to download");
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/documents/Map to Head Office.pdf", "text" => "Map to Head office", "title" => "Click to download map to head office");
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=maxexpress", "text" => "Max Express", "title" => "Click to view Max Express editions");
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=viewnews", "text" => "News", "title" => "Click to view newspaper articles");
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=monthlyvideos", "text" => "Monthly Videos", "title" => "Click to view Neil's monthly video updates");
    $sql = (string) "SELECT * FROM `m3_departments`";
    $departs = $themes->runSql($sql);
    $depts = (array) array();
    foreach ($departs as $dept) {
        $depts[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=listdepartment&department=" . urlencode($dept["name"]), "text" => $dept["name"], "title" => "Click to view department members");
    }
    $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=listdepartment", "text" => "Staff Profiles", "title" => "Click to view all staff members", "children" => $depts);
    echo menu($items);
    print "</span>";
    // }
    // Right Span - Login Details {
    print "<span style='height:34px; float:right; margin-top:-5px; vertical-align:bottom;'>";
    if ($_SESSION["userid"] > 0) {
        print "<p class='standard' style='float:left; margin-right:10px; margin-top:8px;'>Logged in as " . $profile["firstname"] . " " . $profile["lastname"] . "</p>";
        echo "<a href=\"/Maxine/?logout\" id=\"logoutbutton\"></a>" . PHP_EOL;
    } else {
        $name = "";
        if ($_COOKIE["loggedname"]) {
            $name = $_COOKIE["loggedname"];
        }
        print "<form id=\"loginform\" name='loginform' action='index.php?mode=maxine/index&action=loginaction' method='post'>";
        print "<span style='width:16px; height:19px; background-image:url(\"" . BASE . "/images/new/loginicon.png\"); float:left; margin-top:5px;'></span>";
        print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginleft.png\"); float:left; margin-left:10px; margin-top:4px; '></span>";
        print "<input id=\"username\" name='conf[username]' value='" . $name . "' class='loginmid' onKeyPress='submitenter(this,event);' />";
        print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginright.png\"); float:left; margin-top:4px; '></span>";
        print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginleft.png\"); float:left; margin-left:10px; margin-top:4px;'></span>";
        print "<input type='password' id='passbox' name='conf[password]' class='loginmid' onKeyPress='submitenter(this,event);' />";
        print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginright.png\"); float:left; margin-top:4px; '></span>";
        echo "<a href=\"#\" id=\"loginbutton\" onclick=\"document.getElementById('loginform').submit();\"></a>" . PHP_EOL;
        print "</form>";
    }
    print "</span>";
    // }
    print $title;
    print "</span>";
    print "<span style='width:10px; height:51px; background-image:url(\"" . BASE . "/images/new/menubarright.png\"); float:left;'></span>";
    print "</h2>";
    if (isset($_SESSION["userid"]) && in_array($_SESSION["userid"], array(4, 23, 175)) || isset($profile["fortune"]) && $profile["fortune"]) {
        $fortune = shell_exec("fortune -s -n 100");
        echo "<div style=\"height:24px;margin:-14px auto 15px;position:relative;width:850px;\">";
        echo "<img alt=\"left corner\" src=\"" . BASE . "images/new/cookiebar_left.png\" style=\"height:24px;left:0px;position:absolute;top:0px;width:10px;\" />";
        echo "<div style=\"background-image:url(" . BASE . "images/new/cookiebar_mid.png);font-size:0.8em;height:24px;margin:-3px auto 0px;vertical-align:top;width:830px;\">" . $fortune . "</div>";
        echo "<img alt=\"right corner\" src=\"" . BASE . "images/new/cookiebar_right.png\" style=\"height:24px;position:absolute;right:0px;top:0px;width:10px;\" />";
        echo "</div>";
    }
    // }
}
Пример #3
0
/** displayUserProfile($profile)
 * @param array $profile which profile are we displaying?
 */
function displayUserProfile($profile)
{
    $departments = new TableManager("m3_departments");
    $departments->setCustomIndex("id");
    $alldepts = $departments->selectMultiple();
    if ((!isset($profile["department"]) || !$profile["department"]) && $profile["department_id"]) {
        $profile["department"] = $alldepts[$profile["department_id"]]["name"];
    }
    echo "<div class=\"userProfile\">" . PHP_EOL;
    if ($profile["staffno"] && $profile["location"] && date("Y-m-d", strtotime($profile["createDate"])) != "2011-02-01" && $profile["createDate"] > date("Y-m-d H:i:s", strtotime("-2 weeks"))) {
        echo "<img alt=\"New Staff Member\" src=\"" . BASE . "images/new/profile-new.png\" style=\"border:none;height:37px;left:5px;position:absolute;top:4px;width:38px;z-index:1;\" />";
    }
    ## Image
    $staffno = $profile["staffno"];
    if (strlen($staffno) < 4) {
        $staffno = str_pad($staffno, 4, "0", STR_PAD_LEFT);
    }
    if (file_exists(BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg")) {
        $size = getimagesize(BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg");
        echo "<img alt=\"" . $profile["firstname"] . " " . $profile["lastname"] . "\" src=\"" . BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg\" style=\"height:" . $size[1] . "px;width:" . $size[0] . "px;z-index:0;\" />" . PHP_EOL;
    } else {
        $size = getimagesize(BASE . "images" . DS . "profiles" . DS . "0.jpg");
        echo "<img alt=\"" . $profile["firstname"] . " " . $profile["lastname"] . "\" src=\"" . BASE . "images" . DS . "profiles" . DS . "0.jpg\" style=\"height:" . $size[1] . "px;width:" . $size[0] . "px;z-index:0;\" />" . PHP_EOL;
    }
    $abbrs = (array) array("Human Resources" => "H.R", "Information Technology" => "I.T", "Isando Operations" => "Isando Ops", "Operations Distribution" => "Ops Distribution", "Operations Africa" => "Ops Africa", "Operations Freight" => "Ops Freight");
    ## Data
    echo "<div class=\"userProfileBasicData\">" . PHP_EOL;
    echo "<h3>" . $profile["firstname"] . " " . $profile["lastname"] . "</h3>" . PHP_EOL;
    echo "<h4>" . shortenWord(urldecode($profile["jobtitle"]), 23) . "</h5><br />" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Department:</label><label style=\"margin-bottom:2px;width:98px;\">" . (isset($profile["department"]) ? in_array($profile["department"], array_keys($abbrs)) ? $abbrs[$profile["department"]] : $profile["department"] : "") . "</label><br class=\"clear\" />" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Location:</label><label style=\"margin-bottom:2px;width:98px;\">" . $profile["location"] . "</label><br class=\"clear\" />" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Staff No.:</label><label style=\"margin-bottom:2px;width:98px;\">" . $profile["staffno"] . "</label><br class=\"clear\" />" . PHP_EOL;
    echo "</div>" . PHP_EOL;
    ## More|Less
    echo "<div class=\"userProfileMoreLess\" id=\"profile_" . $profile["id"] . "\" onclick=\"events.cancelBubble(event);profiles.show(this);\">more</div>" . PHP_EOL;
    ## Collapsible div
    echo "<div class=\"userProfileMoreInformation\" id=\"profileData[" . $profile["id"] . "]\" style=\"display:none;\">" . PHP_EOL;
    echo "<div>" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:2px;width:75px;\">Birthday:</label><label style=\"margin-bottom:2px;width:205px;\">" . date("d F", $profile["birthday"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    if ($profile["interests"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Interests:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["interests"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["family"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Family:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["family"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["aspirations"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Aspirations:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["aspirations"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["goals"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Goal:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["goals"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["quote"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Quote:</label><br /><label style=\"width:100%;\">" . urldecode($profile["quote"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    echo "</div>" . PHP_EOL;
    echo "</div>" . PHP_EOL;
    echo "</div>" . PHP_EOL;
}
Пример #4
0
/** returnFleetTruckCount()
 * get all fleets truck count
 * @return array on success false otherwise
 */
function returnFleetTruckCount()
{
    $manager = new TableManager("fleet_truck_count");
    $manager->setCustomIndex('fleet_id');
    return $manager->selectMultiple();
}
Пример #5
0
function driversList()
{
    $drivers = new Drivers();
    // Preparation {
    $userobj = new TableManager("users");
    $userobj->setQueryColumns(array("users" => array("personid"), "profile" => array("firstname", "profile.lastname")));
    $userobj->setCustomIndex("personid");
    $userobj->setQueryFrom(array("left join" => array(0 => array("table" => array("abbr" => "profile", "table" => "user_profiles"), "on" => "`users`.`user_profiles_id`=`profile`.`id`"))));
    $userobj->setWhere("`users`.`deleted`=0");
    $userlist = $userobj->selectMultiple();
    if ($_POST["conf"]) {
        $conf = $_POST["conf"];
    }
    // Building the where string {
    $where = "1=1";
    if ($conf["search"]["firstname"]) {
        $where .= " AND firstname LIKE '%" . $conf["search"]["firstname"] . "%'";
    }
    if ($conf["search"]["lastname"]) {
        $where .= " AND lastname LIKE '%" . $conf["search"]["lastname"] . "%'";
    }
    if ($conf["search"]["idno"]) {
        $where .= " AND idno LIKE '%" . $conf["search"]["idno"] . "%'";
    }
    if ($conf["search"]["staffno"]) {
        $where .= " AND staffno LIKE '%" . $conf["search"]["staffno"] . "%'";
    }
    if ($conf["search"]["fleetid"] > 0) {
        $where .= " AND fleetid=" . $conf["search"]["fleetid"];
    }
    $where .= " AND deleted=0";
    // }
    // Building the Sort string {
    if ($conf["sortvar"]) {
        $sort = $conf["sortvar"];
    } else {
        $sort = "1";
    }
    if ($sort == 1) {
        $sortstr = "firstname ASC, lastname ASC";
    } else {
        if ($sort == 2) {
            $sortstr = "firstname DESC, lastname DESC";
        } else {
            if ($sort == 3) {
                $sortstr = "idno ASC";
            } else {
                if ($sort == 4) {
                    $sortstr = "idno DESC";
                } else {
                    if ($sort == 5) {
                        $sortstr = "staffno ASC";
                    } else {
                        if ($sort == 6) {
                            $sortstr = "staffno DESC";
                        } else {
                            if ($sort == 7) {
                                $sortstr = "fleetid ASC";
                            } else {
                                if ($sort == 8) {
                                    $sortstr = "fleetid DESC";
                                } else {
                                    if ($sort == 9) {
                                        $sortstr = "fleetmanid";
                                    } else {
                                        if ($sort == 10) {
                                            $sortstr = "fleetmanid DESC";
                                        } else {
                                            if ($sort == 11) {
                                                $sortstr = "pdpdate DESC";
                                            } else {
                                                if ($sort == 12) {
                                                    $sortstr = "pdpdate";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // }
    $driverslist = $drivers->getRowSet(array("where" => $where, "sort" => $sortstr));
    $fleetlist = sqlPull(array("table" => "fleets", "where" => "1=1"));
    $reload = "driversform.action=\"index.php?mode=maxine/index&action=driverslist\"; driversform.submit();";
    $mouseover = "onmouseover=\"this.style.backgroundImage='url(../../images/new/mainblack.png)';this.style.color='WHITE';\" onmouseout=\"this.style.backgroundImage=''; this.style.color='BLACK';\"";
    // }
    maxineTop("Driver List");
    print "<form id='driversform' name='driversform' action='index.php?mode=maxine/index&action=driverslist' method=post>";
    // Buttons {
    openHeader(1220);
    maxineButton("Add Driver", "goTo(\"index.php?mode=maxine/index&action=editdriver\");", 2);
    maxineButton("Search", "toggle(\"searchdiv\");", 2);
    if ($_SESSION["isit"] > 0) {
        maxineButton("Fleets", "goTo(\"index.php?mode=maxine/index&action=editfleets\");", 2);
    }
    maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=peoplemenu\");", 2);
    closeHeader();
    // }
    print "<div class='tray' style='width:1220px;'>";
    // Search Box {
    print "<div id='searchdiv' style='display:none;'>";
    openSubbar(400);
    print "Search Box";
    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[search][firstname] value='" . $conf["search"]["firstname"] . "' style='width:220px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Last Name";
    print "</td><td>";
    print "<input name=conf[search][lastname] value='" . $conf["search"]["lastname"] . "' style='width:220px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "ID Number";
    print "</td><td>";
    print "<input name=conf[search][idno] value='" . $conf["search"]["idno"] . "' style='width:220px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Staff Number";
    print "</td><td>";
    print "<input name=conf[search][staffno] value='" . $conf["search"]["staffno"] . "' style='width:220px;'>";
    print "</td></tr>";
    print "<tr><td align='center'>";
    print "Fleet";
    print "</td><td>";
    print "<select id='fleetselect' name='conf[search][fleetid]' style='width:200px; z-index:500; color:BLACK;'>";
    print "<option>- Select -</option>";
    foreach ($fleetlist as $fleetkey => $fleetval) {
        print "<option value=" . $fleetval["id"] . ">" . $fleetval["name"] . " " . ($fleetval["deleted"] > 0 ? " (Deleted)" : "") . "</option>";
    }
    print "</select>";
    print "</td></tr>";
    print "<tr><td align='center' colspan=2>";
    maxineButton("Submit", "driversform.submit();", 2);
    print "</td></tr>";
    print "</table>";
    print "</div>";
    // }
    // Driver details {
    openSubbar(1200);
    print "Details";
    closeSubbar();
    print "<table class='standard' style='width:1200px; margin-bottom:20px;'>";
    if ($driverslist) {
        print "<input type='hidden' id='sorttype' name='conf[sortvar]' value=" . $conf["sortvar"] . ">";
        // Headers {
        print "<tr class='heading'><td align='center' width=30% onClick='document.getElementById(\"sorttype\").value=" . ($sort == 1 ? "2" : "1") . "; " . $reload . "'>";
        print "Name";
        if ($sort == 1) {
            print "<img src='" . BASE . "/images/downarrow.png'>";
        } else {
            if ($sort == 2) {
                print "<img src='" . BASE . "/images/uparrow.png'>";
            }
        }
        print "</td><td align='center' width=15% onClick='document.getElementById(\"sorttype\").value=" . ($sort == 3 ? "4" : "3") . "; " . $reload . "'>";
        print "ID No";
        if ($sort == 3) {
            print "<img src='" . BASE . "/images/downarrow.png'>";
        } else {
            if ($sort == 4) {
                print "<img src='" . BASE . "/images/uparrow.png'>";
            }
        }
        print "</td><td align='center' width=10% onClick='document.getElementById(\"sorttype\").value=" . ($sort == 5 ? "6" : "5") . "; " . $reload . "'>";
        print "Staff Number";
        if ($sort == 5) {
            print "<img src='" . BASE . "/images/downarrow.png'>";
        } else {
            if ($sort == 6) {
                print "<img src='" . BASE . "/images/uparrow.png'>";
            }
        }
        print "</td><td align='center' width=10% onClick='document.getElementById(\"sorttype\").value=" . ($sort == 7 ? "8" : "7") . "; " . $reload . "'>";
        print "Fleet";
        if ($sort == 7) {
            print "<img src='" . BASE . "/images/downarrow.png'>";
        } else {
            if ($sort == 8) {
                print "<img src='" . BASE . "/images/uparrow.png'>";
            }
        }
        print "</td><td align='center' width=10%>";
        print "Cellphone";
        print "</td><td align='center' width=15% onClick='document.getElementById(\"sorttype\").value=" . ($sort == 9 ? "10" : "9") . "; " . $reload . "'>";
        print "Fleet Manager";
        if ($sort == 9) {
            print "<img src='" . BASE . "/images/downarrow.png'>";
        } else {
            if ($sort == 10) {
                print "<img src='" . BASE . "/images/uparrow.png'>";
            }
        }
        print "</td><td align='center' width=10% onClick='document.getElementById(\"sorttype\").value=" . ($sort == 11 ? "12" : "11") . "; " . $reload . "'>";
        print "PDP Expiry";
        if ($sort == 11) {
            print "<img src='" . BASE . "/images/downarrow.png'>";
        } else {
            if ($sort == 12) {
                print "<img src='" . BASE . "/images/uparrow.png'>";
            }
        }
        print "</td></tr>";
        // }
        $row = 0;
        foreach ($driverslist as $driverkey => $driverval) {
            $row++;
            print "<tr class='content1' style='cursor:pointer;' onClick='editDriver(\"" . $driverval["id"] . "\");' " . $mouseover . "><td align='center'>";
            print $driverval["firstname"] . " " . $driverval["lastname"];
            print "</td><td align='center'>";
            print $driverval["idno"];
            print "</td><td align='center'>";
            print $driverval["staffno"];
            print "</td><td align='center'>";
            print $fleetlist[$driverval["fleetid"]]["name"];
            print "</td><td align='center'>";
            print $driverval["cell"];
            print "</td><td align='center'>";
            if ($driverval["fleetmanid"] > 0) {
                $fmid = $driverval["fleetmanid"];
                print $userlist[$fmid]["firstname"] . " " . $userlist[$fmid]["lastname"];
            }
            print "</td><td align='center'>";
            if ($driverval["pdpexpires"] == 1) {
                if ($driverval["pdpdate"]) {
                    print date("d-m-Y", $driverval["pdpdate"]);
                }
            } else {
                print "N/A";
            }
            print "</td></tr>";
        }
    }
    print "</table>";
    print "</div>";
    // }
    print "</div>";
    print "</form>";
    maxineBottom();
    // Javascript {
    print "<script type=\"text/javascript\">\n\t\t\tfunction editDriver(driverid) {\n\t\t\t\tgoTo(\"index.php?mode=maxine/index&action=editdriver&driverid=\"+driverid+\"\");\n\t\t\t}\n\t\t\t\n\t\t\t</script>";
    // }
}